use of java.awt.event.FocusListener in project Botnak by Gocnak.
the class BaseComboBoxUI method installListeners.
protected void installListeners() {
super.installListeners();
propertyChangeListener = new PropertyChangeHandler();
comboBox.addPropertyChangeListener(propertyChangeListener);
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
focusListener = new FocusListener() {
public void focusGained(FocusEvent e) {
if (comboBox != null) {
orgBorder = comboBox.getBorder();
orgBackgroundColor = comboBox.getBackground();
LookAndFeel laf = UIManager.getLookAndFeel();
if (laf instanceof AbstractLookAndFeel) {
if (orgBorder instanceof UIResource) {
Border focusBorder = ((AbstractLookAndFeel) laf).getBorderFactory().getFocusFrameBorder();
comboBox.setBorder(focusBorder);
}
Color backgroundColor = AbstractLookAndFeel.getTheme().getFocusBackgroundColor();
comboBox.setBackground(backgroundColor);
}
}
}
public void focusLost(FocusEvent e) {
if (comboBox != null) {
if (orgBorder instanceof UIResource) {
comboBox.setBorder(orgBorder);
}
comboBox.setBackground(orgBackgroundColor);
}
}
};
comboBox.addFocusListener(focusListener);
}
}
use of java.awt.event.FocusListener in project Botnak by Gocnak.
the class BaseEditorPaneUI method installListeners.
protected void installListeners() {
super.installListeners();
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
focusListener = new FocusListener() {
public void focusGained(FocusEvent e) {
if (getComponent() != null) {
orgBorder = getComponent().getBorder();
LookAndFeel laf = UIManager.getLookAndFeel();
if (laf instanceof AbstractLookAndFeel && orgBorder instanceof UIResource) {
Border focusBorder = ((AbstractLookAndFeel) laf).getBorderFactory().getFocusFrameBorder();
getComponent().setBorder(focusBorder);
}
getComponent().invalidate();
getComponent().repaint();
}
}
public void focusLost(FocusEvent e) {
if (getComponent() != null) {
if (orgBorder instanceof UIResource) {
getComponent().setBorder(orgBorder);
}
getComponent().invalidate();
getComponent().repaint();
}
}
};
getComponent().addFocusListener(focusListener);
}
}
use of java.awt.event.FocusListener in project Botnak by Gocnak.
the class BasePasswordFieldUI method installListeners.
protected void installListeners() {
super.installListeners();
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
focusListener = new FocusListener() {
public void focusGained(FocusEvent e) {
if (getComponent() != null) {
orgBorder = getComponent().getBorder();
LookAndFeel laf = UIManager.getLookAndFeel();
if (laf instanceof AbstractLookAndFeel && orgBorder instanceof UIResource) {
Border focusBorder = ((AbstractLookAndFeel) laf).getBorderFactory().getFocusFrameBorder();
getComponent().setBorder(focusBorder);
}
getComponent().invalidate();
getComponent().repaint();
}
}
public void focusLost(FocusEvent e) {
if (getComponent() != null) {
if (orgBorder instanceof UIResource) {
getComponent().setBorder(orgBorder);
}
getComponent().invalidate();
getComponent().repaint();
}
}
};
getComponent().addFocusListener(focusListener);
}
}
use of java.awt.event.FocusListener in project Botnak by Gocnak.
the class BaseTextFieldUI method installListeners.
protected void installListeners() {
super.installListeners();
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
focusListener = new FocusListener() {
public void focusGained(FocusEvent e) {
if (getComponent() != null) {
orgBorder = getComponent().getBorder();
LookAndFeel laf = UIManager.getLookAndFeel();
if (laf instanceof AbstractLookAndFeel && orgBorder instanceof UIResource) {
Border focusBorder = ((AbstractLookAndFeel) laf).getBorderFactory().getFocusFrameBorder();
getComponent().setBorder(focusBorder);
}
getComponent().invalidate();
getComponent().repaint();
}
}
public void focusLost(FocusEvent e) {
if (getComponent() != null) {
if (orgBorder instanceof UIResource) {
getComponent().setBorder(orgBorder);
}
getComponent().invalidate();
getComponent().repaint();
}
}
};
getComponent().addFocusListener(focusListener);
}
}
use of java.awt.event.FocusListener in project ceylon-compiler by ceylon.
the class SelectToolTask method createPane.
JOptionPane createPane(final Properties props) {
JPanel body = new JPanel(new GridBagLayout());
GridBagConstraints lc = new GridBagConstraints();
lc.insets.right = 10;
lc.insets.bottom = 3;
GridBagConstraints fc = new GridBagConstraints();
fc.anchor = GridBagConstraints.WEST;
fc.gridx = 1;
fc.gridwidth = GridBagConstraints.REMAINDER;
fc.insets.bottom = 3;
JLabel toolLabel = new JLabel("Tool:");
body.add(toolLabel, lc);
String[] toolChoices = { "apt", "javac", "javadoc", "javah", "javap" };
if (true || toolProperty == null) {
// include empty value in setup mode
List<String> l = new ArrayList<String>(Arrays.asList(toolChoices));
l.add(0, "");
toolChoices = l.toArray(new String[l.size()]);
}
toolChoice = new JComboBox(toolChoices);
if (toolName != null)
toolChoice.setSelectedItem(toolName);
toolChoice.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
String tn = (String) e.getItem();
argsField.setText(getDefaultArgsForTool(props, tn));
if (toolProperty != null)
okButton.setEnabled(!tn.equals(""));
}
});
body.add(toolChoice, fc);
argsField = new JTextField(getDefaultArgsForTool(props, toolName), 40);
if (toolProperty == null || argsProperty != null) {
JLabel argsLabel = new JLabel("Args:");
body.add(argsLabel, lc);
body.add(argsField, fc);
argsField.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
}
public void focusLost(FocusEvent e) {
String toolName = (String) toolChoice.getSelectedItem();
if (toolName.length() > 0)
props.put(toolName + ".args", argsField.getText());
}
});
}
defaultCheck = new JCheckBox("Set as default");
if (toolProperty == null)
defaultCheck.setSelected(true);
else
body.add(defaultCheck, fc);
final JOptionPane p = new JOptionPane(body);
okButton = new JButton("OK");
okButton.setEnabled(toolProperty == null || (toolName != null && !toolName.equals("")));
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);
d.setVisible(false);
}
});
p.setOptions(new Object[] { okButton });
return p;
}
Aggregations