发现netbeans真的好强大阿,可以建一个工程直接操作数据库,而且使用比较方便
这就是图片
首先新建工程,选则java- desktop application
然后next,再在choose application shell中选择database application
再next
最后在master connection选择new database connection
我使用的是MySQL,所以要选择MySQL,
然后填写一下URL jdbc:mysql://localhost:3306/database_name
和user name,password
最后finish,run就ok了
很爽阿,可是在ubuntu上,我没有使用系统默认的皮肤,于是就产生这样的bug
run:
2008-5-8 14:44:51 org.jdesktop.application.Application create
警告: Couldn't set LookandFeel Application.lookAndFeel = "system"
java.lang.NullPointerException
at javax.swing.plaf.synth.SynthLookAndFeel$AATextListener.propertyChange(SynthLookAndFeel.java:793)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:347)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
at java.awt.Toolkit.setDesktopProperty(Toolkit.java:1784)
at sun.awt.SunToolkit.fireDesktopFontPropertyChanges(SunToolkit.java:1698)
at sun.awt.SunToolkit.setAAFontSettingsCondition(SunToolkit.java:1743)
at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(SwingUtilities2.java:119)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initComponentDefaults(GTKLookAndFeel.java:1258)
at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.getDefaults(GTKLookAndFeel.java:294)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:537)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:581)
at org.jdesktop.application.Application.create(Application.java:249)
at org.jdesktop.application.Application$1.run(Application.java:169)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
2008-5-8 14:44:51 org.jdesktop.application.Application$1 run
严重: Application class dbinout.DBInOutApp failed to launch
java.lang.NullPointerException
。。。。。。
于是乎你要在属性中的desktop app中的look&feel中选择java default,这样就ok了。。。
嘻嘻,2分钟搞定一个界面数据库的基本使用。。。
评论
推荐阅读
留下你的脚步