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();
}
}
}
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);
}
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;
}
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;
}
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;
}
Aggregations