2024-10-14 15:19:13 +03:00
|
|
|
package Common.Visual.Controls;
|
2024-10-10 23:57:36 +03:00
|
|
|
import Common.Passes.Pass;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
public class PassButton extends MenuBarButton implements PassControl {
|
2024-10-09 23:37:58 +03:00
|
|
|
public PassButton(Pass pass, boolean tab) {
|
2023-09-17 22:13:42 +03:00
|
|
|
setText(pass.getButtonText());
|
|
|
|
|
setToolTipText(pass.getDescription());
|
|
|
|
|
if (pass.getIconPath() != null) {
|
|
|
|
|
if (tab) {
|
|
|
|
|
setIcon(pass.getTabIcon());
|
2024-10-14 15:19:13 +03:00
|
|
|
setPreferredSize(new Dimension(18, 18));
|
|
|
|
|
setMaximumSize(new Dimension(18, 18));
|
|
|
|
|
setMinimumSize(new Dimension(18, 18));
|
|
|
|
|
} else
|
|
|
|
|
setIcon(pass.getIconPath());
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
addActionListener(pass.getControlAction());
|
|
|
|
|
pass.controls.add(this);
|
|
|
|
|
}
|
2024-10-09 23:37:58 +03:00
|
|
|
public PassButton(Pass pass) {
|
2023-09-17 22:13:42 +03:00
|
|
|
this(pass, false);
|
|
|
|
|
}
|
|
|
|
|
}
|