Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Icon and JManuBar

 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi:
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
 
inam reyi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try this one out , it seems u didnt give the relative path to the
image.
1) The first argument to the ImageIcon constructor specifies the file
to load, relative to the directory containing the application's class
file.
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.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic