mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
added color properties to abstract leaded comp
This commit is contained in:
Binary file not shown.
+12
-5
@@ -36,7 +36,7 @@ public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchT
|
||||
protected Point[] controlPoints = new Point[] { new Point(0, 0) };
|
||||
protected RoundRectangle2D body;
|
||||
protected String name;
|
||||
protected ToggleSwitchType switchType = ToggleSwitchType.SPST;
|
||||
protected ToggleSwitchType switchType = ToggleSwitchType.DPDT;
|
||||
|
||||
public MiniToggleSwitch() {
|
||||
super();
|
||||
@@ -167,8 +167,8 @@ public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchT
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
|
||||
1f * alpha / MAX_ALPHA));
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
|
||||
/ MAX_ALPHA));
|
||||
}
|
||||
g2d.setColor(BODY_COLOR);
|
||||
g2d.fill(body);
|
||||
@@ -194,7 +194,14 @@ public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchT
|
||||
|
||||
@Override
|
||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
int circleSize = 5 * width / 32;
|
||||
g2d.setColor(BODY_COLOR);
|
||||
g2d.fillRoundRect(width / 4, 1, width / 2, height - 2, circleSize, circleSize);
|
||||
g2d.setColor(BORDER_COLOR);
|
||||
g2d.drawRoundRect(width / 4, 1, width / 2, height - 2, circleSize, circleSize);
|
||||
g2d.setColor(CIRCLE_COLOR);
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
g2d.fillOval(width / 2 - circleSize / 2, i * height / 4 - 3, circleSize, circleSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-3
@@ -17,13 +17,25 @@ public class Jumper extends AbstractLeadedDIYComponent<Void> {
|
||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Color getBodyColor() {
|
||||
return super.getBodyColor();
|
||||
};
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Color getBorderColor() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getBorderColor();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Byte getAlpha() {
|
||||
return super.getAlpha();
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Size getWidth() {
|
||||
@@ -48,12 +60,12 @@ public class Jumper extends AbstractLeadedDIYComponent<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBodyColor() {
|
||||
protected Color getDefaultBodyColor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBorderColor() {
|
||||
protected Color getDefaultBorderColor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+15
-3
@@ -45,7 +45,19 @@ public class Trace extends AbstractLeadedDIYComponent<Void> {
|
||||
public void setLeadThickness(Size leadThickness) {
|
||||
this.leadThickness = leadThickness;
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public Color getBodyColor() {
|
||||
return super.getBodyColor();
|
||||
};
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Color getBorderColor() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getBorderColor();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Byte getAlpha() {
|
||||
@@ -76,12 +88,12 @@ public class Trace extends AbstractLeadedDIYComponent<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBodyColor() {
|
||||
protected Color getDefaultBodyColor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBorderColor() {
|
||||
protected Color getDefaultBorderColor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -59,12 +59,12 @@ public class AxialFilmCapacitor extends AbstractLeadedDIYComponent<Capacitance>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBodyColor() {
|
||||
protected Color getDefaultBodyColor() {
|
||||
return BODY_COLOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBorderColor() {
|
||||
protected Color getDefaultBorderColor() {
|
||||
return BORDER_COLOR;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -59,12 +59,12 @@ public class RadialCeramicDiskCapacitor extends AbstractLeadedDIYComponent<Capac
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBodyColor() {
|
||||
protected Color getDefaultBodyColor() {
|
||||
return BODY_COLOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBorderColor() {
|
||||
protected Color getDefaultBorderColor() {
|
||||
return BORDER_COLOR;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -43,9 +43,9 @@ public class RadialFilmCapacitor extends AbstractLeadedDIYComponent<Capacitance>
|
||||
g2d.setColor(LEAD_COLOR);
|
||||
g2d.drawLine(0, height / 2, width, height / 2);
|
||||
g2d.setColor(BODY_COLOR);
|
||||
g2d.fillRoundRect(4, height / 2 - 3, width - 8, 6, 2, 2);
|
||||
g2d.fillRoundRect(4, height / 2 - 3, width - 8, 6, 5, 5);
|
||||
g2d.setColor(BORDER_COLOR);
|
||||
g2d.drawRoundRect(4, height / 2 - 3, width - 8, 6, 2, 2);
|
||||
g2d.drawRoundRect(4, height / 2 - 3, width - 8, 6, 5, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,12 +59,12 @@ public class RadialFilmCapacitor extends AbstractLeadedDIYComponent<Capacitance>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBodyColor() {
|
||||
protected Color getDefaultBodyColor() {
|
||||
return BODY_COLOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBorderColor() {
|
||||
protected Color getDefaultBorderColor() {
|
||||
return BORDER_COLOR;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -59,12 +59,12 @@ public class Resistor extends AbstractLeadedDIYComponent<Resistance> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBodyColor() {
|
||||
protected Color getDefaultBodyColor() {
|
||||
return BODY_COLOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBorderColor() {
|
||||
protected Color getDefaultBorderColor() {
|
||||
return BORDER_COLOR;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user