• 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

screen layouts on card

 
Ranch Hand
Posts: 287
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to write an application using card layouts. I'd like to be able to position the various fields on screen but I don't understand how to do this. Every item I add to the card just follows on from the last item accross the screen. A simple technique would be great. I'd also be quite happy to position things using x,y positions etc.

I have one card with hotel bookings on screen and the idea is the user can click a booking and get more detailed booking info on a card that pops up. This is the relevant code (I'm currently trying the FlowLayout but I've tried just about everything):

Cheers Mike
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like something which would sit better on the Swing forum. Moving.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Start by reading the section from the Swing tutorial on Using Layout Managers.

A simple technique would be great.



The trick is to use multiple panels with potentially multiple different layout managers to get your desired effect.

Maybe in your case you use a vertical BoxLayout. Then you create JPanels that use a FlowLayout for each row in the form.

I'd also be quite happy to position things using x,y positions etc.



Well, that can be done, but most people will advise you not to do it because you lose all the advantages of using a Layout Manager.


 
I child proofed my house but they still get in. Distract them with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic