This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Mutiple frames + one class = annoying listener problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Mutiple frames + one class = annoying listener problem" Watch "Mutiple frames + one class = annoying listener problem" New topic
Author

Mutiple frames + one class = annoying listener problem

Ann Jemmens
Greenhorn

Joined: Nov 17, 2004
Posts: 2
I have an intro pane that pops up - user clicks one of two buttons; either one pops up 2nd GUI. 2nd GUI has text fields, combobox, etc. Code must be in one class, one file. I initially did this by creating two seperate classes to initialize two separate GUI statments in one file and implementing polling in main for first window for button click, listeners associated with 2nd window items. Reset 'switch' statement in listener so I can implement 2nd window (ie very manually). Have been instructed this is very poor design - even just a word or two of where to look would be appreciated. Trying cardLayout tomorrow to see if this is the cure but - is there a better way?
Thanks
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

aggabagga,

Welcome to Javaranch! We don't have too many rules around here but we do have a Naming Policy. Please read and adjust your display name to comform. You can change your display name here.

Thanks.


GenRocket - Experts at Building Test Data
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
Originally posted by aggabagga:
I have an intro pane that pops up - user clicks one of two buttons; either one pops up 2nd GUI. 2nd GUI has text fields, combobox, etc. Code must be in one class, one file. I initially did this by creating two seperate classes to initialize two separate GUI statments in one file and implementing polling in main for first window for button click, listeners associated with 2nd window items. Reset 'switch' statement in listener so I can implement 2nd window (ie very manually).


I'm afraid I don't undestand that. Some questions :

Why must your code be in one class, one file ?
How do you implement polling ? That doesn't sound right.

D.
Ann Jemmens
Greenhorn

Joined: Nov 17, 2004
Posts: 2
Alright - I have my name displayed correctly now - my apologies...
Guess I don't have to do it this way anyway. The instructor made a TYPO and left out a class on the assignment. Awesome.

Thanks for the halp.
Ann formerly known as aggabagga
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mutiple frames + one class = annoying listener problem
 
Similar Threads
calling second jPanel
running a servlet thru a jsp
Swing not working ...
Multiple file Project
AppletContext.showDocument()