jQuery in Action, 2nd edition*
The moose likes Swing / AWT / SWT and the fly likes beginer gui task. Please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "beginer gui task. Please help" Watch "beginer gui task. Please help" New topic
Author

beginer gui task. Please help

aidas kar
Greenhorn

Joined: Mar 08, 2013
Posts: 6
Hello

i'm reading book How to Program Java 9th deitel. And i'm just after introduction to gui.
And one of the tasks is to create gui without any functionality, i've attached the jpg of a gui.
But i'm not sure what LayoutManagers i ment to use. Cause its meant to be a simple task.
If you could point me to the right direction. Thanks
aidas kar
Greenhorn

Joined: Mar 08, 2013
Posts: 6
aidas kar wrote:Hello

i'm reading book How to Program Java 9th deitel. And i'm just after introduction to gui.
And one of the tasks is to create gui without any functionality, i've attached the jpg of a gui.
But i'm not sure what LayoutManagers i ment to use. Cause its meant to be a simple task.
If you could point me to the right direction. Thanks


[Thumbnail for task.jpg]

Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3426
    
  12
aidas kar wrote:But i'm not sure what LayoutManagers i ment to use.

Why don't you try experimenting with different layout managers and see what results you get. Far more interesting and you'll learn a lot more


Joanne
aidas kar
Greenhorn

Joined: Mar 08, 2013
Posts: 6
I did. No luck though. Book covered flowlayout, boarderlayout and gridlayout. And boxlayout only one method gethorizontalbox.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37986
    
  22
Welcome to the Ranch
You do realise you can use several layouts simultaneously? You can have for example, a top panel, a middle panel and a bottom panel, which sounds like border layout. You can put grid layout on one panel and box on the other two. Just an example. You should find more details as you go through that tutorial. Remember: in grid layout you usually get all the components the same size.
They should be listed here, at least the more commonly‑used ones are. Flow layout is no good, and nobody can understand Spring layout.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37986
    
  22
By the way: I think this discussion would fit better in our GUIs forum, so I shall move it.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4167
    
  21

aidas kar wrote:I did. No luck though. Book covered flowlayout, boarderlayout and gridlayout. And boxlayout only one method gethorizontalbox.

There is no one way to do this, there are many options. The key point to remember is that you can use multiple layouts, so you don't have to find just one that makes the entire layout. Take each portion of the GUI and think what layouts would be best to make that portion. Once you have them designed individually, then choose which layout(s) would be best to put the individual items together.


Steve
aidas kar
Greenhorn

Joined: Mar 08, 2013
Posts: 6
Thanks. I didn't realize I should add empty panels to center components. I thought there's some way to lay them out using managers.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37986
    
  22
aidas kar wrote: . . . I thought there's some way to lay them out using managers.
You can with the “complicated” layouts like gridbag, or you can use several “simple” layouts like grid in different components in different parts of your display.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37986
    
  22
And, “you’re welcome
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: beginer gui task. Please help
 
Similar Threads
task scheduler in core java
Help with implementation - should I use threads???
How to avoid system.exit(0)
Tab Change Issues
Saving a Jpanel as a JPEG