mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
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);
|
g2d.drawLine(getWidth() / 2, getHeight() / 2, endX, endY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color[] colors = getRandomColors();
|
private Color[] colors = Utils.getRandomColors();
|
||||||
private static Color modifyColourALittleBit(Color colorIn) {
|
private static Color modifyColourALittleBit(Color colorIn) {
|
||||||
int r = colorIn.getRed();
|
int r = colorIn.getRed();
|
||||||
int g = colorIn.getGreen();
|
int g = colorIn.getGreen();
|
||||||
@ -180,15 +180,6 @@ public class AnalogClock extends JPanel {
|
|||||||
}
|
}
|
||||||
g2d.setColor(highlight ? Color.BLACK : FOREGROUND_COLOR);
|
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);
|
// System.out.println("square=" + square);
|
||||||
int dotNumber = (int) (donePercent * square);
|
int dotNumber = (int) (donePercent * square);
|
||||||
int y = dotNumber / side;
|
int y = dotNumber / side;
|
||||||
|
int yOrig = y;
|
||||||
int x = dotNumber - y * side;
|
int x = dotNumber - y * side;
|
||||||
|
|
||||||
// System.out.println("dotNumber=" + dotNumber);
|
// System.out.println("dotNumber=" + dotNumber);
|
||||||
@ -128,6 +129,17 @@ public class ProgressSquare extends JPanel {
|
|||||||
}
|
}
|
||||||
g2d.setColor(FOREGROUND_COLOR);
|
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;
|
package rvc.timecalc;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@ -55,4 +56,14 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return new String(Files.readAllBytes(file.toPath()));
|
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