Search in sources :

Example 16 with JButton

use of javax.swing.JButton 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 17 with JButton

use of javax.swing.JButton 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 18 with JButton

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

the class JadxSettingsWindow method makeEditorGroup.

private SettingsGroup makeEditorGroup() {
    JButton fontBtn = new JButton(NLS.str("preferences.select_font"));
    fontBtn.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            JFontChooser fontChooser = new JFontChooser();
            fontChooser.setSelectedFont(settings.getFont());
            int result = fontChooser.showDialog(JadxSettingsWindow.this);
            if (result == JFontChooser.OK_OPTION) {
                Font font = fontChooser.getSelectedFont();
                LOG.info("Selected Font : {}", font);
                settings.setFont(font);
                mainWindow.updateFont(font);
            }
        }
    });
    SettingsGroup other = new SettingsGroup(NLS.str("preferences.editor"));
    other.addRow(NLS.str("preferences.font"), fontBtn);
    return other;
}
Also used : MouseEvent(java.awt.event.MouseEvent) JFontChooser(say.swing.JFontChooser) JButton(javax.swing.JButton) MouseAdapter(java.awt.event.MouseAdapter) Font(java.awt.Font)

Example 19 with JButton

use of javax.swing.JButton in project libgdx by libgdx.

the class EditorPanel method initializeComponents.

protected void initializeComponents() {
    setLayout(new GridBagLayout());
    {
        titlePanel = new JPanel(new GridBagLayout());
        add(titlePanel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(3, 0, 3, 0), 0, 0));
        titlePanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        {
            nameLabel = new JLabel(name);
            titlePanel.add(nameLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 6, 3, 6), 0, 0));
            nameLabel.setFont(nameLabel.getFont().deriveFont(Font.BOLD));
        }
        {
            descriptionLabel = new JLabel(description);
            titlePanel.add(descriptionLabel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 6, 3, 6), 0, 0));
        }
        {
            advancedButton = new JToggleButton("Advanced");
            titlePanel.add(advancedButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
            advancedButton.setVisible(false);
        }
        {
            activeButton = new JToggleButton("Active");
            titlePanel.add(activeButton, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
        }
        {
            removeButton = new JButton("X");
            titlePanel.add(removeButton, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
        }
    }
    {
        contentPanel = new JPanel(new GridBagLayout());
        add(contentPanel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 6, 6, 6), 0, 0));
        contentPanel.setVisible(false);
    }
    {
        advancedPanel = new JPanel(new GridBagLayout());
        add(advancedPanel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 6, 6, 6), 0, 0));
        advancedPanel.setVisible(false);
    }
    titlePanel.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent event) {
            if (!isAlwaysShown)
                showContent(!contentPanel.isVisible());
        }
    });
    activeButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            activate();
        }
    });
    advancedButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            advancedPanel.setVisible(advancedButton.isSelected());
        }
    });
    removeButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            removePanel();
        }
    });
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) GridBagLayout(java.awt.GridBagLayout) JToggleButton(javax.swing.JToggleButton) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel)

Example 20 with JButton

use of javax.swing.JButton in project libgdx by libgdx.

the class DynamicsInfluencerPanel method initializeComponents.

protected void initializeComponents() {
    super.initializeComponents();
    JPanel velocitiesPanel = new JPanel();
    velocitiesPanel.setLayout(new GridBagLayout());
    {
        JPanel sideButtons = new JPanel(new GridBagLayout());
        velocitiesPanel.add(sideButtons, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
        {
            sideButtons.add(velocityBox = new JComboBox(new DefaultComboBoxModel()), new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
        }
        {
            JButton newButton = new JButton("New");
            sideButtons.add(newButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
            newButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent event) {
                    createVelocity(velocityBox.getSelectedItem());
                }
            });
        }
        {
            JButton deleteButton = new JButton("Delete");
            sideButtons.add(deleteButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
            deleteButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent event) {
                    deleteVelocity();
                }
            });
        }
    }
    JScrollPane scroll = new JScrollPane();
    velocitiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
    velocityTable = new JTable() {

        public Class getColumnClass(int column) {
            return column == 1 ? Boolean.class : super.getColumnClass(column);
        }

        @Override
        public Dimension getPreferredScrollableViewportSize() {
            Dimension dim = super.getPreferredScrollableViewportSize();
            dim.height = getPreferredSize().height;
            return dim;
        }
    };
    velocityTable.getTableHeader().setReorderingAllowed(false);
    velocityTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scroll.setViewportView(velocityTable);
    velocityTableModel = new DefaultTableModel(new String[0][0], new String[] { "Velocity", "Active" });
    velocityTable.setModel(velocityTableModel);
    velocityTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent event) {
            if (event.getValueIsAdjusting())
                return;
            velocitySelected();
        }
    });
    velocityTableModel.addTableModelListener(new TableModelListener() {

        public void tableChanged(TableModelEvent event) {
            if (event.getColumn() != 1)
                return;
            velocityChecked(event.getFirstRow(), (Boolean) velocityTable.getValueAt(event.getFirstRow(), 1));
        }
    });
    //Velocity values
    emptyPanel = new ParticleValuePanel(editor, "", "", true, false);
    strengthVelocityPanel = new StrengthVelocityPanel(editor, null, "Life", "", "");
    angularVelocityPanel = new AngularVelocityPanel(editor, null, "Life", "", "");
    strengthVelocityPanel.setVisible(false);
    angularVelocityPanel.setVisible(false);
    emptyPanel.setVisible(false);
    strengthVelocityPanel.setIsAlwayShown(true);
    angularVelocityPanel.setIsAlwayShown(true);
    emptyPanel.setIsAlwayShown(true);
    emptyPanel.setValue(null);
    //Assemble
    int i = 0;
    addContent(i++, 0, velocitiesPanel);
    addContent(i++, 0, strengthVelocityPanel);
    addContent(i++, 0, angularVelocityPanel);
    addContent(i++, 0, emptyPanel);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) TableModelEvent(javax.swing.event.TableModelEvent) DefaultTableModel(javax.swing.table.DefaultTableModel) JButton(javax.swing.JButton) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JScrollPane(javax.swing.JScrollPane) JComboBox(javax.swing.JComboBox) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) Dimension(java.awt.Dimension) ListSelectionListener(javax.swing.event.ListSelectionListener) ActionListener(java.awt.event.ActionListener) JTable(javax.swing.JTable) TableModelListener(javax.swing.event.TableModelListener)

Aggregations

JButton (javax.swing.JButton)923 JPanel (javax.swing.JPanel)408 ActionEvent (java.awt.event.ActionEvent)389 ActionListener (java.awt.event.ActionListener)317 JLabel (javax.swing.JLabel)278 JScrollPane (javax.swing.JScrollPane)166 BoxLayout (javax.swing.BoxLayout)158 FlowLayout (java.awt.FlowLayout)142 BorderLayout (java.awt.BorderLayout)138 Dimension (java.awt.Dimension)138 Insets (java.awt.Insets)114 JTextField (javax.swing.JTextField)114 GridBagLayout (java.awt.GridBagLayout)110 JCheckBox (javax.swing.JCheckBox)103 GridBagConstraints (java.awt.GridBagConstraints)95 ImageIcon (javax.swing.ImageIcon)95 JTable (javax.swing.JTable)67 JDialog (javax.swing.JDialog)65 JComboBox (javax.swing.JComboBox)56 JTextArea (javax.swing.JTextArea)56