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

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

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

JComponent.getListeners介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

JComponent comp = new JPanel();
MouseListener ml = new MouseAdapter() { /* Custom impl */ }
comp.addMouseListener(ml);

// ml is returned
MouseListener[] mls = comp.getListeners(MouseListener.class);

// Nothing is returned, as there's no support for adding listeners 
// for generic EventListeners to a component
EventListener[] els = comp.getListeners(EventListener.class);

代码示例来源:origin: org.swinglabs.swingx/swingx-core

@Override
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
  java.util.List<T> listeners = listenerMap.getListeners(listenerType);
  T[] result;
  if (!listeners.isEmpty()) {
    //noinspection unchecked
    result = (T[]) java.lang.reflect.Array.newInstance(listenerType, listeners.size());
    result = listeners.toArray(result);
  } else {
    result = super.getListeners(listenerType);
  }
  return result;
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

@Override
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
  java.util.List<T> listeners = listenerMap.getListeners(listenerType);
  T[] result;
  if (!listeners.isEmpty()) {
    //noinspection unchecked
    result = (T[]) java.lang.reflect.Array.newInstance(listenerType, listeners.size());
    result = listeners.toArray(result);
  } else {
    result = super.getListeners(listenerType);
  }
  return result;
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

@Override
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
  java.util.List<T> listeners = listenerMap.getListeners(listenerType);
  T[] result;
  if (!listeners.isEmpty()) {
    //noinspection unchecked
    result = (T[]) java.lang.reflect.Array.newInstance(listenerType, listeners.size());
    result = listeners.toArray(result);
  } else {
    result = super.getListeners(listenerType);
  }
  return result;
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

@Override
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
  java.util.List<T> listeners = listenerMap.getListeners(listenerType);
  T[] result;
  if (!listeners.isEmpty()) {
    //noinspection unchecked
    result = (T[]) java.lang.reflect.Array.newInstance(listenerType, listeners.size());
    result = listeners.toArray(result);
  } else {
    result = super.getListeners(listenerType);
  }
  return result;
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

@Override
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
  java.util.List<T> listeners = listenerMap.getListeners(listenerType);
  T[] result;
  if (!listeners.isEmpty()) {
    //noinspection unchecked
    result = (T[]) java.lang.reflect.Array.newInstance(listenerType, listeners.size());
    result = listeners.toArray(result);
  } else {
    result = super.getListeners(listenerType);
  }
  return result;
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

@Override
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
  java.util.List<T> listeners = listenerMap.getListeners(listenerType);
  T[] result;
  if (!listeners.isEmpty()) {
    //noinspection unchecked
    result = (T[]) java.lang.reflect.Array.newInstance(listenerType, listeners.size());
    result = listeners.toArray(result);
  } else {
    result = super.getListeners(listenerType);
  }
  return result;
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

@Override
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
  java.util.List<T> listeners = listenerMap.getListeners(listenerType);
  T[] result;
  if (!listeners.isEmpty()) {
    //noinspection unchecked
    result = (T[]) java.lang.reflect.Array.newInstance(listenerType, listeners.size());
    result = listeners.toArray(result);
  } else {
    result = super.getListeners(listenerType);
  }
  return result;
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

@Override
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
  java.util.List<T> listeners = listenerMap.getListeners(listenerType);
  T[] result;
  if (!listeners.isEmpty()) {
    //noinspection unchecked
    result = (T[]) java.lang.reflect.Array.newInstance(listenerType, listeners.size());
    result = listeners.toArray(result);
  } else {
    result = super.getListeners(listenerType);
  }
  return result;
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

@Override
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
  java.util.List<T> listeners = listenerMap.getListeners(listenerType);
  T[] result;
  if (!listeners.isEmpty()) {
    //noinspection unchecked
    result = (T[]) java.lang.reflect.Array.newInstance(listenerType, listeners.size());
    result = listeners.toArray(result);
  } else {
    result = super.getListeners(listenerType);
  }
  return result;
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

@Override
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
  java.util.List<T> listeners = listenerMap.getListeners(listenerType);
  T[] result;
  if (!listeners.isEmpty()) {
    //noinspection unchecked
    result = (T[]) java.lang.reflect.Array.newInstance(listenerType, listeners.size());
    result = listeners.toArray(result);
  } else {
    result = super.getListeners(listenerType);
  }
  return result;
}

代码示例来源:origin: stackoverflow.com

scrollPane.getListeners(MouseWheelListener.class)[0].mouseWheelMoved(e);

代码示例来源:origin: stackoverflow.com

for (CellEditorListener listener : getListeners(CellEditorListener.class)) {
  listener.editingStopped(new ChangeEvent(this));
for (CellEditorListener listener : getListeners(CellEditorListener.class)) {
  listener.editingCanceled(new ChangeEvent(this));

代码示例来源:origin: org.jspresso.framework/jspresso-swing-application

private SwingViewCellEditorAdapter createTableCellEditor(IView<JComponent> editorView, IActionHandler actionHandler) {
 SwingViewCellEditorAdapter editor;
 JComponent peer = editorView.getPeer();
 FocusListener[] listeners = peer.getListeners(FocusListener.class);
 for (FocusListener listener : listeners) {
  if (listener instanceof FocusGainedListener) {
   peer.removeFocusListener(listener);
  }
  if (listener instanceof FocusLostListener) {
   peer.removeFocusListener(listener);
  }
 }
 if (peer instanceof JActionField && ((JActionField) peer).isShowingTextField()) {
  editor = new SwingViewCellEditorAdapter(editorView, getModelConnectorFactory(), getMvcBinder(), actionHandler) {
   private static final long serialVersionUID = -1551909997448473681L;
   @Override
   public boolean stopCellEditing() {
    if (((JActionField) getEditorView().getPeer()).isSynchronized()) {
     fireEditingStopped();
     return true;
    }
    ((JActionFieldConnector) getEditorView().getConnector()).performActionIfNeeded();
    return false;
   }
  };
 } else {
  editor = new SwingViewCellEditorAdapter(editorView, getModelConnectorFactory(), getMvcBinder(), actionHandler);
 }
 return editor;
}

相关文章

JComponent类方法