set MenuItem unclickable in SystemTray

278 views Asked by At

I want to set my Menuitem in Java unclickable. It should be shown, but not clickable and there shouldn't be a hover color, when you go with your mouse over it. In other words, I want to show a text for info in System-Tray menu. It has no onclick function. The System Tray and the showing works completly, I only need help for this problem above.

 MenuItem itmPrgName = new MenuItem(Main.programmName + " " + Main.version);

How to do this?

1

There are 1 answers

4
mKorbel On

I want to set my Menuitem in Java unclickable. It should be shown, but not clickable and there shouldn't be a hover color, when you go with your mouse over it. In other words, I want to show a text for info in System-Tray menu. It has no onclick function.

  • use JPopup as container put there JLabel / JTextArea(setEditable(false)) / JTextPane (setEditable(false)) or JPanel contains different amount of JComponents

  • set proper LayoutManager for JPopup or JPanel if needed