• R/O
  • SSH
  • HTTPS

mysaifujvm: コミット


コミットメタ情報

リビジョン346 (tree)
日時2010-04-02 14:13:29
作者freebeans

ログメッセージ

2010/04/02 freebeans
*WCEComponentPeer.java(setBounds):Fixed bug #21269

変更サマリ

差分

--- jvm/trunk/lib/classpath/vm/wce/gnu/java/awt/peer/wce/WCEComponentPeer.java (revision 345)
+++ jvm/trunk/lib/classpath/vm/wce/gnu/java/awt/peer/wce/WCEComponentPeer.java (revision 346)
@@ -1,39 +1,38 @@
1-/* WCEComponentPeer.java
2- Copyright (C) 2005 Free Software Foundation, Inc.
1+/*
2+ * WCEComponentPeer.java Copyright (C) 2005 Free Software Foundation, Inc.
3+ *
4+ * This file is part of GNU Classpath.
5+ *
6+ * GNU Classpath is free software; you can redistribute it and/or modify it
7+ * under the terms of the GNU General Public License as published by the Free
8+ * Software Foundation; version 2 of the License.
9+ *
10+ * GNU Classpath is distributed in the hope that it will be useful, but WITHOUT
11+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13+ * details.
14+ *
15+ * You should have received a copy of the GNU General Public License along with
16+ * GNU Classpath; see the file COPYING. If not, write to the Free Software
17+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18+ *
19+ * Linking this library statically or dynamically with other modules is making a
20+ * combined work based on this library. Thus, the terms and conditions of the
21+ * GNU General Public License cover the whole combination.
22+ *
23+ * As a special exception, the copyright holders of this library give you
24+ * permission to link this library with independent modules to produce an
25+ * executable, regardless of the license terms of these independent modules, and
26+ * to copy and distribute the resulting executable under terms of your choice,
27+ * provided that you also meet, for each linked independent module, the terms
28+ * and conditions of the license of that module. An independent module is a
29+ * module which is not derived from or based on this library. If you modify this
30+ * library, you may extend this exception to your version of the library, but
31+ * you are not obligated to do so. If you do not wish to do so, delete this
32+ * exception statement from your version.
33+ */
334
4-This file is part of GNU Classpath.
535
6-GNU Classpath is free software; you can redistribute it and/or modify
7-it under the terms of the GNU General Public License as published by
8-the Free Software Foundation; version 2 of the License.
9-
10-GNU Classpath is distributed in the hope that it will be useful, but
11-WITHOUT ANY WARRANTY; without even the implied warranty of
12-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13-General Public License for more details.
14-
15-You should have received a copy of the GNU General Public License
16-along with GNU Classpath; see the file COPYING. If not, write to the
17-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18-02111-1307 USA.
19-
20-Linking this library statically or dynamically with other modules is
21-making a combined work based on this library. Thus, the terms and
22-conditions of the GNU General Public License cover the whole
23-combination.
24-
25-As a special exception, the copyright holders of this library give you
26-permission to link this library with independent modules to produce an
27-executable, regardless of the license terms of these independent
28-modules, and to copy and distribute the resulting executable under
29-terms of your choice, provided that you also meet, for each linked
30-independent module, the terms and conditions of the license of that
31-module. An independent module is a module which is not derived from
32-or based on this library. If you modify this library, you may extend
33-this exception to your version of the library, but you are not
34-obligated to do so. If you do not wish to do so, delete this
35-exception statement from your version. */
36-
3736 package gnu.java.awt.peer.wce;
3837
3938 import gnu.java.awt.peer.wce.font.WCEFontPeer;
@@ -51,6 +50,7 @@
5150 import java.awt.EventQueue;
5251 import java.awt.Font;
5352 import java.awt.FontMetrics;
53+import java.awt.Frame;
5454 import java.awt.Graphics;
5555 import java.awt.GraphicsConfiguration;
5656 import java.awt.GraphicsEnvironment;
@@ -80,25 +80,25 @@
8080 /**
8181 * WCEComponentPeerクラス。
8282 */
83-public abstract class WCEComponentPeer implements ComponentPeer
83+public abstract class WCEComponentPeer
84+ implements ComponentPeer
8485 {
85-
86+
8687 /**
8788 * イベントキュー
8889 */
8990 static final EventQueue queue = WCEToolkit.queue;
90-
91+
9192 /**
9293 * 対応するComponent
9394 */
9495 private final Component component;
95-
96+
9697 /**
9798 * ネイティブウインドウハンドル。
9899 */
99100 private final int hwnd;
100-
101-
101+
102102 /**
103103 * 今までに表示されたことがあるか?
104104 */
@@ -106,13 +106,13 @@
106106
107107 /**
108108 * 指定されたコンポーネントに対応するpeerのインスタンスを作成する
109- *
110- * @param c コンポーネント
109+ *
110+ * @param c コンポーネント
111111 */
112112 protected WCEComponentPeer(Component c)
113113 {
114114 this.component = c;
115-
115+
116116 // 親のウインドウハンドルを得る
117117 int hParentWnd = searchParentWindowHandle();
118118
@@ -119,17 +119,17 @@
119119 // ネイティブウインドウを生成する
120120 Rectangle r = c.getBounds();
121121 this.hwnd = createNative(hParentWnd, r.x, r.y, r.width, r.height);
122-
122+
123123 setBounds(r.x, r.y, r.width, r.height);
124-
124+
125125 // 色とフォントを設定する
126126 setForeground(c.getForeground());
127127 setBackground(c.getBackground());
128128 if (c.isFontSet())
129- {
130- setFont(c.getFont());
131- }
132-
129+ {
130+ setFont(c.getFont());
131+ }
132+
133133 // 可視状態を設定する
134134 setVisible(c.isVisible());
135135
@@ -136,7 +136,7 @@
136136 // 有効/無効状態を設定する
137137 setEnabled(c.isEnabled());
138138 }
139-
139+
140140 /**
141141 * このコンポーネントのウインドウハンドルを返す
142142 */
@@ -144,15 +144,12 @@
144144 {
145145 return this.hwnd;
146146 }
147-
147+
148148 /**
149- * 親コンポーネントに対応するウインドウハンドルを取得する
150- * 直接の親がLightWeightコンポーネントの場合は、heavy-weight
151- * コンポーネントにたどり着くまでさかのぼり、そのウインドウハンドルを
152- * 返す。
153- * 親がいない、または全ての親がLight-weightの場合には0を返す。
154- *
155- * @return 親のウインドウハンドル
149+ * 親コンポーネントに対応するウインドウハンドルを取得する 直接の親がLightWeightコンポーネントの場合は、heavy-weight
150+ * コンポーネントにたどり着くまでさかのぼり、そのウインドウハンドルを 返す。 親がいない、または全ての親がLight-weightの場合には0を返す。
151+ *
152+ * @return 親のウインドウハンドル
156153 */
157154 protected int searchParentWindowHandle()
158155 {
@@ -160,17 +157,17 @@
160157 int hwnd = 0;
161158 // heavyweightコンポーネントを検索する
162159 for (Component c = getComponent().getParent(); c != null; c = c.getParent())
163- {
164- p = c.getPeer();
165- if (p instanceof WCEComponentPeer)
166160 {
167- hwnd = ((WCEComponentPeer) p).hwnd;
168- break;
161+ p = c.getPeer();
162+ if (p instanceof WCEComponentPeer)
163+ {
164+ hwnd = ((WCEComponentPeer) p).hwnd;
165+ break;
166+ }
169167 }
170- }
171168 return hwnd;
172169 }
173-
170+
174171 /**
175172 * このピアに関連付けられたComponentを返す。
176173 */
@@ -178,20 +175,19 @@
178175 {
179176 return this.component;
180177 }
181-
178+
182179 /**
183- * 指定されたサイズのネイティブウインドウを作成し、
184- * そのウインドウハンドルを返す。
185- * 作成に失敗した場合は0を返す。
186- *
187- * @param hParentWnd 親Windowのハンドル。親が存在しない場合は0を指定する。
180+ * 指定されたサイズのネイティブウインドウを作成し、 そのウインドウハンドルを返す。 作成に失敗した場合は0を返す。
181+ *
182+ * @param hParentWnd 親Windowのハンドル。親が存在しない場合は0を指定する。
188183 * @param x
189184 * @param y
190185 * @param width
191186 * @param height
192187 */
193- protected abstract int createNative(int hParentWnd, int x, int y, int width, int height);
194-
188+ protected abstract int createNative(int hParentWnd, int x, int y, int width,
189+ int height);
190+
195191 public int checkImage(Image img, int width, int height, ImageObserver ob)
196192 {
197193 return Toolkit.getDefaultToolkit().checkImage(img, width, height, ob);
@@ -201,16 +197,16 @@
201197 {
202198 return getToolkit().createImage(prod);
203199 }
204-
200+
205201 public Image createImage(int width, int height)
206202 {
207203 // オフスクリーンイメージのインスタンスを返す
208-// return new WCEOffscreenImage(this, width, height);
204+ // return new WCEOffscreenImage(this, width, height);
209205 // createImage(int x, int y) should return BufferedImage
210206 // Bug #15171
211207 return new BufferedImage(width, height, BufferedImage.TYPE_USHORT_565_RGB);
212208 }
213-
209+
214210 /**
215211 * disable this peer.
216212 */
@@ -218,19 +214,16 @@
218214 {
219215 setEnabled(false);
220216 }
221-
217+
222218 /**
223- * ピアが破棄される前に呼び出される
224- * 派生クラスは、ネイティブコンポーネントの状態をできる限り引数 c に保存する
225- *
226- * super.preDispose(c);
227- * // ... 保存処理 ...
219+ * ピアが破棄される前に呼び出される 派生クラスは、ネイティブコンポーネントの状態をできる限り引数 c に保存する
220+ * super.preDispose(c); // ... 保存処理 ...
228221 */
229222 protected void preDispose(Component c)
230223 {
231224 // WCEComponetPeerの実装は何もしない
232225 }
233-
226+
234227 /**
235228 * ピアを破棄する
236229 */
@@ -240,16 +233,16 @@
240233 preDispose(c);
241234 Font f = c.getFont();
242235 if (f != null)
243- {
244- // ネイティブフォントリソースを開放する
245- WCEFontPeer peer = (WCEFontPeer) f.getPeer();
246- peer.dispose();
247- }
236+ {
237+ // ネイティブフォントリソースを開放する
238+ WCEFontPeer peer = (WCEFontPeer) f.getPeer();
239+ peer.dispose();
240+ }
248241 disposeNative(getWindowHandle());
249242 }
250-
243+
251244 private native void disposeNative(int windowHandle);
252-
245+
253246 /**
254247 * ピアを有効化する
255248 */
@@ -257,12 +250,12 @@
257250 {
258251 setEnabled(true);
259252 }
260-
253+
261254 public ColorModel getColorModel()
262255 {
263256 return ColorModel.getRGBdefault();
264257 }
265-
258+
266259 public FontMetrics getFontMetrics(Font f)
267260 {
268261 return getToolkit().getFontMetrics(f);
@@ -272,7 +265,7 @@
272265 {
273266 return new WCEGraphics2D(this);
274267 }
275-
268+
276269 /**
277270 * 画面上における左上隅の座標を返す
278271 */
@@ -280,9 +273,9 @@
280273 {
281274 return getNativeLocationOnScreen(getWindowHandle());
282275 }
283-
276+
284277 private native Point getNativeLocationOnScreen(int windowHandle);
285-
278+
286279 /**
287280 * 最小サイズを返す。
288281 */
@@ -290,7 +283,7 @@
290283 {
291284 return getPreferredSize();
292285 }
293-
286+
294287 /**
295288 * 推奨サイズを返す。
296289 */
@@ -298,7 +291,7 @@
298291 {
299292 return getNativePreferredSize(getWindowHandle());
300293 }
301-
294+
302295 /**
303296 * ネイティブコンポーネントの推奨サイズを返す
304297 */
@@ -315,7 +308,7 @@
315308 {
316309 return Toolkit.getDefaultToolkit();
317310 }
318-
311+
319312 /**
320313 * イベントを処理する
321314 */
@@ -324,215 +317,235 @@
324317 int id = e.getID();
325318
326319 switch (id)
327- {
320+ {
328321 case PaintEvent.PAINT:
329322 case PaintEvent.UPDATE:
330323 {
331324 Component c = getComponent();
332325 if (! c.isVisible() || c.getIgnoreRepaint())
333- {
334- // 表示されていない場合
335- // またはOSからの再描画メッセージを拒否している場合
336- return;
337- }
326+ {
327+ // 表示されていない場合
328+ // またはOSからの再描画メッセージを拒否している場合
329+ return;
330+ }
338331 try
339- {
340- Graphics g = getGraphics();
341- if (g == null)
342332 {
343- break;
333+ Graphics g = getGraphics();
334+ if (g == null)
335+ {
336+ break;
337+ }
338+
339+ // クリッピング領域を設定する
340+ g.setClip(((PaintEvent) e).getUpdateRect());
341+
342+ if (id == PaintEvent.PAINT)
343+ {
344+ c.paint(g);
345+ }
346+ else
347+ {
348+ c.update(g);
349+ }
350+ g.dispose();
344351 }
352+ catch (InternalError ie)
353+ {
354+ ie.printStackTrace();
355+ }
356+ }
357+ break;
358+ }
359+ }
345360
346- // クリッピング領域を設定する
347- g.setClip(((PaintEvent) e).getUpdateRect());
361+ public boolean isFocusTraversable()
362+ {
363+ return true;
364+ }
348365
349- if (id == PaintEvent.PAINT)
366+ public boolean isFocusable()
367+ {
368+ return false;
369+ }
370+
371+ public Dimension minimumSize()
372+ {
373+ return getMinimumSize();
374+ }
375+
376+ public Dimension preferredSize()
377+ {
378+ return getPreferredSize();
379+ }
380+
381+ public void paint(Graphics graphics)
382+ {
383+ // 何もしない
384+ }
385+
386+ public boolean prepareImage(Image img, int width, int height, ImageObserver ob)
387+ {
388+ return Toolkit.getDefaultToolkit().prepareImage(img, width, height, ob);
389+ }
390+
391+ public void print(Graphics graphics)
392+ {
393+ paint(graphics);
394+ }
395+
396+ public void repaint(long tm, int x, int y, int width, int height)
397+ {
398+ if (width == 0 && height == 0)
399+ {
400+ // サイズ0のコンポーネントに対しては何もしない
401+ return;
402+ }
403+ // キューに PaintEvent.UPDATE を postする
404+ // (結果、update(Graphics) が呼び出されることになる)
405+ queue.postEvent(new PaintEvent(getComponent(), PaintEvent.UPDATE,
406+ new Rectangle(x, y, width, height)));
407+ }
408+
409+ public void requestFocus()
410+ {
411+ assert false : "Call new requestFocus() method instead";
412+ // requestNativeFocus(getWindowHandle());
413+ // postFocusEvent(FocusEvent.FOCUS_GAINED, null);
414+ }
415+
416+ /**
417+ * 指定されたウインドウハンドルに対してSetFocus()を呼び出す
418+ */
419+ private native void requestNativeFocus(int windowHandle);
420+
421+ public boolean requestFocus(Component request, boolean temporary,
422+ boolean allowWindowFocus, long time)
423+ {
424+ boolean retval = false;
425+
426+ if (hasNativeFocus(getWindowHandle()))
427+ {
428+ KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
429+ Component currentFocus = kfm.getFocusOwner();
430+ if (currentFocus == request)
350431 {
351- c.paint(g);
432+ // Nothing to do in this trivial case.
433+ retval = true;
352434 }
353- else
435+ else
354436 {
355- c.update(g);
437+ // Requested component is a lightweight descendant of this one
438+ // or the actual heavyweight.
439+ // Since this (native) component is already focused, we simply
440+ // change the actual focus and be done.
441+ postFocusEvent(FocusEvent.FOCUS_GAINED, temporary, null);
442+ retval = true;
356443 }
357- g.dispose ();
358- }
359- catch (InternalError ie)
360- {
361- ie.printStackTrace();
362- }
363444 }
364- break;
365- }
445+ else
446+ {
447+ // temporaryがfalseの場合にのみネイティブコンポーネントのフォーカスを
448+ // 取得する
449+ // そうしないと、以下の問題が起きる
450+ // ・JMenuの大きさがJFrameよりも大きな場合、JFrameが前面に表示されてしまう
451+ // これは、javax.swing.plaf.basic.BasicPopupMenuUIの以下の箇所が原因
452+ // if (invokerRootPane != null)
453+ // {
454+ // invokerRootPane.requestFocus(true);
455+ // installKeyboardActionsImpl();
456+ // }
457+ // 根本的な解決策が思いつかないので、とりあえずの対処
458+ if (! temporary)
459+ {
460+ requestNativeFocus(getWindowHandle());
461+ }
462+ retval = true;
463+ }
464+ return retval;
366465 }
367466
467+ /**
468+ * 指定されたComponentが存在するWindowを返す。
469+ */
470+ private Window getWindowFor(Component c)
471+ {
472+ Component comp = c;
473+ while (! (comp instanceof Window))
474+ comp = comp.getParent();
475+ return (Window) comp;
476+ }
368477
369- public boolean isFocusTraversable() {
370- return true;
371- }
372-
373- public boolean isFocusable() {
374- return false;
375- }
376-
377- public Dimension minimumSize() {
378- return getMinimumSize();
379- }
380-
381- public Dimension preferredSize() {
382- return getPreferredSize();
383- }
384-
385- public void paint(Graphics graphics) {
386- // 何もしない
387- }
388-
389- public boolean prepareImage(Image img, int width, int height, ImageObserver ob) {
390- return Toolkit.getDefaultToolkit().prepareImage(img, width, height, ob);
391- }
392-
393- public void print(Graphics graphics) {
394- paint(graphics);
395- }
396-
397- public void repaint(long tm, int x, int y, int width, int height) {
398- if (width == 0 && height == 0) {
399- // サイズ0のコンポーネントに対しては何もしない
400- return;
401- }
402- // キューに PaintEvent.UPDATE を postする
403- // (結果、update(Graphics) が呼び出されることになる)
404- queue.postEvent (new PaintEvent (getComponent(),
405- PaintEvent.UPDATE,
406- new Rectangle (x, y, width, height)));
407- }
478+ public void reshape(int x, int y, int width, int height)
479+ {
480+ setBounds(x, y, width, height);
481+ }
408482
409- public void requestFocus() {
410- assert false: "Call new requestFocus() method instead";
411-// requestNativeFocus(getWindowHandle());
412-// postFocusEvent(FocusEvent.FOCUS_GAINED, null);
413- }
414-
415- /**
416- * 指定されたウインドウハンドルに対してSetFocus()を呼び出す
417- */
418- private native void requestNativeFocus(int windowHandle);
419-
420-
421- public boolean requestFocus (Component request,
422- boolean temporary,
423- boolean allowWindowFocus,
424- long time) {
425- boolean retval = false;
426-
427- if (hasNativeFocus(getWindowHandle())) {
428- KeyboardFocusManager kfm =
429- KeyboardFocusManager.getCurrentKeyboardFocusManager();
430- Component currentFocus = kfm.getFocusOwner();
431- if (currentFocus == request) {
432- // Nothing to do in this trivial case.
433- retval = true;
434- } else {
435- // Requested component is a lightweight descendant of this one
436- // or the actual heavyweight.
437- // Since this (native) component is already focused, we simply
438- // change the actual focus and be done.
439- postFocusEvent(FocusEvent.FOCUS_GAINED, temporary, null);
440- retval = true;
441- }
442- } else {
443- // temporaryがfalseの場合にのみネイティブコンポーネントのフォーカスを
444- // 取得する
445- // そうしないと、以下の問題が起きる
446- // ・JMenuの大きさがJFrameよりも大きな場合、JFrameが前面に表示されてしまう
447- // これは、javax.swing.plaf.basic.BasicPopupMenuUIの以下の箇所が原因
448- // if (invokerRootPane != null)
449- // {
450- // invokerRootPane.requestFocus(true);
451- // installKeyboardActionsImpl();
452- // }
453- // 根本的な解決策が思いつかないので、とりあえずの対処
454- if (! temporary) {
455- requestNativeFocus(getWindowHandle());
456- }
457- retval = true;
458- }
459- return retval;
460- }
461-
462- /**
463- * 指定されたComponentが存在するWindowを返す。
464- */
465- private Window getWindowFor(Component c) {
466- Component comp = c;
467- while (! (comp instanceof Window))
468- comp = comp.getParent();
469- return (Window) comp;
470- }
483+ /**
484+ * ピアの背景色を設定する
485+ */
486+ public void setBackground(Color color)
487+ {
488+ if (color == null)
489+ {
490+ // since GNU Classpath 0.18
491+ color = SystemColor.window;
492+ }
493+ setNativeBackground(getWindowHandle(), color.getRGB());
494+ }
471495
472- public void reshape(int x, int y, int width, int height) {
473- setBounds(x, y, width, height);
474- }
475-
476- /**
477- * ピアの背景色を設定する
478- */
479- public void setBackground(Color color) {
480- if (color == null) {
481- // since GNU Classpath 0.18
482- color = SystemColor.window;
483- }
484- setNativeBackground(getWindowHandle(),
485- color.getRGB());
486- }
487-
488- private native void setNativeBackground(int windowHandle,
489- int rgb);
496+ private native void setNativeBackground(int windowHandle, int rgb);
490497
491- /**
492- * ネイティブコンポーネントのサイズを設定する
493- */
494- protected native void setNativeBounds(int windowHandle, int x, int y, int width, int height);
495-
496- /**
497- * ネイティブコンポーネントの大きさを設定する
498- */
499- public void setBounds(int x, int y, int width, int height) {
500- Container parent = getComponent().getParent();
501- Insets i;
502- while (parent != null && parent.isLightweight ()) {
503- i = parent.getInsets ();
504- x += parent.getX () + i.left;
505- y += parent.getY () + i.top;
506- parent = parent.getParent ();
507- }
508-
509- if (parent != null && ! (getComponent() instanceof Dialog)) {
510- ContainerPeer peer = (ContainerPeer) parent.getPeer();
511- if (peer == null) {
512- // デバッグ用
513- throw new AWTError("parent.getPeer() is null. parent=" + parent);
514- } else {
515- // HeavyweightコンポーネントのInsets分 (x, y)から減算する
516- i = peer.getInsets();
517- x -= i.left;
518- y -= i.top;
519- }
520- }
498+ /**
499+ * ネイティブコンポーネントのサイズを設定する
500+ */
501+ protected native void setNativeBounds(int windowHandle, int x, int y,
502+ int width, int height);
521503
522- setNativeBounds(getWindowHandle(), x, y, width, height);
523- }
524-
525-
504+ /**
505+ * ネイティブコンポーネントの大きさを設定する
506+ */
507+ public void setBounds(int x, int y, int width, int height)
508+ {
509+ Container parent = getComponent().getParent();
510+ Insets i;
511+ while (parent != null && parent.isLightweight())
512+ {
513+ i = parent.getInsets();
514+ x += parent.getX() + i.left;
515+ y += parent.getY() + i.top;
516+ parent = parent.getParent();
517+ }
518+
519+ if (parent != null && ! (getComponent() instanceof Window))
520+ {
521+ ContainerPeer peer = (ContainerPeer) parent.getPeer();
522+ if (peer == null)
523+ {
524+ // デバッグ用
525+ throw new AWTError("parent.getPeer() is null. parent=" + parent);
526+ }
527+ else
528+ {
529+ // HeavyweightコンポーネントのInsets分 (x, y)から減算する
530+ i = peer.getInsets();
531+ x -= i.left;
532+ y -= i.top;
533+ }
534+ }
535+
536+ setNativeBounds(getWindowHandle(), x, y, width, height);
537+ }
538+
526539 public void setCursor(Cursor cursor)
527540 {
528541 setNativeCursor(getWindowHandle(), cursor.getType());
529542 }
530-
543+
531544 /**
532545 * ネイティブコンポーネントのカーソルを設定する
533546 */
534547 private native void setNativeCursor(int windowHandle, int type);
535-
548+
536549 /**
537550 * ネイティブコンポーネントの有効/無効状態を変更する
538551 */
@@ -540,9 +553,9 @@
540553 {
541554 setNativeEnabled(getWindowHandle(), enabled);
542555 }
543-
556+
544557 private native void setNativeEnabled(int windowHandle, boolean enabled);
545-
558+
546559 /**
547560 * ピアのフォントを設定する。
548561 */
@@ -551,7 +564,7 @@
551564 WCEFontPeer peer = (WCEFontPeer) font.getPeer();
552565 setNativeFontHandle(getWindowHandle(), peer.getFontHandle());
553566 }
554-
567+
555568 private native void setNativeFontHandle(int windowHandle, int fontHandle);
556569
557570 /**
@@ -561,12 +574,12 @@
561574 {
562575 // Since GNU Classpath 0.19
563576 if (color == null)
564- {
565- color = SystemColor.windowText;
566- }
577+ {
578+ color = SystemColor.windowText;
579+ }
567580 setNativeForeground(getWindowHandle(), color.getRGB());
568581 }
569-
582+
570583 private native void setNativeForeground(int windowHandle, int rgb);
571584
572585 /**
@@ -581,16 +594,16 @@
581594 // 最初に表示された際にComponentEventがpostされないとうまく動作しないアプリケーションが
582595 // あるため、1回目の表示時にはComponentEventをpostする
583596 if (visible && ! this.hasBeenShown)
584- {
585- Component c = getComponent();
586- queue.postEvent(new ComponentEvent(c, ComponentEvent.COMPONENT_MOVED));
587- queue.postEvent(new ComponentEvent(c, ComponentEvent.COMPONENT_RESIZED));
588- this.hasBeenShown = true;
589- }
597+ {
598+ Component c = getComponent();
599+ queue.postEvent(new ComponentEvent(c, ComponentEvent.COMPONENT_MOVED));
600+ queue.postEvent(new ComponentEvent(c, ComponentEvent.COMPONENT_RESIZED));
601+ this.hasBeenShown = true;
602+ }
590603 }
591-
604+
592605 private native void setNativeVisible(int windowHandle, boolean visible);
593-
606+
594607 /**
595608 * このピアを表示する
596609 */
@@ -598,7 +611,7 @@
598611 {
599612 setVisible(true);
600613 }
601-
614+
602615 /**
603616 * このピアを非表示にする
604617 */
@@ -607,21 +620,19 @@
607620 setVisible(false);
608621 }
609622
610- /**
611- * Get the graphics configuration of the component. The color model
612- * of the component can be derived from the configuration.
623+ /**
624+ * Get the graphics configuration of the component. The color model of the
625+ * component can be derived from the configuration.
613626 */
614627 public GraphicsConfiguration getGraphicsConfiguration()
615628 {
616- return GraphicsEnvironment.getLocalGraphicsEnvironment()
617- .getDefaultScreenDevice()
618- .getDefaultConfiguration();
629+ return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
619630 }
620631
621632 /**
622633 * Part of an older API, no longer needed.
623634 */
624- public void setEventMask (long mask)
635+ public void setEventMask(long mask)
625636 {
626637 // 未実装
627638 }
@@ -648,10 +659,11 @@
648659 // 何もしない
649660 }
650661
651- public VolatileImage createVolatileImage(int width, int height) {
662+ public VolatileImage createVolatileImage(int width, int height)
663+ {
652664 return new WCEVolatileImage(new WCEOffscreenImage(this, width, height));
653665 }
654-
666+
655667 public boolean handlesWheelScrolling()
656668 {
657669 // 未実装
@@ -658,7 +670,8 @@
658670 return false;
659671 }
660672
661- public void createBuffers(int x, BufferCapabilities capabilities) throws AWTException
673+ public void createBuffers(int x, BufferCapabilities capabilities)
674+ throws AWTException
662675 {
663676 // 未実装
664677 throw new UnsupportedOperationException("Not implemented");
@@ -681,91 +694,61 @@
681694 // 未実装
682695 throw new UnsupportedOperationException("Not implemented");
683696 }
684-
697+
685698 protected native String getNativeText(int windowHandle);
686-
687- protected native void setNativeText(int windowHandle, String text);
688699
700+ protected native void setNativeText(int windowHandle, String text);
689701
690-
691702 /**
692703 * ネイティブの親ウインドウを変更する
693704 */
694- protected native void setNativeParent(int childWindowHandle, int newParentWindowHandle);
705+ protected native void setNativeParent(int childWindowHandle,
706+ int newParentWindowHandle);
695707
696708 /**
697709 * MouseEventをEventQueueにpostする
698710 */
699- void postMouseEvent(int id,
700- int modifiers,
701- int x,
702- int y,
703- int clickCount,
704- boolean popupTrigger,
705- int button)
711+ void postMouseEvent(int id, int modifiers, int x, int y, int clickCount,
712+ boolean popupTrigger, int button)
706713 {
707-
708- queue.postEvent(
709- new MouseEvent(getComponent(),
710- id,
711- System.currentTimeMillis(),
712- modifiers,
713- x,
714- y,
715- clickCount,
716- popupTrigger,
717- button));
714+
715+ queue.postEvent(new MouseEvent(getComponent(), id,
716+ System.currentTimeMillis(), modifiers, x, y,
717+ clickCount, popupTrigger, button));
718718 }
719719
720720 /**
721721 * MouseWheelEventをEventQueueにpostする
722722 */
723- void postMouseWheelEvent(int id,
724- int modifiers,
725- int x,
726- int y,
727- int clickCount,
728- boolean popupTrigger,
729- int scrollType,
730- int scrollAmount,
731- int wheelRotation)
723+ void postMouseWheelEvent(int id, int modifiers, int x, int y, int clickCount,
724+ boolean popupTrigger, int scrollType,
725+ int scrollAmount, int wheelRotation)
732726 {
733-
734- queue.postEvent(
735- new MouseWheelEvent(getComponent(),
736- id,
737- System.currentTimeMillis(),
738- modifiers,
739- x,
740- y,
741- clickCount,
742- popupTrigger,
743- scrollType,
744- scrollAmount,
745- wheelRotation));
727+
728+ queue.postEvent(new MouseWheelEvent(getComponent(), id,
729+ System.currentTimeMillis(), modifiers,
730+ x, y, clickCount, popupTrigger,
731+ scrollType, scrollAmount, wheelRotation));
746732 }
747733
748734 /**
749735 * PaintEventをpostする
750736 */
751- void postPaintEvent(int id,
752- int x,
753- int y,
754- int width,
755- int height)
737+ void postPaintEvent(int id, int x, int y, int width, int height)
756738 {
757- queue.postEvent(
758- new PaintEvent(getComponent(),
759- id,
760- new Rectangle(x, y, width, height)));
739+ queue.postEvent(new PaintEvent(getComponent(), id, new Rectangle(x, y,
740+ width,
741+ height)));
761742 }
762-
743+
763744 /**
764745 * FocusEventをpostする
765746 */
766- protected void postFocusEvent(int id, boolean temporary, WCEComponentPeer oppositePeer)
747+ protected void postFocusEvent(int id, boolean temporary,
748+ WCEComponentPeer oppositePeer)
767749 {
768- Component opposite = (oppositePeer != null) ? oppositePeer.getComponent() : null;
750+ Component opposite = (oppositePeer != null) ? oppositePeer.getComponent()
751+ : null;
769752 queue.postEvent(new FocusEvent(getComponent(), id, temporary, opposite));
770753 }
771754
@@ -772,37 +755,31 @@
772755 /**
773756 * KeyEventをpostする
774757 */
775- void postKeyEvent(int id,
776- long when,
777- int modifiers,
778- int keyCode,
779- char keyChar,
780- int keyLocation)
758+ void postKeyEvent(int id, long when, int modifiers, int keyCode,
759+ char keyChar, int keyLocation)
781760 {
782- queue.postEvent(new KeyEvent(getComponent(),
783- id,
784- System.currentTimeMillis(),
785- modifiers,
786- keyCode,
787- keyChar,
788- keyLocation));
761+ queue.postEvent(new KeyEvent(getComponent(), id,
762+ System.currentTimeMillis(), modifiers,
763+ keyCode, keyChar, keyLocation));
789764 }
790-
791765
792766 public Rectangle getBounds()
793767 {
794- // FIXME: implement
768+ // FIXME: implement
795769 return null;
796770 }
771+
797772 public void reparent(ContainerPeer parent)
798773 {
799774 // FIXME: implement
800775 }
776+
801777 public void setBounds(int x, int y, int width, int height, int z)
802778 {
803779 // FIXME: implement
804- setBounds (x, y, width, height);
780+ setBounds(x, y, width, height);
805781 }
782+
806783 public boolean isReparentSupported()
807784 {
808785 // FIXME: implement
@@ -812,19 +789,17 @@
812789 public void layout()
813790 {
814791 // FIXME: implement
815- }
792+ }
816793
817794 protected native boolean hasNativeFocus(int windowHandle);
818795
819796 public boolean requestFocus(Component lightweightChild, boolean temporary,
820- boolean focusedWindowChangeAllowed,
821- long time, sun.awt.CausedFocusEvent.Cause cause)
797+ boolean focusedWindowChangeAllowed, long time,
798+ sun.awt.CausedFocusEvent.Cause cause)
822799 {
823800 // TODO: Implement this properly and remove the other requestFocus()
824801 // methods.
825802 return true;
826803 }
827-
804+
828805 }
829-
830-
旧リポジトリブラウザで表示