Labels and paint questions...  
Author Message
Sean Berry





PostPosted: 2004-7-2 15:10:00 Top

java-programmer, Labels and paint questions... 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.


 
Sean Berry





PostPosted: 2004-7-2 15:13:00 Top

java-programmer >> Labels and paint questions... 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.



 
dar7yl





PostPosted: 2004-7-2 17:38:00 Top

java-programmer >> Labels and paint questions... Try putting the components inside a Box(), and use
Box.createHorizontalStrut()
to create the space.

--
regards,
Dar7yl the 7 is silent)

"Sean Berry" <email***@***.com> wrote in message
news:JS7Fc.10105$z81.2249@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.
>
>


 
 
Raymond DeCampo





PostPosted: 2004-7-3 23:39:00 Top

java-programmer >> Labels and paint questions... 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.
 
 
Sean Berry





PostPosted: 2004-7-4 3:15:00 Top

java-programmer >> Labels and paint questions... Just to let you know I am using JDK 1.3.1

Is this still a solution? I am not able to import javax.swing.Box.

I get a compilation error:
selectMenu.java:10: Class javax.swing.Box not found in import.
import javax.swing.Box;

I found the doc in class Box in 1.3 docs, so I assumed I could
import it. Any suggestions?

Sorry about my newbie type question here, this is my first experiece
with Java Applets...




"dar7yl" <email***@***.com> wrote in message
news:G1aFc.44380$_5.23820@clgrps13...
> Try putting the components inside a Box(), and use
> Box.createHorizontalStrut()
> to create the space.
>
> --
> regards,
> Dar7yl the 7 is silent)
>
> "Sean Berry" <email***@***.com> wrote in message
> news:JS7Fc.10105$z81.2249@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.
> >
> >
>
>


 
 
Adam Guillot





PostPosted: 2004-7-4 3:28:00 Top

java-programmer >> Labels and paint questions... Sean Berry wrote:

> Just to let you know I am using JDK 1.3.1
>
> Is this still a solution? I am not able to import javax.swing.Box.
>
> I get a compilation error:
> selectMenu.java:10: Class javax.swing.Box not found in import.
> import javax.swing.Box;
>
> I found the doc in class Box in 1.3 docs, so I assumed I could
> import it. Any suggestions?
>
> Sorry about my newbie type question here, this is my first experiece
> with Java Applets...
>
>
>
>
> "dar7yl" <email***@***.com> wrote in message
> news:G1aFc.44380$_5.23820@clgrps13...
>> Try putting the components inside a Box(), and use
>> Box.createHorizontalStrut()
>> to create the space.
>>
>> --
>> regards,
>> Dar7yl the 7 is silent)
>>
>> "Sean Berry" <email***@***.com> wrote in message
>> news:JS7Fc.10105$z81.2249@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.
>> >
>> >
>>
>>

Can you import other swing classes ?
Maybe a probs with ur java libs
 
 
Sean Berry





PostPosted: 2004-7-4 3:47:00 Top

java-programmer >> Labels and paint questions... "Adam Guillot" <email***@***.com> wrote in message
news:40e7085a$0$24424$email***@***.com...
> Sean Berry wrote:
>
> > Just to let you know I am using JDK 1.3.1
> >
> > Is this still a solution? I am not able to import javax.swing.Box.
> >
> > I get a compilation error:
> > selectMenu.java:10: Class javax.swing.Box not found in import.
> > import javax.swing.Box;
> >

import javax.swing.*;

Reported the same error but for javax.swing.

> > I found the doc in class Box in 1.3 docs, so I assumed I could
> > import it. Any suggestions?
> >
> > Sorry about my newbie type question here, this is my first experiece
> > with Java Applets...
> >
> >
> >
> >
> > "dar7yl" <email***@***.com> wrote in message
> > news:G1aFc.44380$_5.23820@clgrps13...
> >> Try putting the components inside a Box(), and use
> >> Box.createHorizontalStrut()
> >> to create the space.
> >>
> >> --
> >> regards,
> >> Dar7yl the 7 is silent)
> >>
> >> "Sean Berry" <email***@***.com> wrote in message
> >> news:JS7Fc.10105$z81.2249@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.
> >> >
> >> >
> >>
> >>
>
> Can you import other swing classes ?
> Maybe a probs with ur java libs


I am on FreeBSD 5.2.1.
I have only used java to write JavaBeans and JSP pages.
So, I have never run into needing to import javax.swing classes.

Shouldn't JDK 1.3.1 have these installed already?


 
 
Sean Berry





PostPosted: 2004-7-4 3:49:00 Top

java-programmer >> Labels and paint questions...
"Adam Guillot" <email***@***.com> wrote in message
news:40e7085a$0$24424$email***@***.com...
> Sean Berry wrote:
>
> > Just to let you know I am using JDK 1.3.1
> >
> > Is this still a solution? I am not able to import javax.swing.Box.
> >
> > I get a compilation error:
> > selectMenu.java:10: Class javax.swing.Box not found in import.
> > import javax.swing.Box;
> >
> > I found the doc in class Box in 1.3 docs, so I assumed I could
> > import it. Any suggestions?
> >
> > Sorry about my newbie type question here, this is my first experiece
> > with Java Applets...
> >
> >
> >
> >
> > "dar7yl" <email***@***.com> wrote in message
> > news:G1aFc.44380$_5.23820@clgrps13...
> >> Try putting the components inside a Box(), and use
> >> Box.createHorizontalStrut()
> >> to create the space.
> >>
> >> --
> >> regards,
> >> Dar7yl the 7 is silent)
> >>
> >> "Sean Berry" <email***@***.com> wrote in message
> >> news:JS7Fc.10105$z81.2249@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.
> >> >
> >> >
> >>
> >>
>
> Can you import other swing classes ?
> Maybe a probs with ur java libs

Can I install these libraries after the fact,
if they are not installed for some reason?



 
 
Roedy Green





PostPosted: 2004-7-4 4:02:00 Top

java-programmer >> Labels and paint questions... On Sat, 3 Jul 2004 12:15:23 -0700, "Sean Berry" <email***@***.com>
wrote or quoted :

>I get a compilation error:
>selectMenu.java:10: Class javax.swing.Box not found in import.
>import javax.swing.Box;

The import looks ok. What does the selectMenu code say?

Post the smallest complete program that shows the problem.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Roedy Green





PostPosted: 2004-7-4 4:07:00 Top

java-programmer >> Labels and paint questions... On Sat, 3 Jul 2004 12:15:23 -0700, "Sean Berry" <email***@***.com>
wrote or quoted :

>Just to let you know I am using JDK 1.3.1

Why ? JDK 1.4 has been out a long time. We are all getting ready to
jump to 1.5.

You just make life difficult for yourself when you use a different
version from everyone else.

When did Swing start being bundled with the JDK? 1.3 or 1.4?

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Adam Guillot





PostPosted: 2004-7-4 4:11:00 Top

java-programmer >> Labels and paint questions... Sean Berry wrote:

> "Adam Guillot" <email***@***.com> wrote in message
> news:40e7085a$0$24424$email***@***.com...
>> Sean Berry wrote:
>>
>> > Just to let you know I am using JDK 1.3.1
>> >
>> > Is this still a solution? I am not able to import javax.swing.Box.
>> >
>> > I get a compilation error:
>> > selectMenu.java:10: Class javax.swing.Box not found in import.
>> > import javax.swing.Box;
>> >
>
> import javax.swing.*;
>
> Reported the same error but for javax.swing.
>
>> > I found the doc in class Box in 1.3 docs, so I assumed I could
>> > import it. Any suggestions?
>> >
>> > Sorry about my newbie type question here, this is my first experiece
>> > with Java Applets...
>> >
>> >
>> >
>> >
>> > "dar7yl" <email***@***.com> wrote in message
>> > news:G1aFc.44380$_5.23820@clgrps13...
>> >> Try putting the components inside a Box(), and use
>> >> Box.createHorizontalStrut()
>> >> to create the space.
>> >>
>> >> --
>> >> regards,
>> >> Dar7yl the 7 is silent)
>> >>
>> >> "Sean Berry" <email***@***.com> wrote in message
>> >> news:JS7Fc.10105$z81.2249@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.
>> >> >
>> >> >
>> >>
>> >>
>>
>> Can you import other swing classes ?
>> Maybe a probs with ur java libs
>
>
> I am on FreeBSD 5.2.1.
> I have only used java to write JavaBeans and JSP pages.
> So, I have never run into needing to import javax.swing classes.
>
> Shouldn't JDK 1.3.1 have these installed already?

Yes, there is the problem, swing is already with Java, but why didnt you
tell you where under FreeBSD. You don't have swing. I cant help you much
with that because I use an original sun jdk (linux 1.5). Look on the
FreeBSD java projects page there must be something about it. Also you can
grab a full jdk and put you bsd files inside.
 
 
Sean Berry





PostPosted: 2004-7-4 5:53:00 Top

java-programmer >> Labels and paint questions...
"VisionSet" <email***@***.com> wrote in message
news:cBGFc.286$email***@***.com...
>
> "Roedy Green" <email***@***.com> wrote in message
> news:email***@***.com...
>
> >
> > When did Swing start being bundled with the JDK? 1.3 or 1.4?
>
> 1.2 !!
>
> --
> Mike W
>
>

Well, I installed 1.3.1 about 1 year ago.

Why would swing not be included?


 
 
Roedy Green





PostPosted: 2004-7-4 6:27:00 Top

java-programmer >> Labels and paint questions... On Sat, 3 Jul 2004 14:53:24 -0700, "Sean Berry" <email***@***.com>
wrote or quoted :

>Well, I installed 1.3.1 about 1 year ago.
>
>Why would swing not be included?

There was a time when Swing was available, but you had to download and
install it separately. I gather that must be late 1.1?


--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
VisionSet





PostPosted: 2004-7-4 6:40:00 Top

java-programmer >> Labels and paint questions...
"Roedy Green" <email***@***.com> wrote in message
news:email***@***.com...

>
> When did Swing start being bundled with the JDK? 1.3 or 1.4?

1.2 !!


 
 
Andrew Thompson





PostPosted: 2004-7-4 7:02:00 Top

java-programmer >> Labels and paint questions... On Sat, 03 Jul 2004 22:26:43 GMT, Roedy Green wrote:

> There was a time when Swing was available, but you had to download and
> install it separately. I gather that must be late 1.1?

AFAIU, that is correct. It was included
with the core class in the JRE as of 1.2.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
 
VisionSet





PostPosted: 2004-7-4 7:24:00 Top

java-programmer >> Labels and paint questions...
"Sean Berry" <email***@***.com> wrote in message
news:D6GFc.12640$z81.11645@fed1read01...
>
> "VisionSet" <email***@***.com> wrote in message
> news:cBGFc.286$email***@***.com...
> >
> > "Roedy Green" <email***@***.com> wrote in message
> > news:email***@***.com...
> >
> > >
> > > When did Swing start being bundled with the JDK? 1.3 or 1.4?
> >
> > 1.2 !!
> >
> > --
> > Mike W
> >
> >
>
> Well, I installed 1.3.1 about 1 year ago.
>
> Why would swing not be included?
>
>

1.3.1 is currently a single download for all platforms. This does include
Swing

<http://java.sun.com/j2se/1.3/docs/api/javax/swing/package-summary.html>

Are you sure you don't have it?

Get it again, even better - get 1.4.2


 
 
Sean Berry





PostPosted: 2004-7-4 7:46:00 Top

java-programmer >> Labels and paint questions...
"VisionSet" <email***@***.com> wrote in message
news:heHFc.348$email***@***.com...
>
> "Sean Berry" <email***@***.com> wrote in message
> news:D6GFc.12640$z81.11645@fed1read01...
> >
> > "VisionSet" <email***@***.com> wrote in message
> > news:cBGFc.286$email***@***.com...
> > >
> > > "Roedy Green" <email***@***.com> wrote in message
> > > news:email***@***.com...
> > >
> > > >
> > > > When did Swing start being bundled with the JDK? 1.3 or 1.4?
> > >
> > > 1.2 !!
> > >
> > > --
> > > Mike W
> > >
> > >
> >
> > Well, I installed 1.3.1 about 1 year ago.
> >
> > Why would swing not be included?
> >
> >
>
> 1.3.1 is currently a single download for all platforms. This does include
> Swing
>
> <http://java.sun.com/j2se/1.3/docs/api/javax/swing/package-summary.html>
>
> Are you sure you don't have it?
>
> Get it again, even better - get 1.4.2
>
> --
> Mike W
>
>

If I do get 1.4.2, and install it... what else will be involved with having
1.4.2 take over. Is it as simple as seting my Java path?

Will there be any problems as far as functions that may be deprecated that I
have been using to write beans?

Also, is there another way to do what I originally asked about?

Thanks to everyone who has responded thus far.



 
 
VisionSet





PostPosted: 2004-7-4 14:49:00 Top

java-programmer >> Labels and paint questions...

"Sean Berry" <email***@***.com> wrote in message
news:dyHFc.12645$z81.10325@fed1read01...

> > >
> > >
> >
> > 1.3.1 is currently a single download for all platforms. This does
include
> > Swing
> >
> > <http://java.sun.com/j2se/1.3/docs/api/javax/swing/package-summary.html>
> >
> > Are you sure you don't have it?
> >
> > Get it again, even better - get 1.4.2
> >
>
> If I do get 1.4.2, and install it... what else will be involved with
having
> 1.4.2 take over. Is it as simple as seting my Java path?
>
> Will there be any problems as far as functions that may be deprecated that
I
> have been using to write beans?
>
> Also, is there another way to do what I originally asked about?
>
> Thanks to everyone who has responded thus far.
>
>

Installation these days is vastly improved, I think the installer even sets
the path to java home.

Deprecated methods are just that, deprecated. You can still use them you
just add the -deprecated flag to the compiler tool. Deprecated methods are
removed in time, but if they weren't deprecated in 1.3 then they won't have
been removed yet.

Provide a short compilable example that illustrates the problem you have. If
it involves an image just comment the size, so we can inlcude an appropriate
stand-in. It can definitely be solved simply with 1.3 but that is no reason
to stick with it.


 
 
eightgraph





PostPosted: 2004-7-9 18:44:00 Top

java-programmer >> Labels and paint questions... "Sean Berry" <email***@***.com> 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.