随笔分类 -  JavaSE

摘要:import java.awt.BorderLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JComboBox;import javax.swing.JFrame;public class MainClass { public static void main(final String args[]) { final String labels[] = { "A", "B", "C", & 阅读全文
posted @ 2010-06-27 20:28 qiang.xu 阅读(1804) 评论(0) 推荐(0) 编辑
摘要:参考:http://k.pconline.com.cn/question/2210578.htmlhttp://liuliang136.javaeye.com/blog/551524最终代码:这个版本的代码是可以支持中文,需要导入jxl.jar包。/* * To change this template, choose Tools | Templates * and open the template in the editor. */package Utils;///////////////////////////////////////////////////// importimport 阅读全文
posted @ 2010-06-27 18:24 qiang.xu 阅读(2852) 评论(0) 推荐(0) 编辑
摘要:1。http://blog.csdn.net/qingyuexiao/archive/2009/04/21/4097723.aspx1、JAVA读取文件,避免中文乱码。/** * 读取文件内容 * * @param filePathAndName * String 如 c:\\1.txt 绝对路径 * @return boolean */public static String readFile(String filePathAndName) {String fileContent = "";try {File f = new File(filePathAndName);i 阅读全文
posted @ 2010-06-27 18:22 qiang.xu 阅读(3171) 评论(0) 推荐(0) 编辑
摘要:Hibernate Class Is Not Mapped ?1.http://blog.csdn.net/mycxsky/archive/2008/12/02/3430131.aspx好久没玩Hibernate了,都忘记了,今天碰到一个关于没有映射的错误,找了半天才发现原来是HQL的错误。org.springframework.orm.hibernate3.HibernateQueryException: USERINFO is not mapped.看到.hbm.xml文件中的<hibernate-mapping package="form"&gt 阅读全文
posted @ 2010-06-27 15:01 qiang.xu 阅读(7233) 评论(0) 推荐(1) 编辑
摘要:netbeans生成数据报表由于在做课程设计时,需要产生数据报表,于是google得到下面一篇文章:http://gjl2008yn.javaeye.com/blog/186582--------------------------------------------------------------------------------------最近一个项目中要求报表打印功能,而在Java中一直没有找到合适的报表设计工具。到网上找了好久, 8) 终于被我找到了——就是iReport,它是基于JasperReports的报表设计工具。 我下载的是它的n 阅读全文
posted @ 2010-06-23 18:50 qiang.xu 阅读(1558) 评论(0) 推荐(1) 编辑
摘要:netbeans 中JTabbedPanel的使用http://java.sun.com/developer/onlineTraining/tools/netbeans_part1/#importingSo far, you have created a project and aJFrameclass calledSamplesJFrame. Next, you'll build on theJFramecomponent and add other components.Click on Tabbed Pane in the Palette, then click on the b 阅读全文
posted @ 2010-06-21 18:39 qiang.xu 阅读(1433) 评论(0) 推荐(0) 编辑
摘要:JTable sortingimport javax.swing.JFrame;import javax.swing.JScrollPane;import javax.swing.JTable;import javax.swing.SwingUtilities;import javax.swing.table.DefaultTableModel;import javax.swing.table.TableModel;import javax.swing.table.TableRowSorter;public class JTableSortDemo { public static void 阅读全文
posted @ 2010-06-19 15:41 qiang.xu 阅读(244) 评论(0) 推荐(0) 编辑
摘要:How to operate data in JTable public boolean isRecordSelected() { return masterTable.getSelectedRow() != -1; } @Action public void newRecord() { desktopapplicationdbtest.Car c = new desktopapplicationdbtest.Car(); entityManager.persist(c); list.add(c); int row = list.size()-1; masterTable.setRowSele 阅读全文
posted @ 2010-06-19 15:40 qiang.xu 阅读(180) 评论(0) 推荐(0) 编辑
摘要:How to open a JFrame @Action public void showAboutBox() { if (aboutBox == null) { JFrame mainFrame = NumberSliderApp.getApplication().getMainFrame(); aboutBox = new NumberSliderAboutBox(mainFrame); aboutBox.setLocationRelativeTo(mainFrame); } NumberSliderApp.getApplication().show(aboutBox); } 阅读全文
posted @ 2010-06-19 15:21 qiang.xu 阅读(126) 评论(0) 推荐(0) 编辑
摘要:netbean 数据绑定http://netbeans.org/kb/docs/java/gui-binding_zh_CN.html 阅读全文
posted @ 2010-06-19 15:14 qiang.xu 阅读(138) 评论(0) 推荐(0) 编辑
摘要:简单说:extends是继承父类,只要那个类不是声明为final或者那个类定义为abstract的就能继承,JAVA中不支持多重继承,但是可以用接口来实现,这样就要用到implements,继承只能继承一个类,但implements可以实现多个接口,用逗号分开就行了比如class A extends B implements C,D,E 术语话来说:extends 继承类;implements 实现接口。类和接口是不同的:类里是有程序实现的;而接口无程序实现,只可以预定义方法 extends 继承类。implements 实现接口:Java也提供继承机制﹐但还另外提供一个叫interface的 阅读全文
posted @ 2010-06-18 15:12 qiang.xu 阅读(1155) 评论(0) 推荐(0) 编辑
摘要:Documents : http://java.sun.com/docs/books/tutorial/uiswing/This trail tells you how to create graphical user interfaces (GUIs) for applications and applets, using the Swing components. Getting Started with Swing is a quick start lesson. First it gives you a bit of background about the JFC and Swing 阅读全文
posted @ 2010-06-18 09:59 qiang.xu 阅读(128) 评论(0) 推荐(0) 编辑
摘要:Java数据类型Hibernate数据类型标准SQL数据类型(PS:对于不同的DB可能有所差异)byte、java.lang.BytebyteTINYINTshort、java.lang.ShortshortSMALLINTint、java.lang.IntegerintegerINGEGERlong、java.lang.LonglongBIGINTfloat、java.lang.FloatfloatFLOATdouble、java.lang.DoubledoubleDOUBLEjava.math.BigDecimalbig_decimalNUMERICchar、java.lang.Chara 阅读全文
posted @ 2010-06-17 16:32 qiang.xu 阅读(248) 评论(0) 推荐(0) 编辑
摘要:swing look and feel demo这里使用的皮肤是substance。1.首先新建一个netbean工程,将两个包trident.jar,substance.jar加入到工程中。2.在run函数前添加:import javax.swing.JDialog;import javax.swing.JFrame;import javax.swing.UIManager;import javax.swing.UnsupportedLookAndFeelException;import org.pushingpixels.substance.api.SubstanceLookAndFeel 阅读全文
posted @ 2010-06-16 11:05 qiang.xu 阅读(1067) 评论(0) 推荐(0) 编辑
摘要:swing skin demohttp://www.blogjava.net/gml520/archive/2009/05/23/277603.html 阅读全文
posted @ 2010-06-15 16:19 qiang.xu 阅读(257) 评论(0) 推荐(0) 编辑
摘要:java skin http://www.open-open.com/61.htm 阅读全文
posted @ 2010-06-15 16:15 qiang.xu 阅读(166) 评论(0) 推荐(0) 编辑
摘要:HQL Batch Update, Insert1.Batch InsertSession session = sessionFactory.openSession();Transaction tx = session.beginTransaction();for ( int i=0; i<100000; i++ ) { Customer customer = new Customer(.....); session.save(customer);}tx.commit();session.close(); 2.Batch UpdateSession session = sessi 阅读全文
posted @ 2010-06-14 17:00 qiang.xu 阅读(252) 评论(0) 推荐(0) 编辑
摘要:HQL Delete Example/////////////////////////////////////////////////////////////////////////import java.util.*;import java.sql.*;import org.hibernate.*;import org.hibernate.criterion.*;public class Main { public static void main(String[] args) { HibernateUtil.setup("create table Supplier ( id in 阅读全文
posted @ 2010-06-14 16:56 qiang.xu 阅读(283) 评论(0) 推荐(0) 编辑
摘要:How to use Hibernate in NetBean IDE?See this : http://netbeans.org/kb/docs/java/hibernate-java-se_zh_CN.html,这里使用的是mysql数据库,如何使用sql server数据库参见: http://blog.csdn.net/xuqianghit/archive/2010/06/10/5662371.aspx 阅读全文
posted @ 2010-06-14 16:42 qiang.xu 阅读(115) 评论(0) 推荐(0) 编辑
摘要:What's Hibernate? and What is the function of Hibernate?Working with object-oriented software and a relational database can be cumbersome and time consuming in today's enterprise environments. Hibernate is an Object/Relational Mapping tool for Java environments. The term Object/Relational Ma 阅读全文
posted @ 2010-06-14 16:37 qiang.xu 阅读(141) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示