Search in sources :

Example 71 with ActionListener

use of java.awt.event.ActionListener in project gephi by gephi.

the class DirectoryChooserUI method checkUpdate.

private void checkUpdate() {
    if (Utilities.isWindows() && useShellFolder) {
        Long startTime = (Long) fileChooser.getClientProperty(DelegatingChooserUI.START_TIME);
        if (startTime == null) {
            return;
        }
        // clean for future marking
        fileChooser.putClientProperty(DelegatingChooserUI.START_TIME, null);
        long elapsed = System.currentTimeMillis() - startTime.longValue();
        long timeOut = NbPreferences.forModule(DirectoryChooserUI.class).getLong(TIMEOUT_KEY, 10000);
        if (timeOut > 0 && elapsed > timeOut && slownessPanel == null) {
            JLabel slownessNote = new JLabel(NbBundle.getMessage(DirectoryChooserUI.class, "MSG_SlownessNote"));
            slownessNote.setForeground(Color.RED);
            slownessPanel = new JPanel();
            JButton notShow = new JButton(NbBundle.getMessage(DirectoryChooserUI.class, "BTN_NotShow"));
            notShow.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    NbPreferences.forModule(DirectoryChooserUI.class).putLong(TIMEOUT_KEY, 0);
                    centerPanel.remove(slownessPanel);
                    centerPanel.revalidate();
                }
            });
            JPanel notShowP = new JPanel();
            notShowP.add(notShow);
            slownessPanel.setLayout(new BorderLayout());
            slownessPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
            slownessPanel.add(BorderLayout.CENTER, slownessNote);
            slownessPanel.add(BorderLayout.SOUTH, notShowP);
            centerPanel.add(BorderLayout.NORTH, slownessPanel);
            centerPanel.revalidate();
        }
    }
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent)

Example 72 with ActionListener

use of java.awt.event.ActionListener in project binnavi by google.

the class CViewSearcherDialog method createGui.

/**
   * Creates the GUI of the dialog.
   */
private void createGui() {
    setLayout(new BorderLayout());
    final JPanel panel = new JPanel(new BorderLayout());
    final JLabel lbl = new JLabel("Address" + ":");
    lbl.setBorder(new EmptyBorder(5, 5, 5, 5));
    panel.add(lbl, BorderLayout.WEST);
    m_offsetField.setSize(400, 20);
    final ActionListener listener = new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            search();
        }
    };
    m_offsetField.addActionListener(listener);
    panel.add(m_offsetField, BorderLayout.CENTER);
    panel.add(new JButton(CActionProxy.proxy(new SearchAction(this))), BorderLayout.EAST);
    add(panel, BorderLayout.NORTH);
    m_table = new JTable(tableModel);
    m_table.addMouseListener(m_listener);
    add(new JScrollPane(m_table), BorderLayout.CENTER);
    add(new CPanelTwoButtons(CActionProxy.proxy(new InternalActionListener()), "OK", "Cancel"), BorderLayout.SOUTH);
    setSize(500, 300);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JTable(javax.swing.JTable) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) CPanelTwoButtons(com.google.security.zynamics.zylib.gui.CPanelTwoButtons) EmptyBorder(javax.swing.border.EmptyBorder)

Example 73 with ActionListener

use of java.awt.event.ActionListener in project zaproxy by zaproxy.

the class OptionsConnectionPanel method getCommonUserAgents.

private JComboBox<String> getCommonUserAgents() {
    if (commonUserAgents == null) {
        commonUserAgents = new JComboBox<String>(CommonUserAgents.getNames());
        if (commonUserAgents.getItemCount() == 0) {
            commonUserAgents.setEnabled(false);
        } else {
            commonUserAgents.addItem("");
            commonUserAgents.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    String item = (String) commonUserAgents.getSelectedItem();
                    String ua = CommonUserAgents.getStringFromName(item);
                    if (ua != null) {
                        getDefaultUserAgent().setText(ua);
                    }
                }
            });
        }
    }
    return commonUserAgents;
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent)

Example 74 with ActionListener

use of java.awt.event.ActionListener in project zaproxy by zaproxy.

the class OptionsViewPanel method getFontName.

@SuppressWarnings("unchecked")
private JComboBox<String> getFontName() {
    if (fontName == null) {
        fontName = new JComboBox<String>();
        fontName.setRenderer(new JComboBoxFontRenderer());
        String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
        // Default to system font
        fontName.addItem(" ");
        for (String font : fonts) {
            fontName.addItem(font);
        }
        if (!FontUtils.canChangeSize()) {
            fontName.setEnabled(false);
        }
        fontName.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                // Show what the default font will look like
                setExampleFont();
            }
        });
    }
    return fontName;
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent)

Example 75 with ActionListener

use of java.awt.event.ActionListener in project zaproxy by zaproxy.

the class AbstractParamDialog method getBtnCancel.

/**
     * This method initializes btnCancel
     *
     * @return javax.swing.JButton
     */
protected JButton getBtnCancel() {
    if (btnCancel == null) {
        btnCancel = new JButton();
        btnCancel.setName("btnCancel");
        btnCancel.setText(Constant.messages.getString("all.button.cancel"));
        btnCancel.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                exitResult = JOptionPane.CANCEL_OPTION;
                AbstractParamDialog.this.setVisible(false);
            }
        });
    }
    return btnCancel;
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton)

Aggregations

ActionListener (java.awt.event.ActionListener)1347 ActionEvent (java.awt.event.ActionEvent)1303 JButton (javax.swing.JButton)363 JPanel (javax.swing.JPanel)345 JLabel (javax.swing.JLabel)234 JMenuItem (javax.swing.JMenuItem)191 BoxLayout (javax.swing.BoxLayout)150 GridBagConstraints (java.awt.GridBagConstraints)121 Insets (java.awt.Insets)121 GridBagLayout (java.awt.GridBagLayout)114 Dimension (java.awt.Dimension)113 FlowLayout (java.awt.FlowLayout)110 JCheckBox (javax.swing.JCheckBox)103 JScrollPane (javax.swing.JScrollPane)103 JMenu (javax.swing.JMenu)96 BorderLayout (java.awt.BorderLayout)88 JTextField (javax.swing.JTextField)79 JComboBox (javax.swing.JComboBox)73 ButtonGroup (javax.swing.ButtonGroup)64 ArrayList (java.util.ArrayList)60