How many kinds of listeners supported in Java? I am a newbie and just know there is the ActionListener
, which listens the button clicked. I want to a JLabel
in a JFrame
to update with time. So, is there any listeners for time to update the label in a frame?
Java支持多少种侦听器?我是一个新手,只知道有一个ActionListener,它监听点击的按钮。我希望JFrame中的JLabel能够随时更新。那么,是否有任何听众有时间更新框架中的标签?
2 个解决方案
#1
1
How many kinds of listeners supported in Java?
Java支持多少种侦听器?
The Java 8 Standard API supports these:
Java 8 Standard API支持以下内容:
ActionListener
AdjustmentListener
AncestorListener
AWTEventListener
BasicButtonListener
BeanContextMembershipListener
BeanContextServiceRevokedListener
BeanContextServicesListener
CaretListener
CellEditorListener
ChangeListener
ComponentListener
ConnectionEventListener
ContainerListener
ControllerEventListener
DiagnosticListener
DocumentListener
DragGestureListener
DragSourceListener
DragSourceMotionListener
DropTargetListener
ErrorListener
EventListener
EventListener
ExceptionListener
FlavorListener
FocusListener
HandshakeCompletedListener
HierarchyBoundsListener
HierarchyListener
HyperlinkListener
IIOReadProgressListener
IIOReadUpdateListener
IIOReadWarningListener
IIOWriteProgressListener
IIOWriteWarningListener
InputMethodListener
InternalFrameListener
ItemListener
KeyListener
LineListener
ListDataListener
ListSelectionListener
Marshaller.Listener
MenuDragMouseListener
MenuKeyListener
MenuListener
MetaEventListener
MouseInputListener
MouseListener
MouseMotionListener
MouseWheelListener
NamespaceChangeListener
NamingListener
NodeChangeListener
NotificationListener
ObjectChangeListener
PopupMenuListener
PreferenceChangeListener
PrintJobAttributeListener
PrintJobListener
PrintServiceAttributeListener
PropertyChangeListener
RowSetListener
RowSorterListener
SSLSessionBindingListener
StatementEventListener
TableColumnModelListener
TableModelListener
TextListener
TreeExpansionListener
TreeModelListener
TreeSelectionListener
TreeWillExpandListener
UndoableEditListener
Unmarshaller.Listener
UnsolicitedNotificationListener
VetoableChangeListener
WindowFocusListener
WindowListener
WindowStateListener
So, is there any listeners for time to update the label in a frame?
那么,是否有任何听众有时间更新框架中的标签?
As mentioned by MadProgrammer, an ActionListener
used inside a Swing based Timer
should do the job.
正如MadProgrammer所提到的,在基于Swing的Timer中使用的ActionListener应该可以胜任。
#2
0
Listeners
-
ActionListener
This interface is used for receiving the action events. 2
此接口用于接收动作事件。 2
-
ComponentListener
This interface is used for receiving the component events. 3
此接口用于接收组件事件。 3
-
ItemListener
This interface is used for receiving the item events. 4
此接口用于接收项目事件。 4
-
KeyListener
This interface is used for receiving the key events. 5
该接口用于接收密钥事件。五
-
MouseListener
This interface is used for receiving the mouse events. 6
该接口用于接收鼠标事件。 6
-
TextListener
This interface is used for receiving the text events. 7
此接口用于接收文本事件。 7
-
WindowListener
This interface is used for receiving the window events. 8
该接口用于接收窗口事件。 8
-
AdjustmentListener
This interface is used for receiving the adjusmtent events. 9
该接口用于接收adjusmtent事件。 9
-
ContainerListener
This interface is used for receiving the container events. 10
此接口用于接收容器事件。 10
-
MouseMotionListener
This interface is used for receiving the mouse motion events. 11
该接口用于接收鼠标运动事件。 11
-
FocusListener
This interface is used for receiving the focus events.
该接口用于接收焦点事件。
For more info Show this, this too
更多信息显示这个,这也是
#1
1
How many kinds of listeners supported in Java?
Java支持多少种侦听器?
The Java 8 Standard API supports these:
Java 8 Standard API支持以下内容:
ActionListener
AdjustmentListener
AncestorListener
AWTEventListener
BasicButtonListener
BeanContextMembershipListener
BeanContextServiceRevokedListener
BeanContextServicesListener
CaretListener
CellEditorListener
ChangeListener
ComponentListener
ConnectionEventListener
ContainerListener
ControllerEventListener
DiagnosticListener
DocumentListener
DragGestureListener
DragSourceListener
DragSourceMotionListener
DropTargetListener
ErrorListener
EventListener
EventListener
ExceptionListener
FlavorListener
FocusListener
HandshakeCompletedListener
HierarchyBoundsListener
HierarchyListener
HyperlinkListener
IIOReadProgressListener
IIOReadUpdateListener
IIOReadWarningListener
IIOWriteProgressListener
IIOWriteWarningListener
InputMethodListener
InternalFrameListener
ItemListener
KeyListener
LineListener
ListDataListener
ListSelectionListener
Marshaller.Listener
MenuDragMouseListener
MenuKeyListener
MenuListener
MetaEventListener
MouseInputListener
MouseListener
MouseMotionListener
MouseWheelListener
NamespaceChangeListener
NamingListener
NodeChangeListener
NotificationListener
ObjectChangeListener
PopupMenuListener
PreferenceChangeListener
PrintJobAttributeListener
PrintJobListener
PrintServiceAttributeListener
PropertyChangeListener
RowSetListener
RowSorterListener
SSLSessionBindingListener
StatementEventListener
TableColumnModelListener
TableModelListener
TextListener
TreeExpansionListener
TreeModelListener
TreeSelectionListener
TreeWillExpandListener
UndoableEditListener
Unmarshaller.Listener
UnsolicitedNotificationListener
VetoableChangeListener
WindowFocusListener
WindowListener
WindowStateListener
So, is there any listeners for time to update the label in a frame?
那么,是否有任何听众有时间更新框架中的标签?
As mentioned by MadProgrammer, an ActionListener
used inside a Swing based Timer
should do the job.
正如MadProgrammer所提到的,在基于Swing的Timer中使用的ActionListener应该可以胜任。
#2
0
Listeners
-
ActionListener
This interface is used for receiving the action events. 2
此接口用于接收动作事件。 2
-
ComponentListener
This interface is used for receiving the component events. 3
此接口用于接收组件事件。 3
-
ItemListener
This interface is used for receiving the item events. 4
此接口用于接收项目事件。 4
-
KeyListener
This interface is used for receiving the key events. 5
该接口用于接收密钥事件。五
-
MouseListener
This interface is used for receiving the mouse events. 6
该接口用于接收鼠标事件。 6
-
TextListener
This interface is used for receiving the text events. 7
此接口用于接收文本事件。 7
-
WindowListener
This interface is used for receiving the window events. 8
该接口用于接收窗口事件。 8
-
AdjustmentListener
This interface is used for receiving the adjusmtent events. 9
该接口用于接收adjusmtent事件。 9
-
ContainerListener
This interface is used for receiving the container events. 10
此接口用于接收容器事件。 10
-
MouseMotionListener
This interface is used for receiving the mouse motion events. 11
该接口用于接收鼠标运动事件。 11
-
FocusListener
This interface is used for receiving the focus events.
该接口用于接收焦点事件。
For more info Show this, this too
更多信息显示这个,这也是