Skip to content

Commit d2f3efc

Browse files
Change font size
1 parent 73b9de4 commit d2f3efc

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

VisualizationOfSearchAlgorithms/src/view/MainWindow.java

Lines changed: 7 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.Font;
67
import java.awt.GridLayout;
78
import java.awt.event.ActionEvent;
89
import java.awt.event.ActionListener;
@@ -47,7 +48,7 @@ public class MainWindow extends JFrame {
4748
private JComboBox<String> algorithmSelection;
4849

4950
// TODO Edit here to display new algorithms
50-
String[] algorithmsToChoose = { "BFS", "DFS", "Best First Search", "A*", "Heuristic Dephth First Search" };
51+
String[] algorithmsToChoose = { "BFS (optimal Path)", "DFS", "Best First Search","Heuristic Dephth First Search" ,"A* (optimal Path)" };
5152
private MainWindow window;
5253
private int status = 0; // 0 before start of the animation, 1 after start of animation, 2 after end of
5354
// animation
@@ -72,6 +73,8 @@ public MainWindow(Controller controller) {
7273
this.startButton = new JButton("Start");
7374
this.algorithmSelection = new JComboBox<>(algorithmsToChoose);
7475

76+
int fontSize = 20;
77+
this.textArea.setFont(new Font(textArea.getFont().getFontName(),textArea.getFont().getStyle() , fontSize));
7578
// adding UI components to the MainWindow
7679
this.setLayout(new BorderLayout());
7780

@@ -155,7 +158,7 @@ public void actionPerformed(ActionEvent e) {
155158
String algorithm = (String) algorithmSelection.getSelectedItem();
156159
Grid grid = controller.getCurrentGrid();
157160

158-
if (algorithm == "BFS") {
161+
if (algorithm == "BFS (optimal Path)") {
159162
displayMessage("Starting path calculation...");
160163
Queue<AnimationInstruction> animationQueue = SearchAlgorithms.BFS(grid, grid.getStartCell(),
161164
grid.getEndCell());
@@ -177,7 +180,7 @@ public void actionPerformed(ActionEvent e) {
177180
animationThread.start();
178181
}
179182

180-
if (algorithm == "A*") {
183+
if (algorithm == "A* (optimal Path)") {
181184
displayMessage("Starting path calculation...");
182185
Queue<AnimationInstruction> animationQueue = SearchAlgorithms.AStar(grid, grid.getStartCell(),
183186
grid.getEndCell());
@@ -255,7 +258,7 @@ public void actionPerformed(ActionEvent e) {
255258
@Override
256259
public void stateChanged(ChangeEvent e) {
257260
controller.applyChanges(-1, animationSpeedSlider.getValue(), null);
258-
displayMessage("Set the time in between animation steps to " + animationSpeedSlider.getValue() + " ms");
261+
displayMessage("Stepsize: " + animationSpeedSlider.getValue() + " ms");
259262

260263
}
261264
});

0 commit comments

Comments
 (0)