Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

JMenu layout

  Asked By: Seth    Date: Feb 03    Category: Java    Views: 679
  

I have the menu like this:
Menu1
Image1 MenuItem1
MenuItem2
Image3 MenuItem3
MenuItem4
MenuItem5

But I want to have the menu layout like this:
Menu1
Image1 MenuItem1
MenuItem2
Image3 MenuItem3
MenuItem4
MenuItem5

How can I do it?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Skye Hughes     Answered On: Feb 03

I have been prompted the solution:

if (image != null) {
item.setIcon(new ImageIcon(getClass().getResource(image)) {
public int getIconHeight() { return 17; }
public int getIconWidth() { return 17; }
});
}
else {
item.setIcon(new ImageIcon("") {
public int getIconHeight() { return 17; }
public int getIconWidth() { return 17; }
});
}

 
Didn't find what you were looking for? Find more on JMenu layout Or get search suggestion and latest updates.




Tagged: