質問編集履歴
1
ソースの追加、タグの編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,8 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
+
※まだプロトタイプ実装途中のため、addActionListenerが一部thisのままになっています。
|
26
|
+
|
25
27
|
```java
|
26
28
|
|
27
29
|
package test;
|
@@ -162,6 +164,226 @@
|
|
162
164
|
|
163
165
|
|
164
166
|
|
167
|
+
```java
|
168
|
+
|
169
|
+
package test;
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
import java.awt.Font;
|
174
|
+
|
175
|
+
import java.awt.event.ActionEvent;
|
176
|
+
|
177
|
+
import java.awt.event.ActionListener;
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
import javax.swing.BoxLayout;
|
182
|
+
|
183
|
+
import javax.swing.JButton;
|
184
|
+
|
185
|
+
import javax.swing.JFrame;
|
186
|
+
|
187
|
+
import javax.swing.JLabel;
|
188
|
+
|
189
|
+
import javax.swing.JPanel;
|
190
|
+
|
191
|
+
import javax.swing.JTextField;
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
class MenuListener implements ActionListener {
|
196
|
+
|
197
|
+
private JFrame f;
|
198
|
+
|
199
|
+
public MenuListener(JFrame f) {
|
200
|
+
|
201
|
+
this.f=f;
|
202
|
+
|
203
|
+
}
|
204
|
+
|
205
|
+
public void actionPerformed(ActionEvent e) {
|
206
|
+
|
207
|
+
// TODO 自動生成されたメソッド・スタブ
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
f.setTitle("トランプコレクション");
|
212
|
+
|
213
|
+
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
f.setSize(1280, 720);
|
218
|
+
|
219
|
+
f.setLocationRelativeTo(null);
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
f.getContentPane().add(getPanel());
|
224
|
+
|
225
|
+
f.setVisible(true);
|
226
|
+
|
227
|
+
}
|
228
|
+
|
229
|
+
private JPanel getPanel() {
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
JLabel title = new JLabel("トランプコレクション");
|
234
|
+
|
235
|
+
JPanel panel=new JPanel();
|
236
|
+
|
237
|
+
JButton button=new JButton();
|
238
|
+
|
239
|
+
title.setLayout(new BoxLayout(title, BoxLayout.PAGE_AXIS));
|
240
|
+
|
241
|
+
title.setFont(new Font("MS ゴシック", Font.PLAIN, 60));
|
242
|
+
|
243
|
+
title.setBounds(350, 100, 1600, 100);
|
244
|
+
|
245
|
+
panel.add(title);
|
246
|
+
|
247
|
+
// panel.add(new JLabel("トランプコレクション"));
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
button = new JButton("神経衰弱");
|
252
|
+
|
253
|
+
button.setSize(120, 50);
|
254
|
+
|
255
|
+
button.setLocation(300, 300);
|
256
|
+
|
257
|
+
button.setActionCommand("3");
|
258
|
+
|
259
|
+
button.addActionListener(this);
|
260
|
+
|
261
|
+
JButton button2 = new JButton("ポーカー");
|
262
|
+
|
263
|
+
button2.setSize(120, 50);
|
264
|
+
|
265
|
+
button2.setLocation(300, 400);
|
266
|
+
|
267
|
+
button2.setActionCommand("3");
|
268
|
+
|
269
|
+
button2.addActionListener(this);
|
270
|
+
|
271
|
+
JButton button3 = new JButton("ソリティア");
|
272
|
+
|
273
|
+
button3.setSize(120, 50);
|
274
|
+
|
275
|
+
button3.setLocation(300, 500);
|
276
|
+
|
277
|
+
button3.setActionCommand("3");
|
278
|
+
|
279
|
+
button3.addActionListener(this);
|
280
|
+
|
281
|
+
JButton button4 = new JButton("タイトルに戻る");
|
282
|
+
|
283
|
+
button4.setSize(150, 50);
|
284
|
+
|
285
|
+
button4.setLocation(550, 600);
|
286
|
+
|
287
|
+
button4.addActionListener(this);
|
288
|
+
|
289
|
+
JTextField txt = new JTextField("基本自分の記憶力が勝負を左右するゲームです。");
|
290
|
+
|
291
|
+
txt.setSize(600, 50);
|
292
|
+
|
293
|
+
txt.setLocation(500, 300);
|
294
|
+
|
295
|
+
txt.setEditable(false);
|
296
|
+
|
297
|
+
JTextField ptxt = new JTextField("5枚の手札の組み合わせで、カードの強さをきそうトランプゲームです。");
|
298
|
+
|
299
|
+
ptxt.setSize(600, 50);
|
300
|
+
|
301
|
+
ptxt.setLocation(500, 400);
|
302
|
+
|
303
|
+
ptxt.setEditable(false);
|
304
|
+
|
305
|
+
JTextField stxt = new JTextField("並べられたカードを数字の順番で列を移動させながら、同じマークのAからKの順番に並べかえるゲームです。");
|
306
|
+
|
307
|
+
stxt.setSize(600, 50);
|
308
|
+
|
309
|
+
stxt.setLocation(500, 500);
|
310
|
+
|
311
|
+
stxt.setEditable(false);
|
312
|
+
|
313
|
+
JTextField sp = new JTextField(" ");
|
314
|
+
|
315
|
+
sp.setEditable(false);
|
316
|
+
|
317
|
+
// txt.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
318
|
+
|
319
|
+
panel.removeAll();
|
320
|
+
|
321
|
+
panel.add(title);
|
322
|
+
|
323
|
+
panel.add(button);
|
324
|
+
|
325
|
+
panel.add(button2);
|
326
|
+
|
327
|
+
panel.add(button3);
|
328
|
+
|
329
|
+
panel.add(button4);
|
330
|
+
|
331
|
+
panel.add(txt);
|
332
|
+
|
333
|
+
panel.add(ptxt);
|
334
|
+
|
335
|
+
panel.add(stxt);
|
336
|
+
|
337
|
+
panel.add(sp);
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
return panel;
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
}
|
346
|
+
|
347
|
+
}
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
```
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
```java
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
package test;
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
import java.awt.event.ActionEvent;
|
364
|
+
|
365
|
+
import java.awt.event.ActionListener;
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
class ExitListener implements ActionListener {
|
370
|
+
|
371
|
+
@Override
|
372
|
+
|
373
|
+
public void actionPerformed(ActionEvent e) {
|
374
|
+
|
375
|
+
System.exit(0);
|
376
|
+
|
377
|
+
}
|
378
|
+
|
379
|
+
}
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
```
|
384
|
+
|
385
|
+
|
386
|
+
|
165
387
|
### 試したこと
|
166
388
|
|
167
389
|
|