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:es.emergya.ui.gis.ControlPanel.java

public ControlPanel(final CustomMapView view) {
    super(new FlowLayout(FlowLayout.LEADING, 12, 0));
    this.view = view;
    // Posicion: panel con un label de icono y un textfield
    JPanel posPanel = new JPanel();
    posPanel.setOpaque(true);//from  ww w .j  a  v  a 2s  .com
    posPanel.setVisible(true);
    JLabel mouseLocIcon = new JLabel(LogicConstants.getIcon("map_icon_coordenadas"));
    posPanel.add(mouseLocIcon);
    final JTextField posField = new JTextField(15);
    posField.setEditable(false);
    posField.setBorder(null);
    posField.setForeground(UIManager.getColor("Label.foreground"));
    posField.setFont(UIManager.getFont("Label.font"));
    posPanel.add(posField);
    view.addMouseMotionListener(new MouseMotionListener() {

        @Override
        public void mouseMoved(MouseEvent e) {
            LatLon ll = ((ICustomMapView) e.getSource()).getLatLon(e.getX(), e.getY());
            String position = "";
            String format = LogicConstants.get("FORMATO_COORDENADAS_MAPA", "UTM");
            if (format.equals(LogicConstants.COORD_UTM)) {
                UTM u = new UTM(LogicConstants.getInt("ZONA_UTM"));
                EastNorth en = u.latlon2eastNorth(ll);
                position = String.format("x: %.1f y: %.1f", en.getX(), en.getY());
            } else {
                position = String.format("Lat: %.4f Lon: %.4f", ll.lat(), ll.lon());
            }

            posField.setText(position);
            validate();
        }

        @Override
        public void mouseDragged(MouseEvent e) {
        }
    });
    posPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    add(posPanel);

    // Panel de centrado: label, desplegable y parte cambiante
    JPanel centerPanel = new JPanel();
    centerPanel.add(new JLabel(i18n.getString("map.centerIn")));
    centerOptions = new JComboBox(new String[] { i18n.getString("map.street"), i18n.getString("map.resource"),
            i18n.getString("map.incidence"), i18n.getString("map.location") });
    centerPanel.add(centerOptions);

    centerData = new JPanel(new CardLayout());
    centerPanel.add(centerData);

    JPanel centerStreet = new JPanel();
    street = new JTextField(30);
    street.setName(i18n.getString("map.street"));
    autocompleteKeyListener = new AutocompleteKeyListener(street);
    street.addKeyListener(autocompleteKeyListener);
    street.addActionListener(this);
    centerStreet.add(street);
    centerData.add(centerStreet, i18n.getString("map.street"));

    JPanel centerResource = new JPanel();
    resources = new JComboBox(avaliableResources);
    resources.setName(i18n.getString("map.resource"));
    resources.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    resources.addPopupMenuListener(new PopupMenuListener() {

        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            isComboResourcesShowing = true;
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            isComboResourcesShowing = false;
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent e) {
            // view.repaint();
        }
    });
    centerResource.add(resources);
    centerData.add(centerResource, i18n.getString("map.resource"));

    centerResource = new JPanel();
    incidences = new JComboBox(avaliableIncidences);
    incidences.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    incidences.setName(i18n.getString("map.incidence"));
    incidences.addPopupMenuListener(new PopupMenuListener() {

        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            isComboIncidencesShowing = true;
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            isComboIncidencesShowing = false;
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent e) {

        }
    });
    centerResource.add(incidences);
    centerData.add(centerResource, i18n.getString("map.incidence"));

    JPanel centerLocation = new JPanel();
    cx = new JTextField(10);
    cx.setName("x");
    cx.addActionListener(this);
    centerLocation.add(cx);
    cy = new JTextField(10);
    cy.setName("y");
    cy.addActionListener(this);
    centerLocation.add(cy);
    centerData.add(centerLocation, i18n.getString("map.location"));

    centerOptions.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            ((CardLayout) centerData.getLayout()).show(centerData, (String) e.getItem());
        }
    });

    JButton centerButton = new JButton(i18n.getString("map.center"));
    centerButton.addActionListener(this);
    centerPanel.add(centerButton);
    add(centerPanel);

}

From source file:de.pavloff.spark4knime.jsnippet.ui.JarListPanel.java

/** Inits GUI. */
public JarListPanel() {
    super(new BorderLayout());
    m_addJarList = new JList<String>(new DefaultListModel<String>()) {
        /** {@inheritDoc} */
        @Override/*from   ww w  .j a v a2s . co  m*/
        protected void processComponentKeyEvent(final KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_A && e.isControlDown()) {
                int end = getModel().getSize() - 1;
                getSelectionModel().setSelectionInterval(0, end);
            } else if (e.getKeyCode() == KeyEvent.VK_DELETE) {
                onJarRemove();
            }
        }
    };
    m_addJarList.setCellRenderer(new ConvenientComboBoxRenderer());
    add(new JScrollPane(m_addJarList), BorderLayout.CENTER);
    JPanel southP = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 5));
    m_addJarFilesButton = new JButton("Add File(s)...");
    m_addJarFilesButton.addActionListener(new ActionListener() {
        /** {@inheritDoc} */
        @Override
        public void actionPerformed(final ActionEvent e) {
            onJarFileAdd();
        }
    });
    m_addJarURLsButton = new JButton("Add KNIME URL...");
    m_addJarURLsButton.setToolTipText("Add 'knime' URLs that resolve to local paths");
    m_addJarURLsButton.addActionListener(new ActionListener() {
        /** {@inheritDoc} */
        @Override
        public void actionPerformed(final ActionEvent e) {
            onJarURLAdd();
        }
    });
    m_removeButton = new JButton("Remove");
    m_removeButton.addActionListener(new ActionListener() {
        /** {@inheritDoc} */
        @Override
        public void actionPerformed(final ActionEvent e) {
            onJarRemove();
        }
    });
    m_addJarList.addListSelectionListener(new ListSelectionListener() {
        /** {@inheritDoc} */
        @Override
        public void valueChanged(final ListSelectionEvent e) {
            m_removeButton.setEnabled(!m_addJarList.isSelectionEmpty());
        }
    });
    m_removeButton.setEnabled(!m_addJarList.isSelectionEmpty());
    southP.add(m_addJarFilesButton);
    southP.add(m_addJarURLsButton);
    southP.add(m_removeButton);
    add(southP, BorderLayout.SOUTH);

    JPanel northP = new JPanel(new FlowLayout());
    JLabel label = new JLabel("<html><body>Specify additional jar files "
            + "that are necessary for the snippet to run</body></html>");
    northP.add(label);
    add(northP, BorderLayout.NORTH);
}

From source file:org.esa.smos.gui.gridpoint.GridPointBtDataChartTopComponent.java

@Override
protected JComponent createGridPointComponentOptionsComponent() {
    modeCheckers = new JCheckBox[] { new JCheckBox("X", true), new JCheckBox("Y", true),
            new JCheckBox("XY", true), };
    final JPanel optionsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 2, 2));
    for (JCheckBox modeChecker : modeCheckers) {
        modeChecker.addActionListener(e -> updateGridPointBtDataComponent());
        optionsPanel.add(modeChecker);//from   ww  w . j a v a 2 s .c o  m
    }
    return optionsPanel;
}

From source file:it.unifi.rcl.chess.traceanalysis.gui.TracePanel.java

private void initialize() {

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

    JPanel pnlInfo = new JPanel();
    JPanel pnlBound = new JPanel();
    JPanel pnlPlot = new JPanel();
    JPanel pnlPhases = new JPanel();

    pnlInfo.setLayout(new BoxLayout(pnlInfo, BoxLayout.Y_AXIS));
    pnlBound.setLayout(new BoxLayout(pnlBound, BoxLayout.Y_AXIS));
    pnlPlot.setLayout(new BoxLayout(pnlPlot, BoxLayout.Y_AXIS));
    pnlPhases.setLayout(new BoxLayout(pnlPhases, BoxLayout.Y_AXIS));

    //      pnlInfo.setBorder(BorderFactory.createLineBorder(Color.black));
    //      pnlBound.setBorder(BorderFactory.createLineBorder(Color.black));
    //      pnlPlot.setBorder(BorderFactory.createLineBorder(Color.black));
    //      pnlPhases.setBorder(BorderFactory.createLineBorder(Color.black));
    pnlInfo.setPreferredSize(new Dimension(300, 250));
    pnlBound.setPreferredSize(new Dimension(400, 250));
    pnlPlot.setPreferredSize(new Dimension(300, 250));
    pnlPhases.setPreferredSize(new Dimension(400, 250));

    pnlInfo.setBorder(new EmptyBorder(6, 6, 6, 6));
    pnlBound.setBorder(new EmptyBorder(6, 6, 6, 6));
    pnlPlot.setBorder(new EmptyBorder(6, 6, 6, 6));
    pnlPhases.setBorder(new EmptyBorder(6, 6, 6, 6));

    this.add(pnlInfo);
    this.add(pnlBound);
    this.add(pnlPlot);
    this.add(pnlPhases);

    lblInfo = new JPlainLabel("<html><b>TRACE SUMMARY</b><br/>"
            + "<em>Information about the loaded trace.</em><br/><br/></html>");
    pnlInfo.add(lblInfo);/*ww w  . j  a v a  2 s .  co m*/

    lblPoints = new JPlainLabel("#Points");
    pnlInfo.add(lblPoints);

    lblTraceName = new JPlainLabel();
    pnlInfo.add(lblTraceName);

    lblStat = new JPlainLabel();
    pnlInfo.add(lblStat);

    btnReload = new JButton("Reload");
    btnReload.addActionListener(new ButtonAction("Reload", KeyEvent.VK_L));
    pnlInfo.add(btnReload);

    btnClose = new JButton("Close");
    btnClose.addActionListener(new ButtonAction("Close", KeyEvent.VK_U));
    pnlInfo.add(btnClose);

    /* Bound evaluation */
    lblSectionBounds = new JPlainLabel("<html><b>BOUND EVALUATION</b><br/>"
            + "<em>Compute probabilistic bounds on manually selected portions of the trace.</em></html>");
    lblSectionBounds.setToolTipText("Compute probabilistic bounds on manually selected portions of the trace");
    lblSectionBounds.setFont(new Font("Dialog", Font.PLAIN, 12));
    //      lblSectionBounds.setBorder(BorderFactory.createLineBorder(Color.black));
    pnlBound.add(lblSectionBounds);

    scrollTabBounds = new JScrollPane();
    scrollTabBounds.setPreferredSize(new Dimension(400, 100));
    pnlBound.add(scrollTabBounds);

    tableBounds = new BoundsTable();
    scrollTabBounds.setViewportView(tableBounds);

    btnUpdateBoundsTable = new JButton("Update");
    btnUpdateBoundsTable.addActionListener(new ButtonAction("Update", KeyEvent.VK_U));
    pnlBound.add(btnUpdateBoundsTable);

    btnClearBoundsTable = new JButton("Clear Table");
    btnClearBoundsTable.addActionListener(new ButtonAction("Clear Table", KeyEvent.VK_C));
    pnlBound.add(btnClearBoundsTable);

    /* Plotting */
    lblSectionPlot = new JPlainLabel("<html><b>PLOTTING</b><br/>"
            + "<em>Plot the trace, together with \"dynamic\" probabilistic bounds, i.e., bounds obtained dynamically as if they were evaluated at runtime with a fixed window size.</em></html>");
    lblSectionPlot.setToolTipText("Plot the trace and dynamic bounds");
    pnlPlot.add(lblSectionPlot);

    scrollTabWSize = new JScrollPane();
    scrollTabWSize.setPreferredSize(new Dimension(400, 200));
    pnlPlot.add(scrollTabWSize);

    tableWindowSize = new JDynamicTable();
    tableWindowSize.setModel(new DefaultTableModel(new Object[][] { { 100, 0.99 }, { null, null } },
            new String[] { "WindowSize", "Confidence" }) {

        Class[] columnTypes = new Class[] { Integer.class, Double.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }
    });
    tableWindowSize.setMonitoredColumn(0);
    tableWindowSize.setMonitoredColumn(1);
    tableWindowSize.getColumnModel().getColumn(0).setPreferredWidth(10);
    tableWindowSize.getColumnModel().getColumn(1).setPreferredWidth(10);
    scrollTabWSize.setViewportView(tableWindowSize);

    btnPlot = new JButton("Plot");
    btnPlot.addActionListener(new ButtonAction("Plot", KeyEvent.VK_P));
    pnlPlot.add(btnPlot);

    btnBoundExport = new JButton("Export");
    btnBoundExport.addActionListener(new ButtonAction("Export", KeyEvent.VK_E));
    pnlPlot.add(btnBoundExport);

    btnCompareAll = new JButton("Compare All Traces");
    btnCompareAll.addActionListener(new ButtonAction("Compare All Traces", KeyEvent.VK_A));
    pnlPlot.add(btnCompareAll);

    btnClearWSizeTable = new JButton("Clear Table");
    btnClearWSizeTable.addActionListener(new ButtonAction("Clear Table", KeyEvent.VK_C));
    pnlPlot.add(btnClearWSizeTable);

    /* Phases analysis */
    lblSectionPhases = new JPlainLabel("<html><b>PHASES ANALYSIS</b><br/>"
            + "<em>Detect phases in the trace having different probabilistic properties.</em></html>.");
    lblSectionPhases.setToolTipText("Detect phases in the trace having different probabilistic properties");
    pnlPhases.add(lblSectionPhases);

    scrollTabPhases = new JScrollPane();
    scrollTabPhases.setPreferredSize(new Dimension(200, 150));
    pnlPhases.add(scrollTabPhases);

    tablePhases = new JTable();
    tablePhases.setModel(new DefaultTableModel(new Object[][] { { null, null, null, null } },
            new String[] { "Start", "End", "Distribution*", "Bound*" }) {

        Class[] columnTypes = new Class[] { Integer.class, Integer.class, String.class, String.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    });
    tablePhases.getColumnModel().getColumn(0).setPreferredWidth(10);
    tablePhases.getColumnModel().getColumn(1).setPreferredWidth(10);
    tablePhases.getColumnModel().getColumn(2).setPreferredWidth(100);
    tablePhases.getColumnModel().getColumn(3).setPreferredWidth(100);
    scrollTabPhases.setViewportView(tablePhases);

    lblPhasesCoverage = new JPlainLabel("Coverage: ");
    pnlPhases.add(lblPhasesCoverage);
    txtPhasesCoverage = new JTextField("0.99");
    pnlPhases.add(txtPhasesCoverage);

    lblPhasesWSize = new JPlainLabel("Window Size: ");
    pnlPhases.add(lblPhasesWSize);
    txtPhasesWSize = new JTextField("20");
    pnlPhases.add(txtPhasesWSize);

    btnPhaseDetection = new JButton("Phases Analysis");
    ;
    btnPhaseDetection.addActionListener(new ButtonAction("PhasesAnalysis", KeyEvent.VK_P));
    pnlPhases.add(btnPhaseDetection);
}

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

@Override
protected void decorate(CrosstabResult result, DCTable table, DisplayChartCallback displayChartCallback) {
    super.decorate(result, table, displayChartCallback);

    table.setAlignment(1, Alignment.RIGHT);

    final int rowCount = table.getRowCount();

    for (int i = 0; i < rowCount; i++) {
        final Object expressionObject = table.getValueAt(i, 0);
        final String label = extractString(expressionObject);
        final String expression = extractExpression(label);

        final String stringPatternName = "PF: " + label;

        if (!_catalog.containsStringPattern(stringPatternName)) {
            DCPanel panel = new DCPanel();
            panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));

            panel.add(Box.createHorizontalStrut(4));
            panel.add(new JLabel(label));

            final JButton button = WidgetFactory.createSmallButton("images/actions/save.png");
            button.setToolTipText("Save as string pattern");
            button.addActionListener(new ActionListener() {
                @Override//from w ww.j a v a 2s  . c  o m
                public void actionPerformed(ActionEvent e) {
                    _catalog.addStringPattern(new SimpleStringPattern(stringPatternName, expression));
                    button.setEnabled(false);
                }
            });
            panel.add(Box.createHorizontalStrut(4));
            panel.add(button);

            table.setValueAt(panel, i, 0);
        }
    }

    if (isInitiallyCharted(table)) {
        displayChart(table, displayChartCallback);
    }
}

From source file:gdt.jgui.entity.contact.JContactEditor.java

public JContactEditor() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 100, 0, 0 };
    gridBagLayout.rowHeights = new int[] { 0, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0 };
    setLayout(gridBagLayout);/*from   w  ww.  j a  v a 2  s  .  c o m*/
    JLabel lblTitle = new JLabel("Label");

    GridBagConstraints gbc_lblTitle = new GridBagConstraints();
    gbc_lblTitle.insets = new Insets(5, 5, 5, 5);
    gbc_lblTitle.gridx = 0;
    gbc_lblTitle.gridy = 0;
    gbc_lblTitle.anchor = GridBagConstraints.NORTHWEST;
    add(lblTitle, gbc_lblTitle);
    title = new JTextField();

    GridBagConstraints gbc_title = new GridBagConstraints();
    gbc_title.insets = new Insets(5, 0, 5, 5);
    gbc_title.fill = GridBagConstraints.HORIZONTAL;
    gbc_title.gridx = 1;
    gbc_title.gridy = 0;
    add(title, gbc_title);
    title.setColumns(10);

    JLabel lblPhone = new JLabel("Phone");
    GridBagConstraints gbc_lblphone = new GridBagConstraints();
    gbc_lblphone.insets = new Insets(5, 5, 5, 5);
    gbc_lblphone.gridx = 0;
    gbc_lblphone.gridy = 1;
    gbc_lblphone.anchor = GridBagConstraints.NORTHWEST;
    add(lblPhone, gbc_lblphone);

    phone = new JTextField();
    GridBagConstraints gbc_phone = new GridBagConstraints();
    gbc_phone.insets = new Insets(5, 0, 5, 5);
    gbc_phone.fill = GridBagConstraints.HORIZONTAL;
    gbc_phone.gridx = 1;
    gbc_phone.gridy = 1;
    add(phone, gbc_phone);
    phone.setColumns(10);

    JLabel lblEmail = new JLabel("Email");
    GridBagConstraints gbc_lblEmail = new GridBagConstraints();
    gbc_lblEmail.insets = new Insets(5, 5, 5, 5);
    gbc_lblEmail.gridx = 0;
    gbc_lblEmail.gridy = 2;
    gbc_lblEmail.anchor = GridBagConstraints.NORTHWEST;
    add(lblEmail, gbc_lblEmail);

    email = new JTextField();
    GridBagConstraints gbc_email = new GridBagConstraints();
    gbc_phone.insets = new Insets(5, 0, 5, 5);
    gbc_email.fill = GridBagConstraints.HORIZONTAL;
    gbc_email.gridx = 1;
    gbc_email.gridy = 2;
    add(email, gbc_email);
    email.setColumns(10);
    JPanel panel = new JPanel();
    GridBagConstraints gbc_panel = new GridBagConstraints();
    gbc_panel.weighty = 1.0;
    gbc_panel.insets = new Insets(5, 0, 5, 5);
    gbc_panel.fill = GridBagConstraints.BOTH;
    gbc_panel.gridx = 0;
    gbc_panel.gridy = 3;
    add(panel, gbc_panel);
    panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
}

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

@Override
protected void decorate(CrosstabResult result, DCTable table, DisplayChartCallback displayChartCallback) {
    super.decorate(result, table, displayChartCallback);

    table.setAlignment(1, Alignment.RIGHT);

    final int rowCount = table.getRowCount();

    for (int i = 0; i < rowCount; i++) {
        final Object expressionObject = table.getValueAt(i, 0);
        final String label = extractString(expressionObject);
        final String expression = extractExpression(label);

        final String stringPatternName = "PF: " + label;

        if (!_catalog.containsStringPattern(stringPatternName)) {
            DCPanel panel = new DCPanel();
            panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));

            panel.add(Box.createHorizontalStrut(4));
            panel.add(new JLabel(label));

            final JButton button = WidgetFactory.createSmallButton(IconUtils.ACTION_SAVE_DARK);
            button.setToolTipText("Save as string pattern");
            button.addActionListener(new ActionListener() {
                @Override//from  w  w  w  .  j  av  a 2  s  .  c o m
                public void actionPerformed(ActionEvent e) {
                    _catalog.addStringPattern(new SimpleStringPattern(stringPatternName, expression));
                    button.setEnabled(false);
                }
            });
            panel.add(Box.createHorizontalStrut(4));
            panel.add(button);

            table.setValueAt(panel, i, 0);
        }
    }

    if (isInitiallyCharted(table)) {
        displayChart(table, displayChartCallback);
    }
}

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

/**
 * @return//ww  w  .jav a  2s.c om
 */
private Component createButtonPanel() {
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 5));
    JButton cancelBT = new JButton("Cancel");
    cancelBT.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            setVisible(false);
        }
    });
    okBT = new JButton("Ok");
    okBT.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            select();
        }
    });

    panel.add(okBT);
    panel.add(cancelBT);
    return panel;
}