use of javax.swing.ButtonModel in project jsql-injection by ron190.
the class CheckBoxIcon method paintOceanIcon.
private void paintOceanIcon(Component c, Graphics g, int x, int y) {
ButtonModel model = ((JCheckBoxMenuItem) c).getModel();
g.translate(x, y);
int w = this.getIconWidth();
int h = this.getIconHeight();
if (model.isEnabled()) {
if (model.isPressed() && model.isArmed()) {
g.setColor(MetalLookAndFeel.getControlShadow());
g.fillRect(0, 0, w, h);
g.setColor(MetalLookAndFeel.getControlDarkShadow());
g.fillRect(0, 0, w, 2);
g.fillRect(0, 2, 2, h - 2);
g.fillRect(w - 1, 1, 1, h - 1);
g.fillRect(1, h - 1, w - 2, 1);
} else if (model.isRollover()) {
MetalUtilsCustom.drawGradient(c, g, "CheckBox.gradient", 0, 0, w, h, true);
g.setColor(MetalLookAndFeel.getControlDarkShadow());
g.drawRect(0, 0, w - 1, h - 1);
g.setColor(MetalLookAndFeel.getPrimaryControl());
g.drawRect(1, 1, w - 3, h - 3);
g.drawRect(2, 2, w - 5, h - 5);
} else {
MetalUtilsCustom.drawGradient(c, g, "CheckBox.gradient", 0, 0, w, h, true);
g.setColor(MetalLookAndFeel.getControlDarkShadow());
g.drawRect(0, 0, w - 1, h - 1);
}
g.setColor(MetalLookAndFeel.getControlInfo());
} else {
g.setColor(MetalLookAndFeel.getControlDarkShadow());
g.drawRect(0, 0, w - 1, h - 1);
}
g.translate(-x, -y);
if (model.isSelected()) {
this.drawCheck(g, x, y);
}
}
use of javax.swing.ButtonModel in project jsql-injection by ron190.
the class CheckBoxMenuItemIconCustom method paintIcon.
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
boolean isSelected = model.isSelected();
boolean isEnabled = model.isEnabled();
boolean isPressed = model.isPressed();
boolean isArmed = model.isArmed();
g.translate(x, y);
if (isEnabled) {
if (isPressed || isArmed) {
g.setColor(MetalLookAndFeel.getControlInfo());
g.drawLine(0, 0, 8, 0);
g.drawLine(0, 0, 0, 8);
g.drawLine(8, 2, 8, 8);
g.drawLine(2, 8, 8, 8);
g.setColor(MetalLookAndFeel.getPrimaryControl());
g.drawLine(1, 1, 7, 1);
g.drawLine(1, 1, 1, 7);
g.drawLine(9, 1, 9, 9);
g.drawLine(1, 9, 9, 9);
} else {
g.setColor(MetalLookAndFeel.getControlDarkShadow());
g.drawLine(0, 0, 8, 0);
g.drawLine(0, 0, 0, 8);
g.drawLine(8, 2, 8, 8);
g.drawLine(2, 8, 8, 8);
g.setColor(MetalLookAndFeel.getControlHighlight());
g.drawLine(1, 1, 7, 1);
g.drawLine(1, 1, 1, 7);
g.drawLine(9, 1, 9, 9);
g.drawLine(1, 9, 9, 9);
}
} else {
g.setColor(MetalLookAndFeel.getMenuDisabledForeground());
g.drawRect(0, 0, 8, 8);
}
if (isSelected) {
if (isEnabled) {
if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
g.setColor(MetalLookAndFeel.getMenuSelectedForeground());
} else {
g.setColor(b.getForeground());
}
} else {
g.setColor(MetalLookAndFeel.getMenuDisabledForeground());
}
g.drawLine(2, 2, 2, 6);
g.drawLine(3, 2, 3, 6);
g.drawLine(4, 4, 8, 0);
g.drawLine(4, 5, 9, 0);
}
g.translate(-x, -y);
}
use of javax.swing.ButtonModel in project jsql-injection by ron190.
the class RadioMenuItemIconCustom method paintOceanIcon.
public void paintOceanIcon(Component c, Graphics g, int x, int y) {
ButtonModel model = ((AbstractButton) c).getModel();
boolean isSelected = model.isSelected();
boolean isEnabled = model.isEnabled();
boolean isPressed = model.isPressed();
boolean isArmed = model.isArmed();
g.translate(x, y);
if (isEnabled) {
MetalUtilsCustom.drawGradient(c, g, "RadioButtonMenuItem.gradient", 1, 1, 7, 7, true);
if (isPressed || isArmed) {
g.setColor(MetalLookAndFeel.getPrimaryControl());
} else {
g.setColor(MetalLookAndFeel.getControlHighlight());
}
g.drawLine(2, 9, 7, 9);
g.drawLine(9, 2, 9, 7);
g.drawLine(8, 8, 8, 8);
if (isPressed || isArmed) {
g.setColor(MetalLookAndFeel.getControlInfo());
} else {
g.setColor(MetalLookAndFeel.getControlDarkShadow());
}
} else {
g.setColor(MetalLookAndFeel.getMenuDisabledForeground());
}
g.drawLine(2, 0, 6, 0);
g.drawLine(2, 8, 6, 8);
g.drawLine(0, 2, 0, 6);
g.drawLine(8, 2, 8, 6);
g.drawLine(1, 1, 1, 1);
g.drawLine(7, 1, 7, 1);
g.drawLine(1, 7, 1, 7);
g.drawLine(7, 7, 7, 7);
if (isSelected) {
if (isEnabled) {
if (isArmed || (c instanceof JMenu && model.isSelected())) {
g.setColor(MetalLookAndFeel.getMenuSelectedForeground());
} else {
g.setColor(MetalLookAndFeel.getControlInfo());
}
} else {
g.setColor(MetalLookAndFeel.getMenuDisabledForeground());
}
g.drawLine(3, 2, 5, 2);
g.drawLine(2, 3, 6, 3);
g.drawLine(2, 4, 6, 4);
g.drawLine(2, 5, 6, 5);
g.drawLine(3, 6, 5, 6);
}
g.translate(-x, -y);
}
use of javax.swing.ButtonModel in project kindergarten by clear-group-ausbildung.
the class NavigationButtonBorder method paintBorder.
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
AbstractButton b = (AbstractButton) c;
ButtonModel m = b.getModel();
Color lightest;
Color veryLight;
Color light;
Color outerLine;
Color innerLine = Color.WHITE;
if (m.isArmed()) {
outerLine = new Color(165, 165, 165);
light = new Color(178, 178, 178);
veryLight = new Color(198, 198, 198);
lightest = new Color(204, 204, 204);
} else if (m.isRollover() || m.isPressed()) {
outerLine = new Color(198, 198, 198);
light = new Color(210, 210, 210);
veryLight = new Color(234, 234, 234);
lightest = new Color(245, 245, 245);
} else {
return;
}
g.translate(x, y);
// Outer very light corner
g.setColor(veryLight);
// Upper left
g.fillRect(1, 0, 1, 1);
g.fillRect(0, 1, 1, 1);
// Upper right
g.fillRect(w - 2, 0, 1, 1);
g.fillRect(w - 1, 1, 1, 1);
// Lower left
g.fillRect(1, h - 1, 1, 1);
g.fillRect(0, h - 2, 1, 1);
// Lower right
g.fillRect(w - 2, h - 1, 1, 1);
g.fillRect(w - 1, h - 2, 1, 1);
g.setColor(light);
// Upper left
g.fillRect(2, 0, 1, 1);
g.fillRect(1, 1, 1, 1);
g.fillRect(0, 2, 1, 1);
// Upper right
g.fillRect(w - 3, 0, 1, 1);
g.fillRect(w - 2, 1, 1, 1);
g.fillRect(w - 1, 2, 1, 1);
// Lower left
g.fillRect(2, h - 1, 1, 1);
g.fillRect(1, h - 2, 1, 1);
g.fillRect(0, h - 3, 1, 1);
// Lower right
g.fillRect(w - 3, h - 1, 1, 1);
g.fillRect(w - 2, h - 2, 1, 1);
g.fillRect(w - 1, h - 3, 1, 1);
g.setColor(outerLine);
g.fillRect(3, 0, w - 6, 1);
g.fillRect(3, h - 1, w - 6, 1);
g.fillRect(0, 3, 1, h - 6);
g.fillRect(w - 1, 3, 1, h - 6);
// Inner corner
g.setColor(lightest);
// Upper left
g.fillRect(2, 1, 1, 1);
g.fillRect(1, 2, 1, 1);
// Upper right
g.fillRect(w - 3, 1, 1, 1);
g.fillRect(w - 2, 2, 1, 1);
// Lower left
g.fillRect(2, h - 2, 1, 1);
g.fillRect(1, h - 3, 1, 1);
// Lower right
g.fillRect(w - 3, h - 2, 1, 1);
g.fillRect(w - 2, h - 3, 1, 1);
g.setColor(innerLine);
g.fillRect(3, 1, w - 6, 1);
g.fillRect(3, h - 2, w - 6, 1);
g.fillRect(1, 3, 1, h - 6);
g.fillRect(w - 2, 3, 1, h - 6);
g.translate(-x, -y);
}
use of javax.swing.ButtonModel in project kindergarten by clear-group-ausbildung.
the class ToolBarButtonBorder method paintBorder.
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
Image image;
int width;
int height;
AbstractButton b = (AbstractButton) c;
ButtonModel m = b.getModel();
if (m.isPressed() && m.isArmed()) {
image = pressedImage;
width = pressedWidth;
height = pressedHeight;
} else if (m.isRollover()) {
image = rolloverImage;
width = rolloverWidth;
height = rolloverHeight;
} else {
return;
}
g.translate(x, y);
// north west
g.drawImage(image, 0, 0, 5, 4, 0, 0, 5, 4, null);
// north
g.drawImage(image, 5, 0, w - 5, 4, 5, 0, width - 5, 4, null);
// north east
g.drawImage(image, w - 5, 0, w, 4, width - 5, 0, width, 4, null);
// west
g.drawImage(image, 0, 4, 4, h - 4, 0, 4, 4, height - 4, null);
// west
g.drawImage(image, w - 4, 4, w, h - 4, width - 4, 4, width, height - 4, null);
// west
g.drawImage(image, 0, h - 4, 4, h, 0, height - 4, 4, height, null);
// west
g.drawImage(image, 4, h - 4, w - 4, h, 4, height - 4, width - 4, height, null);
// west
g.drawImage(image, w - 4, h - 4, w, h, width - 4, height - 4, width, height, null);
g.translate(-x, -y);
}
Aggregations