Search in sources :

Example 11 with GridBagLayout

use of java.awt.GridBagLayout in project libgdx by libgdx.

the class ScaledNumericPanel method initializeComponents.

private void initializeComponents(String chartTitle) {
    JPanel contentPanel = getContentPanel();
    {
        formPanel = new JPanel(new GridBagLayout());
        contentPanel.add(formPanel, new GridBagConstraints(5, 5, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
        {
            JLabel label = new JLabel("High:");
            formPanel.add(label, new GridBagConstraints(2, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
        }
        {
            highMinSlider = new Slider(0, -99999, 99999, 1f, -400, 400);
            formPanel.add(highMinSlider, new GridBagConstraints(3, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
        }
        {
            highMaxSlider = new Slider(0, -99999, 99999, 1f, -400, 400);
            formPanel.add(highMaxSlider, new GridBagConstraints(4, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 6, 0, 0), 0, 0));
        }
        {
            highRangeButton = new JButton("<");
            highRangeButton.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
            formPanel.add(highRangeButton, new GridBagConstraints(5, 1, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 1, 0, 0), 0, 0));
        }
        {
            JLabel label = new JLabel("Low:");
            formPanel.add(label, new GridBagConstraints(2, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
        }
        {
            lowMinSlider = new Slider(0, -99999, 99999, 1f, -400, 400);
            formPanel.add(lowMinSlider, new GridBagConstraints(3, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
        }
        {
            lowMaxSlider = new Slider(0, -99999, 99999, 1f, -400, 400);
            formPanel.add(lowMaxSlider, new GridBagConstraints(4, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 6, 0, 0), 0, 0));
        }
        {
            lowRangeButton = new JButton("<");
            lowRangeButton.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
            formPanel.add(lowRangeButton, new GridBagConstraints(5, 2, 1, 1, 0.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 1, 0, 0), 0, 0));
        }
    }
    {
        chart = new Chart(chartTitle) {

            public void pointsChanged() {
                value.setTimeline(chart.getValuesX());
                value.setScaling(chart.getValuesY());
            }
        };
        contentPanel.add(chart, new GridBagConstraints(6, 5, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
        chart.setPreferredSize(new Dimension(150, 30));
    }
    {
        expandButton = new JButton("+");
        contentPanel.add(expandButton, new GridBagConstraints(7, 5, 1, 1, 1, 0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0));
        expandButton.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8));
    }
    {
        relativeCheckBox = new JCheckBox("Relative");
        contentPanel.add(relativeCheckBox, new GridBagConstraints(7, 5, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 6, 0, 0), 0, 0));
    }
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 12 with GridBagLayout

use of java.awt.GridBagLayout in project gephi by gephi.

the class ImporterVnaUI method getPanel.

@Override
public JPanel getPanel() {
    panel = new JPanel(new GridBagLayout());
    comboBox = new JComboBox(EdgeWidthFunction.Function.values());
    textField = new JTextField("1", 5);
    messageLabel = new JLabel(MESSAGE_LINEAR);
    comboBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            comboBoxSelectionChanged(e);
        }
    });
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.insets = new Insets(5, 5, 5, 5);
    constraints.gridx = 0;
    constraints.gridy = 0;
    panel.add(comboBox, constraints);
    constraints.gridx = 1;
    panel.add(textField, constraints);
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.gridwidth = 2;
    panel.add(messageLabel, constraints);
    constraints.gridy = 2;
    constraints.gridwidth = 2;
    constraints.fill = GridBagConstraints.VERTICAL;
    panel.add(new JPanel());
    panel.setPreferredSize(new Dimension(350, 100));
    panel.setSize(new Dimension(350, 100));
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JComboBox(javax.swing.JComboBox) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField)

Example 13 with GridBagLayout

use of java.awt.GridBagLayout in project binnavi by google.

the class ArrayTypePanel method createControls.

private void createControls() {
    setLayout(new BorderLayout());
    final JPanel contentPanel = new JPanel();
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    add(contentPanel, BorderLayout.CENTER);
    final GridBagLayout gbl_m_contentPanel = new GridBagLayout();
    gbl_m_contentPanel.columnWidths = new int[] { 0, 0, 0 };
    gbl_m_contentPanel.rowHeights = new int[] { 0, 0, 0, 0, 0 };
    gbl_m_contentPanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gbl_m_contentPanel.rowWeights = new double[] { 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE };
    contentPanel.setLayout(gbl_m_contentPanel);
    final JLabel lblSize = new JLabel("Number of elements:");
    final GridBagConstraints gbc_lblSize = new GridBagConstraints();
    gbc_lblSize.anchor = GridBagConstraints.WEST;
    gbc_lblSize.insets = new Insets(0, 0, 5, 5);
    gbc_lblSize.gridx = 0;
    gbc_lblSize.gridy = 1;
    contentPanel.add(lblSize, gbc_lblSize);
    numberElements = new JSpinner(new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1));
    numberElements.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(final ChangeEvent e) {
            updatePreview();
        }
    });
    final GridBagConstraints gbc_numberElements = new GridBagConstraints();
    gbc_numberElements.anchor = GridBagConstraints.WEST;
    gbc_numberElements.insets = new Insets(0, 0, 5, 0);
    gbc_numberElements.gridx = 1;
    gbc_numberElements.gridy = 1;
    contentPanel.add(numberElements, gbc_numberElements);
    final JLabel lblFillWith = new JLabel("Element type:");
    final GridBagConstraints gbc_lblFillWith = new GridBagConstraints();
    gbc_lblFillWith.anchor = GridBagConstraints.WEST;
    gbc_lblFillWith.insets = new Insets(0, 0, 5, 5);
    gbc_lblFillWith.gridx = 0;
    gbc_lblFillWith.gridy = 0;
    contentPanel.add(lblFillWith, gbc_lblFillWith);
    baseTypes = new TypeComboBox(new TypeListModel(typeManager.getTypes(), new TypeListModel.PrototypesFilter()));
    baseTypes.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            updatePreview();
        }
    });
    final GridBagConstraints gbc_baseTypes = new GridBagConstraints();
    gbc_baseTypes.insets = new Insets(0, 0, 5, 0);
    gbc_baseTypes.fill = GridBagConstraints.HORIZONTAL;
    gbc_baseTypes.gridx = 1;
    gbc_baseTypes.gridy = 0;
    contentPanel.add(baseTypes, gbc_baseTypes);
    final JLabel lblPreview = new JLabel("Preview:");
    final GridBagConstraints gbc_lblPreview = new GridBagConstraints();
    gbc_lblPreview.anchor = GridBagConstraints.WEST;
    gbc_lblPreview.insets = new Insets(0, 0, 5, 5);
    gbc_lblPreview.gridx = 0;
    gbc_lblPreview.gridy = 2;
    contentPanel.add(lblPreview, gbc_lblPreview);
    final JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBorder(null);
    final GridBagConstraints gbc_scrollPane = new GridBagConstraints();
    gbc_scrollPane.insets = new Insets(0, 0, 5, 0);
    gbc_scrollPane.fill = GridBagConstraints.BOTH;
    gbc_scrollPane.gridx = 1;
    gbc_scrollPane.gridy = 2;
    contentPanel.add(scrollPane, gbc_scrollPane);
    preview = new JTextArea();
    preview.setEditable(false);
    scrollPane.setViewportView(preview);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JTextArea(javax.swing.JTextArea) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JLabel(javax.swing.JLabel) SpinnerNumberModel(javax.swing.SpinnerNumberModel) BorderLayout(java.awt.BorderLayout) ChangeEvent(javax.swing.event.ChangeEvent) ActionListener(java.awt.event.ActionListener) JSpinner(javax.swing.JSpinner) ChangeListener(javax.swing.event.ChangeListener) EmptyBorder(javax.swing.border.EmptyBorder)

Example 14 with GridBagLayout

use of java.awt.GridBagLayout in project binnavi by google.

the class AtomicTypePanel method createControls.

private void createControls() {
    setLayout(new BorderLayout());
    final JPanel contentPanel = new JPanel();
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    add(contentPanel, BorderLayout.CENTER);
    final GridBagLayout gbl_m_contentPanel = new GridBagLayout();
    gbl_m_contentPanel.columnWidths = new int[] { 0, 0, 0 };
    gbl_m_contentPanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0 };
    gbl_m_contentPanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gbl_m_contentPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE };
    contentPanel.setLayout(gbl_m_contentPanel);
    final JLabel lblNewLabel = new JLabel("Name:");
    final GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
    gbc_lblNewLabel.anchor = GridBagConstraints.WEST;
    gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
    gbc_lblNewLabel.gridx = 0;
    gbc_lblNewLabel.gridy = 0;
    contentPanel.add(lblNewLabel, gbc_lblNewLabel);
    name = new JTextField();
    name.addKeyListener(new KeyAdapter() {

        @Override
        public void keyReleased(final KeyEvent e) {
            updatePreview();
        }
    });
    final GridBagConstraints gbc_m_name = new GridBagConstraints();
    gbc_m_name.insets = new Insets(0, 0, 5, 0);
    gbc_m_name.fill = GridBagConstraints.HORIZONTAL;
    gbc_m_name.gridx = 1;
    gbc_m_name.gridy = 0;
    contentPanel.add(name, gbc_m_name);
    name.setColumns(10);
    final JLabel lblSize = new JLabel("Size (bits):");
    final GridBagConstraints gbc_lblSize = new GridBagConstraints();
    gbc_lblSize.anchor = GridBagConstraints.WEST;
    gbc_lblSize.insets = new Insets(0, 0, 5, 5);
    gbc_lblSize.gridx = 0;
    gbc_lblSize.gridy = 1;
    contentPanel.add(lblSize, gbc_lblSize);
    size = new JTextField();
    final GridBagConstraints gbc_m_size = new GridBagConstraints();
    gbc_m_size.insets = new Insets(0, 0, 5, 0);
    gbc_m_size.fill = GridBagConstraints.HORIZONTAL;
    gbc_m_size.gridx = 1;
    gbc_m_size.gridy = 1;
    contentPanel.add(size, gbc_m_size);
    size.setColumns(10);
    signed = new JCheckBox("Signed");
    final GridBagConstraints gbc_m_signed = new GridBagConstraints();
    gbc_m_signed.anchor = GridBagConstraints.WEST;
    gbc_m_signed.insets = new Insets(0, 0, 5, 5);
    gbc_m_signed.gridx = 0;
    gbc_m_signed.gridy = 2;
    contentPanel.add(signed, gbc_m_signed);
    lblPreview = new JLabel("Preview:");
    final GridBagConstraints gbc_lblPreview = new GridBagConstraints();
    gbc_lblPreview.insets = new Insets(0, 0, 5, 5);
    gbc_lblPreview.gridx = 0;
    gbc_lblPreview.gridy = 3;
    contentPanel.add(lblPreview, gbc_lblPreview);
    preview = new JTextArea();
    preview.setEditable(false);
    final GridBagConstraints gbc_preview = new GridBagConstraints();
    gbc_preview.insets = new Insets(0, 0, 5, 0);
    gbc_preview.fill = GridBagConstraints.BOTH;
    gbc_preview.gridx = 1;
    gbc_preview.gridy = 3;
    contentPanel.add(preview, gbc_preview);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JTextArea(javax.swing.JTextArea) GridBagLayout(java.awt.GridBagLayout) KeyAdapter(java.awt.event.KeyAdapter) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) KeyEvent(java.awt.event.KeyEvent) JCheckBox(javax.swing.JCheckBox) BorderLayout(java.awt.BorderLayout) EmptyBorder(javax.swing.border.EmptyBorder)

Example 15 with GridBagLayout

use of java.awt.GridBagLayout in project binnavi by google.

the class ComplexTypePanel method createControls.

private void createControls(final List<BaseType> baseTypes) {
    setBorder(new EmptyBorder(5, 5, 5, 5));
    final GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 0, 0, 0 };
    gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 1.0, 1.0, Double.MIN_VALUE };
    setLayout(gridBagLayout);
    final JLabel lblName = new JLabel("Name:");
    GridBagConstraints gbcLblName = new GridBagConstraints();
    gbcLblName.insets = new Insets(0, 0, 5, 5);
    gbcLblName.anchor = GridBagConstraints.WEST;
    gbcLblName.gridx = 0;
    gbcLblName.gridy = 0;
    add(lblName, gbcLblName);
    name = new JTextField();
    GridBagConstraints gbcName = new GridBagConstraints();
    gbcName.insets = new Insets(0, 0, 5, 0);
    gbcName.fill = GridBagConstraints.HORIZONTAL;
    gbcName.gridx = 1;
    gbcName.gridy = 0;
    add(name, gbcName);
    name.setColumns(10);
    final JLabel lblMembers = new JLabel("Members:");
    final GridBagConstraints gbcLblMembers = new GridBagConstraints();
    gbcLblMembers.anchor = GridBagConstraints.WEST;
    gbcLblMembers.insets = new Insets(0, 0, 5, 5);
    gbcLblMembers.gridx = 0;
    gbcLblMembers.gridy = 2;
    add(lblMembers, gbcLblMembers);
    final MemberTableModel model = new MemberTableModel();
    model.addTableModelListener(new MemberTableModelListener());
    members = new MemberTable(model, baseTypes);
    final TableRowSorter<MemberTableModel> sorter = new TableRowSorter<MemberTableModel>(model);
    // Triggers immediate re-sort when offset is updated.
    sorter.setSortsOnUpdates(true);
    sorter.setSortable(MemberTableModel.NAME_COLUMN, false);
    sorter.setSortable(MemberTableModel.TYPE_COLUMN, false);
    // Initial state is ascending sort order.
    sorter.toggleSortOrder(MemberTableModel.INDEX_COLUMN);
    members.setRowSorter(sorter);
    final GridBagConstraints gbcMembers = new GridBagConstraints();
    gbcMembers.insets = new Insets(0, 0, 5, 0);
    gbcMembers.fill = GridBagConstraints.BOTH;
    gbcMembers.gridx = 1;
    gbcMembers.gridy = 2;
    add(new JScrollPane(members), gbcMembers);
    final JLabel lblPreview = new JLabel("Preview:");
    final GridBagConstraints gbcLblPreview = new GridBagConstraints();
    gbcLblPreview.anchor = GridBagConstraints.WEST;
    gbcLblPreview.insets = new Insets(0, 0, 0, 5);
    gbcLblPreview.gridx = 0;
    gbcLblPreview.gridy = 3;
    add(lblPreview, gbcLblPreview);
    final JTextArea preview = new JTextArea();
    final GridBagConstraints gbcPreview = new GridBagConstraints();
    gbcPreview.fill = GridBagConstraints.BOTH;
    gbcPreview.gridx = 1;
    gbcPreview.gridy = 3;
    add(preview, gbcPreview);
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JTextArea(javax.swing.JTextArea) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) EmptyBorder(javax.swing.border.EmptyBorder) TableRowSorter(javax.swing.table.TableRowSorter)

Aggregations

GridBagLayout (java.awt.GridBagLayout)739 GridBagConstraints (java.awt.GridBagConstraints)576 JPanel (javax.swing.JPanel)532 JLabel (javax.swing.JLabel)425 Insets (java.awt.Insets)409 Dimension (java.awt.Dimension)182 JScrollPane (javax.swing.JScrollPane)147 JButton (javax.swing.JButton)143 ActionEvent (java.awt.event.ActionEvent)136 ActionListener (java.awt.event.ActionListener)115 JTextField (javax.swing.JTextField)100 BorderLayout (java.awt.BorderLayout)96 JCheckBox (javax.swing.JCheckBox)79 BoxLayout (javax.swing.BoxLayout)66 ButtonGroup (javax.swing.ButtonGroup)56 TitledBorder (javax.swing.border.TitledBorder)48 JComboBox (javax.swing.JComboBox)46 FlowLayout (java.awt.FlowLayout)42 JRadioButton (javax.swing.JRadioButton)36 Color (java.awt.Color)34