jones
jones

Reputation: 1453

How to display icon on the right side of menu items?

In my project I want to display icons on the right side of JMenuItem entries. Below is my code, but it displays icon on the left side of menu items.

Icon student2 = new ImageIcon(getClass().getResource("images/new-student.png"));
JMenuItem student = new JMenuItem("New students",student1);

Upvotes: 0

Views: 776

Answers (1)

camickr
camickr

Reputation: 324128

i want to display icons on the right side of jemnu items

Try:

JMenuItem student = new JMenuItem(...);
student.setComponentOrientation(JComponent.ComponentOrientation.RIGHT_TO_LEFT);

Upvotes: 2

Related Questions