New improvements
This commit is contained in:
parent
7da0e72dc7
commit
30356e2b5d
@ -122,7 +122,7 @@ public class AnalogClock extends JPanel {
|
||||
g2d.drawLine(getWidth() / 2, getHeight() / 2, endX, endY);
|
||||
}
|
||||
|
||||
private Color[] colors = getRandomColors();
|
||||
private Color[] colors = Utils.getRandomColors();
|
||||
private static Color modifyColourALittleBit(Color colorIn) {
|
||||
int r = colorIn.getRed();
|
||||
int g = colorIn.getGreen();
|
||||
@ -180,15 +180,6 @@ public class AnalogClock extends JPanel {
|
||||
}
|
||||
g2d.setColor(highlight ? Color.BLACK : FOREGROUND_COLOR);
|
||||
}
|
||||
private Color[] getRandomColors() {
|
||||
Color[] result = new Color[12];
|
||||
for(int i = 0; i<12; i++) {
|
||||
result[i] = getRandomColor();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private Color getRandomColor() {
|
||||
return new Color(((int)(Math.random() * 256)),((int)(Math.random() * 256)),((int)(Math.random() * 256)));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -96,6 +96,7 @@ public class ProgressSquare extends JPanel {
|
||||
// System.out.println("square=" + square);
|
||||
int dotNumber = (int) (donePercent * square);
|
||||
int y = dotNumber / side;
|
||||
int yOrig = y;
|
||||
int x = dotNumber - y * side;
|
||||
|
||||
// System.out.println("dotNumber=" + dotNumber);
|
||||
@ -128,6 +129,17 @@ public class ProgressSquare extends JPanel {
|
||||
}
|
||||
g2d.setColor(FOREGROUND_COLOR);
|
||||
}
|
||||
// int nextX = (int) (Math.random() * 200);
|
||||
// int nextY = (int) (Math.random() * (yOrig- 1));
|
||||
// for(int i = 0;i< yOrig / 8;i++) {
|
||||
// g2d.setColor(Color.GRAY/*Utils.getRandomColor()*/);
|
||||
// g2d.drawLine(x, y, nextX, nextY);
|
||||
// x = nextX;
|
||||
// y = nextY;
|
||||
// nextX = (int) (Math.random() * 200);
|
||||
// nextY = (int) (Math.random() * (yOrig - 1));
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package rvc.timecalc;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@ -55,4 +56,14 @@ public class Utils {
|
||||
}
|
||||
return new String(Files.readAllBytes(file.toPath()));
|
||||
}
|
||||
public static Color[] getRandomColors() {
|
||||
Color[] result = new Color[12];
|
||||
for(int i = 0; i<12; i++) {
|
||||
result[i] = getRandomColor();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public static Color getRandomColor() {
|
||||
return new Color(((int)(Math.random() * 256)),((int)(Math.random() * 256)),((int)(Math.random() * 256)));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user