• Post Reply Bookmark Topic Watch Topic
  • New Topic

programe keeps opening minimilized  RSS feed

 
mitchell cooper
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why does my program start minimalized? I have changed jframes preferred, minimum, and maximum but it still happens?
 
Les Morgan
Rancher
Posts: 767
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have anything in your JFrame?

Some code illustrating the problem would be nice.
 
mitchell cooper
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Les Morgan
Rancher
Posts: 767
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is one of several posts you have done today on, I believe, code. You need to go through the tutorials and figure out how to code a simple GUI.

mitchell cooper wrote:


You really need to read the tutorials on the fundamentals of GUI development, the one on naming would do wonders for you too.
 
Les Morgan
Rancher
Posts: 767
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is just a basic little JFrame app to get you started:


Here's a link to all the Oracle tutorials: http://docs.oracle.com/javase/tutorial/reallybigindex.html
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mitchell cooper wrote:
It is probably a good discipline to create GUIs without extending any display classes, except possibly to override paintComponent and a few other methods mentioned in this thread. It is probably another good discipline not to let NetBeans confuse your code by adding all sorts of things to it while you are not watching. But those two things don't affect the above code, which ain't right. You are creating a table object (that should read Table) but not giving it a size (line 143). You then create a second table object in line 144 and give it a size, but never set it visible. You only want one table object.
 
Stephan van Hulst
Saloon Keeper
Posts: 7720
142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Les, I would recommend against calling pack() or setVisible() in the constructor, because a constructor should do nothing more than set up the object, while these two methods may kick off new threads. If you don't want to extend JFrame (I'm ambivalent about this, but Campbell discourages extending), call setVisible() and pack() in a separate show() method.

Even though most of the time it seems to work, I also recommend calling these methods on the EDT:
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I said probably. I think you will learn better programming if you only extend classes when you have to. But I am not going to try to be definite about this.
You can extend frame to add components to it. Or you can have a method which adds the same components. Why extend when you can do the same without extending?

You can extend frame to add business logic to it. Now that is bad design indeed.
 
Stephan van Hulst
Saloon Keeper
Posts: 7720
142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fully agree.
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even though I have seen books with business logic inside Frames.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!