Example usage for java.awt FlowLayout FlowLayout

List of usage examples for java.awt FlowLayout FlowLayout

Introduction

In this page you can find the example usage for java.awt FlowLayout FlowLayout.

Prototype

public FlowLayout(int align, int hgap, int vgap) 

Source Link

Document

Creates a new flow layout manager with the indicated alignment and the indicated horizontal and vertical gaps.

Usage

From source file:com.antelink.sourcesquare.gui.view.CopyrightPanel.java

public CopyrightPanel() {
    super();/*from  ww w. j  a v a  2  s  .  com*/

    ArrayList<JLabel> sentence = new ArrayList<JLabel>();
    sentence.add(new JLabel("Powered by"));
    sentence.add(createJLabelWithHyperlink("Antepedia", "http://www.antepedia.com"));
    sentence.add(new JLabel(", an "));
    sentence.add(createJLabelWithHyperlink("Antelink", "http://www.antelink.com"));
    sentence.add(new JLabel(" product - "));
    sentence.add(
            createJLabelWithHyperlink("About SourceSquare", "https://sourcesquare.antepedia.com/about.html"));

    setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    for (JLabel jLabel : sentence) {
        jLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
        this.add(jLabel);
    }
    this.setSize(360, 25);
}

From source file:com.emental.mindraider.ui.dialogs.FtsJDialog.java

public FtsJDialog() {
    super(Messages.getString("FtsJDialog.title"));

    JPanel dialogPanel = new JPanel();
    dialogPanel.setBorder(new EmptyBorder(5, 10, 0, 10));
    dialogPanel.setLayout(new BorderLayout());

    JPanel contentAndButtons = new JPanel(new GridLayout(2, 1));
    JPanel contentPanel = new JPanel(new BorderLayout());

    // 1a./*from   www  .  j a  v a 2 s.  c  o  m*/
    // TODO add help like in eclipse
    contentPanel.add(new JLabel(Messages.getString("FtsJDialog.searchString")), BorderLayout.NORTH);
    // 1b.
    String[] knownSearches = new String[] { "", "RDF", "mind", "concept", "China" };
    ftsCombo = new JComboBox(knownSearches);
    ftsCombo.setPreferredSize(new Dimension(200, 18));
    ftsCombo.setEditable(true);
    ftsCombo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if ("comboBoxEdited".equals(e.getActionCommand())) {
                search();
            }
        }
    });
    contentPanel.add(ftsCombo, BorderLayout.SOUTH);
    contentAndButtons.add(contentPanel);

    // 2.
    JPanel p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.CENTER, 1, 5));
    JButton searchButton = new JButton(Messages.getString("FtsJDialog.searchButton"));
    searchButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            search();
        }
    });
    p.add(searchButton);

    JButton cancelButton = new JButton(Messages.getString("FtsJDialog.cancel"));
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });
    p.add(cancelButton);

    contentAndButtons.add(p);

    dialogPanel.add(contentAndButtons, BorderLayout.CENTER);

    getContentPane().add(dialogPanel, BorderLayout.CENTER);

    // show
    pack();
    Gfx.centerAndShowWindow(this);
}

From source file:net.chunkyhosting.Roe.computer.CHGManager.gui.dialogs.DownloadNotice.java

public DownloadNotice(HashMap<JSONObject, URL> downloads) {

    this.setDownloads(downloads);
    JPanel basic = new JPanel();
    basic.setLayout(new BoxLayout(basic, BoxLayout.Y_AXIS));
    add(basic);/*ww w .java  2 s.c o  m*/

    JPanel topPanel = new JPanel(new BorderLayout(0, 0));
    topPanel.setMaximumSize(new Dimension(450, 0));
    JLabel hint = new JLabel("CHGManager Download Manager");
    hint.setBorder(BorderFactory.createEmptyBorder(0, 25, 0, 0));
    topPanel.add(hint);

    JSeparator separator = new JSeparator();
    separator.setForeground(Color.gray);

    topPanel.add(separator, BorderLayout.SOUTH);

    basic.add(topPanel);

    JPanel textPanel = new JPanel(new BorderLayout());
    textPanel.setBorder(BorderFactory.createEmptyBorder(15, 25, 15, 25));
    this.setTextPanel(new JTextPane());

    this.getTextPanel().setContentType("text/html");
    String text = "<p><b>Some files are missing from your CHGManager install. Don't worry. We're trying to download them. Please don't close this panel!</b></p>";
    this.getText().add(text);
    this.getTextPanel().setText(text);
    this.getTextPanel().setEditable(false);
    JScrollPane sp = new JScrollPane();
    sp.setSize(this.getTextPanel().getSize());
    basic.add(sp);

    //basic.add(textPanel);

    JPanel boxPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 0));
    basic.add(boxPanel);

    JPanel bottom = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JButton close = new JButton("Close");

    bottom.add(close);
    basic.add(bottom);

    bottom.setMaximumSize(new Dimension(450, 0));

    this.setTitle("CHGManager Download Manager");
    this.setResizable(false);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    this.setLocationRelativeTo(null);
    this.setVisible(true);
    try {

        Thread.sleep(2000);

    } catch (InterruptedException e) {

    }

    this.startDownload();

}

From source file:com.intuit.tank.tools.debugger.VariableDialog.java

/**
 * @return//from w ww  . j ava  2s  .c  o  m
 */
private Component createButtonPanel() {
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 5));
    JButton saveBT = new JButton("Save");
    saveBT.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (table.isEditing()) {
                table.getCellEditor().stopCellEditing();
            }
            Map<String, String> ret = new HashMap<String, String>();
            for (int row = 0; row < table.getModel().getRowCount(); row++) {
                String key = (String) table.getModel().getValueAt(row, 0);
                String value = (String) table.getModel().getValueAt(row, 1);
                if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(value)) {
                    ret.put(key, value);
                }
            }
            f.setProjectVariables(ret);
            setVisible(false);
        }
    });
    panel.add(saveBT);

    JButton cancelBT = new JButton("Close");
    cancelBT.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            setVisible(false);
        }
    });
    panel.add(cancelBT);

    JButton addBt = new JButton("Add Variable");
    addBt.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (table.isEditing()) {
                table.getCellEditor().stopCellEditing();
            }
            try {
                ((DefaultTableModel) table.getModel()).addRow(new Object[] { "Key", "Value" });
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    panel.add(addBt);

    deleteBT = new JButton("Delete Variable");
    deleteBT.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (table.isEditing()) {
                table.getCellEditor().stopCellEditing();
            }
            try {
                int selectedRow = table.getSelectedRow();
                ((DefaultTableModel) table.getModel()).removeRow(table.getSelectedRow());
                if (selectedRow > 0) {
                    table.getSelectionModel().setSelectionInterval(selectedRow - 1, selectedRow - 1);
                } else if (table.getRowCount() > 0) {
                    table.getSelectionModel().setSelectionInterval(0, 0);
                } else {
                    table.getSelectionModel().clearSelection();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    deleteBT.setEnabled(false);
    panel.add(deleteBT);
    return panel;
}

From source file:FileLister.java

/**
 * Constructor: create the GUI, and list the initial directory.
 *//* ww w .  j a v a2 s. c  om*/
public FileLister(String directory, FilenameFilter filter) {
    super("File Lister"); // Create the window
    this.filter = filter; // Save the filter, if any

    // Destroy the window when the user requests it
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            dispose();
        }
    });

    list = new List(12, false); // Set up the list
    list.setFont(new Font("MonoSpaced", Font.PLAIN, 14));
    list.addActionListener(this);
    list.addItemListener(this);

    details = new TextField(); // Set up the details area
    details.setFont(new Font("MonoSpaced", Font.PLAIN, 12));
    details.setEditable(false);

    buttons = new Panel(); // Set up the button box
    buttons.setLayout(new FlowLayout(FlowLayout.RIGHT, 15, 5));
    buttons.setFont(new Font("SansSerif", Font.BOLD, 14));

    up = new Button("Up a Directory"); // Set up the two buttons
    close = new Button("Close");
    up.addActionListener(this);
    close.addActionListener(this);

    buttons.add(up); // Add buttons to button box
    buttons.add(close);

    this.add(list, "Center"); // Add stuff to the window
    this.add(details, "North");
    this.add(buttons, "South");
    this.setSize(500, 350);

    listDirectory(directory); // And now list initial directory.
}

From source file:gui.TraitViewerDialog.java

private JPanel createButtons() {
    bClose = new JButton("Close");
    bClose.addActionListener(this);

    JPanel p1 = new JPanel(new GridLayout(1, 1, 5, 5));
    p1.add(bClose);// w  ww .  j av a 2 s .  co  m

    JPanel p2 = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
    p2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    p2.add(p1);

    return p2;
}

From source file:com.emental.mindraider.ui.dialogs.SearchConceptAnnotation.java

/**
 * Constructor./*  w ww  .j a v a 2s  .  c  o m*/
 */
public SearchConceptAnnotation(AbstractTextAnnotationRenderer renderer) {
    super("Search Annotation");

    this.renderer = renderer;

    JPanel dialogPanel = new JPanel();
    dialogPanel.setBorder(new EmptyBorder(5, 10, 0, 10));
    dialogPanel.setLayout(new BorderLayout());

    JPanel contentAndButtons = new JPanel(new GridLayout(2, 1));
    JPanel contentPanel = new JPanel(new BorderLayout());

    // 1a.
    // TODO add help like in eclipse
    contentPanel.add(new JLabel(Messages.getString("FtsJDialog.searchString")), BorderLayout.NORTH);
    // 1b.
    searchCombo = new JComboBox(history.toArray());
    searchCombo.setSelectedItem("");
    searchCombo.setPreferredSize(new Dimension(200, 18));
    searchCombo.setEditable(true);
    searchCombo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if ("comboBoxEdited".equals(e.getActionCommand())) {
                search();
            }
        }
    });
    contentPanel.add(searchCombo, BorderLayout.SOUTH);
    contentAndButtons.add(contentPanel);

    // 2.
    JPanel p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.CENTER, 1, 5));
    JButton searchButton = new JButton(Messages.getString("FtsJDialog.searchButton"));
    searchButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            search();
        }
    });
    p.add(searchButton);

    JButton cancelButton = new JButton(Messages.getString("FtsJDialog.cancel"));
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });
    p.add(cancelButton);

    contentAndButtons.add(p);

    dialogPanel.add(contentAndButtons, BorderLayout.CENTER);

    getContentPane().add(dialogPanel, BorderLayout.CENTER);

    // show
    pack();
    Gfx.centerAndShowWindow(this);
}

From source file:org.datacleaner.widgets.result.PatternFinderResultSwingRendererCrosstabDelegate.java

@Override
public JComponent render(CrosstabResult result) {
    final CrosstabPanel crosstabPanel = super.renderInternal(result);
    final DCTable table = crosstabPanel.getTable();
    if (isInitiallyCharted(table) || isTooLimitedToChart(table)) {
        return crosstabPanel;
    }/*  w  w  w .jav  a  2 s  . c o m*/

    final DCPanel headerPanel = new DCPanel();
    headerPanel.setLayout(new FlowLayout(Alignment.RIGHT.getFlowLayoutAlignment(), 1, 1));

    final JButton chartButton = WidgetFactory.createDefaultButton("Show distribution chart",
            IconUtils.CHART_BAR);
    chartButton.setMargin(new Insets(1, 1, 1, 1));
    chartButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            headerPanel.setVisible(false);
            displayChart(table, crosstabPanel.getDisplayChartCallback());
        }
    });

    headerPanel.add(chartButton);

    final DCPanel panel = new DCPanel();
    panel.setLayout(new BorderLayout());
    panel.add(headerPanel, BorderLayout.NORTH);
    panel.add(crosstabPanel, BorderLayout.CENTER);

    return panel;
}

From source file:org.eobjects.datacleaner.widgets.result.PatternFinderResultSwingRendererCrosstabDelegate.java

@Override
public JComponent render(CrosstabResult result) {
    final CrosstabPanel crosstabPanel = super.renderInternal(result);
    final DCTable table = crosstabPanel.getTable();
    if (isInitiallyCharted(table) || isTooLimitedToChart(table)) {
        return crosstabPanel;
    }//from   w  ww  .  j  a  v  a2s . co  m

    final DCPanel headerPanel = new DCPanel();
    headerPanel.setLayout(new FlowLayout(Alignment.RIGHT.getFlowLayoutAlignment(), 1, 1));

    final JButton chartButton = new JButton("Show distribution chart",
            ImageManager.get().getImageIcon("images/chart-types/bar.png"));
    chartButton.setMargin(new Insets(1, 1, 1, 1));
    chartButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            headerPanel.setVisible(false);
            displayChart(table, crosstabPanel.getDisplayChartCallback());
        }
    });

    headerPanel.add(chartButton);

    final DCPanel panel = new DCPanel();
    panel.setLayout(new BorderLayout());
    panel.add(headerPanel, BorderLayout.NORTH);
    panel.add(crosstabPanel, BorderLayout.CENTER);

    return panel;
}

From source file:com.eviware.soapui.support.editor.inspectors.auth.ExpirationTimeChooser.java

private JPanel createTimeSelectionPanel() {
    JPanel timeSelectionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 3, 0));

    boolean enableManualTimeControls = profile.useManualAccessTokenExpirationTime();

    timeTextField = createTimeTextField(enableManualTimeControls);
    timeUnitCombo = createTimeUnitCombo(enableManualTimeControls);

    timeSelectionPanel.add(timeTextField);
    timeSelectionPanel.add(timeUnitCombo);

    return timeSelectionPanel;
}