如题,控件有Label,textbox,table等。
解决方案 »
- java写文件
- TimerTask上一轮任务未结束,会启动下一轮任务吗?
- 暑假里实在太无聊了,所以编了个贪吃蛇玩玩
- 关于框架的一个问题!
- 执行jar程序时界面显示与在其它电脑上显示的不一样?netbeans6.0生成的jar程序如何添加风格包?
- 出现result set type is TYPE_FORWARD_ONLY的错误
- 关于线程
- 关于正则表达式的问题,有难度,高手来试试,多谢
- 谁能帮我弄清楚 怎样用JBuilder7.0 打开 Jakarta Structs 的源代码
- 一个关于字符转换的问题!
- 为何这句编码放在try外面会出错?String urlStr = URLEncoder.encode(message, "utf-8"));
- 如何用java程序来实现虚拟目录来表示系统的文件体系结构
private JLabel ipLabel = new JLabel("NTP Server Information");
private JTextField ipTextField = new JTextField("", 15);
private JLabel samplingLabel = new JLabel("Sampling Times");
private JTextField samplingTextField = new JTextField("", 15);
private JLabel samplingUnitLabel = new JLabel("sec");
private JButton getButton = new JButton("Get");
private JButton putButton = new JButton("Put"); public NtpInfoPanel() {
super();
setStatus();
setComponent();
} private void setStatus() {
// Set layout
this.setLayout(new GridLayout(1, 1)); // Set Border
setBorder(
BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder("NTP Information"),
BorderFactory.createEmptyBorder(5, 5, 5, 5)));
} private void setComponent() {
setLayout(null); add(ipLabel);
add(ipTextField);
add(samplingLabel);
add(samplingTextField);
add(samplingUnitLabel);
add(getButton);
add(putButton); addComponentListener(this);
} public void componentMoved(ComponentEvent e) {
} public void componentHidden(ComponentEvent e) {
}
public void componentShown(ComponentEvent e) {
} public void componentResized(ComponentEvent e) {
Component c = e.getComponent();
int offsetValue=20;
int nWidth=c.getWidth()-2*offsetValue;
int nHeight=c.getHeight()-2*offsetValue;
int nIntevalX=nWidth/7;
int nInnerWidth=nIntevalX-10;
int nIntevalY=nHeight;
int nPosX=offsetValue;
ipLabel.setLocation(nPosX, offsetValue);
ipLabel.setSize(nInnerWidth, nIntevalY);
nPosX+=nIntevalX;
ipTextField.setLocation(nPosX, offsetValue);
ipTextField.setSize(nInnerWidth, nIntevalY);
nPosX+=nIntevalX;
samplingLabel.setLocation(nPosX+10, offsetValue);
samplingLabel.setSize(nInnerWidth, nIntevalY);
nPosX+=nIntevalX;
samplingTextField.setLocation(nPosX, offsetValue);
samplingTextField.setSize(nInnerWidth, nIntevalY);
nPosX+=nIntevalX;
samplingUnitLabel.setLocation(nPosX, offsetValue);
samplingUnitLabel.setSize(nInnerWidth, nIntevalY);
nPosX+=nIntevalX;
getButton.setLocation(nPosX, offsetValue);
getButton.setSize(nInnerWidth, nIntevalY);
nPosX+=nIntevalX;
putButton.setLocation(nPosX, offsetValue);
putButton.setSize(nInnerWidth, nIntevalY);
}
}