Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

GUI issues  RSS feed

 
Mitchell Oldfield
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having some iissues with some homework, the jtextfields included are stretching in height where i need them to do so horizontally. I have no clue what i have done wrong can you tell me what i have done wrong?

 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mitchell Oldfield wrote:the jtextfields included are stretching in height where i need them to do so horizontally.


Choose an appropriate layout manager, or nest containers each with their own layout if needed.
http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html
 
Campbell Ritchie
Marshal
Posts: 55725
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch I added code tags, which you should always use, to your post and you can see how much better it looks. There are unfortunately some things which will lose you marks which appear in the code now:-
  • 1: Inconsistent indentation. You should only indent after { or when you have to break a long line.
  • 2: Incorrect use of // for multi‑line comments. Use /*...*/
  • 3: Field names starting with Capital Letters.
  • You are also using that most dreadful piece of design, making a Component implement a Listener interface.

    I think your displaying problem occurred because you have not supplied layouts properly. You set a border layout on the Frame, which is all right (but Frames support border as a default anyway). You appear not to have applied any layouts to your panels, however. You can read about panels here, and there is a Java Tutorials link in that page. Follow that and it tells you about several layouts applied to panels, and what its default it.
     
    Campbell Ritchie
    Marshal
    Posts: 55725
    163
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Dammit, DB, even Rob can hardly beat me by 40″
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!