Topic: 请大家帮忙看看这个程序错在哪

  Print this page

1.请大家帮忙看看这个程序错在哪 Copy to clipboard
Posted by: haoyue
Posted on: 2004-08-16 10:08

请问这段程序错在哪呀?请大家帮我解释一下好吗!
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class QueryDB
{
public static void main(String[] args)
{
QueryFrame myframe=new QueryFrame();
myframe.show();
}
}

class QueryFrame extends JFrame implements ActionListener
{
private Connection con=null;
private Statement stmt=null;
private ResultSet rs=null;
private JLabel conditionlabel=new JLabel("请填写下列查询条件",SwingConstants.CENTER);
private JLabel numberlabel=new JLabel("学号",SwingConstants.RIGHT);
private JTextField number=new JTextField(10);
private JLabel namelabel=new JLabel("姓名",SwingConstants.RIGHT);
private JTextField name=new JTextField(10);
private JLabel sexlabel=new JLabel("性别",SwingConstants.RIGHT);
private JTextField sex=new JTextField(3);
private JLabel agelabel=new JLabel("年龄",SwingConstants.RIGHT);
private JTextField age=new JTextField(3);
private JLabel deptlabel=new JLabel("所在系",SwingConstants.RIGHT);
private JTextField dept=new JTextField(4);
private JButton commit=new JButton("递交");
private JLabel resultlabel=new JLabel("查询结果",SwingConstants.CENTER);
private JTextArea resultarea=new JTextArea(10,28);
private String command=null;

public QueryFrame()
{
setTitle("数据库查询");
setSize(500,300);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}

Container c=getContentPane();
c.setLayout(new GridBagLayout());
//以下的代码功能是使用GridBagLayout布局编排Swing组件
GridBagConstraints gbc=new GridBagConstraints();
gbc.fll=GridBagConstraints.NONE;
gbc.anchor=GridBagConstraints.CENTER;
gbc.weightx=100;
gbc.weighty=100;
add(conditionlabel,gbc,3,0,5,1);

public void actionPerformed(ActionEvent evt)
{

}
}

2.Re:请大家帮忙看看这个程序错在哪 [Re: haoyue] Copy to clipboard
Posted by: coolnight
Posted on: 2004-08-16 17:53

setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

3.Re:请大家帮忙看看这个程序错在哪 [Re: haoyue] Copy to clipboard
Posted by: haoyue
Posted on: 2004-08-17 09:41

这句话是什么意思呀,我看不懂呀

4.Re:请大家帮忙看看这个程序错在哪 [Re: haoyue] Copy to clipboard
Posted by: xhxasdf
Posted on: 2004-08-18 00:13

这里毛的高手么??
我是新手!


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923