Wednesday, June 23, 2004

 

Toute Votre Base Sont Appartiennent À Nous.

You have no chance to survive. Make your time. Here's the current lesson I'm learning wrt the 'null' layout manager. Each component needs the following:

private static final JLabel lblNotes = new JLabel("Notes:");
private static final int x = 100; // the component width
private static final int y = 20; // the component height
private static final int xo = x+10; // the x offset
private static final int yo = y+5; // the y offset
...
lblNotes.setToolTipText("Notes");
lblNotes.setHorizontalAlignment(JLabel.RIGHT);
lblNotes.setBounds((int)lblDescription.getBounds().getX(), (int)lblDescription.getBounds().getY()+yo, x, y);
topPanel.add(lblNotes);

Actually, I'm starting to prefer it to any other cookie cutter Layout Manager I've experienced - even Springs! I get control over what size the average field will be, and they don't grow and shrink when the window resizes. I also get to place the items relative to some anchor in constilations. The anchor can either be the topPanel or another component.

Anywho, thought I'd share my insight with the world - or three people who may read this. Nifty, eh?

Comments: Post a Comment

Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?

Locations of visitors to this page