borderlayout设置大小 | borderlayout默认位置

borderlayout设置大小 | borderlayout默认位置

1. borderlayout默认位置

Frame默认的是BorderLayout布局管理器。

2. Borderlayout

Applet是awt的JApplet是swing的1、JApplet类使用BorderLayout的一个实例做为其内容窗格的布局管理器,而BorderLayout的缺省约束条件是BorderLayout.CENTER;Applet的缺省的布局管理器是FlowLayout,而FlowLayout的缺省约束条件是FlowLayout.LEFT,这是二者最显著的区别之一。

2、JApplet是只包含一个组件的容器,这个组件就是JRootPane的一个实例,而JRootPane包含了一个称作内容窗格的容器。

3、“内容窗格”,它包含与特定的小应用程序有关的所有内容。即是说,小应用程序必须把所有的组件添加到内容窗格中,而不是把它们直接添加到小应用程序中。4、JApplet的实例可以有一个菜单栏,它是由setJMenuBar方法指定的,而AWT小应用程序却不能。

3. css怎么设置border的位置

html中的ul隔开可以设置css样式,利用css的属性border属性可以让ul分离,如果多个ul需要分开的话可以设置css的marign属性,margin属性包含了4个值,分别表示上下左右的边距的,单位的值可以为px也可以是百分比,在设置百分比的时候是对应的父元素的宽度的。

4. borderlayout用法

UI Layout是一种基于jQuery的布局框架,项目主页http://layout.jquery-dev.net/

该框架的参考原型是ExtJS的border-layout,因此十分适用于将原有使用ExtJS的项目改造成jQuery项目。

核心是:一个大小自适应的中心面板(必选),面板的上下左右四个方向可以放置可折叠、可缩放的面板(可选),各个面板可以添加任意数量的页眉和页脚面板。

UI Layout支持内层布局的嵌套,任意块元素都可以当作布局的容器,最基本的布局容器是body。

5. border在哪里设置

VB 的 Form 组件中,BorderStyle 属性可以设置为以下值:

缺省设置值为 Sizable,即窗口可以随意改变大小、最大化、最小化、关闭,窗口边框较宽:

Fixed Single 固定的单边:窗口只有关闭按钮,不能改变大小,窗口边框较窄:

Fixed Dialog 样式与 Fixed Single 类似,与其区别在于:以 Dialog 对话框显示,即只有关闭这个窗口之后,程序中该窗口之下的窗口才能响应用户。

6. setlayout(new borderlayout)

下面文件名要为:

JiSuanQi.java

import java.awt.*;

import java.awt.event.*;

public class JiSuanQi

{

String s="",s1=null,s2=null;

Frame f=new Frame("计算器");

TextField tf=new TextField(30);

Panel p1=new Panel();

Panel p2=new Panel();

Panel p3=new Panel();

Button bt1=new Button("=");

Button bt2=new Button("删除");

Button[] bt=new Button[16];

int id=0;

public static void main(String[] args)

{

new JiSuanQi().init();

}

public void init()

{

f.setBackground(new Color(85,247,253));

f.setLayout(new BorderLayout(4,4));

p2.setLayout(new GridLayout(4,4,4,4));

p3.setLayout(new BorderLayout(4,4));

f.setResizable(false);

f.add(p1,BorderLayout.NORTH);

f.add(p2);

p3.add(bt2,BorderLayout.NORTH);

p3.add(bt1);

p1.add(tf);

f.add(p3,BorderLayout.EAST);

String[] b={"1","2","3","+","4","5","6","-","7","8","9","*","0",".","复位","/"};

for(int i=0;i<16;i++)

{

bt[i]=new Button(b[i]);

p2.add(bt[i]);

}

bt[0].setForeground(Color.blue);

bt[1].setForeground(Color.blue);

bt[2].setForeground(Color.blue);

bt[4].setForeground(Color.blue);

bt[5].setForeground(Color.blue);

bt[6].setForeground(Color.blue);

bt[8].setForeground(Color.blue);

bt[9].setForeground(Color.blue);

bt[10].setForeground(Color.blue);

bt[12].setForeground(Color.blue);

bt[13].setForeground(Color.blue);

bt[3].setForeground(Color.red);

bt[7].setForeground(Color.red);

bt[11].setForeground(Color.red);

bt[15].setForeground(Color.red);

bt[14].setForeground(Color.red);

bt1.setForeground(Color.red);

bt2.setForeground(Color.red);

f.pack();

f.setVisible(true);

f.addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(0);

}

}

);

bt[0].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s+=1;

s2+=1;

tf.setText(s);

}

}

);

bt[1].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s+=2;

s2+=2;

tf.setText(s);

}

}

);

bt[2].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s+=3;

s2+=3;

tf.setText(s);

}

}

);

bt[4].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s+=4;

s2+=4;

tf.setText(s);

}

}

);

bt[5].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s+=5;

s2+=5;

tf.setText(s);

}

}

);

bt[6].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s+=6;

s2+=6;

tf.setText(s);

}

}

);

bt[8].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s+=7;

s2+=7;

tf.setText(s);

}

}

);

bt[9].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s+=8;

s2+=8;

tf.setText(s);

}

}

);

bt[10].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s+=9;

s2+=9;

tf.setText(s);

}

}

);

bt[12].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s+=0;

s2+=0;

tf.setText(s);

}

}

);

bt[13].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s+='.';

s2+='.';

tf.setText(s);

}

}

);

bt[3].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s1=s;

s+='+';

id=1;

s2="";

tf.setText(s);

}

}

);

bt[7].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s1=s;

s+='-';

id=2;

s2="";

tf.setText(s);

}

}

);

bt[11].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s1=s;

s+='*';

id=3;

s2="";

tf.setText(s);

}

}

);

bt[14].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s="";

s2="";

tf.setText(s);

}

}

);

bt[15].addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

s1=s;

s+='/';

id=4;

s2="";

tf.setText(s);

}

}

);

bt1.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

if(id<1) ;

else{

s+='=';

double a=Double.parseDouble(s1);

double b=Double.parseDouble(s2);

double c=0;

switch(id)

{

case 1:c=a+b; break;

case 2:c=a-b; break;

case 3:c=a*b; break;

case 4:c=a/b; break;

}

s+=c;

tf.setText(s);

}

s="";s1="";s2="";id=0;

}

}

);

bt2.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

char[] c1;

char[] c2=new char[s.length()-1];

c1=s.toCharArray();

for(int i=0;i<s.length()-1;i++)

c2[i]=c1[i];

s=s.valueOf(c2);

if(id<1)

{

s1=s;

}

if(s2.length()>=1)

{

char[] c3;

char[] c4=new char[s2.length()-1];

c3=s2.toCharArray();

for(int i=0;i<s2.length()-1;i++)

c4[i]=c3[i];

s2=s2.valueOf(c4);

}

tf.setText(s);

}

}

);

}

}

7. 在borderlayout中,添加

这是一个布置容器的边界布局,它可以对容器组件进行安排,并调整其大小,使其符合下列五个区域:南、北、东、西和中间区域...

8. borderlayout布局

JPanel默认布局的是FlowLayout可以new的时候就定义成其他布局:

JPanelp=newJPanel(newGridLayout(2,1))

;//两行一列JPanelp=newJPanel(newBorderLayout());

tag:设置位置默认布局大小

相关内容