首页 > 其他分享 >lesson2 BorderLayOut 东西南北中

lesson2 BorderLayOut 东西南北中

时间:2023-09-27 22:44:54浏览次数:34  
标签:lesson2 BorderLayOut frame BorderLayout add 东西南北中 new Button SOUTH

 

 

package com.kuang.lesson1;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class TestBorderLayOut {
    public static void main(String[] args) {

        Frame frame=new Frame("BorderLayOut");

        //组件按钮
        Button EAST=new Button("EAST");
        Button WEST=new Button("WAST");
        Button CENTER=new Button("CENTER");
        Button SOUTH=new Button("SOUTH");
        Button NORTH=new Button("NORTH");
        //设置流式布局  默认是靠中
        //frame.setLayout(new FlowLayout());
        frame.setSize(300,300);
        frame.add(EAST,BorderLayout.EAST);
        frame.add(WEST,BorderLayout.WEST);
        frame.add(CENTER,BorderLayout.CENTER);
        frame.add(SOUTH,BorderLayout.SOUTH);
        frame.add(NORTH,BorderLayout.NORTH);
        frame.setVisible(true);

        frame.addWindowListener(new WindowAdapter() {
                                    //窗体关闭时做的事
                                    @Override
                                    public void windowClosing(WindowEvent e) {
                                        // super.windowClosed(e);
                                        System.exit(0);
                                    }
                                }
        );

    }


    }

 

 

标签:lesson2,BorderLayOut,frame,BorderLayout,add,东西南北中,new,Button,SOUTH
From: https://www.cnblogs.com/zym97816/p/17734565.html

相关文章

  • lesson2 Panel 解决了窗体闭关事件
      packagecom.kuang.lesson1;importjava.awt.*;importjava.awt.event.*;//panel可以看着一个空间,但不能单独存在,必须放在frame上publicclassTestPanel{publicstaticvoidmain(String[]args){Frameframe=newFrame();Panelpanel=......
  • G6 Lesson2 Grammar
    GrammarWhatAretheFourKindsofSentence?adeclarativesentencemakesastatement.Itendswithaperiod.Aninterrogativesentenceasksaquestion.Itends......
  • lesson20 神经网络搭建八股
    #lesson20神经网络搭建八股#搭建模块化的神经网络八股:#前向传播就是搭建网络,设计网络结构(forward.py)#defforward(x,regularizer):#w=#b=#y=#retu......