Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java IDE  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 程序编译求助!!!
tanytan





发贴: 22
积分: 0
于 2005-03-12 20:07 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
本人进行程序编译,主程序如下:
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.processWindowEventEnvelope;
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
请哪位大侠帮帮忙,到底出了什么问题啊?




话题树型展开
人气 标题 作者 字数 发贴时间
4621 程序编译求助!!! tanytan 4717 2005-03-12 20:07

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   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