質問編集履歴
5
MarkDown
title
CHANGED
File without changes
|
body
CHANGED
@@ -100,7 +100,7 @@
|
|
100
100
|
|
101
101
|
|
102
102
|
### 試したこと
|
103
|
+
ここからどんな文をどこに書き足したらいいのか分からなくなってしまいました。
|
103
104
|
|
104
105
|
|
105
|
-
|
106
106
|
### 補足情報(FW/ツールのバージョンなど)
|
4
MarkDown
title
CHANGED
File without changes
|
body
CHANGED
@@ -98,6 +98,7 @@
|
|
98
98
|
|
99
99
|
|
100
100
|
|
101
|
+
|
101
102
|
### 試したこと
|
102
103
|
|
103
104
|
|
3
MarkDown
title
CHANGED
File without changes
|
body
CHANGED
@@ -93,7 +93,8 @@
|
|
93
93
|
lbl.setText("Game Over! 正解は"+ans+"でした!");
|
94
94
|
}
|
95
95
|
}
|
96
|
+
}
|
96
|
-
|
97
|
+
```
|
97
98
|
|
98
99
|
|
99
100
|
|
2
MarkDown
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,9 +5,79 @@
|
|
5
5
|
|
6
6
|
### 該当のソースコード
|
7
7
|
|
8
|
-
```java
|
8
|
+
```java
|
9
|
+
import java.awt.BorderLayout;
|
10
|
+
import java.awt.EventQueue;
|
11
|
+
|
12
|
+
import javax.swing.JFrame;
|
13
|
+
import javax.swing.JPanel;
|
14
|
+
import javax.swing.border.EmptyBorder;
|
15
|
+
import javax.swing.JLabel;
|
16
|
+
import javax.swing.JTextField;
|
17
|
+
import javax.swing.JButton;
|
18
|
+
import java.awt.event.ActionListener;
|
19
|
+
import java.awt.event.ActionEvent;
|
20
|
+
import java.util.Random;
|
21
|
+
import javax.swing.SwingConstants;
|
22
|
+
|
23
|
+
public class Pre09 extends JFrame implements ActionListener {
|
24
|
+
|
25
|
+
private JPanel contentPane;
|
26
|
+
private JTextField txf;
|
27
|
+
private JLabel lbl;
|
28
|
+
private JLabel hnt;
|
29
|
+
Random random = new Random();
|
30
|
+
int ans = random.nextInt(100);
|
9
|
-
|
31
|
+
int count =0;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Launch the application.
|
35
|
+
*/
|
36
|
+
public static void main(String[] args) {
|
37
|
+
EventQueue.invokeLater(new Runnable() {
|
38
|
+
public void run() {
|
39
|
+
try {
|
40
|
+
Pre09 frame = new Pre09();
|
41
|
+
frame.setVisible(true);
|
42
|
+
} catch (Exception e) {
|
43
|
+
e.printStackTrace();
|
44
|
+
}
|
45
|
+
}
|
46
|
+
});
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Create the frame.
|
51
|
+
*/
|
52
|
+
public Pre09() {
|
53
|
+
setTitle("プレ案");
|
54
|
+
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
55
|
+
setBounds(100, 100, 450, 220);
|
56
|
+
contentPane = new JPanel();
|
57
|
+
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
58
|
+
setContentPane(contentPane);
|
59
|
+
contentPane.setLayout(null);
|
60
|
+
|
61
|
+
lbl = new JLabel("0~100の数字を当ててね!");
|
62
|
+
lbl.setBounds(20, 24, 224, 13);
|
63
|
+
contentPane.add(lbl);
|
64
|
+
|
65
|
+
txf = new JTextField();
|
66
|
+
txf.setHorizontalAlignment(SwingConstants.RIGHT);
|
67
|
+
txf.addActionListener(this);
|
68
|
+
txf.setBounds(20, 62, 86, 19);
|
69
|
+
contentPane.add(txf);
|
70
|
+
txf.setColumns(10);
|
71
|
+
|
72
|
+
hnt = new JLabel("ヒント");
|
73
|
+
hnt.setBounds(20, 99, 147, 13);
|
74
|
+
contentPane.add(hnt);
|
75
|
+
|
76
|
+
JLabel gif = new JLabel("gif");
|
77
|
+
gif.setBounds(304, 65, 45, 13);
|
78
|
+
contentPane.add(gif);
|
79
|
+
}
|
10
|
-
public void actionPerformed(ActionEvent e) {
|
80
|
+
public void actionPerformed(ActionEvent e) {
|
11
81
|
int a =Integer.parseInt(txf.getText());
|
12
82
|
|
13
83
|
if(e.getSource()==txf)
|
@@ -23,8 +93,10 @@
|
|
23
93
|
lbl.setText("Game Over! 正解は"+ans+"でした!");
|
24
94
|
}
|
25
95
|
}
|
96
|
+
} ```
|
26
97
|
|
27
98
|
|
99
|
+
|
28
100
|
### 試したこと
|
29
101
|
|
30
102
|
|
1
MarkDownのcode
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
|
6
6
|
### 該当のソースコード
|
7
7
|
|
8
|
-
|
8
|
+
```java(言語名)
|
9
|
-
ソースコード
|
9
|
+
ソースコード ```
|
10
10
|
public void actionPerformed(ActionEvent e) {
|
11
11
|
int a =Integer.parseInt(txf.getText());
|
12
12
|
|