Search in sources :

Example 1 with BoxLayout

use of javax.swing.BoxLayout 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 2 with BoxLayout

use of javax.swing.BoxLayout in project jadx by skylot.

the class AboutDialog method initUI.

public final void initUI() {
    Font font = new Font("Serif", Font.BOLD, 13);
    JLabel name = new JLabel("jadx");
    name.setFont(font);
    name.setAlignmentX(0.5f);
    JLabel desc = new JLabel("Dex to Java decompiler");
    desc.setFont(font);
    desc.setAlignmentX(0.5f);
    JLabel version = new JLabel("version: " + JadxDecompiler.getVersion());
    version.setFont(font);
    version.setAlignmentX(0.5f);
    JPanel textPane = new JPanel();
    textPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
    textPane.setLayout(new BoxLayout(textPane, BoxLayout.PAGE_AXIS));
    textPane.add(Box.createRigidArea(new Dimension(0, 10)));
    textPane.add(name);
    textPane.add(Box.createRigidArea(new Dimension(0, 10)));
    textPane.add(desc);
    textPane.add(Box.createRigidArea(new Dimension(0, 10)));
    textPane.add(version);
    textPane.add(Box.createRigidArea(new Dimension(0, 20)));
    JButton close = new JButton(NLS.str("tabs.close"));
    close.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            dispose();
        }
    });
    close.setAlignmentX(0.5f);
    Container contentPane = getContentPane();
    contentPane.add(textPane, BorderLayout.CENTER);
    contentPane.add(close, BorderLayout.PAGE_END);
    setModalityType(ModalityType.APPLICATION_MODAL);
    setTitle("About JADX");
    pack();
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setLocationRelativeTo(null);
}
Also used : JPanel(javax.swing.JPanel) Container(java.awt.Container) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Font(java.awt.Font)

Example 3 with BoxLayout

use of javax.swing.BoxLayout in project jadx by skylot.

the class CommonSearchDialog method initButtonsPanel.

@NotNull
protected JPanel initButtonsPanel() {
    progressPane = new ProgressPanel(mainWindow, false);
    JButton cancelButton = new JButton(NLS.str("search_dialog.cancel"));
    cancelButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            dispose();
        }
    });
    JButton openBtn = new JButton(NLS.str("search_dialog.open"));
    openBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            openSelectedItem();
        }
    });
    getRootPane().setDefaultButton(openBtn);
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
    buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
    buttonPane.add(progressPane);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(Box.createHorizontalGlue());
    buttonPane.add(openBtn);
    buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonPane.add(cancelButton);
    return buttonPane;
}
Also used : JPanel(javax.swing.JPanel) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with BoxLayout

use of javax.swing.BoxLayout in project jdk8u_jdk by JetBrains.

the class JLabel269 method main.

public static void main(String[] args) {
    String labelText = "<html><body><code>A</code></body></html>";
    verbose = Arrays.asList(args).contains("-verbose");
    JFrame mainFrame = new JFrame();
    JPanel container = new JPanel();
    container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS));
    JPanel p1 = new JPanel();
    JLabel l1 = new JLabelTest(labelText);
    l1.setFont(new FontUIResource("Tahoma", Font.PLAIN, 36));
    p1.add(l1);
    container.add(p1);
    JPanel p2 = new JPanel();
    JLabel l2 = new JLabelTest(labelText);
    l2.setFont(new FontUIResource("Tahoma", Font.PLAIN, 72));
    p2.add(l2);
    container.add(p2);
    mainFrame.add(container);
    mainFrame.pack();
    mainFrame.setVisible(true);
    BufferedImage bi = new BufferedImage(l1.getWidth(), l1.getHeight(), BufferedImage.TYPE_INT_ARGB);
    l1.paint(bi.getGraphics());
    int height1 = maxCharHeight(bi, l1.getWidth(), l1.getHeight());
    bi = new BufferedImage(l2.getWidth(), l2.getHeight(), BufferedImage.TYPE_INT_ARGB);
    l2.paint(bi.getGraphics());
    int height2 = maxCharHeight(bi, l2.getWidth(), l2.getHeight());
    mainFrame.dispose();
    if (Math.abs(height2 - 2 * height1) > 2) {
        throw new RuntimeException("Heights of \"<code>A</code>\" for 36pt and for 72pt " + "must differ by half (+/- 2pxs)");
    }
}
Also used : JPanel(javax.swing.JPanel) JFrame(javax.swing.JFrame) FontUIResource(javax.swing.plaf.FontUIResource) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) BufferedImage(java.awt.image.BufferedImage)

Example 5 with BoxLayout

use of javax.swing.BoxLayout in project jdk8u_jdk by JetBrains.

the class bug4337267 method createContentPane.

Component createContentPane() {
    Dimension size = new Dimension(500, 100);
    i1 = new TestBufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
    i2 = new TestBufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
    p1 = new TestJPanel();
    p1.setPreferredSize(size);
    p2 = new TestJPanel();
    p2.setPreferredSize(size);
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(p1);
    panel.add(p2);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) BoxLayout(javax.swing.BoxLayout) Dimension(java.awt.Dimension)

Aggregations

BoxLayout (javax.swing.BoxLayout)496 JPanel (javax.swing.JPanel)423 JLabel (javax.swing.JLabel)252 ActionEvent (java.awt.event.ActionEvent)165 JButton (javax.swing.JButton)161 Dimension (java.awt.Dimension)143 ActionListener (java.awt.event.ActionListener)141 JScrollPane (javax.swing.JScrollPane)125 FlowLayout (java.awt.FlowLayout)123 BorderLayout (java.awt.BorderLayout)63 GridBagLayout (java.awt.GridBagLayout)57 ButtonGroup (javax.swing.ButtonGroup)49 Container (java.awt.Container)48 JTable (javax.swing.JTable)48 JCheckBox (javax.swing.JCheckBox)47 JmriJFrame (jmri.util.JmriJFrame)45 JSeparator (javax.swing.JSeparator)44 JTextField (javax.swing.JTextField)43 JRadioButton (javax.swing.JRadioButton)30 JComboBox (javax.swing.JComboBox)28