导航:首页 > 编程语言 > javabox左对齐

javabox左对齐

发布时间:2025-01-15 02:09:07

A. java界面高手请进 200分

我还当是程序改错……
看来这200分我是没有时间拿了
我做J2EE的,界面让我找个错还有 可能,重新写
……困难

B. swing里的box是什么作用java

主要就用到了这四个方法
createHorizontalBox()
创建一个从左到右显示其组件的 Box。
createHorizontalStrut(int width) //左右部件之间的中间间隔就可以用这个方法来控制
创建一个不可见的、固定宽度的组件。
createVerticalBox()
创建一个从上到下显示其组件的 Box。
createVerticalStrut(int height) //上下部件之间的中间间隔就可以用这个方法来控制
创建一个不可见的、固定高度的组件。

效果图如下
package com.geogro.webapp.applet.track;

import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;

/**3G版本的数据过滤面板,输入过滤值查询3G值.
*
* @author snail
* @date 07-03-26
* @version 1.0
*/
public class Fliter3GPanel extends JPanel {
private static Font defaultFont = new Font("SimSun", Font.PLAIN, 12); //默认字体
TitledBorder titledBorder1 = new TitledBorder("参数设置");
JTextField xTextField;
JTextField yTextField;
JTextField zTextField;
JTextField inteTextField;
DateChooserJButton fliterStartTimeButton;
DateChooserJButton fliterEndTimeButton;
JProgressBar fliterLoadBar;
JButton okButton;
JButton cancelButton;

private void jbInit() throws Exception {
Box b = Box.createVerticalBox();
JLabel bannerLabel = new JLabel("3G数据过滤查询");
b.add(bannerLabel);

//-------------setTheInputPanel------------------------------

JPanel inputPanel = new JPanel();
TitledBorder inputPanelBorder = new TitledBorder("设置参数");
inputPanelBorder.setTitleFont(defaultFont);
inputPanel.setBorder(inputPanelBorder);

Box vtemp = Box.createVerticalBox();
Box htemp1 = Box.createHorizontalBox();
Box htemp2 = Box.createHorizontalBox();
Box htemp3 = Box.createHorizontalBox();
Box htemp4 = Box.createHorizontalBox();
Box htemp5 = Box.createHorizontalBox();
Box htemp6 = Box.createHorizontalBox();
Box htemp7 = Box.createHorizontalBox();
Box htemp8 = Box.createHorizontalBox();

xTextField = new JTextField();
xTextField.setPreferredSize(new Dimension(50, 10));
htemp1.add(new JLabel("横向:"));
htemp1.add(Box.createHorizontalStrut(10)); //创建label和textFied之间的距离
htemp1.add(xTextField);
htemp1.add(new JLabel("(例:3.01)"));

yTextField = new JTextField();
yTextField.setPreferredSize(new Dimension(50, 10));
htemp2.add(new JLabel("纵向:"));
htemp2.add(Box.createHorizontalStrut(10));
htemp2.add(yTextField);
htemp2.add(new JLabel("(例:4.01)"));

zTextField = new JTextField();
zTextField.setPreferredSize(new Dimension(50, 10));
htemp3.add(new JLabel("垂直:"));
htemp3.add(Box.createHorizontalStrut(10));
htemp3.add(zTextField);
htemp3.add(new JLabel("(例:3.01)"));

inteTextField = new JTextField();
inteTextField.setPreferredSize(new Dimension(50, 10));
htemp4.add(new JLabel("综合:"));
htemp4.add(Box.createHorizontalStrut(10));
htemp4.add(inteTextField);
htemp4.add(new JLabel("(例:5.01)"));

fliterStartTimeButton = new DateChooserJButton();
JLabel tmpLabel = new JLabel("开始时间:");
htemp5.add(tmpLabel);
htemp5.add(fliterStartTimeButton);

fliterEndTimeButton = new DateChooserJButton();
JLabel tmpLabel2 = new JLabel("结束时间:");
htemp6.add(tmpLabel2);
htemp6.add(fliterEndTimeButton);

fliterLoadBar = new JProgressBar();
JLabel tmpLabel3 = new JLabel("进度:");
htemp7.add(tmpLabel3);
htemp7.add(fliterLoadBar);

okButton = new JButton("过滤");
cancelButton = new JButton("撤销");
htemp8.add(okButton);
htemp8.add(Box.createHorizontalStrut(10));
htemp8.add(cancelButton);

vtemp.add(htemp1);
vtemp.add(Box.createVerticalStrut(10)); //创建上下空间距离
vtemp.add(htemp2);
vtemp.add(Box.createVerticalStrut(10));
vtemp.add(htemp3);
vtemp.add(Box.createVerticalStrut(10));
vtemp.add(htemp4);
vtemp.add(Box.createVerticalStrut(10));
vtemp.add(htemp5);
vtemp.add(Box.createVerticalStrut(10));
vtemp.add(htemp6);
vtemp.add(Box.createVerticalStrut(25));
vtemp.add(htemp7);
vtemp.add(Box.createVerticalStrut(5));
vtemp.add(htemp8);

inputPanel.add(vtemp);
//----------------------------------------------------------

//------------other panel init here-------------------------

//initCode!

//----------------------------------------------------------

b.add(inputPanel);
//b.add(otherPanel);

this.add(b, BorderLayout.NORTH);
}

public Fliter3GPanel() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}

}

阅读全文

与javabox左对齐相关的资料

热点内容
怎么改合同网站 浏览:73
网络斗地主记牌器怎么实现的 浏览:377
ps镜像文件制作教程 浏览:45
系统分页文件大小设置多少 浏览:447
win10有线无法上网 浏览:339
wps无法访问指定文件 浏览:96
iphone4震动坏了 浏览:217
安卓随机数软件rand 浏览:356
CNC编程如何掌握公差 浏览:297
linux搭建php环境 浏览:514
星形网络怎么表示有故障 浏览:719
dbf文件c语言处理excel 浏览:138
金蝶kis支持win10吗 浏览:113
常州采集物联网大数据平台有哪些 浏览:950
win10休眠文件改到d盘 浏览:626
如何编程手机app软件 浏览:656
node获取文件名 浏览:367
iphoneios7怎么设置铃声 浏览:52
手机qq激活星钻 浏览:302
html中引入js文件路径 浏览:83

友情链接