File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Icon and JManuBar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Icon and JManuBar" Watch "Icon and JManuBar" New topic

Icon and JManuBar

Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
I want to place an image in the manu bar of a frame. Similar to the one in the top right cornder of internet explorer.
I used the followin code with no luck:

ImageIcon icon = new ImageIcon("", Constants.CONNECT_IMAGE);
JLabel iconLabel = new JLabel("icon", icon, SwingConstants.CENTER);
add(iconLabel, BorderLayout.EAST);

The label appears, but the image doesn't. Also, it doesn't appear in the east corner.
Any help is appreciated

SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
inam reyi

Joined: May 11, 2004
Posts: 7

Try this one out , it seems u didnt give the relative path to the
1) The first argument to the ImageIcon constructor specifies the file
to load, relative to the directory containing the application's class
2) The second argument provides a description of the icon.

ImageIcon icon = new ImageIcon("images/middle.gif",
"Inam Reyi ");
label1 = new JLabel("some text", icon, JLabel.CENTER);

I hope this solves ur prob.

I agree. Here's the link:
subject: Icon and JManuBar
It's not a secret anymore!