MainPanel prototype
This commit is contained in:
@@ -118,8 +118,11 @@ public class Sample extends DeviceBase {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int getNormalDrawSize() {
|
||||
return (int)((getSize().getWidth() / getPuck().getSize().getWidth()) * getPuck().getDrawSize());
|
||||
}
|
||||
int getDrawSize() {
|
||||
int ret = (int)((getSize().getWidth() / getPuck().getSize().getWidth()) * getPuck().getDrawSize());
|
||||
int ret = getNormalDrawSize();
|
||||
if (isSelected()) {
|
||||
ret += 2;
|
||||
}
|
||||
@@ -138,11 +141,12 @@ public class Sample extends DeviceBase {
|
||||
|
||||
|
||||
Color getLabelColor() {
|
||||
return Color.BLACK;
|
||||
return Color.DARK_GRAY;
|
||||
}
|
||||
|
||||
Font getLabelFont() {
|
||||
return new Font("Times New Roman", Font.PLAIN, 9);
|
||||
//return new Font("Times New Roman", Font.PLAIN, 8);
|
||||
return new Font("Courier New", Font.PLAIN, 8);
|
||||
}
|
||||
|
||||
Point getLabelPosition(String text, Graphics g) {
|
||||
@@ -170,10 +174,12 @@ public class Sample extends DeviceBase {
|
||||
g.drawOval(position.x - size / 2, position.y - size / 2, size, size);
|
||||
|
||||
String text = String.valueOf(index + 1);
|
||||
Point labelPosition = getLabelPosition(text, g);
|
||||
g.setColor(getLabelColor());
|
||||
g.setFont(getLabelFont());
|
||||
g.drawString(text, labelPosition.x, labelPosition.y);
|
||||
Point labelPosition = getLabelPosition(text, g);
|
||||
if (getNormalDrawSize()>10){
|
||||
g.setColor(getLabelColor());
|
||||
g.setFont(getLabelFont());
|
||||
g.drawString(text, labelPosition.x, labelPosition.y);
|
||||
}
|
||||
g.setPaintMode();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user