展开全部
import java.awt.*;
import java.awt.event.*;
public class BorderLayoutDemo extends Frame{
public void BorderLayoutDemo(){
this.add(new Button("1"),BorderLayout.EAST);
this.add(new Button("2"),BorderLayout.CENTER);
this.add(new Button("3"),BorderLayout.NORTH);
this.add(new Button("4"),BorderLayout.WEST);
add(new Label("this is a borderlayout"),BorderLayout.SOUTH);
}
public static void main(String args[]){
BorderLayoutDemo blyd=new BorderLayoutDemo();
blyd.setTitle("this is a borderlayout");
blyd.setVisible(true);
blyd.BorderLayoutDemo();
blyd.pack();
blyd.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
public Dimension getPerferredSzie(){
return new Dimension(400,200);
}
}
import java.awt.event.*;
public class BorderLayoutDemo extends Frame{
public void BorderLayoutDemo(){
this.add(new Button("1"),BorderLayout.EAST);
this.add(new Button("2"),BorderLayout.CENTER);
this.add(new Button("3"),BorderLayout.NORTH);
this.add(new Button("4"),BorderLayout.WEST);
add(new Label("this is a borderlayout"),BorderLayout.SOUTH);
}
public static void main(String args[]){
BorderLayoutDemo blyd=new BorderLayoutDemo();
blyd.setTitle("this is a borderlayout");
blyd.setVisible(true);
blyd.BorderLayoutDemo();
blyd.pack();
blyd.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
public Dimension getPerferredSzie(){
return new Dimension(400,200);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询