/** Delegates to the original listener.
*/
public void focusLost(FocusEvent ev) {
FocusListener l = (FocusListener) super.get(ev);
if (l != null) {
l.focusLost(ev);
}
}
java类java.awt.event.FocusListener的实例源码
WeakListener.java 文件源码
项目:incubator-netbeans
阅读 23
收藏 0
点赞 0
评论 0
SectionInnerPanel.java 文件源码
项目:incubator-netbeans
阅读 21
收藏 0
点赞 0
评论 0
public synchronized void addFocusListener(FocusListener l) {
super.addFocusListener(l);
if (!localFocusListenerInitialized) {
localFocusListenerInitialized = true;
Container container = this;
FocusListener focusListener = localFocusListener;
addFocusListenerRecursively(container, focusListener);
}
}
SectionInnerPanel.java 文件源码
项目:incubator-netbeans
阅读 19
收藏 0
点赞 0
评论 0
private void addFocusListenerRecursively(Container container, FocusListener focusListener) {
final Component[] components = container.getComponents();
for (int i = 0; i < components.length; i++) {
Component component = components[i];
if (component.isFocusable() && !(component instanceof JLabel)) {
component.addFocusListener(focusListener);
}
if (component instanceof Container) {
if (!(component instanceof SectionNodePanel)) {
addFocusListenerRecursively((Container) component, focusListener);
}
}
}
}
FixDuplicateImportStmts.java 文件源码
项目:incubator-netbeans
阅读 20
收藏 0
点赞 0
评论 0
private JComboBox createComboBox(CandidateDescription[] choices, CandidateDescription defaultValue, Font font, FocusListener listener ) {
JComboBox combo = new JComboBox(choices);
combo.setSelectedItem(defaultValue);
combo.getAccessibleContext().setAccessibleDescription(getBundleString("FixDupImportStmts_Combo_ACSD")); //NOI18N
combo.getAccessibleContext().setAccessibleName(getBundleString("FixDupImportStmts_Combo_Name_ACSD")); //NOI18N
combo.setOpaque(false);
combo.setFont( font );
combo.addFocusListener( listener );
combo.setEnabled( choices.length > 1 );
combo.setRenderer( new DelegatingRenderer(combo.getRenderer()));
InputMap inputMap = combo.getInputMap( JComboBox.WHEN_FOCUSED );
inputMap.put( KeyStroke.getKeyStroke( KeyEvent.VK_SPACE, 0), "showPopup" ); //NOI18N
combo.getActionMap().put( "showPopup", new TogglePopupAction() ); //NOI18N
return combo;
}
ResolveDeclarationsPanel.java 文件源码
项目:incubator-netbeans
阅读 23
收藏 0
点赞 0
评论 0
private void initComponentsMore() {
contentPanel.setLayout(new GridBagLayout());
contentPanel.setBackground(UIManager.getColor("Table.background")); //NOI18N
int row = 0;
combos = new ArrayList<>(items.size());
Font monoSpaced = new Font("Monospaced", Font.PLAIN, new JLabel().getFont().getSize()); //NOI18N
FocusListener focusListener = new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
Component c = e.getComponent();
Rectangle r = c.getBounds();
contentPanel.scrollRectToVisible(r);
}
};
for (int i = 0; i < items.size(); i++) {
ResolveDeclarationItem item = items.get(i);
JComboBox jComboBox = createComboBox(item, monoSpaced, focusListener);
combos.add(jComboBox);
JLabel lblSimpleName = new JLabel(item.getName());
lblSimpleName.setOpaque(false);
lblSimpleName.setFont(monoSpaced);
lblSimpleName.setLabelFor(jComboBox);
contentPanel.add(lblSimpleName, new GridBagConstraints(0, row, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 5, 2, 5), 0, 0));
contentPanel.add(jComboBox, new GridBagConstraints(1, row++, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(3, 5, 2, 5), 0, 0));
}
contentPanel.add(new JLabel(), new GridBagConstraints(2, row, 2, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
Dimension d = contentPanel.getPreferredSize();
d.height = getRowHeight() * Math.min(combos.size(), 6);
}
WeakListenerImpl.java 文件源码
项目:incubator-netbeans
阅读 26
收藏 0
点赞 0
评论 0
/** Delegates to the original listener.
*/
@Override public void focusGained(FocusEvent ev) {
FocusListener l = (FocusListener) super.get(ev);
if (l != null) {
l.focusGained(ev);
}
}
AutoCompletionComboBox.java 文件源码
项目:rapidminer
阅读 31
收藏 0
点赞 0
评论 0
@Override
public synchronized void addFocusListener(FocusListener l) {
// workaround for java bug #6433257
for (Component c : getComponents()) {
c.addFocusListener(l);
}
}
ComponentOperator.java 文件源码
项目:openjdk-jdk10
阅读 20
收藏 0
点赞 0
评论 0
/**
* Maps {@code Component.addFocusListener(FocusListener)} through queue
*/
public void addFocusListener(final FocusListener focusListener) {
runMapping(new MapVoidAction("addFocusListener") {
@Override
public void map() {
getSource().addFocusListener(focusListener);
}
});
}
ComponentOperator.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
/**
* Maps {@code Component.removeFocusListener(FocusListener)} through queue
*/
public void removeFocusListener(final FocusListener focusListener) {
runMapping(new MapVoidAction("removeFocusListener") {
@Override
public void map() {
getSource().removeFocusListener(focusListener);
}
});
}
StagingPanel.java 文件源码
项目:oxygen-git-plugin
阅读 20
收藏 0
点赞 0
评论 0
/**
* Adds a focus listener on the component and its descendents.
*
* @param c
* The component.
* @param focusListener
* Focus Listener.
*/
private void installFocusListener(Component c, FocusListener focusListener) {
c.addFocusListener(focusListener);
if (c instanceof Container) {
Container container = (Container) c;
int componentCount = container.getComponentCount();
for (int i = 0; i < componentCount; i++) {
Component child = container.getComponent(i);
installFocusListener(child, focusListener);
}
}
}