javax.swing.JComponent.addFocusListener()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中javax.swing.JComponent.addFocusListener()方法的一些代码示例,展示了JComponent.addFocusListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComponent.addFocusListener()方法的具体详情如下:
包路径:javax.swing.JComponent
类名称:JComponent
方法名:addFocusListener

JComponent.addFocusListener介绍

暂无

代码示例

代码示例来源:origin: org.java.net.substance/substance

public void registerFocusListeners() {
  this.focusListener = new FocusListener() {
    public void focusGained(FocusEvent e) {
      setFocusState(true);
    }
    public void focusLost(FocusEvent e) {
      setFocusState(false);
    }
  };
  this.component.addFocusListener(this.focusListener);
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-component-fields

public void addSaveFocusListener(JComponent c) {
  c.addFocusListener(new FocusListener() {
    public void focusGained(FocusEvent e) {
    }
    public void focusLost(FocusEvent e) {
      if (OnClickEditableField.this.isAutonomousEditingEnabled()) {
        saveWithValidationWarning();
        setEditing(false);
      }
    }
  });
}

代码示例来源:origin: otros-systems/otroslogviewer

public static void addBlinkOnFocusGain(final JComponent component){
 component.addFocusListener(new FocusListener() {
  @Override
  public void focusGained(FocusEvent e) {
   blinkComponent(component);
  }
  @Override
  public void focusLost(FocusEvent e) {
  }
 });
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** Overridden to proxy adds to the custom editor button and the
 * installed component */
public void addFocusListener(FocusListener l) {
  if (comp != null) {
    button.addFocusListener(l);
    comp.addFocusListener(l);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

public void addFocusListener(FocusListener fl) {
  if (comp != null) {
    comp.addFocusListener(fl);
  } else {
    super.addFocusListener(fl);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Overridden to proxy adds to the custom editor button and the 
 * installed component */
public void addFocusListener (FocusListener l) {
  if (comp != null) {
    button.addFocusListener (l);
    comp.addFocusListener (l);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public void addFocusListener(FocusListener fl) {
  if (comp != null) {
    comp.addFocusListener(fl);
  } else {
    super.addFocusListener(fl);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Overridden to proxy adds to the custom editor button and the 
 * installed component */
public void addFocusListener (FocusListener l) {
  if (comp != null) {
    button.addFocusListener (l);
    comp.addFocusListener (l);
  }
}

代码示例来源:origin: org.java.net.substance/substance

public void registerListeners() {
  this.component.addMouseListener(this);
  this.component.addMouseMotionListener(this);
  this.component.addFocusListener(this);
}

代码示例来源:origin: comtel2000/fx-experience

@Override
public void installUI(JComponent c) {
 if (c instanceof JTextComponent) {
  if (fl != null) {
   c.addFocusListener(fl);
  }
  if (ml != null) {
   c.addMouseListener(ml);
  }
 }
 super.installUI(c);
}

代码示例来源:origin: com.github.insubstantial/substance

public void registerListeners() {
  this.component.addMouseListener(this);
  this.component.addMouseMotionListener(this);
  this.component.addFocusListener(this);
}

代码示例来源:origin: org.nuiton/nuiton-widgets

public void install(JComponent attachedComponent) {
  //attachedComponent.addCaretListener(this);
  attachedComponent.addComponentListener(this);
  attachedComponent.addFocusListener(this);
  attachedComponent.addKeyListener(this);
  attachedComponent.addMouseListener(this);
  attachedComponent.addMouseMotionListener(this);
}

代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra

public void install(JComponent attachedComponent) {
  //attachedComponent.addCaretListener(this);
  attachedComponent.addComponentListener(this);
  attachedComponent.addFocusListener(this);
  attachedComponent.addKeyListener(this);
  attachedComponent.addMouseListener(this);
  attachedComponent.addMouseMotionListener(this);
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

@Override
public void add(DrawingView view) {
  views.add(view);
  view.addNotify(this);
  view.getComponent().addFocusListener(focusHandler);
  if (tool != null) {
    view.addMouseListener(tool);
    view.addMouseMotionListener(tool);
    view.addKeyListener(tool);
  }
  updateActiveView();
}

代码示例来源:origin: lbalazscs/Pixelitor

@Override
public void installUI(JComponent slider) {
  slider.addMouseListener(this);
  slider.addMouseMotionListener(this);
  slider.addFocusListener(focusListener);
  slider.addKeyListener(keyListener);
  slider.addComponentListener(compListener);
  slider.addPropertyChangeListener(propertyListener);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

void registerForComponent(JComponent component) {
  if (component == null) {
    return;
  }
  component.addComponentListener(this);
  component.addKeyListener(this);
  component.addFocusListener(this);
  component.addPropertyChangeListener(this);
  component.addHierarchyListener(this);
  component.addHierarchyBoundsListener(this);
}

代码示例来源:origin: org.gephi/ui-components

@Override
public void installUI(JComponent slider) {
  slider.addMouseListener(this);
  slider.addMouseMotionListener(this);
  slider.addFocusListener(focusListener);
  slider.addKeyListener(keyListener);
  slider.addComponentListener(compListener);
  slider.addPropertyChangeListener(propertyListener);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-visualizers

void registerForComponent(JComponent component) {
  if (component == null) {
    return;
  }
  component.addComponentListener(this);
  component.addKeyListener(this);
  component.addFocusListener(this);
  component.addPropertyChangeListener(this);
  component.addHierarchyListener(this);
  component.addHierarchyBoundsListener(this);
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

private void attachToInplaceEditor(InplaceEditor ed) {
  Object o = fetchCachedInitialValue();
  if (o != NO_VALUE) {
    ed.setValue(o);
  }
  ed.addActionListener(getInplaceEditorListener());
  ed.getComponent().addFocusListener(getInplaceEditorListener());
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

private void attachToInplaceEditor (InplaceEditor ed) {
  Object o = fetchCachedInitialValue();
  if (o != NO_VALUE) {
    ed.setValue(o);
  }
  ed.addActionListener(getInplaceEditorListener());
  ed.getComponent().addFocusListener(getInplaceEditorListener());
}

相关文章

JComponent类方法