Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mutiple frames + one class = annoying listener problem

 
Ann Jemmens
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic