• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems with arranging objects on a JFrame  RSS feed

 
Håkan Axheim
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have som problems with a GUI for a application that I have written.

All buisness and database logic is alreday finished but the I have problems with the presentation logic.
The only problem I have is how to arrange the different objects on my JFrame.

Can someone show how to arrange the objectrs I have in my JFrame.
All presentation logic is finished but I cannot arrange the objects in my Jframe according to attachment file!


Best regards

BigSpender
myJFrame.jpg
[Thumbnail for myJFrame.jpg]
My JFrame
 
Mahesh Kumaraguru
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What layout would you like to use? ~ Mahesh
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a nutshell
1) Identify visual grouping patterns (e.g. arranged horizontally, arranged in a grid, arranged in cardinal directions)
2) Choose a layout which supports this grouping
3) Nest layouts if required

More on layouts here https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
Besides the built in layouts, also check out http://www.miglayout.com/
 
Håkan Axheim
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used a FlowLayout!
 
Stephan van Hulst
Saloon Keeper
Posts: 6981
110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldn't use "a" layout. Like Maneesh said:
Nest layouts if required


It looks like the top of your panel can be arranged best using a GridBagLayout. The bottom part (with the two buttons) can be in a FlowLayout or a horizontal BoxLayout. These two can be nested in a BorderLayout.

Take a look at the tutorials on layout managers.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!