File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes arranging components in jpanel in a vertical manner...? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "arranging components in jpanel in a vertical manner...?" Watch "arranging components in jpanel in a vertical manner...?" New topic
Author

arranging components in jpanel in a vertical manner...?

mike lim
Greenhorn

Joined: Jul 18, 2012
Posts: 2
Hi guys, I'm just starting in java... or coming back to using it again... I'm not that good so I was wondering after reading on my old java book, how to arrange components such as labels and buttons in a panel in a vertical position, much like a webpage link panel on the left side where the user chooses which page he wants to go to... the default layout of a jpanel is a flowlayout I think and all the components I add to it just automatically arranges itself horizontally which is really far from what I want to do... Hope any help would be ok... it would be easier if it was html where I just add a <br> in order to skip a line and then just add each separate link... is there some sort of absolute positioning for components in a panel or contentpane where I can use to store jlabels/jbuttons so I can arrange the components in a way that can be more user friendly... thanks again...
mike lim
Greenhorn

Joined: Jul 18, 2012
Posts: 2
without third party gui editing software please... thanks... only hard code...
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
take your pick from this lot

http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html

> is there some sort of absolute positioning for components in a panel

you set the layout to null, but then you are totally responsible for handling it all.
you might think absolute positioning is the easiest, but it will only create headaches
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: arranging components in jpanel in a vertical manner...?