java left_Java Label.LEFT属性代码示例

/**

* Create the graphical user interface. This is AWT code.

*/

private void initGUI() {

// all panels

Panel pQuery = new Panel();

Panel pCommand = new Panel();

Panel pButton = new Panel();

Panel pRecent = new Panel();

Panel pResult = new Panel();

Panel pBorderWest = new Panel();

Panel pBorderEast = new Panel();

Panel pBorderSouth = new Panel();

pQuery.setLayout(new BorderLayout());

pCommand.setLayout(new BorderLayout());

pButton.setLayout(new BorderLayout());

pRecent.setLayout(new BorderLayout());

pResult.setLayout(new BorderLayout());

pBorderWest.setBackground(SystemColor.control);

pBorderSouth.setBackground(SystemColor.control);

pBorderEast.setBackground(SystemColor.control);

// labels

Label lblCommand = new Label(" Command", Label.LEFT);

Label lblRecent = new Label(" Recent", Label.LEFT);

Label lblResult = new Label(" Result", Label.LEFT);

lblCommand.setBackground(SystemColor.control);

lblRecent.setBackground(SystemColor.control);

lblResult.setBackground(SystemColor.control);

// buttons

butExecute = new Button("Execute");

butScript = new Button("Script");

butImport = new Button("Import");

pButton.add("South", butScript);

pButton.add("Center", butExecute);

pButton.add("North", butImport);

// command - textarea

Font fFont = new Font("Dialog", Font.PLAIN, 12);

txtCommand = new TextArea(5, 40);

txtCommand.setFont(fFont);

// recent - choice

choRecent = new Choice();

// result - grid

gResult = new Grid();

// combine it

setLayout(new BorderLayout());

pRecent.add("Center", choRecent);

pRecent.add("North", lblRecent);

pCommand.add("North", lblCommand);

pCommand.add("East", pButton);

pCommand.add("Center", txtCommand);

pCommand.add("South", pRecent);

pResult.add("North", lblResult);

pResult.add("Center", gResult);

pQuery.add("North", pCommand);

pQuery.add("Center", pResult);

add("Center", pQuery);

add("West", pBorderWest);

add("East", pBorderEast);

add("South", pBorderSouth);

// [email protected] 20011210 - patch 450412 by [email protected]

doLayout();

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值