private class textFieldFocusListener extends FocusAdapter { @Override public void focusGained(FocusEvent arg0) { if (arg0 instanceOf JTextComponent) { ((JTextComponent) arg0.getComponent()).selectAll(); } } }
@Override public void focusGained(FocusEvent event) { ((JTextField) event.getComponent()).selectAll(); } });
public void focusGained(FocusEvent focusEvent) { // Makes the newly focused button the default button rootPane.setDefaultButton((JButton)focusEvent.getComponent()); }
@Override public void focusLost(FocusEvent e) { e.getComponent().repaint(); } }
@Override public void focusLost(FocusEvent e) { e.getComponent().repaint(); } }
public void focusLost(FocusEvent e) { Component c = e.getComponent(); if (c instanceof TextField) ((TextField)c).select(0,0); }
@Override public void focusLost(FocusEvent e) { myCursor.cursorChanged(); handleHyperlinks(e.getComponent(), false); } });
list.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent e) { JList list = (JList) e.getComponent(); list.clearSelection(); } });
@Override public void focusLost(FocusEvent e) { e.getComponent().repaint(); } }
public void focusGained(FocusEvent e) { Component c = e.getComponent(); //IJ.log("focusGained: "+c); if (c instanceof TextField) ((TextField)c).selectAll(); }
@Override public void run() { event.getComponent().requestFocus(); } });
textField.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { JTextField source = (JTextField)e.getComponent(); source.setText(""); source.removeFocusListener(this); } });
@Override public void focusLost(FocusEvent e) { e.getComponent().repaint(); } }
@Override public void focusGained(final FocusEvent e) { final JTextComponent tc = ((JTextComponent) e.getComponent()); tc.setCaretPosition(tc.getText().length()); tc.moveCaretPosition(0); } };
public void focusLost(FocusEvent focusEvent) { if(focusEvent.getComponent().equals(getChatInputEditor())) { setChatState( ChatState.inactive ); } }
@Override public void focusGained(FocusEvent e) { e.getComponent().removeFocusListener(this); SwingUtilities.getWindowAncestor(pane).addWindowListener(new WindowAdapter(){ @Override public void windowClosed(WindowEvent e) { e.getWindow().removeWindowListener(this); deHighlight(); } }); } });
@Override public void focusGained(final FocusEvent e) { highlightSuggestion(suggestionComponent); SwingUtilities.invokeLater(() -> { final Component component = e.getComponent(); suggestionScrollPane.scrollRectToVisible(component.getBounds()); }); }
@Override public void focusGained(java.awt.event.FocusEvent ev) { // unregister ev.getComponent().removeFocusListener(this); // lazy activation of drag source if (DragDropUtilities.dragAndDropEnabled && dragActive) { setDragSource(true); // note: dropTarget is activated in constructor } }
public void focusGained(FocusEvent focusEvent) { validate(); invalidate(); repaint(); if(focusEvent.getComponent().equals(getChatInputEditor())) { setChatState( ChatState.active ); } }
private class SelectAllOfFocus extends FocusAdapter { @Override public void focusGained(FocusEvent e) { if (! e.isTemporary()) { JFormattedTextField textField = (JFormattedTextField)e.getComponent(); // This is needed to put the text field in edited mode, so that its processFocusEvent doesn't // do anything. Otherwise, it calls setValue, and the selection is lost. textField.setText(textField.getText()); textField.selectAll(); } } }