Java Code Examples for java.awt.event.FocusEvent#getSource()

The following examples show how to use java.awt.event.FocusEvent#getSource() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigWindow.java    From rscplus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void focusLost(FocusEvent arg0) {
  JButton button = (JButton) arg0.getSource();

  for (KeybindSet kbs : KeyboardHandler.keybindSetList) {
    if (button == kbs.button) {
      ConfigWindow.setKeybindButtonText(kbs);
      kbs.button.setFocusable(false);
    }
  }
}
 
Example 2
Source File: ServiceDialog.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void focusLost(FocusEvent e) {
    Object source = e.getSource();

    if (source == tfJobName) {
        asCurrent.add(new JobName(tfJobName.getText(),
                                  Locale.getDefault()));
    } else if (source == tfUserName) {
        asCurrent.add(new RequestingUserName(tfUserName.getText(),
                                             Locale.getDefault()));
    }
}
 
Example 3
Source File: DefaultPolarPlotEditor.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 *  Revalidates minimum/maximum range.
 *
 *  @param event  the event.
 */
@Override
public void focusLost(FocusEvent event) {
    if (event.getSource() == this.angleOffset) {
        validateAngleOffset();
    }
    else if (event.getSource() == this.manualTickUnit) {
        validateTickUnit();
    }
}
 
Example 4
Source File: ServiceDialog.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void focusLost(FocusEvent e) {
    Object source = e.getSource();

    if (source == tfJobName) {
        asCurrent.add(new JobName(tfJobName.getText(),
                                  Locale.getDefault()));
    } else if (source == tfUserName) {
        asCurrent.add(new RequestingUserName(tfUserName.getText(),
                                             Locale.getDefault()));
    }
}
 
Example 5
Source File: TextFieldFocusListener.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void focusGained(FocusEvent e) {
    if (!e.isTemporary()) {
        JTextComponent textComp = (JTextComponent) e.getSource();
        if (textComp.getText().length() != 0) {
            textComp.selectAll();
        }
    }
}
 
Example 6
Source File: ServiceDialog.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void focusLost(FocusEvent e) {
    Object source = e.getSource();

    if ((source == tfRangeFrom) || (source == tfRangeTo)) {
        updateRangeAttribute();
    }
}
 
Example 7
Source File: ServiceDialog.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void focusLost(FocusEvent e) {
    Object source = e.getSource();

    if ((source == tfRangeFrom) || (source == tfRangeTo)) {
        updateRangeAttribute();
    }
}
 
Example 8
Source File: FormattedTextField.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Override
public void focusGained(FocusEvent e) {
   final JTextField field = (JTextField) e.getSource();
   final int dot = field.getCaret().getDot();
   final int mark = field.getCaret().getMark();
   if (field.isEnabled() && field.isEditable()) {
      SwingUtilities.invokeLater(() -> {
         if (dot == mark ) {
            field.getCaret().setDot(dot);
         }
      });
   }
}
 
Example 9
Source File: ValueFormatter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void focusGained(FocusEvent event) {
    Object source = event.getSource();
    if (source instanceof JFormattedTextField) {
        this.text = (JFormattedTextField) source;
        SwingUtilities.invokeLater(this);
    }
}
 
Example 10
Source File: ServiceDialog.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void focusLost(FocusEvent e) {
    Object source = e.getSource();

    if ((source == tfRangeFrom) || (source == tfRangeTo)) {
        updateRangeAttribute();
    }
}
 
Example 11
Source File: ServiceDialog.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void focusLost(FocusEvent e) {
    Object source = e.getSource();

    if (source == tfJobName) {
        asCurrent.add(new JobName(tfJobName.getText(),
                                  Locale.getDefault()));
    } else if (source == tfUserName) {
        asCurrent.add(new RequestingUserName(tfUserName.getText(),
                                             Locale.getDefault()));
    }
}
 
Example 12
Source File: ValueFormatter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void focusGained(FocusEvent event) {
    Object source = event.getSource();
    if (source instanceof JFormattedTextField) {
        this.text = (JFormattedTextField) source;
        SwingUtilities.invokeLater(this);
    }
}
 
Example 13
Source File: ValueFormatter.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
public void focusGained(FocusEvent event) {
    Object source = event.getSource();
    if (source instanceof JFormattedTextField) {
        this.text = (JFormattedTextField) source;
        SwingUtilities.invokeLater(this);
    }
}
 
Example 14
Source File: ServiceDialog.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void focusLost(FocusEvent e) {
    Object source = e.getSource();

    if ((source == tfRangeFrom) || (source == tfRangeTo)) {
        updateRangeAttribute();
    }
}
 
Example 15
Source File: DoubleEntryDialog.java    From nanoleaf-desktop with MIT License 5 votes vote down vote up
@Override
public void focusGained(FocusEvent e)
{
	JTextField entry = (JTextField)e.getSource();
	if (entry.getText().equals(defaultText))
	{
		entry.setText("");
	}
}
 
Example 16
Source File: ServiceDialog.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public void focusLost(FocusEvent e) {
    Object source = e.getSource();
    updateMargins(source);
}
 
Example 17
Source File: JTrackerEditDialog.java    From jeveassets with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void focusGained(FocusEvent e) {
	JTextField jTextField = (JTextField) e.getSource();
	jTextField.setBackground(Color.WHITE);
}
 
Example 18
Source File: GoToPanel.java    From Juicebox with MIT License 4 votes vote down vote up
public void focusGained(FocusEvent event) {
    if (event.getSource() == positionChrLeft) positionChrLeft.setBackground(Color.white);
    else if (event.getSource() == positionChrTop) positionChrTop.setBackground(Color.white);
}
 
Example 19
Source File: ServiceDialog.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void focusLost(FocusEvent e) {
    Object source = e.getSource();
    updateMargins(source);
}
 
Example 20
Source File: FindReplaceUtility.java    From groovy with Apache License 2.0 4 votes vote down vote up
@Override
public void focusGained(FocusEvent fe) {
    textComponent = (JTextComponent) fe.getSource();
    attributeSet =
            textComponent.getDocument().getDefaultRootElement().getAttributes();
}