Problem with SWT and Layouts



I'm coding with SWT and I came across a problem with layouts. I have a
shell, which has a sashForm, which has two sashForms. Another one of these
has yet another sashForm within it. Now, this third sashForm has a
Composite(GridLayout), which consists of several Composites. These
Composites have a rowLayout. The Rowlayout has three Labels. But any changes
I make to rowLayout doesn't seem to effect on the appearance of the row. And
I don't seem to be able to add rowData to a Label within this rowLayout.

For example, I try to get labels in the middle, but horizontalAlignment =
GridData.CENTER does nothing.
Nor does playerLayout.justify = true;

Here's some code example:
----
// Let's create a sash form for whole area
wholePane = new SashForm(shell, SWT.HORIZONTAL);

// Now let's divide thw whole area in two vertically
// Left pane is for gametable and player's cards
leftPane = new SashForm(wholePane, SWT.VERTICAL);
rightPane = new SashForm(wholePane, SWT.VERTICAL);
....
// First, on the left: name of the game comes on the top
Label gameName = new Label(leftPane, SWT.CENTER);

// Next is the actual game table
gameTablePane = new SashForm(leftPane, SWT.HORIZONTAL);

// Then we make some room for the error texts
errorPane = new SashForm(leftPane, SWT.NONE);

// And player's own cards are on the bottom
cardsPane = new SashForm(leftPane, SWT.HORIZONTAL);
....

leftPlayers = new Composite(gameTablePane, SWT.NONE);
middleArea = new Composite(gameTablePane, SWT.NONE);
rightPlayers = new Composite(gameTablePane, SWT.NONE);
....

// Let's set a gridlayout for players
GridLayout playersLayout = new GridLayout();
playersLayout.numColumns = 1;
leftPlayers.setLayout(playersLayout);
middleArea.setLayout(playersLayout);
rightPlayers.setLayout(playersLayout);
....

// A player is a rowlayout, which consists of two decks and a player's name
RowLayout playerLayout = new RowLayout();
playerLayout.wrap = true;
playerLayout.pack = true;
playerLayout.justify = true;
playerLayout.type = SWT.HORIZONTAL;
playerLayout.spacing = 5;
playerLayout.marginLeft = 5;
playerLayout.marginRight = 5;
playerLayout.marginBottom = 5;

// And add some style to the components
GridData playersData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
playersData.horizontalAlignment = GridData.CENTER;
playersData.grabExcessHorizontalSpace = true;
playersData.horizontalIndent = 5;

// a Composite for a player
Composite newPlayerArea = new Composite(leftPlayers, SWT.CENTER);
newPlayerArea.setLayout(playerLayout); // Doesn't work, no effect what so
ever

// deck of cards
Label cards = new Label(newPlayerArea, SWT.CENTER);
cards.setImage(image);

// Name of the player
Label name = new Label(newPlayerArea, SWT.CENTER);
name.setText("player");
name.setLayoutData(playerLayout); // ClassCastException here, why?

// a card that player has hit
Label card = new Label(newPlayerArea, SWT.CENTER);
card.setImage(image2);

----
I know, very complicated. But I'm desperate.

--
"Äijät nää, ei lähde täältä mihinkään,
äijät nää vaan humppaa jyskyttää" -Eläkeläiset
Mikko Tanskanen - Humpparitari/ETOn tiedotusvastaava/TiTen lemmikkiKirahvi


.



Relevant Pages

  • Re: How To Burn An MP3 CD For Player?
    ... >> only .mp3 files on it BUT the player starts, reads the volume label ... I haven't tested this requirement yet BUT this player states that it ... In my case `mkisofs` takes care of truncating the file names ...
    (comp.os.linux.hardware)
  • Re: CD labels with curved text
    ... When I got the car it had some CD player issues as well. ... MVP Microsoft [Publisher] ... Tech Editor for "Microsoft Publisher 2007 For Dummies" ... Wouldn't it be great if the CD/DVD burner could burn a label on the disk?! ...
    (microsoft.public.publisher)
  • Re: Glop on the label side of a CD - help!!??
    ... stuck tight inside, and it took an extreme degree of force to pull ... Two of them I couldn't pull out at all, and literally had to rip the ... label side of the CD's - practically all of them! ... You would put a CD with glop on it into your CD player or computer? ...
    (rec.music.classical.recordings)
  • Re: Glop on the label side of a CD - help!!??
    ... stuck tight inside, and it took an extreme degree of force to pull them ... Two of them I couldn't pull out at all, and literally had to rip the ... label side of the CD's - practically all of them! ... You would put a CD with glop on it into your CD player or computer? ...
    (rec.music.classical.recordings)
  • Re: Glop on the label side of a CD - help!!??
    ... stuck tight inside, and it took an extreme degree of force to pull them ... Two of them I couldn't pull out at all, and literally had to rip the ... label side of the CD's - practically all of them! ... You would put a CD with glop on it into your CD player or computer? ...
    (rec.music.classical.recordings)