Skip to content

Commit bbd0780

Browse files
committed
Changed Window size, added JSlider
1 parent d83aa08 commit bbd0780

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/com/example/algorithmvisualizer/AlgVisualizer.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222

2323
public class AlgVisualizer implements ActionListener {
2424

25-
private final int CONTENT_WIDTH = 800;
26-
private final int CONTENT_HEIGHT = 860;
27-
private final int ARR_DISPLAY_HEIGHT = 800;
28-
private final String[] SIZE_OPTIONS = { "10", "50", "100", "200", "400", "800" }; // array size options
25+
private final int CONTENT_WIDTH = 900;
26+
private final int CONTENT_HEIGHT = 960;
27+
private final int ARR_DISPLAY_HEIGHT = 900;
28+
private final String[] SIZE_OPTIONS = { "10", "50", "100", "300", "450", "900" }; // array size options
2929
private int n;
3030
private int numSwaps;
3131
private int delay;
@@ -50,6 +50,7 @@ public class AlgVisualizer implements ActionListener {
5050
private JButton mergeButton;
5151
private JButton quickButton;
5252
private JComboBox<String> sizeChanger;
53+
private JSlider FPSslider;
5354
private JLabel performanceLabel;
5455
private SwingWorker<Void, Integer[]> arrSort;
5556

@@ -135,6 +136,8 @@ public void initializeVars() {
135136
sizeChanger = new JComboBox<String>(SIZE_OPTIONS); // Pass the String containing all of the size options
136137
sizeChanger.addActionListener(this);
137138
sizeChanger.setBackground(Color.WHITE);
139+
140+
FPSslider = new JSlider(JSlider.HORIZONTAL, 0, 30, 15);
138141

139142
// Initialize the performance label and center it
140143

@@ -157,6 +160,7 @@ public void setFrame() {
157160
buttonPanel.add(mergeButton);
158161
buttonPanel.add(quickButton);
159162
buttonPanel.add(sizeChanger);
163+
buttonPanel.add(FPSslider);
160164

161165
// Initialize and make the frame visible
162166
frame = new JFrame("Algorithm Visualizer");
@@ -439,4 +443,12 @@ public int getDelay() {
439443
public void setDelay(int delay) {
440444
this.delay = delay;
441445
}
446+
447+
public JSlider getFPSslider() {
448+
return FPSslider;
449+
}
450+
451+
public void setFPSslider(JSlider fPSslider) {
452+
FPSslider = fPSslider;
453+
}
442454
}

0 commit comments

Comments
 (0)