Skip to content

Commit 96034fd

Browse files
committed
JSwing added and installable available
1 parent ff150fc commit 96034fd

21 files changed

+452
-159
lines changed

Nunito-Regular.ttf

129 KB
Binary file not shown.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
1515
> ### A Few Changes
1616
>
17-
> As I am an amateur coder, I made some small compromises (doesn't affect the overall game). First, I display only the number of double letters and not show them in the word itself; this makes the game a little more difficult. To counter it, I added 1 more try so you get a total of 7 tries.
17+
> As I am an amateur coder, I made some small compromises (doesn't affect the overall game). First, I display only the number of double letters and not show them in the word itself; this makes the game a little more difficult. To counter it, I added 1 more try so you get a total of 7 tries. Also, when 2 of the same letters in a guess are the same, there could be only be one depending on the display of the multiple letters.

bin/wordle/Calculate.class

226 Bytes
Binary file not shown.

bin/wordle/ErrorOne$1.class

925 Bytes
Binary file not shown.

bin/wordle/ErrorOne.class

1.62 KB
Binary file not shown.

bin/wordle/ErrorTwo$1.class

925 Bytes
Binary file not shown.

bin/wordle/ErrorTwo.class

1.62 KB
Binary file not shown.

bin/wordle/Fail$1.class

662 Bytes
Binary file not shown.

bin/wordle/Fail.class

1.72 KB
Binary file not shown.

bin/wordle/Main.class

3.08 KB
Binary file not shown.

bin/wordle/Success$1.class

680 Bytes
Binary file not shown.

bin/wordle/Success.class

1.9 KB
Binary file not shown.

src/wordle/Calculate.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
public class Calculate {
44

55
public static String[] resultArray = {"", "", "", "", "", ""};
6-
public static final String TEXT_YELLOW = "\u001B[33m";
7-
public static final String TEXT_GREEN = "\u001B[32m";
8-
public static final String TEXT_RESET = "\u001B[0m";
6+
public static final String TEXT_YELLOW = "<html> <font color = 'yellow'>";
7+
public static final String TEXT_GREEN = "<html> <font color = 'green'>";
8+
public static final String TEXT_NORMAL = "<html> <font color = '#F5F5DC'>";
9+
public static final String TEXT_RESET = "</font> <html>";
910

1011
public static String result(String[] wordle, String[] attempt) {
1112

@@ -26,7 +27,7 @@ public static String result(String[] wordle, String[] attempt) {
2627
!attempt[0].equals(wordle[3]) &&
2728
!attempt[0].equals(wordle[4])) {
2829

29-
resultArray[0] = attempt[0];
30+
resultArray[0] = TEXT_NORMAL + attempt[0] + TEXT_RESET;
3031

3132
}
3233

@@ -47,7 +48,7 @@ public static String result(String[] wordle, String[] attempt) {
4748
!attempt[1].equals(wordle[3]) &&
4849
!attempt[1].equals(wordle[4])) {
4950

50-
resultArray[1] = attempt[1];
51+
resultArray[1] = TEXT_NORMAL + attempt[1] + TEXT_RESET;
5152

5253
}
5354

@@ -68,7 +69,7 @@ public static String result(String[] wordle, String[] attempt) {
6869
!attempt[2].equals(wordle[3]) &&
6970
!attempt[2].equals(wordle[4])) {
7071

71-
resultArray[2] = attempt[2];
72+
resultArray[2] = TEXT_NORMAL + attempt[2] + TEXT_RESET;
7273

7374
}
7475

@@ -89,7 +90,7 @@ public static String result(String[] wordle, String[] attempt) {
8990
!attempt[3].equals(wordle[3]) &&
9091
!attempt[3].equals(wordle[4])) {
9192

92-
resultArray[3] = attempt[3];
93+
resultArray[3] = TEXT_NORMAL + attempt[3] + TEXT_RESET;
9394

9495
}
9596

@@ -110,7 +111,7 @@ public static String result(String[] wordle, String[] attempt) {
110111
!attempt[4].equals(wordle[3]) &&
111112
!attempt[4].equals(wordle[4])) {
112113

113-
resultArray[4] = attempt[4];
114+
resultArray[4] = TEXT_NORMAL + attempt[4] + TEXT_RESET;
114115

115116
}
116117

src/wordle/ErrorOne.java

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package wordle;
2+
3+
import java.awt.Color;
4+
import java.awt.event.ActionEvent;
5+
import java.awt.event.ActionListener;
6+
import javax.swing.*;
7+
8+
public class ErrorOne {
9+
10+
public ErrorOne() {
11+
12+
JFrame error1 = new JFrame("Error!");
13+
JButton proceed = new JButton("Continue");
14+
proceed.setBackground(Color.decode("#FF9532"));
15+
proceed.setFont(Main.textFont);
16+
error1.getContentPane().setBackground(Color.decode("#cf8699"));
17+
JLabel error1Label = new JLabel("Word is not 5-letters long, please try again");
18+
error1Label.setFont(Main.textFont);
19+
error1Label.setForeground(Color.decode("#F5F5DC"));
20+
21+
proceed.addActionListener(new ActionListener() {
22+
23+
@Override
24+
public void actionPerformed(ActionEvent e) {
25+
26+
error1.setVisible(false);
27+
Main.guessBox.setText(null);
28+
29+
}
30+
});
31+
32+
proceed.setBounds(125, 125, 150, 25);
33+
error1Label.setBounds(50, 30, 250, 30);
34+
error1.add(error1Label);
35+
error1.add(proceed);
36+
37+
38+
error1.setSize(375, 225);
39+
error1.setLayout(null);
40+
error1.setVisible(true);
41+
42+
}
43+
44+
public static void message() {
45+
46+
new ErrorOne();
47+
48+
}
49+
50+
}

src/wordle/ErrorTwo.java

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package wordle;
2+
3+
import java.awt.Color;
4+
import java.awt.event.ActionEvent;
5+
import java.awt.event.ActionListener;
6+
7+
import javax.swing.JButton;
8+
import javax.swing.JFrame;
9+
import javax.swing.JLabel;
10+
11+
public class ErrorTwo {
12+
13+
public ErrorTwo() {
14+
JFrame error2 = new JFrame("Error!");
15+
JButton proceed = new JButton("Continue");
16+
proceed.setBackground(Color.decode("#FF9532"));
17+
proceed.setFont(Main.textFont);
18+
error2.getContentPane().setBackground(Color.decode("#cf8699"));
19+
JLabel error1Label = new JLabel("Word is not in the dictionary, please try again");
20+
error1Label.setFont(Main.textFont);
21+
error1Label.setForeground(Color.decode("#F5F5DC"));
22+
23+
proceed.addActionListener(new ActionListener() {
24+
25+
@Override
26+
public void actionPerformed(ActionEvent e) {
27+
28+
error2.setVisible(false);
29+
Main.guessBox.setText(null);
30+
31+
}
32+
});
33+
34+
proceed.setBounds(125, 125, 150, 25);
35+
error1Label.setBounds(50, 30, 250, 30);
36+
error2.add(error1Label);
37+
error2.add(proceed);
38+
39+
40+
error2.setSize(375, 225);
41+
error2.setLayout(null);
42+
error2.setVisible(true);
43+
}
44+
45+
public static void message() {
46+
47+
new ErrorTwo();
48+
49+
}
50+
51+
}

src/wordle/Fail.java

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package wordle;
2+
3+
import java.awt.Color;
4+
import java.awt.event.ActionEvent;
5+
import java.awt.event.ActionListener;
6+
7+
import javax.swing.JButton;
8+
import javax.swing.JFrame;
9+
import javax.swing.JLabel;
10+
11+
public class Fail {
12+
13+
public Fail() {
14+
15+
JFrame failure = new JFrame("Oh No!");
16+
JButton proceed = new JButton("Exit");
17+
proceed.setBackground(Color.decode("#FF9532"));
18+
proceed.setFont(Main.textFont);
19+
failure.getContentPane().setBackground(Color.decode("#cf8699"));
20+
JLabel error1Label = new JLabel("Oh No! You failed the wordle! The wordle was " +
21+
Main.wordle + ".");
22+
error1Label.setFont(Main.textFont);
23+
error1Label.setForeground(Color.decode("#F5F5DC"));
24+
25+
proceed.addActionListener(new ActionListener() {
26+
27+
@Override
28+
public void actionPerformed(ActionEvent e) {
29+
30+
System.exit(0);
31+
32+
}
33+
});
34+
35+
proceed.setBounds(125, 125, 150, 25);
36+
error1Label.setBounds(50, 30, 250, 30);
37+
failure.add(error1Label);
38+
failure.add(proceed);
39+
40+
41+
failure.setSize(375, 225);
42+
failure.setLayout(null);
43+
failure.setVisible(true);
44+
45+
}
46+
47+
}

0 commit comments

Comments
 (0)