no message
This commit is contained in:
41
src/_VisualDVM/Visual/Menus/StableMenuItem.java
Normal file
41
src/_VisualDVM/Visual/Menus/StableMenuItem.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package _VisualDVM.Visual.Menus;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Menus.VisualiserMenuItem;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicMenuItemUI;
|
||||
//неичезающий меню итем. нужен для настроек
|
||||
//https://translated.turbopages.org/proxy_u/en-ru.ru.64537f6c-6460c460-8e74a1ab-74722d776562/https/tips4java.wordpress.com/2010/09/12/keeping-menus-open/
|
||||
class StableItemUI extends BasicMenuItemUI {
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new StableItemUI();
|
||||
}
|
||||
@Override
|
||||
protected void doClick(MenuSelectionManager msm) {
|
||||
menuItem.doClick(0);
|
||||
if (CommonUI.last_menu_path != null)
|
||||
MenuSelectionManager.defaultManager().setSelectedPath(CommonUI.last_menu_path);
|
||||
}
|
||||
}
|
||||
public class StableMenuItem extends VisualiserMenuItem {
|
||||
{
|
||||
getModel().addChangeListener(e -> {
|
||||
if (getModel().isArmed() && isShowing())
|
||||
CommonUI.last_menu_path = MenuSelectionManager.defaultManager().getSelectedPath();
|
||||
});
|
||||
}
|
||||
public StableMenuItem(String text) {
|
||||
super(text);
|
||||
setUI(new StableItemUI());
|
||||
}
|
||||
public StableMenuItem(String text, String icon_path) {
|
||||
super(text);
|
||||
setIcon(CommonUtils.getIcon(icon_path));
|
||||
setUI(new StableItemUI());
|
||||
}
|
||||
public StableMenuItem() {
|
||||
setUI(new StableItemUI());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user