• Post Reply Bookmark Topic Watch Topic
  • New Topic

swing (no IDE "cheats") to build a gui- problem

 
Niklas Karlsson
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!
I study the swing, and I faced a problem I've been sitting for days thinking about.

I wish to do the following:

a frame consisting of "three main columns"

The left column will have four images (clickable JLabels) one under another, and so on (with some intervals).

The middle column, I have only ONE JButton, placed in the middle.

Column in the right, I have a number of clickable JLabel's
listed as a table, but the JLabel's.
where each column corresponds to an object stored data (saved by clicking on it)
(like a Jtabel, but I wish to use JLabel instead)
when I click respectively. Label, I wish that the JLabel either get a boarder or change color.
I understand that if I put a boarder, I will change the size of this and potentially sabotage the table layout, Janska quickly if I make a mistake,

How would you solve this?

it feels like you
first has a
"master JPanel" having a Flow Layout (3 colum) (align? left to right)

then
"Left Column JPanel" having a Flow layout (colum 4) (align? top to button).

then
"middle column JPanel" having a Flow Layout (3 colum) (align? top to button).

then
"Right column JPanel" having a Flow layout (XNO colum) (align? Left to right).
and in this "Right column JPanel":
a "data JPanel" one for each object that has a Flow Layout (1 colum) (align? top to button).

but my concern is that they do not line up as a tabäll when values are changed, or when one is selected, :-(
layoutTest.png
[Thumbnail for layoutTest.png]
my Layout example
 
Campbell Ritchie
Marshal
Posts: 52519
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stop using flow layout. I think flow layout is no good. Others may disagree with me.
Don't sit for days. If you are that stuck, ask the question quickly and you will get help quickly
A few suggestions:-

Try a horizontal Box with six columns (that will make all the columns the same width however) and put a tall panel into each of the 6 positions. Your columns can use box layout (in which case use a Box rather than a panel) except for the 2nd. Try a panel with border layout and add panels in the north and south positions simply to fill up the space.

Learn MigLayout.

Find out about Cay Horstmann's GBC class and use grid bag layout.

There are hundreds of other combinations of layouts you could use.
 
Niklas Karlsson
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Stop using flow layout. I think flow layout is no good. Others may disagree with me.
Don't sit for days. If you are that stuck, ask the question quickly and you will get help quickly
A few suggestions:-

Try a horizontal Box with six columns (that will make all the columns the same width however) and put a tall panel into each of the 6 positions.
Your columns can use box layout (in which case use a Box rather than a panel) except for the 2nd.
Try a panel with border layout and add panels in the north and south positions simply to fill up the space.

Learn MigLayout.

Find out about Cay Horstmann's GBC class and use grid bag layout.

There are hundreds of other combinations of layouts you could use.


Interesting! :-)
but I see a problem (but ma-by I'm wrong here..), please see my "new" picture, with a red markings,
those colums can be 1 to 10, and if I use a horizontal Box with six columns all colums will change.
or did I misunderstood you ?

BEST regards
Niklas
layoutTes1t.png
[Thumbnail for layoutTes1t.png]
layoutTes2t.png
[Thumbnail for layoutTes2t.png]
 
Campbell Ritchie
Marshal
Posts: 52519
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought you meant six columns. Obviously things are different if you want the numbers of columns to change. A panel on the right with grid layout?? But why do you need different numbers of columns?
 
Niklas Karlsson
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:I thought you meant six columns. Obviously things are different if you want the numbers of columns to change. A panel on the right with grid layout?? But why do you need different numbers of columns?


the colums represent players/users
hmm and if I ude scrollpane on only the users the "lower scrolling-bar" is scaling the distorting the UserPane ..
please look at my SUPER BASIC example

test.png
[Thumbnail for test.png]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!