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

热点内容
maya粒子表达式教程 浏览:84
抖音小视频如何挂app 浏览:283
cad怎么设置替补文件 浏览:790
win10启动文件是空的 浏览:397
jk网站有哪些 浏览:134
学编程和3d哪个更好 浏览:932
win10移动硬盘文件无法打开 浏览:385
文件名是乱码还删不掉 浏览:643
苹果键盘怎么打开任务管理器 浏览:437
手机桌面文件名字大全 浏览:334
tplink默认无线密码是多少 浏览:33
ipaddgm文件 浏览:99
lua语言编程用哪个平台 浏览:272
政采云如何导出pdf投标文件 浏览:529
php获取postjson数据 浏览:551
javatimetask 浏览:16
编程的话要什么证件 浏览:94
钱脉通微信多开 浏览:878
中学生学编程哪个培训机构好 浏览:852
荣耀路由TV设置文件共享错误 浏览:525

友情链接