| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1001 人关注过本帖
标题:[原创]前辈们~~求救啊 !!java编程
只看楼主 加入收藏
joer_11
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-10-22
收藏
 问题点数:0 回复次数:3 
[原创]前辈们~~求救啊 !!java编程

我用Jbuilder正做一个联数据库的小工程 具体情况是这样的: 做的那个学生插入和删除还有查询功能 ,有几个frame, 有一个class 里有一个 函数用来返回connection类的一个对象。 在要联接数据的地方就生成这个对象。 另外有一个主类有一个主函数,从个类里又生成新的frame, 当点击这个frame中的一个button时又会什么成另一个frame 出现另一个介面 .......问题就是我 总出现下面的错误 : UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JPanel[,0,0,0x0,invalid,layout=java.awt.FlowLayout,alignmentX=null,alignmentY=null,border=,flags=9,maximumSize=,minimumSize=,preferredSize=] java.lang.Error at javax.swing.UIDefaults.getUIError(UIDefaults.java:689) at javax.swing.UIDefaults.getUI(UIDefaults.java:719) at javax.swing.UIManager.getUI(UIManager.java:784) at javax.swing.JPanel.updateUI(JPanel.java:104) at javax.swing.JPanel.<init>(JPanel.java:64) at javax.swing.JPanel.<init>(JPanel.java:87) at javax.swing.JPanel.<init>(JPanel.java:95) at javax.swing.JRootPane.createGlassPane(JRootPane.java:480) at javax.swing.JRootPane.<init>(JRootPane.java:311) at javax.swing.JFrame.createRootPane(JFrame.java:253) at javax.swing.JFrame.frameInit(JFrame.java:232) at javax.swing.JFrame.<init>(JFrame.java:155) at xuesheng.xs_Frame1.<init>(xs_Frame1.java:54) at xuesheng.Application1.<init>(Application1.java:34) at xuesheng.Application1.main(Application1.java:85) 我实在找不出来原因,十分痛苦呀!!~~ 求高手们帮帮我啊 万分感谢呀 ~~~ 自己想点东西,但是有问题出现身边没人能帮忙真是一件很 痛苦的事情呀~~~

搜索更多相关主题的帖子: java 数据库 前辈 frame 
2005-10-22 21:49
飘飘叶子
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:34
帖 子:597
专家分:10
注 册:2005-8-17
收藏
得分:0 
给错误我们也帮不了你啊,发代码

向着软件工程师的目标前进!
2005-10-22 23:23
joer_11
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-10-22
收藏
得分:0 
代码好长的哦 因为我是用jbuder写的 不过我再换成笔本写
看看好有什么错误吧 ,我再发代码上来 ,好吧 ,谢谢你看我的问题哦!
2005-10-23 10:58
joer_11
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-10-22
收藏
得分:0 

[原创]前辈们~~求救啊 !!java编程

我用Jbuilder正做一个联数据库的小工程 具体情况是这样的: 做的那个学生插入和删除还有查询功能 ,有几个frame, 有一个class 里有一个 函数用来返回connection类的一个对象。 在要联接数据的地方就生成这个对象。 另外有一个主类有一个主函数,从个类里又生成新的frame, 当点击这个frame中的一个button时又会什么成另一个frame 出现另一个介面 .......问题就是我 总出现下面的错误 :

package xuesheng;

import java.awt.Toolkit; import javax.swing.SwingUtilities; import javax.swing.UIManager; import java.awt.Dimension; import java.sql.*;

import java.awt.*; import java.awt.event.*; import javax.swing.*; //import com.borland.jbcl.layout.PaneLayout; //import com.borland.jbcl.layout.*; //import com.borland.dx.sql.dataset.Database; //import com.borland.dx.dataset.TableDataSet; //import com.borland.dx.dataset.Column; //import com.borland.dx.sql.dataset.*; //import com.borland.jbcl.layout.XYLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener;

import javax.swing.JFrame;

public class Application1 { xs_Frame1 frame; Connection con;

public Application1(){ try { jbInit(); } catch (Exception ex) { ex.printStackTrace(); } }

public static void main(String[] args)throws Exception { new Application1(); }

private void jbInit() throws Exception { // Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // Dimension frameSize = frame.getSize(); frame = new xs_Frame1(); frame.setVisible(true); } }

/*********************************ZW*******************************************/ class xs_Frame1 extends JFrame { Connection conn; ResultSet re; JPanel contentPane; // XYLayout xYLayout1 = new XYLayout(); JPanel jPanel1 = new JPanel(); JPanel jPanel2 = new JPanel(); JLabel L1 = new JLabel(); JLabel L2 = new JLabel(); JLabel L3 = new JLabel(); JTextField jTextField1 = new JTextField(); JTextField jTextField2 = new JTextField(); JButton jButton1 = new JButton(); JButton jButton2 = new JButton(); JLabel jLabel1 = new JLabel(); public xs_Frame1() { try { //**************** setDefaultCloseOperation(EXIT_ON_CLOSE); jbInit(); } catch (Exception exception) { exception.printStackTrace(); } }

/** * Component initialization. * * @throws java.lang.Exception */ private void jbInit() throws Exception { contentPane = (JPanel) getContentPane(); // contentPane.setLayout(xYLayout1); contentPane.setBackground(Color.orange); setSize(new Dimension(400, 300)); setTitle("In Put The Information Of The student"); L1.setText("管理学生系统"); L3.setPreferredSize(new Dimension(134, 16)); L3.setText("输入密码:"); jTextField1.setPreferredSize(new Dimension(130, 21)); jTextField1.setText("jTextField1"); L2.setPreferredSize(new Dimension(134, 16)); L2.setText("输入用户名:"); jTextField2.setPreferredSize(new Dimension(132, 21)); jTextField2.setText("jTextField2"); jButton1.setText("管理员登录"); jButton1.addActionListener(new xs_Frame1_jButton1_actionAdapter(this)); jPanel1.setBackground(new Color(224, 228, 255)); jButton2.setText("jButton2"); jButton2.addActionListener(new xs_Frame1_jButton2_actionAdapter(this)); jLabel1.setBackground(Color.pink); jLabel1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 16)); jLabel1.setPreferredSize(new Dimension(64, 166)); jLabel1.setText("学生进入"); contentPane.add(jPanel1); // contentPane.add(jPanel1, new XYConstraints(0, 0, 183, 299)); jPanel1.add(jLabel1); jPanel1.add(jButton2); contentPane.add(jPanel2); // contentPane.add(jPanel2, new XYConstraints(208, 0, 191, 299)); jPanel2.add(L1); jPanel2.add(L2); jPanel2.add(jTextField1); jPanel2.add(L3); jPanel2.add(jTextField2); jPanel2.add(jButton1);

}

public void jButton1_actionPerformed(ActionEvent e) { manage_frame man_f = new manage_frame(); this.setVisible(false); man_f.setSize(260,210); man_f.setVisible(true); }

/* Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = man_f.getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } man_f.setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); man_f.setVisible(true);

} */ public void jButton2_actionPerformed(ActionEvent e) {

}

}

class xs_Frame1_jButton2_actionAdapter implements ActionListener { private xs_Frame1 adaptee; xs_Frame1_jButton2_actionAdapter(xs_Frame1 adaptee) { this.adaptee = adaptee; }

public void actionPerformed(ActionEvent e) { adaptee.jButton2_actionPerformed(e); } }

class xs_Frame1_jButton1_actionAdapter implements ActionListener { private xs_Frame1 adaptee; xs_Frame1_jButton1_actionAdapter(xs_Frame1 adaptee) { this.adaptee = adaptee; }

public void actionPerformed(ActionEvent e) { adaptee.jButton1_actionPerformed(e); } } /************************************************************************/

class manage_frame extends JFrame { BorderLayout borderLayout1 = new BorderLayout(); JLabel L1 = new JLabel(); JPanel P1 = new JPanel(); JPanel p2 = new JPanel(); // XYLayout xYLayout1 = new XYLayout(); JButton b1 = new JButton(); JButton b3 = new JButton(); JButton b2 = new JButton(); //XYLayout xYLayout2 = new XYLayout(); JPanel p11 = new JPanel(); // XYLayout xYLayout3 = new XYLayout(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JLabel jLabel3 = new JLabel(); JLabel jLabel4 = new JLabel(); JLabel jLabel5 = new JLabel(); JTextField jTextField1 = new JTextField(); JTextField jTextField2 = new JTextField(); JTextField jTextField3 = new JTextField(); JRadioButton jRadioButton1 = new JRadioButton(); JRadioButton jRadioButton2 = new JRadioButton(); JComboBox jComboBox1 = new JComboBox(); JTextField jTextField4 = new JTextField(); JLabel jLabel6 = new JLabel(); public manage_frame() { try { jbInit(); } catch (Exception exception) { exception.printStackTrace(); } }

private void jbInit() throws Exception { getContentPane().setLayout(borderLayout1); setSize(new Dimension(456, 370)); L1.setBackground(new Color(255, 235, 255)); L1.setFont(new java.awt.Font("Default", Font.BOLD | Font.ITALIC, 18)); L1.setForeground(new Color(76, 111, 194)); L1.setPreferredSize(new Dimension(134, 36)); L1.setHorizontalAlignment(SwingConstants.CENTER); L1.setText("the information of the studetn"); P1.setBackground(Color.pink); // P1.setLayout(xYLayout2); p2.setPreferredSize(new Dimension(130, 30)); // p2.setLayout(xYLayout1); b1.setText("INSERT"); b1.addActionListener(new manage_frame_b1_actionAdapter(this)); b3.setText("BACK"); b2.setText("DELETE");

// p11.setLayout(xYLayout3); jLabel1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 16)); jLabel1.setText("姓名:"); jLabel2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 16)); jLabel2.setText("性别:"); jLabel3.setFont(new java.awt.Font("Dialog", Font.PLAIN, 16)); jLabel3.setText("身高:"); jLabel4.setFont(new java.awt.Font("Dialog", Font.PLAIN, 16)); jLabel4.setText("所选课程:"); jLabel5.setFont(new java.awt.Font("Dialog", Font.PLAIN, 16)); jLabel5.setText("分数:"); jTextField1.setText("jTextField1"); jTextField2.setText("jTextField2"); jTextField3.setText("jTextField3"); jRadioButton1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13)); jRadioButton1.setText("女"); jRadioButton2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13)); jRadioButton2.setText("男"); jComboBox1.addActionListener(new manage_frame_jComboBox1_actionAdapter(this)); jComboBox1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 12)); jTextField4.setText("jTextField4"); jLabel6.setFont(new java.awt.Font("Dialog", Font.PLAIN, 16)); jLabel6.setText("学号:"); p2.add(b1); p2.add(b3); p2.add(b2); /* p2.add(b1, new XYConstraints(72, 3, -1, -1));

p2.add(b3, new XYConstraints(302, 4, -1, -1)); p2.add(b2, new XYConstraints(189, 5, -1, -1)); */ this.getContentPane().add(L1, java.awt.BorderLayout.NORTH); this.getContentPane().add(P1, java.awt.BorderLayout.CENTER); //P1.add(p11, new XYConstraints(22, 10, 401, 275)); P1.add(p11); this.getContentPane().add(p2, java.awt.BorderLayout.SOUTH); p11.add(jLabel1); p11.add(jTextField1); p11.add(jTextField2); p11.add(jComboBox1); p11.add(jTextField3); p11.add(jLabel4); p11.add(jLabel5); p11.add(jRadioButton2); p11.add(jLabel6); p11.add(jLabel2); p11.add(jLabel3); p11.add(jTextField4); p11.add(jRadioButton1);

/* p11.add(jLabel1, new XYConstraints(48, 13, 71, 31)); p11.add(jTextField1, new XYConstraints(164, 16, 123, 25)); p11.add(jTextField2, new XYConstraints(164, 134, 124, 23)); p11.add(jComboBox1, new XYConstraints(167, 175, 124, -1)); p11.add(jTextField3, new XYConstraints(169, 215, 110, 24)); p11.add(jLabel4, new XYConstraints(48, 171, 86, 28)); p11.add(jLabel5, new XYConstraints(47, 205, 71, 31)); p11.add(jRadioButton2, new XYConstraints(233, 99, -1, -1)); p11.add(jLabel6, new XYConstraints(46, 66, 61, -1)); p11.add(jLabel2, new XYConstraints(49, 96, 72, 28)); p11.add(jLabel3, new XYConstraints(47, 134, 72, 30)); p11.add(jTextField4, new XYConstraints(164, 64, 121, 25)); p11.add(jRadioButton1, new XYConstraints(161, 96, -1, -1)); */ jComboBox1.addItem(new String(" 数据库应用")); jComboBox1.addItem(new String(" JAVA")); jComboBox1.addItem(new String(" 微机原理")); jComboBox1.addItem(new String(" 信号与系统")); }

public void jComboBox1_actionPerformed(ActionEvent e) {

}

public void b1_actionPerformed(ActionEvent e) { try { LinkData LD=new LinkData(); Connection con=LD.link();

} catch (Exception exception) {}

}

class manage_frame_b1_actionAdapter implements ActionListener { private manage_frame adaptee; manage_frame_b1_actionAdapter(manage_frame adaptee) { this.adaptee = adaptee; }

public void actionPerformed(ActionEvent e) { adaptee.b1_actionPerformed(e); } }

class manage_frame_jComboBox1_actionAdapter implements ActionListener { private manage_frame adaptee; manage_frame_jComboBox1_actionAdapter(manage_frame adaptee) { this.adaptee = adaptee; }

public void actionPerformed(ActionEvent e) { adaptee.jComboBox1_actionPerformed(e); } } }

/**************************************************************************/ class LinkData { Connection con; public LinkData() { }

public Connection link()throws Exception{ LinkData linkdata = new LinkData();

try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException ce) { System.out.println(ce); } try { con=DriverManager.getConnection("jdbc:odbc:xueshengXT",null,null); Statement st= con.createStatement();

} catch(SQLException ce) { System.out.println(ce); } return con;

} }

2005-10-23 13:23
快速回复:[原创]前辈们~~求救啊 !!java编程
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025067 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved