C
ccweifen
Unregistered / Unconfirmed
GUEST, unregistred user!
import java.awt.*;
import javax.swing.*;
public class InsetsLay extends JFrame
{
JButton panicButton=new JButton("panic");
JButtondo
ntpanicButton=new JButton("dontpanic");
JButton blameButton=new JButton("blame Others");
JButton mediaButton=new JButton("Notify the media");
JButton saveButton=new JButton("save yourself");
public InsetsLay()
{
super("InsetsLay");
setSize(308,128);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container pane= getContentPane();
GridLayout grid =new GridLayout(2,3);
pane.setLayout(grid);
pane.add(panicButton);
pane.add(dontpanicButton);
pane.add(blameButton);
pane.add(mediaButton);
pane.add(saveButton);
setContentPane(pane);
setVisible(true) ;
}
public static void main(String[] args)
{
InsetsLay cr=new InsetsLay();
}
public Insets getInsets()
{
Insets squeeze=new Insets(50,20,10,20);
return squeeze ;
}
}
Main函数中没有调用过getInsets()这方法 , 为何这方法会有效?
import javax.swing.*;
public class InsetsLay extends JFrame
{
JButton panicButton=new JButton("panic");
JButtondo
ntpanicButton=new JButton("dontpanic");
JButton blameButton=new JButton("blame Others");
JButton mediaButton=new JButton("Notify the media");
JButton saveButton=new JButton("save yourself");
public InsetsLay()
{
super("InsetsLay");
setSize(308,128);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container pane= getContentPane();
GridLayout grid =new GridLayout(2,3);
pane.setLayout(grid);
pane.add(panicButton);
pane.add(dontpanicButton);
pane.add(blameButton);
pane.add(mediaButton);
pane.add(saveButton);
setContentPane(pane);
setVisible(true) ;
}
public static void main(String[] args)
{
InsetsLay cr=new InsetsLay();
}
public Insets getInsets()
{
Insets squeeze=new Insets(50,20,10,20);
return squeeze ;
}
}
Main函数中没有调用过getInsets()这方法 , 为何这方法会有效?