質問編集履歴

1

配列クラスを導入(そして失敗)

2018/08/28 03:10

投稿

kairi.sakusaku
kairi.sakusaku

スコア6

test CHANGED
File without changes
test CHANGED
@@ -12,8 +12,6 @@
12
12
 
13
13
 
14
14
 
15
- ```JAVAFX
16
-
17
15
  package b012.libro;
18
16
 
19
17
 
@@ -22,23 +20,25 @@
22
20
 
23
21
  import javafx.scene.Scene;
24
22
 
25
- import javafx.scene.input.MouseEvent;
23
+ import javafx.scene.input.*;
26
-
24
+
27
- import javafx.scene.layout.Pane;
25
+ import javafx.scene.layout.*;
26
+
27
+ import javafx.scene.shape.*;
28
+
29
+ import javafx.scene.control.Label;
28
30
 
29
31
  import javafx.scene.paint.Color;
30
32
 
33
+ import javafx.scene.ImageCursor;
34
+
31
- import javafx.scene.shape.*;
35
+ import javafx.scene.image.Image;
32
36
 
33
37
  import javafx.stage.Stage;
34
38
 
35
- import javafx.scene.input.KeyEvent;
36
-
37
- import javafx.scene.input.KeyCode;
39
+ import java.io.File;
38
-
39
- import javafx.scene.control.Label;
40
+
40
-
41
- import javafx.scene.layout.BorderPane;
41
+
42
42
 
43
43
 
44
44
 
@@ -62,6 +62,8 @@
62
62
 
63
63
  int[] Bolty=new int[1000];
64
64
 
65
+ Path[] p = new Path[1000];
66
+
65
67
 
66
68
 
67
69
  public static void main(String[] args) {
@@ -80,6 +82,12 @@
80
82
 
81
83
  BorderPane root = new BorderPane();
82
84
 
85
+ String uri = new File("img/cursor.png").toURI().toString();
86
+
87
+ Image img = new Image( uri );
88
+
89
+ ImageCursor cursor = new ImageCursor( img , img.getWidth() / 2 , img.getHeight() );
90
+
83
91
 
84
92
 
85
93
  root.setTop(label);
@@ -90,6 +98,10 @@
90
98
 
91
99
  scene.setOnKeyPressed(event -> change(event));
92
100
 
101
+
102
+
103
+ scene.setCursor( cursor );
104
+
93
105
  stage.setScene(scene);
94
106
 
95
107
  stage.setTitle("B012 TEST Ver0.5");
@@ -162,17 +174,19 @@
162
174
 
163
175
  Boltno++;
164
176
 
165
-
177
+ int p[B]=Boltno;
178
+
179
+
166
180
 
167
181
  //Totalno(x,y);
168
182
 
169
- Path path = new Path();
183
+ p[B] = new p();
170
184
 
171
185
  MoveTo b00 = new MoveTo(x-20,y+0);
172
186
 
173
- path.getElements().add(b00);
187
+ p[B].getElements().add(b00);
174
-
188
+
175
- LineTo b01 = new LineTo(x-10,y-10);
189
+ p[B]To b01 = new LineTo(x-10,y-10);
176
190
 
177
191
  path.getElements().add(b01);
178
192
 
@@ -182,25 +196,25 @@
182
196
 
183
197
  LineTo b03 = new LineTo(x+20,y+0);
184
198
 
185
- path.getElements().add(b03);
199
+ p[B].getElements().add(b03);
186
200
 
187
201
  LineTo b04 = new LineTo(x+10,y+10);
188
202
 
189
- path.getElements().add(b04);
203
+ p[B].getElements().add(b04);
190
204
 
191
205
  LineTo b05 = new LineTo(x-10,y+10);
192
206
 
193
- path.getElements().add(b05);
207
+ p[B].getElements().add(b05);
194
-
208
+
195
- path.getElements().add(new ClosePath());
209
+ p[B].getElements().add(new ClosePath());
196
-
210
+
197
- path.setFill(cc);
211
+ p[B].setFill(cc);
198
-
212
+
199
- path.setStroke(Color.BLACK);
213
+ p[B].setStroke(Color.BLACK);
200
-
214
+
201
- path.setStrokeWidth(2);
215
+ p[B].setStrokeWidth(2);
202
-
216
+
203
- root.getChildren().add(path);
217
+ root.getChildren().add(p[B]);
204
218
 
205
219
 
206
220
 
@@ -272,7 +286,7 @@
272
286
 
273
287
 
274
288
 
275
- ### 実現してこと
289
+ ### 実現してこと
276
290
 
277
291
 
278
292
 
@@ -286,13 +300,9 @@
286
300
 
287
301
 
288
302
 
289
- ### わからないながらも推測するのは
303
+ ### わからないこと
290
-
304
+
291
- transformを使う前提でpathの配列化?
305
+ transformを使う前提でpathの配列化?をしてみたのですが、エラー多発・。
292
-
293
- ただその場合に、どう表記するかがよく分かってません。
294
-
295
- (文字や数字変数の配列化がやっと出来るレベルの知識なので)
296
306
 
297
307
 
298
308