• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

beginer gui task. Please help

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

task.jpg
[Thumbnail for task.jpg]
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
aidas kar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did. No luck though. Book covered flowlayout, boarderlayout and gridlayout. And boxlayout only one method gethorizontalbox.
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way: I think this discussion would fit better in our GUIs forum, so I shall move it.
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
aidas kar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And, “you’re welcome
 
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic