Skip to content

Commit a196efa

Browse files
committed
Fixed #23
1 parent 9a50732 commit a196efa

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/com/example/algorithmvisualizer/ArrDisplay.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void paintComponent(Graphics g) {
6565
// Iterate through the array and draw every index
6666
for (int i = 0; i < arr.length; i++) {
6767
int width = (int) (frame.getArrDisplayWidth() / (double) arr.length);
68-
int height = arr[i] * ((int) (frame.getArrDisplayHeight() / (double) arr.length));
68+
int height = arr[i] * ((int) (frame.getArrDisplayHeight() / arr.length));
6969
int x = i * width;
7070
int y = frame.getArrDisplayHeight() - height;
7171
if (i == swappedIndex1 && !algVisualizer.stopSort()) {

src/com/example/algorithmvisualizer/ContentWindow.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.awt.BorderLayout;
44
import java.awt.Color;
55
import java.awt.Dimension;
6+
import java.awt.GridBagLayout;
67
import java.awt.Toolkit;
78

89
import javax.swing.JButton;
@@ -46,7 +47,7 @@ public ContentWindow(AlgVisualizer algVisualizer) {
4647

4748
/*
4849
* Initializes all of the components that will be in this frame. Add the action
49-
* / change listeners and set their colors.
50+
* change listeners and set their colors.
5051
*/
5152
public void initComponents() {
5253

@@ -59,7 +60,7 @@ public void initComponents() {
5960
sizeOptions = new String[] { "10", "50", "100", "250", "500", "1000" };
6061
} else if (screenHeight < 1080.0) { // too small for original dimensions
6162
arrDisplayHeight = 500;
62-
contentWidth = arrDisplayHeight + 400;
63+
contentWidth = arrDisplayHeight + 500;
6364
sizeOptions = new String[] { "10", "50", "100", "250", "500" };
6465
} else { // Original dimensions (1080p)
6566
arrDisplayHeight = 900;
@@ -81,10 +82,9 @@ public void initComponents() {
8182
buttonPanel.setBackground(Color.DARK_GRAY);
8283

8384
arrPanel = new JPanel();
85+
arrPanel.setLayout(new GridBagLayout());
8486
arrPanel.setBackground(Color.DARK_GRAY);
8587
arrPanel.add(arrDisplay);
86-
//arrPanel.setPreferredSize(new Dimension(arrDisplayWidth, arrDisplayHeight));
87-
arrDisplay.setAlignmentX(0);
8888

8989
// Initialize all components and add action listeners
9090
resetButton = new JButton("Reset");

0 commit comments

Comments
 (0)