Search in sources :

Example 76 with EmptyBorder

use of javax.swing.border.EmptyBorder in project android by JetBrains.

the class ChooseResourceDialogFixture method getDrawableResolutionChain.

public String getDrawableResolutionChain() {
    JPanelFixture panelFixture = getDrawablePreviewResolutionPanel();
    JPanel panel = panelFixture.target();
    StringBuilder sb = new StringBuilder();
    for (int i = 0, n = panel.getComponentCount(); i < n; i++) {
        Component component = panel.getComponent(i);
        if (component instanceof JLabel) {
            JLabel label = (JLabel) component;
            Border border = label.getBorder();
            if (border instanceof EmptyBorder) {
                EmptyBorder emptyBorder = (EmptyBorder) border;
                Insets insets = emptyBorder.getBorderInsets();
                if (insets != null) {
                    for (int x = 0; x < insets.left; x += JBUI.scale(12)) {
                        sb.append(' ');
                    }
                }
            }
            sb.append(label.getText());
            sb.append('\n');
        }
    }
    return sb.toString();
}
Also used : JTextComponent(javax.swing.text.JTextComponent) EmptyBorder(javax.swing.border.EmptyBorder) Border(javax.swing.border.Border) EmptyBorder(javax.swing.border.EmptyBorder)

Example 77 with EmptyBorder

use of javax.swing.border.EmptyBorder in project JMRI by JMRI.

the class ManageBackupsDialog method initComponents.

private void initComponents() {
    setModalityType(ModalityType.DOCUMENT_MODAL);
    setModal(true);
    setTitle(Bundle.getMessage("ManageBackupsDialog.manageBackupSets"));
    setBounds(100, 100, 461, 431);
    BorderLayout borderLayout = new BorderLayout();
    borderLayout.setVgap(5);
    borderLayout.setHgap(5);
    getContentPane().setLayout(borderLayout);
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    GridBagLayout gbl_contentPanel = new GridBagLayout();
    gbl_contentPanel.columnWidths = new int[] { 0, 0 };
    gbl_contentPanel.rowHeights = new int[] { 0, 0, 0 };
    gbl_contentPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_contentPanel.rowWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    contentPanel.setLayout(gbl_contentPanel);
    {
        selectBackupSetsLabel = new JLabel(Bundle.getMessage("ManageBackupsDialog.instructionsLabel.text"));
        GridBagConstraints gbc_selectBackupSetsLabel = new GridBagConstraints();
        gbc_selectBackupSetsLabel.anchor = GridBagConstraints.WEST;
        gbc_selectBackupSetsLabel.insets = new Insets(0, 0, 5, 0);
        gbc_selectBackupSetsLabel.gridx = 0;
        gbc_selectBackupSetsLabel.gridy = 0;
        contentPanel.add(selectBackupSetsLabel, gbc_selectBackupSetsLabel);
    }
    {
        scrollPane = new JScrollPane();
        GridBagConstraints gbc_scrollPane = new GridBagConstraints();
        gbc_scrollPane.fill = GridBagConstraints.BOTH;
        gbc_scrollPane.gridx = 0;
        gbc_scrollPane.gridy = 1;
        contentPanel.add(scrollPane, gbc_scrollPane);
        {
            setList = new JList<BackupSet>();
            setList.setVisibleRowCount(20);
            model = new DefaultListModel<BackupSet>();
            // Load up the list control with the available BackupSets
            for (BackupSet bs : backup.getBackupSets()) {
                model.addElement(bs);
            }
            setList.setModel(model);
            // Update button states based on if anything is selected in the
            // list.
            setList.addListSelectionListener(new ListSelectionListener() {

                @Override
                public void valueChanged(ListSelectionEvent e) {
                    updateButtonStates();
                }
            });
            scrollPane.setViewportView(setList);
        }
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            selectAllButton = new JButton(Bundle.getMessage("ManageBackupsDialog.selectAllButton.text"));
            selectAllButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    do_selectAllButton_actionPerformed(e);
                }
            });
            buttonPane.add(selectAllButton);
        }
        {
            horizontalStrut = Box.createHorizontalStrut(10);
            buttonPane.add(horizontalStrut);
        }
        {
            clearAllButton = new JButton(Bundle.getMessage("ManageBackupsDialog.clearAllButton.text"));
            clearAllButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    do_clearAllButton_actionPerformed(e);
                }
            });
            buttonPane.add(clearAllButton);
        }
        {
            horizontalGlue = Box.createHorizontalGlue();
            buttonPane.add(horizontalGlue);
        }
        {
            deleteButton = new JButton(Bundle.getMessage("ButtonDelete"));
            deleteButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    do_deleteButton_actionPerformed(e);
                }
            });
            deleteButton.setActionCommand("");
            buttonPane.add(deleteButton);
        }
        {
            horizontalStrut_1 = Box.createHorizontalStrut(10);
            buttonPane.add(horizontalStrut_1);
        }
        {
            JButton closeButton = new JButton(Bundle.getMessage("ButtonCancel"));
            closeButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    do_cancelButton_actionPerformed(e);
                }
            });
            // NOI18N
            closeButton.setActionCommand("Cancel");
            getRootPane().setDefaultButton(closeButton);
            buttonPane.add(closeButton);
        }
        {
            horizontalStrut_2 = Box.createHorizontalStrut(10);
            buttonPane.add(horizontalStrut_2);
        }
    // {
    // helpButton = new JButton(Bundle.getMessage("BackupDialog.helpButton.text"));
    // helpButton.addActionListener(new ActionListener() {
    // public void actionPerformed(ActionEvent e) {
    // do_helpButton_actionPerformed(e);
    // }
    // });
    // helpButton.setEnabled(false);
    // buttonPane.add(helpButton);
    // }
    }
    updateButtonStates();
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) ListSelectionListener(javax.swing.event.ListSelectionListener) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) EmptyBorder(javax.swing.border.EmptyBorder)

Example 78 with EmptyBorder

use of javax.swing.border.EmptyBorder in project beast-mcmc by beast-dev.

the class MLEDialog method showDialog.

public int showDialog() {
    JOptionPane optionPane = new JOptionPane(optionsPanel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null, null);
    optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));
    final JDialog dialog = optionPane.createDialog(frame, description);
    dialog.pack();
    dialog.setVisible(true);
    int result = JOptionPane.CANCEL_OPTION;
    Integer value = (Integer) optionPane.getValue();
    if (value != null && value != -1) {
        result = value;
    }
    return result;
}
Also used : EmptyBorder(javax.swing.border.EmptyBorder)

Example 79 with EmptyBorder

use of javax.swing.border.EmptyBorder in project beast-mcmc by beast-dev.

the class BeastDialog method showDialog.

public boolean showDialog(String title) {
    JOptionPane optionPane = new JOptionPane(optionPanel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, new String[] { "Run", "Quit" }, "Run");
    optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));
    final JDialog dialog = optionPane.createDialog(frame, title);
    //dialog.setResizable(true);
    dialog.pack();
    dialog.setVisible(true);
    return (optionPane.getValue() != null ? optionPane.getValue().equals("Run") : false);
}
Also used : EmptyBorder(javax.swing.border.EmptyBorder)

Example 80 with EmptyBorder

use of javax.swing.border.EmptyBorder in project beast-mcmc by beast-dev.

the class CloneModelDialog method showDialog.

public int showDialog(List<PartitionClockModel> sourceModels) {
    JOptionPane optionPane = new JOptionPane(optionPanel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null, null);
    optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));
    sourceModelCombo.removeAllItems();
    for (PartitionClockModel model : sourceModels) {
        sourceModelCombo.addItem(model);
    }
    final JDialog dialog = optionPane.createDialog(frame, "Clone model settings");
    dialog.pack();
    dialog.setVisible(true);
    int result = JOptionPane.CANCEL_OPTION;
    Integer value = (Integer) optionPane.getValue();
    if (value != null && value != -1) {
        result = value;
    }
    return result;
}
Also used : PartitionClockModel(dr.app.beauti.options.PartitionClockModel) EmptyBorder(javax.swing.border.EmptyBorder)

Aggregations

EmptyBorder (javax.swing.border.EmptyBorder)224 JPanel (javax.swing.JPanel)96 BorderLayout (java.awt.BorderLayout)87 JLabel (javax.swing.JLabel)70 JButton (javax.swing.JButton)44 JScrollPane (javax.swing.JScrollPane)44 Insets (java.awt.Insets)37 Dimension (java.awt.Dimension)35 Border (javax.swing.border.Border)30 GridBagLayout (java.awt.GridBagLayout)29 ActionEvent (java.awt.event.ActionEvent)27 ActionListener (java.awt.event.ActionListener)27 TitledBorder (javax.swing.border.TitledBorder)25 GridBagConstraints (java.awt.GridBagConstraints)24 Box (javax.swing.Box)22 JTextField (javax.swing.JTextField)21 CompoundBorder (javax.swing.border.CompoundBorder)20 BoxLayout (javax.swing.BoxLayout)17 FlowLayout (java.awt.FlowLayout)16 JCheckBox (javax.swing.JCheckBox)16