no message
This commit is contained in:
7
src/Common/Visual/Controls/ECButtonPosition.java
Normal file
7
src/Common/Visual/Controls/ECButtonPosition.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package Common.Visual.Controls;
|
||||
public enum ECButtonPosition {
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
51
src/Common/Visual/Controls/ExpandCollapseButton.java
Normal file
51
src/Common/Visual/Controls/ExpandCollapseButton.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package Common.Visual.Controls;
|
||||
public class ExpandCollapseButton extends MenuBarButton {
|
||||
protected String description;
|
||||
protected ECButtonPosition position;
|
||||
public ExpandCollapseButton(String description_in, ECButtonPosition position_in) {
|
||||
description = description_in;
|
||||
position = position_in;
|
||||
Switch(true);
|
||||
}
|
||||
public void Switch(boolean flag) {
|
||||
String prefix = "?";
|
||||
String icon_name = "Help";
|
||||
if (flag) {
|
||||
prefix = "Развернуть";
|
||||
switch (position) {
|
||||
case Up:
|
||||
icon_name = "ExpandDown";
|
||||
break;
|
||||
case Down:
|
||||
icon_name = "CollapseUp";
|
||||
break;
|
||||
case Left:
|
||||
icon_name = "SilwerArrowLeft";
|
||||
break;
|
||||
case Right:
|
||||
icon_name = "SilwerArrowRight";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
prefix = "Свернуть";
|
||||
switch (position) {
|
||||
case Up:
|
||||
icon_name = "CollapseUp";
|
||||
break;
|
||||
case Down:
|
||||
icon_name = "ExpandDown";
|
||||
break;
|
||||
case Left:
|
||||
icon_name = "SilwerArrowRight";
|
||||
break;
|
||||
case Right:
|
||||
icon_name = "SilwerArrowLeft";
|
||||
break;
|
||||
}
|
||||
}
|
||||
setToolTipText(prefix + " " + description);
|
||||
setIcon("/Common/icons/" + icon_name + ".png");
|
||||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
35
src/Common/Visual/Controls/MenuBarButton.java
Normal file
35
src/Common/Visual/Controls/MenuBarButton.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
//https://java-online.ru/swing-jbutton.xhtml
|
||||
public class MenuBarButton extends JButton {
|
||||
public MenuBarButton() {
|
||||
super();
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
//
|
||||
setBorderPainted(false);
|
||||
setContentAreaFilled(false);
|
||||
setOpaque(false);
|
||||
//setFocusPainted(false);
|
||||
//-
|
||||
setMinimumSize(new Dimension(38, 30)); //иначе сужаются вертикально.
|
||||
}
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
if (getModel().isPressed()) {
|
||||
g.setColor(new Color(163, 184, 204));
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
}
|
||||
super.paintComponent(g);
|
||||
}
|
||||
public void setIcon(String icon_path) {
|
||||
setIcon(CommonUtils.getIcon(icon_path));
|
||||
}
|
||||
public void setFont(VisualiserFonts font_in){
|
||||
setFont(CommonUI.getTheme().Fonts.get(font_in));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user