Skip to content

Commit de91e83

Browse files
committed
Changed Default Colors
1 parent 2bde76d commit de91e83

File tree

5 files changed

+19
-3
lines changed

5 files changed

+19
-3
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.marcomsl.algorithmvisualization;
2+
3+
public class Mainj {
4+
5+
public static void main(String[] args) throws InterruptedException {
6+
AlgorithmVisualizer algorithmVisualizer = new AlgorithmVisualizer(BarColor.BLUE);
7+
algorithmVisualizer.bubblesort(50);
8+
}
9+
}

src/com/marcomsl/algorithmvisualization/ValueBars.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@ protected void paintComponent(Graphics g){
2626

2727
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
2828

29+
if(barColor == null){
30+
g.setColor(Color.BLACK);
31+
g.fillRect(0,0,size,size);
32+
}
33+
34+
2935
int x = 0;
30-
g.setColor(Color.WHITE);
3136

3237
for(int i = 0; i < array.length; i++){
3338
if(array[i] / 2<= 255 && array[i] / 2 >= 0){
@@ -39,11 +44,11 @@ protected void paintComponent(Graphics g){
3944
}else if(barColor == BarColor.BLUE){
4045
g.setColor(new Color(0,0,array[i] / 2));
4146
}else{
42-
g.setColor(Color.BLACK);
47+
g.setColor(Color.WHITE);
4348
}
4449

4550
}else{
46-
g.setColor(Color.BLACK);
51+
g.setColor(Color.WHITE);
4752
}
4853

4954
g.fillRect(x , size - 60 - array[i], 10, array[i] + 30);
@@ -53,6 +58,8 @@ protected void paintComponent(Graphics g){
5358

5459
g.setColor(Color.WHITE);
5560

61+
62+
5663
repaint();
5764
}
5865

0 commit comments

Comments
 (0)