javaのソースで、引数の違うはずの関数が呼ばれています。
ソースは、
java
1package org.yukkuri.jyl.base.swing; 2 3import java.awt.*; 4 5import javax.swing.JFrame; 6 7import org.yukkuri.jyl.base.ComSize; 8 9public class JylFrame extends JFrame 10{ 11 private String title = "frame"; 12 private int x, y, width, height; 13 14 private Color backgroundColor; 15 private GraphicsConfiguration gc; 16 17 public JylFrame() 18 { 19 super(); 20 initFrame(); 21 } 22 23 public JylFrame( boolean fullscreen ) 24 { 25 setFullScreen( fullscreen ); 26 new JFrame( gc ); 27 } 28 29 public void setBackground( int argb ) 30 { 31 backgroundColor = new Color( argb , true); 32 getContentPane().setBackground( backgroundColor ); 33 } 34 35 public void setBounds( ComSize f ) 36 { 37 this.x = f.x; this.y = f.y; this.width = f.width; this.height = f.height; 38 39 setSize( new ComSize( width, height ) ); 40 setLocation( new ComSize( x, y ) ); 41 } 42 43 public void setLocation( ComSize f ) 44 { 45 this.x =f.x; this.y = f.y; 46 getContentPane().setLocation( x, y ); 47 } 48 49 public void setSize( ComSize f ) 50 { 51 getContentPane().setPreferredSize( new Dimension( f.width, f.height ) ); 52 pack(); 53 setBackground( backgroundColor ); 54 } 55 56 private void initFrame() 57 { 58 setTitle( title ); 59 setResizable( false ); 60 setDefaultCloseOperation( 3 ); 61 setBackground( 0xff000000 ); 62 } 63 64 private void setFullScreen( boolean fullscreen ) 65 { 66 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); 67 GraphicsDevice gd = ge.getDefaultScreenDevice(); 68 gc = gd.getDefaultConfiguration(); 69 if( fullscreen ){ 70 gd.setFullScreenWindow( this ); 71 }else{ 72 gd.setFullScreenWindow( null ); 73 } 74 } 75} 76
ComSize.java
java
1package org.yukkuri.jyl.base; 2 3public class ComSize 4{ 5 6 public int x; 7 8 public int y; 9 10 public int width; 11 12 public int height; 13 14 public ComSize() 15 { 16 x = y = width = height = 0; 17 } 18 19 public ComSize( int x, int y ) 20 { 21 this.x = x; this.y = y; 22 this.width = this.height = 0; 23 } 24 25 public ComSize( int xy, int width, int height ) 26 { 27 this.x = xy; this.y = xy; 28 this.width = width; this.height = height; 29 } 30 31 public ComSize( int x, int y, int width, int height ) 32 { 33 this.x = x; this.y = y; 34 this.width = width; this.height = height; 35 } 36} 37
この中のsetSize( ComSize )を呼び出すと、
at org.yukkuri.jyl.base.swing.JylFrame.setBounds at java.awt.Window.setClientSize( Window.java:958 ) at java.awt.Window.pack( Window.java:811 ) at org.yukkuri.jyl.base.swing.JylFrame.setSize
とループしています。
調べたこと、やってみたこと
setBounds()の関数名を変更してみた > エラーは一緒
引数確認 > 引数の数、型が違うことが確認
ちなみにEclipse, java7 で、エラーは一瞬しか表示されませんでした。実行はされます。
追加 呼び出しクラス
java
1final class SwingTest 2{ 3 public static void main( String[] args ) throws InterruptedException 4 { 5 JylFrame jf = new JylFrame(); 6 jf.setSize( new ComSize( 640, 480 ) ); 7 jf.add( new SwingTestPanel() ); 8 jf.setVisible( true ); 9 Thread.sleep( 10000 ); 10 System.exit( 0 ); 11 } 12}
回答3件
あなたの回答
tips
プレビュー