質問編集履歴
5
MarkDown
test
CHANGED
File without changes
|
test
CHANGED
@@ -202,7 +202,7 @@
|
|
202
202
|
|
203
203
|
### 試したこと
|
204
204
|
|
205
|
-
|
205
|
+
ここからどんな文をどこに書き足したらいいのか分からなくなってしまいました。
|
206
206
|
|
207
207
|
|
208
208
|
|
4
MarkDown
test
CHANGED
File without changes
|
test
CHANGED
@@ -198,6 +198,8 @@
|
|
198
198
|
|
199
199
|
|
200
200
|
|
201
|
+
|
202
|
+
|
201
203
|
### 試したこと
|
202
204
|
|
203
205
|
|
3
MarkDown
test
CHANGED
File without changes
|
test
CHANGED
@@ -188,7 +188,9 @@
|
|
188
188
|
|
189
189
|
}
|
190
190
|
|
191
|
+
}
|
192
|
+
|
191
|
-
|
193
|
+
```
|
192
194
|
|
193
195
|
|
194
196
|
|
2
MarkDown
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,11 +12,151 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
```java
|
15
|
+
```java
|
16
|
+
|
16
|
-
|
17
|
+
import java.awt.BorderLayout;
|
18
|
+
|
19
|
+
import java.awt.EventQueue;
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
import javax.swing.JFrame;
|
24
|
+
|
25
|
+
import javax.swing.JPanel;
|
26
|
+
|
27
|
+
import javax.swing.border.EmptyBorder;
|
28
|
+
|
29
|
+
import javax.swing.JLabel;
|
30
|
+
|
31
|
+
import javax.swing.JTextField;
|
32
|
+
|
33
|
+
import javax.swing.JButton;
|
34
|
+
|
35
|
+
import java.awt.event.ActionListener;
|
36
|
+
|
37
|
+
import java.awt.event.ActionEvent;
|
38
|
+
|
39
|
+
import java.util.Random;
|
40
|
+
|
41
|
+
import javax.swing.SwingConstants;
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
public class Pre09 extends JFrame implements ActionListener {
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
private JPanel contentPane;
|
50
|
+
|
51
|
+
private JTextField txf;
|
52
|
+
|
53
|
+
private JLabel lbl;
|
54
|
+
|
55
|
+
private JLabel hnt;
|
56
|
+
|
57
|
+
Random random = new Random();
|
58
|
+
|
59
|
+
int ans = random.nextInt(100);
|
60
|
+
|
17
|
-
|
61
|
+
int count =0;
|
62
|
+
|
63
|
+
|
64
|
+
|
18
|
-
|
65
|
+
/**
|
66
|
+
|
67
|
+
* Launch the application.
|
68
|
+
|
69
|
+
*/
|
70
|
+
|
71
|
+
public static void main(String[] args) {
|
72
|
+
|
73
|
+
EventQueue.invokeLater(new Runnable() {
|
74
|
+
|
75
|
+
public void run() {
|
76
|
+
|
77
|
+
try {
|
78
|
+
|
79
|
+
Pre09 frame = new Pre09();
|
80
|
+
|
81
|
+
frame.setVisible(true);
|
82
|
+
|
83
|
+
} catch (Exception e) {
|
84
|
+
|
85
|
+
e.printStackTrace();
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
}
|
90
|
+
|
91
|
+
});
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
/**
|
98
|
+
|
99
|
+
* Create the frame.
|
100
|
+
|
101
|
+
*/
|
102
|
+
|
103
|
+
public Pre09() {
|
104
|
+
|
105
|
+
setTitle("プレ案");
|
106
|
+
|
107
|
+
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
108
|
+
|
109
|
+
setBounds(100, 100, 450, 220);
|
110
|
+
|
111
|
+
contentPane = new JPanel();
|
112
|
+
|
113
|
+
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
114
|
+
|
115
|
+
setContentPane(contentPane);
|
116
|
+
|
117
|
+
contentPane.setLayout(null);
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
lbl = new JLabel("0~100の数字を当ててね!");
|
122
|
+
|
123
|
+
lbl.setBounds(20, 24, 224, 13);
|
124
|
+
|
125
|
+
contentPane.add(lbl);
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
txf = new JTextField();
|
130
|
+
|
131
|
+
txf.setHorizontalAlignment(SwingConstants.RIGHT);
|
132
|
+
|
133
|
+
txf.addActionListener(this);
|
134
|
+
|
135
|
+
txf.setBounds(20, 62, 86, 19);
|
136
|
+
|
137
|
+
contentPane.add(txf);
|
138
|
+
|
139
|
+
txf.setColumns(10);
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
hnt = new JLabel("ヒント");
|
144
|
+
|
145
|
+
hnt.setBounds(20, 99, 147, 13);
|
146
|
+
|
147
|
+
contentPane.add(hnt);
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
JLabel gif = new JLabel("gif");
|
152
|
+
|
153
|
+
gif.setBounds(304, 65, 45, 13);
|
154
|
+
|
155
|
+
contentPane.add(gif);
|
156
|
+
|
157
|
+
}
|
158
|
+
|
19
|
-
public void actionPerformed(ActionEvent e) {
|
159
|
+
public void actionPerformed(ActionEvent e) {
|
20
160
|
|
21
161
|
int a =Integer.parseInt(txf.getText());
|
22
162
|
|
@@ -48,6 +188,10 @@
|
|
48
188
|
|
49
189
|
}
|
50
190
|
|
191
|
+
} ```
|
192
|
+
|
193
|
+
|
194
|
+
|
51
195
|
|
52
196
|
|
53
197
|
|
1
MarkDownのcode
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,9 +12,9 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
|
15
|
+
```java(言語名)
|
16
16
|
|
17
|
-
ソースコード
|
17
|
+
ソースコード ```
|
18
18
|
|
19
19
|
public void actionPerformed(ActionEvent e) {
|
20
20
|
|