• Post Reply Bookmark Topic Watch Topic
  • New Topic

screen layouts on card

 
Mich Robinson
Ranch Hand
Posts: 260
1
  • Mark post as helpful
  • send pies
  • 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
 
Campbell Ritchie
Marshal
Posts: 52556
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like something which would sit better on the Swing forum. Moving.
 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • 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.


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!