質問編集履歴
2
ソース追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -133,4 +133,20 @@
|
|
133
133
|
setBounds()の関数名を変更してみた > エラーは一緒
|
134
134
|
引数確認 > 引数の数、型が違うことが確認
|
135
135
|
|
136
|
-
ちなみにEclipse, java7 で、エラーは一瞬しか表示されませんでした。実行はされます。
|
136
|
+
ちなみにEclipse, java7 で、エラーは一瞬しか表示されませんでした。実行はされます。
|
137
|
+
|
138
|
+
追加 呼び出しクラス
|
139
|
+
```java
|
140
|
+
final class SwingTest
|
141
|
+
{
|
142
|
+
public static void main( String[] args ) throws InterruptedException
|
143
|
+
{
|
144
|
+
JylFrame jf = new JylFrame();
|
145
|
+
jf.setSize( new ComSize( 640, 480 ) );
|
146
|
+
jf.add( new SwingTestPanel() );
|
147
|
+
jf.setVisible( true );
|
148
|
+
Thread.sleep( 10000 );
|
149
|
+
System.exit( 0 );
|
150
|
+
}
|
151
|
+
}
|
152
|
+
```
|
1
code追加 不要部分削除
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,11 +9,6 @@
|
|
9
9
|
|
10
10
|
import org.yukkuri.jyl.base.ComSize;
|
11
11
|
|
12
|
-
/**
|
13
|
-
* 簡易的なフレームのクラスです。
|
14
|
-
*
|
15
|
-
* @author とあるゆっくり
|
16
|
-
*/
|
17
12
|
public class JylFrame extends JFrame
|
18
13
|
{
|
19
14
|
private String title = "frame";
|
@@ -22,44 +17,24 @@
|
|
22
17
|
private Color backgroundColor;
|
23
18
|
private GraphicsConfiguration gc;
|
24
19
|
|
25
|
-
/**
|
26
|
-
* 不可視のフレームを作成します。
|
27
|
-
*/
|
28
20
|
public JylFrame()
|
29
21
|
{
|
30
22
|
super();
|
31
23
|
initFrame();
|
32
24
|
}
|
33
25
|
|
34
|
-
/**
|
35
|
-
* 不可視のフレームを作成します。このコンストラクタでは、
|
36
|
-
* フレームをフルスクリーン化できますが、終了時にフレームを戻す必要があります。
|
37
|
-
* フルスクリーン化しない場合は、終了処理を含めてすべてユーザーが設定する必要があります。
|
38
|
-
*
|
39
|
-
* @param fullscreen フルスクリーン化する場合は true
|
40
|
-
*/
|
41
26
|
public JylFrame( boolean fullscreen )
|
42
27
|
{
|
43
28
|
setFullScreen( fullscreen );
|
44
29
|
new JFrame( gc );
|
45
30
|
}
|
46
31
|
|
47
|
-
/**
|
48
|
-
* フレームの背景色を設定します。
|
49
|
-
*
|
50
|
-
* @param argb 背景色のARGB値
|
51
|
-
*/
|
52
32
|
public void setBackground( int argb )
|
53
33
|
{
|
54
34
|
backgroundColor = new Color( argb , true);
|
55
35
|
getContentPane().setBackground( backgroundColor );
|
56
36
|
}
|
57
37
|
|
58
|
-
/**
|
59
|
-
* フレームの位置、サイズを設定します。
|
60
|
-
*
|
61
|
-
* @param f フレームの座標、サイズを代入された ComSize
|
62
|
-
*/
|
63
38
|
public void setBounds( ComSize f )
|
64
39
|
{
|
65
40
|
this.x = f.x; this.y = f.y; this.width = f.width; this.height = f.height;
|
@@ -68,22 +43,12 @@
|
|
68
43
|
setLocation( new ComSize( x, y ) );
|
69
44
|
}
|
70
45
|
|
71
|
-
/**
|
72
|
-
* フレームの位置を設定します。
|
73
|
-
*
|
74
|
-
* @param f フレームの位置を代入された ComSize
|
75
|
-
*/
|
76
46
|
public void setLocation( ComSize f )
|
77
47
|
{
|
78
48
|
this.x =f.x; this.y = f.y;
|
79
49
|
getContentPane().setLocation( x, y );
|
80
50
|
}
|
81
51
|
|
82
|
-
/**
|
83
|
-
* フレームのサイズを設定します。
|
84
|
-
*
|
85
|
-
* @param f フレームのサイズを代入された ComSize
|
86
|
-
*/
|
87
52
|
public void setSize( ComSize f )
|
88
53
|
{
|
89
54
|
getContentPane().setPreferredSize( new Dimension( f.width, f.height ) );
|
@@ -114,6 +79,47 @@
|
|
114
79
|
|
115
80
|
```
|
116
81
|
|
82
|
+
ComSize.java
|
83
|
+
```java
|
84
|
+
package org.yukkuri.jyl.base;
|
85
|
+
|
86
|
+
public class ComSize
|
87
|
+
{
|
88
|
+
|
89
|
+
public int x;
|
90
|
+
|
91
|
+
public int y;
|
92
|
+
|
93
|
+
public int width;
|
94
|
+
|
95
|
+
public int height;
|
96
|
+
|
97
|
+
public ComSize()
|
98
|
+
{
|
99
|
+
x = y = width = height = 0;
|
100
|
+
}
|
101
|
+
|
102
|
+
public ComSize( int x, int y )
|
103
|
+
{
|
104
|
+
this.x = x; this.y = y;
|
105
|
+
this.width = this.height = 0;
|
106
|
+
}
|
107
|
+
|
108
|
+
public ComSize( int xy, int width, int height )
|
109
|
+
{
|
110
|
+
this.x = xy; this.y = xy;
|
111
|
+
this.width = width; this.height = height;
|
112
|
+
}
|
113
|
+
|
114
|
+
public ComSize( int x, int y, int width, int height )
|
115
|
+
{
|
116
|
+
this.x = x; this.y = y;
|
117
|
+
this.width = width; this.height = height;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
```
|
122
|
+
|
117
123
|
この中のsetSize( ComSize )を呼び出すと、
|
118
124
|
```エラー
|
119
125
|
at org.yukkuri.jyl.base.swing.JylFrame.setBounds
|