2024-10-09 22:01:19 +03:00
|
|
|
|
package _VisualDVM.Visual.Menus;
|
2024-10-14 18:41:02 +03:00
|
|
|
|
import Common.MainModule_;
|
2024-10-11 00:00:30 +03:00
|
|
|
|
import Common.Utils.Utils_;
|
2024-10-08 22:33:49 +03:00
|
|
|
|
import Common.Visual.Fonts.VisualiserFonts;
|
2024-10-13 23:55:03 +03:00
|
|
|
|
import Common.Visual.UI_;
|
|
|
|
|
|
import _VisualDVM.Global;
|
2024-10-14 15:19:13 +03:00
|
|
|
|
import _VisualDVM.Passes.PassCode;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
|
//https://java-online.ru/swing-menu.xhtml
|
|
|
|
|
|
public class VisualiserMenuBar extends JToolBar {
|
|
|
|
|
|
public VisualiserMenuBar() {
|
|
|
|
|
|
setFloatable(false);
|
|
|
|
|
|
setSizeLimits();
|
|
|
|
|
|
}
|
2024-10-09 23:37:58 +03:00
|
|
|
|
public void addPasses(PassCode... codes) {
|
2023-09-17 22:13:42 +03:00
|
|
|
|
//- кнопки. связать их с проходами. (!)
|
2024-10-13 23:55:03 +03:00
|
|
|
|
for (PassCode code : codes) {
|
|
|
|
|
|
if (Global.mainModule.getPass(code) != null) {
|
|
|
|
|
|
add(Global.mainModule.getPass(code).createButton());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
public JMenuBar addMenus(JMenu... menus) {
|
|
|
|
|
|
JMenuBar bar = new JMenuBar() {
|
|
|
|
|
|
{
|
|
|
|
|
|
for (JMenu menu : menus)
|
|
|
|
|
|
add(menu);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
add(bar);
|
|
|
|
|
|
return bar;
|
|
|
|
|
|
}
|
2023-12-11 18:29:15 +03:00
|
|
|
|
public JLabel addLabel(String text_in) {
|
|
|
|
|
|
return addLabel(text_in, null);
|
|
|
|
|
|
}
|
|
|
|
|
|
public JLabel addLabel(String text_in, String icon_path_in) {
|
|
|
|
|
|
JLabel res = new JLabel(text_in) {
|
|
|
|
|
|
{
|
2024-10-14 18:41:02 +03:00
|
|
|
|
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
2023-12-11 18:29:15 +03:00
|
|
|
|
if (icon_path_in != null) {
|
2024-10-11 00:00:30 +03:00
|
|
|
|
setIcon(Utils_.getIcon(icon_path_in));
|
2023-12-11 18:29:15 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
add(res);
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
|
public void setSizeLimits() {
|
|
|
|
|
|
setPreferredSize(new Dimension(0, 30));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|