• Post Reply Bookmark Topic Watch Topic
  • New Topic

ComboBox GUI

 
Dale Herring
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having trouble with this GUI. I am trying to use a gridbaglayout for all the components in the center panel, although, I am not sure my understanding of gridbaglayout is the best. I can get this code to show a panel but nothing shows up on the panel. If anything is out of place or commented out it's all a part of me trying to debug and play with the code.





 
Christian Pflugradt
Ranch Hand
Posts: 74
5
Eclipse IDE Python Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your class BaseballLine extends JFrame yet you create a separate JFrame "jfrm" inside your class and add every GUI component to it. In the end though you invoke setVisible() on your BaseballLine instance and not on jfrm which has all the components added to it. For a start you could remove your declaration of "jfrm" and replace all occurrences of it with "this". That should solve your problem. I would also consider refactoring your code. You have a lot of copy paste elements which makes it hard to read and hard to enhance later on.
 
Dave Tolls
Ranch Hand
Posts: 2270
23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would go the other way and not have your BaseballLine class extend JFrame. There's normally no need to extend JFrame as you are not actually extending the functionality of the class, just adding things to it. Extending it is a bit like extending ArrayList simply to populate it with entries.

Just use the jfrm instance, and display that. You might want to make it an instance variable of the BaseballLine class rather than a local variable, though that may not be necessary.
 
Dale Herring
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yea thanks, I didn't realize I was instantiating the JFrame again and that's what was screwing me. I've got a few other issues to clean up with my actionlisteners and layouts but you really helped me out.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!