Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

JMenu with images

Thread view: 
Chameleon - 25 Oct 2005 01:59 GMT
http://www.cs.cf.ac.uk/Dave/HCI/HCI_Handout_CALLER/menu.gif

In this picture we see a JMenu with images.

How can I create the same menu with

New
SaveAs
Properties
Exit

Start in y axis of "O" from "Open"?
zero - 25 Oct 2005 02:18 GMT
Chameleon <cham_gss@hotmail.NOSPAM.com> wrote in news:djk00u$a5e$1
@volcano1.grnet.gr:

> http://www.cs.cf.ac.uk/Dave/HCI/HCI_Handout_CALLER/menu.gif
>
[quoted text clipped - 8 lines]
>
> Start in y axis of "O" from "Open"?

Easiest would be to have a transparent gif image the same size of the other
icons and use that for the JMenuItems that don't have an icon.

I think you can do the same by using Swing "padding" classes such as
HorizontalGlue.  I'm not sure though.  And even if it is possible, I don't
recommend it.  It'll be a lot of code for what can be done with one or two
lines if you just add a transparent gif image.
Thomas Fritsch - 25 Oct 2005 02:36 GMT
> Easiest would be to have a transparent gif image the same size of the
> other
> icons and use that for the JMenuItems that don't have an icon.

As an alternative you can create a transparent icon with the following
class:

public class BlankIcon implements Icon {
 public int getIconHeight() { return 24; }
 public int getIconWidth() { return 24; }
 public void paintIcon(Component c, Graphics g, int x, int y) {
/*nothing*/ }
}

Signature

"TFritsch$t-online:de".replace(':','.').replace('$','@')

zero - 26 Oct 2005 22:50 GMT
"Thomas Fritsch" <i.dont.like.spam@invalid.com> wrote in news:djk222$mlg$03
$1@news.t-online.com:

> As an alternative you can create a transparent icon with the following
> class:
[quoted text clipped - 5 lines]
> /*nothing*/ }
> }

Interesting idea.  Have you tested this with both opaque and non-opaque
components?
Thomas Fritsch - 27 Oct 2005 00:20 GMT
> Interesting idea.  Have you tested this with both opaque and non-opaque
> components?
Until now only with JMenuItem.
Roedy Green - 25 Oct 2005 03:28 GMT
On Tue, 25 Oct 2005 03:59:13 +0300, Chameleon
<cham_gss@hotmail.NOSPAM.com> wrote, quoted or indirectly quoted
someone who said :

>In this picture we see a JMenu with images.
>
[quoted text clipped - 6 lines]
>
>Start in y axis of "O" from "Open"?

You are just asking how to set up a JMenu?

See http://mindprod.com/jgloss/jmenu.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.