ソース

Assignment6_1.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import
import
import
import
import
import
import
import
import
import
import
javafx.application.*;
javafx.scene.*;
javafx.scene.layout.*;
javafx.scene.control.*;
javafx.scene.paint.*;
javafx.scene.image.*;
javafx.scene.effect.*;
javafx.scene.text.*;
javafx.stage.*;
javafx.geometry.*;
javafx.collections.*;
/////////////////////////////////////////////////////////////
// 問1 以下のように情報処理技術者オンライン試験の選択画面…
/////////////////////////////////////////////////////////////
public class Assignment6_1 extends Application
{
public void start(Stage stage) throws Exception
{
// ピン画像を準備します
ImageView iv1 = new ImageView("Pin.gif");
ImageView iv2 = new ImageView("Pin.gif");
ImageView iv3 = new ImageView("Pin.gif");
// フォントを生成します
Font ft1 = new Font(24);
Font ft2 = new Font(24);
Font ft3 = new Font(24);
Font ft4 = new Font(24);
// ラベルを生成します
Label[] lb = new Label[4];
lb[0] = new Label("〔問1〕 正しい説明文を1つ選びなさい。");
lb[1] = new Label("1バイトは16ビットからなります。");
lb[2] = new Label("1Mバイトは1024バイトです。");
lb[3] = new Label("10進数の10は16進数でAです。");
// 各ラベルの設定を行います
lb[0].setFont(ft1);
lb[1].setFont(ft2);
lb[2].setFont(ft3);
lb[3].setFont(ft4);
lb[1].setGraphic(iv1);
lb[2].setGraphic(iv2);
lb[3].setGraphic(iv3);
lb[1].setCursor(Cursor.HAND);
lb[2].setCursor(Cursor.HAND);
lb[3].setCursor(Cursor.HAND);
lb[1].setTextFill(Color.GRAY);
lb[2].setTextFill(Color.GRAY);
lb[3].setTextFill(Color.GRAY);
// レイアウトHBoxを生成/設定します
VBox vb = new VBox();
ObservableList<Node> lst = vb.getChildren();
lst.addAll(lb);
vb.setPadding(new
new Insets(10));
vb.setSpacing(15);
// シーンを生成/設定します
Scene scene = new Scene(vb);
// ステージを設定します
stage.setScene(scene);
stage.setTitle("情報処理技術者オンライン試験");
// ステージを表示します
stage.show();
}
public static void main(String[] args)
{
launch(args);
}
}
Assignment6_2.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import
import
import
import
import
import
import
import
import
import
import
javafx.application.*;
javafx.scene.*;
javafx.scene.layout.*;
javafx.scene.control.*;
javafx.scene.paint.*;
javafx.scene.image.*;
javafx.scene.effect.*;
javafx.scene.text.*;
javafx.stage.*;
javafx.geometry.*;
javafx.collections.*;
/////////////////////////////////////////////////////////////
// 問2 秋の性格診断システムのアンケート画面を作成しま…
/////////////////////////////////////////////////////////////
public class Assignment6_2 extends Application
{
public void start(Stage stage) throws Exception
{
// 画像ファイル配列
String[] files = {"persimmon.png","maple1.png","maple2.png","maple3.png","maple4.png","click.png"};
// 画像を準備します
ImageView[] ivs = new ImageView[files.length];
for
for(int
int i=0; i<files.length; i++)
ivs[i] = new ImageView(files[i]);
// フォントを生成します
Font ft = new Font(24);
// ラベルを生成します
Label top = new Label("秋の性格診断です\n当てはまる項目にチェックしましょう");
// ラベルの設定を行います
top.setFont(ft);
top.setGraphic(ivs[0]);
top.setTextFill(Color.PINK);
// チェックボックスを生成します
CheckBox[] cbs = new CheckBox[4];
cbs[0] = new CheckBox("人と話すのが好きですか");
cbs[1] = new CheckBox("大ざっぱな人だと言われる");
cbs[2] = new CheckBox("まわりの人の意見に流されやすい");
cbs[3] = new CheckBox("ぶっつけ本番やアドリブは苦手");
// チェックボックスの設定を行います
for
for(int
int i=0; i<cbs.length; i++){
cbs[i].setFont(ft);
cbs[i].setGraphic(ivs[i+1]);
cbs[i].setTextFill(Color.ORANGE);
}
cbs[0].setContentDisplay(ContentDisplay.RIGHT);
cbs[2].setContentDisplay(ContentDisplay.RIGHT);
// ボタンを生成(設定も)します
Button ok = new Button("送信");
ok.setPrefSize(300,100);
ok.setFont(ft);
ok.setGraphic(ivs[5]);
// レイアウトHBoxを生成/設定します
VBox vb = new VBox();
ObservableList<Node> lst = vb.getChildren();
lst.add(top);
lst.addAll(cbs);
lst.add(ok);
vb.setPadding(new
new Insets(10));
vb.setSpacing(20);
vb.setBackground(null
null
null);
// シーンを生成/設定します
Scene scene = new Scene(vb);
scene.setFill(Color.BROWN);
// ステージを設定します
stage.setScene(scene);
stage.setTitle("秋の性格診断");
// ステージを表示します
stage.show();
}
public static void main(String[] args)
{
launch(args);
}
}