o**d 发帖数: 11 | 1 1 Create the frame
2 create the Panel
3 create the button
4 create an instance of listener class which implements the
ActionLister interface.
5 register the listener object to the button
6 add button to the panel
7 add the panel to the frame.
8 Make the frame show on the screen
Actually, if you have a Swing book, open the chaper of
"Event", it will have at least one sample code which is
similar to the problem you are trying to deal with. | s***i 发帖数: 186 | 2 override the function "paintComponent()" in JPanel.
and to repaint, just call "repaint()".
it will then call your paintComponent() to refresh view. |
|