簡體   English   中英

如何在菜單項的右側顯示圖標?

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

在我的項目中,我想在JMenuItem條目的右側顯示圖標。 下面是我的代碼,但是它在菜單項的左側顯示圖標。

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

我想在jemnu項目的右側顯示圖標

嘗試:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM