|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Event in UserInterface - organizing classes
Hello
This doubt ocurred while working on the design of a UI to a simple app. It's java. The user interface is a JFrame that contains 3 JPanel objects. Two of these JPanel will have to listen to actions (buttons clickfor example) as well as the JFrame itself. 1) UI.java ---- JFrame, creates and lanches the UI, JMenu events 2) LeftPanel.java ---- JPanel, contains a JList, JList selections events 3) CenterPanel.java ----- JPanel, contains some text 4) RightPanel.java ----- JPanel, contains buttons, button click How do you suggest the organization for this? -> Using the main JPanel/JFrame to implement Action Listener -> New class wich implements Action Listener then in the JPanel an instance of that class is passed to the addActionListener method -> there's also that syntax button1.addActionListener ( new ActionListener() { ... } ) however that seams kind of strange. -> Other ways? Thanks |
|
#2
|
|||
|
|||
|
Quote:
I would have each panel implement the listening interface that they are concerned with. Cypher |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Software Design > Event in UserInterface - organizing classes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|