By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,469 Members | 1,885 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,469 IT Pros & Developers. It's quick & easy.

Labels and paint questions...

P: n/a
I have an applet, here
http://www.aquaticwhirlpools.com/sean/selectMenu.html

What I need is for the select menus to have some space between
them so that I can have the orange/yellow images next to each one.

As you can see, there is a bit of one of the images next to
"by product size" and a full image next to "by model".

The space between the two "by product size" and "by shape" is
created by an empty label. The image is placed in the paint method.

The problem is that without the empty label, the menus have no space
between them, as with "by shape" and "by model". Is there any other
way to create that space... or is there a way to make the images 'paint'
on top of the labels?

Thanks for any help.

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Sean Berry wrote:
I have an applet, here
http://www.aquaticwhirlpools.com/sean/selectMenu.html

What I need is for the select menus to have some space between
them so that I can have the orange/yellow images next to each one.

As you can see, there is a bit of one of the images next to
"by product size" and a full image next to "by model".

The space between the two "by product size" and "by shape" is
created by an empty label. The image is placed in the paint method.

The problem is that without the empty label, the menus have no space
between them, as with "by shape" and "by model". Is there any other
way to create that space... or is there a way to make the images 'paint'
on top of the labels?


Sean,

The best way I know of to create space is to use
Box.createHorizontalStrut(), Box.createVerticalStrut() or
Box.createRigidArea(). (Note that the components returned by these
methods do not need to be in a Box to work.) You could also try the
Box.create*Glue() methods, although I have not tried them outside of Box
(insert pun here).

BTW, your applet had some serious layout issues when viewed by Mozilla
1.6 using the Java Plug-in on linux. OTOH, it sounds like it is a work
in progress, so maybe you'll get that cleaned up for the production version.

HTH,
Ray

--
XML is the programmer's duct tape.
Jul 17 '05 #2

P: n/a
"Sean Berry" <se********@cox.net> wrote in message news:<KW7Fc.10113$z81.2831@fed1read01>...
I have an applet, here
http://www.aquaticwhirlpools.com/sean/selectMenu.html

What I need is for the select menus to have some space between
them so that I can have the orange/yellow images next to each one.

As you can see, there is a bit of one of the images next to
"by product size" and a full image next to "by model".

The space between the two "by product size" and "by shape" is
created by an empty label. The image is placed in the paint method.

The problem is that without the empty label, the menus have no space
between them, as with "by shape" and "by model". Is there any other
way to create that space... or is there a way to make the images 'paint'
on top of the labels?

Thanks for any help.


Create a custom Component by overriding Canvas.
Put your component where the image should be and paint the image in
your component's paint() method. Or make the label transparent by
setOpaque(false) if your are using Swing.
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.