Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9396ba7cb5 | ||
|
|
b674e441f3 | ||
|
|
93543f744b | ||
|
|
ae7e77a2cf |
13
.classpath
13
.classpath
@@ -6,12 +6,6 @@
|
|||||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="bin/main" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="main"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/java">
|
<classpathentry kind="src" output="bin/test" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="gradle_scope" value="test"/>
|
<attribute name="gradle_scope" value="test"/>
|
||||||
@@ -19,13 +13,6 @@
|
|||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="test"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="test"/>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||||
<classpathentry kind="output" path="bin/default"/>
|
<classpathentry kind="output" path="bin/default"/>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
arguments=--init-script /home/libkyy/.cache/jdtls/config/org.eclipse.osgi/51/0/.cp/gradle/init/init.gradle
|
arguments=--init-script /home/linly/.cache/jdtls/config/org.eclipse.osgi/52/0/.cp/gradle/init/init.gradle
|
||||||
auto.sync=false
|
auto.sync=false
|
||||||
build.scans.enabled=false
|
build.scans.enabled=false
|
||||||
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
|
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ public class Sign extends JFrame {
|
|||||||
|
|
||||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
this.setLayout(new GridLayout(4, 1));
|
this.setLayout(new GridLayout(4, 1));
|
||||||
this.setPreferredSize(new Dimension(300, 300));
|
this.setPreferredSize(new Dimension(600, 600));
|
||||||
|
this.setSize(175, 600);
|
||||||
this.setLocationRelativeTo(null);
|
this.setLocationRelativeTo(null);
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
this.getContentPane().setBackground(Color.BLACK);
|
this.getContentPane().setBackground(Color.BLACK);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class Traffic {
|
|||||||
public static boolean pressed = false;
|
public static boolean pressed = false;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
// Countdowns
|
||||||
// Lights
|
// Lights
|
||||||
Redlight redlight = new Redlight();
|
Redlight redlight = new Redlight();
|
||||||
Yellowlight yellowlight = new Yellowlight();
|
Yellowlight yellowlight = new Yellowlight();
|
||||||
@@ -19,9 +20,9 @@ public class Traffic {
|
|||||||
Traffic_Sign.add(greenlight, 2);
|
Traffic_Sign.add(greenlight, 2);
|
||||||
|
|
||||||
// Threads
|
// Threads
|
||||||
Thread red_thread = new Thread(redlight);
|
// Thread red_thread = new Thread(redlight);
|
||||||
Thread yellow_thread = new Thread(yellowlight);
|
// Thread yellow_thread = new Thread(yellowlight);
|
||||||
Thread green_thread = new Thread(greenlight);
|
// Thread green_thread = new Thread(greenlight);
|
||||||
// Button
|
// Button
|
||||||
JButton StopButton = new JButton("STOP");
|
JButton StopButton = new JButton("STOP");
|
||||||
StopButton.addActionListener(
|
StopButton.addActionListener(
|
||||||
@@ -31,12 +32,33 @@ public class Traffic {
|
|||||||
Traffic_Sign.add(StopButton, 3);
|
Traffic_Sign.add(StopButton, 3);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
red_thread.run();
|
Thread red_thread = new Thread(redlight);
|
||||||
if (pressed) break;
|
Thread yellow_thread = new Thread(yellowlight);
|
||||||
yellow_thread.run();
|
Thread green_thread = new Thread(greenlight);
|
||||||
if (pressed) break;
|
red_thread.start();
|
||||||
green_thread.run();
|
try {
|
||||||
if (pressed) break;
|
red_thread.join();
|
||||||
|
} catch (InterruptedException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
if (pressed)
|
||||||
|
break;
|
||||||
|
yellow_thread.start();
|
||||||
|
try {
|
||||||
|
yellow_thread.join();
|
||||||
|
} catch (InterruptedException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
if (pressed)
|
||||||
|
break;
|
||||||
|
green_thread.start();
|
||||||
|
try {
|
||||||
|
green_thread.join();
|
||||||
|
} catch (InterruptedException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
if (pressed)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ import java.awt.Color;
|
|||||||
public class Yellowlight extends Light {
|
public class Yellowlight extends Light {
|
||||||
|
|
||||||
Yellowlight() {
|
Yellowlight() {
|
||||||
super(5, Color.YELLOW);
|
super(2, Color.YELLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user