导航:首页 > 编程语言 > 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左对齐相关的资料

热点内容
现在哪里开设了编程课 浏览:230
漫一网络培训学校有哪些 浏览:752
酷狗app如何在电脑同步播放 浏览:668
云浮微信群 浏览:344
公司文件打不开 浏览:267
LOL的设置文件在哪里 浏览:254
线上开庭是什么app 浏览:526
新中大软件怎么设置文件夹 浏览:807
git删除文件夹 浏览:353
皇室战争怎么升级竞技场 浏览:447
雅虎统计工具 浏览:741
edgepdf文件分类 浏览:901
cad为什么捕捉不到外部参照文件 浏览:935
重庆一共有多少个网站 浏览:34
k8s配置文件env创建失败 浏览:197
编程序在电脑上叫做什么 浏览:92
qq阅读可赚 浏览:21
怎样查找web储存文件图片 浏览:681
人口档案数据库包括什么信息 浏览:709
手机有什么好玩的星战网络游戏 浏览:15

友情链接