Search in sources :

Example 86 with FlowLayout

use of java.awt.FlowLayout in project jadx by skylot.

the class SearchDialog method initUI.

private void initUI() {
    JLabel findLabel = new JLabel(NLS.str("search_dialog.open_by_name"));
    searchField = new JTextField();
    searchField.setAlignmentX(LEFT_ALIGNMENT);
    searchField.getDocument().addDocumentListener(new SearchFieldListener());
    new TextStandardActions(searchField);
    JCheckBox clsChBox = makeOptionsCheckBox(NLS.str("search_dialog.class"), SearchOptions.CLASS);
    JCheckBox mthChBox = makeOptionsCheckBox(NLS.str("search_dialog.method"), SearchOptions.METHOD);
    JCheckBox fldChBox = makeOptionsCheckBox(NLS.str("search_dialog.field"), SearchOptions.FIELD);
    JCheckBox codeChBox = makeOptionsCheckBox(NLS.str("search_dialog.code"), SearchOptions.CODE);
    JPanel searchOptions = new JPanel(new FlowLayout(FlowLayout.LEFT));
    searchOptions.setBorder(BorderFactory.createTitledBorder(NLS.str("search_dialog.search_in")));
    searchOptions.add(clsChBox);
    searchOptions.add(mthChBox);
    searchOptions.add(fldChBox);
    searchOptions.add(codeChBox);
    searchOptions.setAlignmentX(LEFT_ALIGNMENT);
    JPanel searchPane = new JPanel();
    searchPane.setLayout(new BoxLayout(searchPane, BoxLayout.PAGE_AXIS));
    findLabel.setLabelFor(searchField);
    searchPane.add(findLabel);
    searchPane.add(Box.createRigidArea(new Dimension(0, 5)));
    searchPane.add(searchField);
    searchPane.add(Box.createRigidArea(new Dimension(0, 5)));
    searchPane.add(searchOptions);
    searchPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    initCommon();
    JPanel resultsPanel = initResultsTable();
    JPanel buttonPane = initButtonsPanel();
    Container contentPane = getContentPane();
    contentPane.add(searchPane, BorderLayout.PAGE_START);
    contentPane.add(resultsPanel, BorderLayout.CENTER);
    contentPane.add(buttonPane, BorderLayout.PAGE_END);
    searchField.addKeyListener(new KeyAdapter() {

        @Override
        public void keyReleased(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                if (resultsModel.getRowCount() != 0) {
                    resultsTable.setRowSelectionInterval(0, 0);
                }
                resultsTable.requestFocus();
            }
        }
    });
    setTitle(NLS.str("menu.text_search"));
    pack();
    setSize(800, 500);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setModalityType(ModalityType.MODELESS);
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BoxLayout(javax.swing.BoxLayout) KeyAdapter(java.awt.event.KeyAdapter) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) TextStandardActions(jadx.gui.utils.TextStandardActions) JCheckBox(javax.swing.JCheckBox) KeyEvent(java.awt.event.KeyEvent) Container(java.awt.Container)

Example 87 with FlowLayout

use of java.awt.FlowLayout in project jadx by skylot.

the class TabbedPane method makeTabComponent.

private Component makeTabComponent(final ContentPanel contentPanel) {
    JNode node = contentPanel.getNode();
    String name = node.makeLongString();
    final JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 3, 0));
    panel.setOpaque(false);
    final JLabel label = new JLabel(name);
    label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
    label.setIcon(node.getIcon());
    final JButton button = new JButton();
    button.setIcon(ICON_CLOSE_INACTIVE);
    button.setRolloverIcon(ICON_CLOSE);
    button.setRolloverEnabled(true);
    button.setOpaque(false);
    button.setUI(new BasicButtonUI());
    button.setContentAreaFilled(false);
    button.setFocusable(false);
    button.setBorder(null);
    button.setBorderPainted(false);
    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            closeCodePanel(contentPanel);
        }
    });
    panel.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (SwingUtilities.isMiddleMouseButton(e)) {
                closeCodePanel(contentPanel);
            } else if (SwingUtilities.isRightMouseButton(e)) {
                JPopupMenu menu = createTabPopupMenu(contentPanel);
                menu.show(panel, e.getX(), e.getY());
            } else {
                // TODO: make correct event delegation to tabbed pane
                setSelectedComponent(contentPanel);
            }
        }
    });
    panel.add(label);
    panel.add(button);
    panel.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0));
    return panel;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) MouseEvent(java.awt.event.MouseEvent) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) BasicButtonUI(javax.swing.plaf.basic.BasicButtonUI) JPopupMenu(javax.swing.JPopupMenu) ActionListener(java.awt.event.ActionListener) JNode(jadx.gui.treemodel.JNode)

Example 88 with FlowLayout

use of java.awt.FlowLayout in project jadx by skylot.

the class UsageDialog method initUI.

private void initUI() {
    JLabel lbl = new JLabel(NLS.str("usage_dialog.label"));
    JLabel nodeLabel = new JLabel(this.node.makeLongString(), this.node.getIcon(), SwingConstants.LEFT);
    lbl.setLabelFor(nodeLabel);
    JPanel searchPane = new JPanel();
    searchPane.setLayout(new FlowLayout(FlowLayout.LEFT));
    searchPane.add(lbl);
    searchPane.add(nodeLabel);
    searchPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    initCommon();
    JPanel resultsPanel = initResultsTable();
    JPanel buttonPane = initButtonsPanel();
    Container contentPane = getContentPane();
    contentPane.add(searchPane, BorderLayout.PAGE_START);
    contentPane.add(resultsPanel, BorderLayout.CENTER);
    contentPane.add(buttonPane, BorderLayout.PAGE_END);
    setTitle(NLS.str("usage_dialog.title"));
    pack();
    setSize(800, 500);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setModalityType(ModalityType.MODELESS);
}
Also used : JPanel(javax.swing.JPanel) Container(java.awt.Container) FlowLayout(java.awt.FlowLayout) JLabel(javax.swing.JLabel)

Example 89 with FlowLayout

use of java.awt.FlowLayout in project jgnash by ccavanaugh.

the class ReconcileDialog method buildTablePanel.

private static JPanel buildTablePanel(final String title, final JLabel label, final JTable table) {
    JPanel p = new JPanel(new BorderLayout());
    JPanel footer = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    footer.setBackground(SystemColor.inactiveCaptionBorder);
    footer.add(label);
    JScrollPane pane = new JScrollPane(table);
    pane.setBorder(new EmptyBorder(0, 0, 0, 0));
    pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    JXTitledPanel panel = new JXTitledPanel(title, pane);
    p.add(panel, BorderLayout.CENTER);
    p.add(footer, BorderLayout.SOUTH);
    return p;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JXTitledPanel(org.jdesktop.swingx.JXTitledPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) EmptyBorder(javax.swing.border.EmptyBorder)

Example 90 with FlowLayout

use of java.awt.FlowLayout in project jdk8u_jdk by JetBrains.

the class XOpenTypeViewer method setupDisplay.

private void setupDisplay(XOpenTypeData data) {
    setBackground(Color.white);
    container = new JScrollPane(data, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    JPanel buttons = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tabularPrev = new JButton(Messages.LESS_THAN);
    tabularNext = new JButton(Messages.GREATER_THAN);
    JPanel tabularButtons = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tabularButtons.add(tabularPrev);
    tabularPrev.addActionListener(this);
    tabularLabel = new JLabel(tabularNavigationSingle);
    tabularLabel.setEnabled(false);
    tabularButtons.add(tabularLabel);
    tabularButtons.add(tabularNext);
    tabularNext.addActionListener(this);
    tabularButtons.setBackground(Color.white);
    prev = new JButton(Messages.A_LOT_LESS_THAN);
    prev.addActionListener(this);
    buttons.add(prev);
    incr = new JButton(Messages.GREATER_THAN);
    incr.addActionListener(this);
    decr = new JButton(Messages.LESS_THAN);
    decr.addActionListener(this);
    JPanel array = new JPanel();
    array.setBackground(Color.white);
    array.add(decr);
    compositeLabel = new JLabel(compositeNavigationSingle);
    compositeLabel.setEnabled(false);
    array.add(compositeLabel);
    array.add(incr);
    buttons.add(array);
    setLayout(new BorderLayout());
    buttons.setBackground(Color.white);
    JPanel navigationPanel = new JPanel(new BorderLayout());
    navigationPanel.setBackground(Color.white);
    navigationPanel.add(tabularButtons, BorderLayout.NORTH);
    navigationPanel.add(buttons, BorderLayout.WEST);
    add(navigationPanel, BorderLayout.NORTH);
    add(container, BorderLayout.CENTER);
    Dimension d = new Dimension((int) container.getPreferredSize().getWidth() + 20, (int) container.getPreferredSize().getHeight() + 20);
    setPreferredSize(d);
}
Also used : FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) Dimension(java.awt.Dimension)

Aggregations

FlowLayout (java.awt.FlowLayout)400 JPanel (javax.swing.JPanel)338 JLabel (javax.swing.JLabel)189 JButton (javax.swing.JButton)161 ActionEvent (java.awt.event.ActionEvent)134 BoxLayout (javax.swing.BoxLayout)129 BorderLayout (java.awt.BorderLayout)118 ActionListener (java.awt.event.ActionListener)113 Dimension (java.awt.Dimension)95 JScrollPane (javax.swing.JScrollPane)94 Container (java.awt.Container)49 GridBagLayout (java.awt.GridBagLayout)42 JTextField (javax.swing.JTextField)41 Insets (java.awt.Insets)39 GridBagConstraints (java.awt.GridBagConstraints)38 ButtonGroup (javax.swing.ButtonGroup)38 JCheckBox (javax.swing.JCheckBox)35 JTable (javax.swing.JTable)32 JmriJFrame (jmri.util.JmriJFrame)30 JSeparator (javax.swing.JSeparator)24