Topic: 程序编译求助!!! |
Print this page |
1.程序编译求助!!! | Copy to clipboard |
Posted by: tanytan Posted on: 2005-03-12 20:07 本人进行程序编译,主程序如下: package databasepro; import javax.swing.UIManager; import java.awt.*; public class DatabasePro { boolean packFrame = false; //Construct the application public DatabasePro() { DatabaseFrame frame = new DatabaseFrame(); //Validate frames that have preset sizes //Pack frames that have useful preferred size info, e.g. from their layout if (packFrame) { frame.pack(); } else { frame.validate(); } //Center the window Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = frame.getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); frame.setVisible(true); } //Main method public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { e.printStackTrace(); } new DatabasePro(); } } 窗口程序如下: package databasepro; import java.awt.*; import java.awt.event.*; import javax.swing.*; import com.borland.dx.sql.dataset.*; import com.borland.dbSwing.*; public class QueryDataFrame extends JFrame implements ActionListener { JPanel contentPane; Database database1 = new Database(); QueryDataSet queryDataSet1 = new QueryDataSet(); TableScrollPane tableScrollPane1 = new TableScrollPane(); JdbTable jdbTable1 = new JdbTable(); BorderLayout borderLayout1 = new BorderLayout(); FlowLayout flowlayout1=new FlowLayout(); JButton first = new JButton(); JButton prior = new JButton(); JButton next = new JButton(); JButton last = new JButton(); JPanel jPanel1 = new JPanel(); //Construct the frame public QueryDataFrame() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { contentPane = (JPanel) this.getContentPane(); database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:odbc:NorthwindSQLServer", "", "", false, "sun.jdbc.odbc.JdbcOdbcDriver")); queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select * from shippers", null, true, Load .AS_NEEDED)); contentPane.setLayout(borderLayout1); jPanel1.setLayout(flowlayout1); this.setSize(new Dimension(556, 215)); this.setTitle("QueryData类演示"); tableScrollPane1.setAlignmentX((float) 0.5); jdbTable1.setLocale(java.util.Locale.getDefault()); jdbTable1.setDataSet(queryDataSet1); first.setText("第一条"); prior.setText("上一条"); next.setText("下一条"); last.setText("最后一条"); contentPane.add(tableScrollPane1, BorderLayout.NORTH); tableScrollPane1.getViewport().add(jdbTable1,BorderLayout.CENTER); contentPane.add(jPanel1, BorderLayout.SOUTH); jPanel1.add(prior,null); jPanel1.add(next, null); jPanel1.add(last,null); jPanel1.add(first, null); first.addActionListener(this); prior.addActionListener(this); next.addActionListener(this); last.addActionListener(this); } //Overridden so we can exit when window is closed protected void processWindowEvent(WindowEvent e) { super.processWindowEvent; if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } } public void actionPerformed(ActionEvent e) { String actionComm=e.getActionCommand(); if (actionComm.equals("first")){ queryDataSet1.first(); } if (actionComm.equals("prior")){ queryDataSet1.prior(); } if (actionComm.equals("next")){ queryDataSet1.next(); } if (actionComm.equals("last")){ queryDataSet1.last(); } } } 在初次编译时通过,但再次打开时却不能编译,反而出现: "QueryDataFrame.java": package com.borland.dbSwing does not exist at line 7, column 1 "QueryDataFrame.java": cannot resolve symbol: class TableScrollPane in class databasepro.QueryDataFrame at line 16, column 3 "QueryDataFrame.java": cannot resolve symbol: class JdbTable in class databasepro.QueryDataFrame at line 17, column 3 "QueryDataFrame.java": cannot resolve symbol: class TableScrollPane in class databasepro.QueryDataFrame at line 16, column 42 "QueryDataFrame.java": cannot resolve symbol: class JdbTable in class databasepro.QueryDataFrame at line 17, column 28 请哪位大侠帮帮忙,到底出了什么问题啊? |
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 |