haoyue
发贴: 24
积分: 0
|
于 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) { } }
haoyue edited on 2004-08-16 13:14
|