Contol Windwo Update. Velocity Change implemented. FONT and some other Var and method needs to be implemented in the GUI class not in Menu Window

Update Velocity SLider to have the right Starting Value.
This commit is contained in:
Noah
2021-11-30 10:47:44 +01:00
parent 319ca9e306
commit 359b153460
4 changed files with 15 additions and 6 deletions
+4
View File
@@ -327,6 +327,10 @@ public class Control {
clock.setVelocity(velocity); clock.setVelocity(velocity);
} }
public int getVelocity() {
return clock.getVelocity();
}
public boolean isMouseLocked() { public boolean isMouseLocked() {
return mouseLocked; return mouseLocked;
} }
+5 -4
View File
@@ -97,7 +97,7 @@ public class ControlWindow {
velocitySlider.setBounds(120, 110, 230, 20); velocitySlider.setBounds(120, 110, 230, 20);
velocitySlider.setFont(text); velocitySlider.setFont(text);
velocitySlider.setForeground(Color.decode("#121212")); velocitySlider.setForeground(Color.decode("#121212"));
velocitySlider.setValue(6); velocitySlider.setValue(gui.getVelocity());
velocitySlider.addChangeListener(new ChangeListener() { velocitySlider.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
@@ -117,7 +117,7 @@ public class ControlWindow {
velocitySliderName.setForeground(Color.decode("#121212")); velocitySliderName.setForeground(Color.decode("#121212"));
velocitySliderName.setVisible(true); velocitySliderName.setVisible(true);
velocitySliderLabel = new JTextField("6"); velocitySliderLabel = new JTextField(String.valueOf(gui.getVelocity()));
velocitySliderLabel.setBackground(null); velocitySliderLabel.setBackground(null);
velocitySliderLabel.setBorder(null); velocitySliderLabel.setBorder(null);
velocitySliderLabel.setBounds(120, 80, 200, 30); velocitySliderLabel.setBounds(120, 80, 200, 30);
@@ -251,7 +251,7 @@ public class ControlWindow {
private void initMultibleGenSkip(){ private void initMultibleGenSkip(){
multipleGenSkipButton = new JButton(); multipleGenSkipButton = new JButton();
multipleGenSkipButton.setText("Next Generation"); multipleGenSkipButton.setText("Next Generation");
multipleGenSkipButton.setFont(text); multipleGenSkipButton.setFont(text);
multipleGenSkipButton.setForeground(Color.decode("#121212")); multipleGenSkipButton.setForeground(Color.decode("#121212"));
multipleGenSkipButton.setBorderPainted(true); multipleGenSkipButton.setBorderPainted(true);
@@ -270,9 +270,10 @@ public class ControlWindow {
}); });
multipleGenSkipLable = new JTextField("6"); multipleGenSkipLable = new JTextField("6");
multipleGenSkipLable.setOpaque(false);
multipleGenSkipLable.setBackground(null); multipleGenSkipLable.setBackground(null);
multipleGenSkipLable.setBorder(null); multipleGenSkipLable.setBorder(null);
multipleGenSkipLable.setBounds(50, 450, 200, 30); multipleGenSkipLable.setBounds(160, 450, 50, 50);
multipleGenSkipLable.setFont(text); multipleGenSkipLable.setFont(text);
multipleGenSkipLable.setForeground(Color.decode("#121212")); multipleGenSkipLable.setForeground(Color.decode("#121212"));
multipleGenSkipLable.setVisible(true); multipleGenSkipLable.setVisible(true);
+4
View File
@@ -151,6 +151,10 @@ public class GUI {
gameWindow.updateTitle(gen); gameWindow.updateTitle(gen);
} }
public int getVelocity(){
return control.getVelocity();
}
//TODO: Delet this Methods. Those are shit. //TODO: Delet this Methods. Those are shit.
public void setVisibility(boolean value){ public void setVisibility(boolean value){
controlWindow.setVisibility(value); controlWindow.setVisibility(value);
+2 -2
View File
@@ -27,7 +27,7 @@ public class GameWindow {
this.title = title; this.title = title;
gameWindow = new JFrame(title + " Generation: " + gui.getGeneration()); gameWindow = new JFrame(title + " | Generation: " + gui.getGeneration());
gameWindow.getContentPane().setPreferredSize(new Dimension(width + (2 * offset), height + (2 * offset))); gameWindow.getContentPane().setPreferredSize(new Dimension(width + (2 * offset), height + (2 * offset)));
gameWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); gameWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
@@ -161,7 +161,7 @@ public class GameWindow {
return gameWindow.getLocation(); return gameWindow.getLocation();
} }
public void updateTitle(int gen){ public void updateTitle(int gen){
gameWindow.setTitle(title + " Generation: " + gen); gameWindow.setTitle(title + " | Generation: " + gen);
} }