資源簡介
JAVA核心技術第八版(1,2卷)-源碼
JAVA核心技術第八版(1,2卷)-書中所有例題(程序清單)的源碼,包含第一卷和第二卷內容都有

代碼片段和文件信息
import?java.awt.EventQueue;
import?java.awt.event.*;
import?java.io.*;
import?javax.swing.*;
/**
?*?A?program?for?viewing?images.
?*?@version?1.22?2007-05-21
?*?@author?Cay?Horstmann
?*/
public?class?ImageViewer
{
???public?static?void?main(String[]?args)
???{
??????EventQueue.invokeLater(new?Runnable()
?????????{
????????????public?void?run()
????????????{
???????????????Jframe?frame?=?new?ImageViewerframe();
???????????????frame.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
???????????????frame.setVisible(true);
????????????}
?????????});
???}
}
/**
?*?A?frame?with?a?label?to?show?an?image.
?*/
class?ImageViewerframe?extends?Jframe
{
???public?ImageViewerframe()
???{
??????settitle(“ImageViewer“);
??????setSize(DEFAULT_WIDTH?DEFAULT_HEIGHT);
??????//?use?a?label?to?display?the?images
??????label?=?new?JLabel();
??????add(label);
??????//?set?up?the?file?chooser
??????chooser?=?new?JFileChooser();
??????chooser.setCurrentDirectory(new?File(“.“));
??????//?set?up?the?menu?bar
??????JMenuBar?menuBar?=?new?JMenuBar();
??????setJMenuBar(menuBar);
??????JMenu?menu?=?new?JMenu(“File“);
??????menuBar.add(menu);
??????JMenuItem?openItem?=?new?JMenuItem(“Open“);
??????menu.add(openItem);
??????openItem.addActionListener(new?ActionListener()
?????????{
????????????public?void?actionPerformed(ActionEvent?event)
????????????{
???????????????//?show?file?chooser?dialog
???????????????int?result?=?chooser.showOpenDialog(null);
???????????????//?if?file?selected?set?it?as?icon?of?the?label
???????????????if?(result?==?JFileChooser.APPROVE_OPTION)
???????????????{
??????????????????String?name?=?chooser.getSelectedFile().getPath();
??????????????????label.setIcon(new?ImageIcon(name));
???????????????}
????????????}
?????????});
??????JMenuItem?exitItem?=?new?JMenuItem(“Exit“);
??????menu.add(exitItem);
??????exitItem.addActionListener(new?ActionListener()
?????????{
????????????public?void?actionPerformed(ActionEvent?event)
????????????{
???????????????System.exit(0);
????????????}
?????????});
???}
???private?JLabel?label;
???private?JFileChooser?chooser;
???private?static?final?int?DEFAULT_WIDTH?=?300;
???private?static?final?int?DEFAULT_HEIGHT?=?400;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-11-10?07:51??源碼\
?????目錄???????????0??2012-10-13?07:26??源碼\v2ch06\
?????目錄???????????0??2012-10-13?07:26??源碼\v2ch06\SpinnerTest\
?????文件????????6159??2007-09-20?08:28??源碼\v2ch06\SpinnerTest\SpinnerTest.java
?????目錄???????????0??2012-10-13?07:26??源碼\v2ch06\ClassTree\
?????文件?????????925??2000-10-04?06:04??源碼\v2ch06\ClassTree\blue-ball.gif
?????文件?????????527??2000-10-04?06:04??源碼\v2ch06\ClassTree\red-ball.gif
?????文件????????7850??2007-07-31?09:11??源碼\v2ch06\ClassTree\ClassTree.java
?????文件?????????925??2000-10-04?06:08??源碼\v2ch06\ClassTree\yellow-ball.gif
?????目錄???????????0??2012-10-13?07:26??源碼\v2ch06\ob
?????文件????????5420??2007-07-31?04:10??源碼\v2ch06\ob
?????目錄???????????0??2012-10-13?07:26??源碼\v2ch06\InvestmentTable\
?????文件????????2294??2007-07-31?04:04??源碼\v2ch06\InvestmentTable\InvestmentTable.java
?????目錄???????????0??2012-10-13?07:26??源碼\v2ch06\EditorPaneTest\
?????文件????????4361??2007-07-31?04:05??源碼\v2ch06\EditorPaneTest\EditorPaneTest.java
?????目錄???????????0??2012-10-13?07:26??源碼\v2ch06\TreeEditTest\
?????文件????????4921??2007-07-31?03:59??源碼\v2ch06\TreeEditTest\TreeEditTest.java
?????目錄???????????0??2012-10-13?07:26??源碼\v2ch06\FormatTest\
?????文件????????8847??2007-08-04?10:24??源碼\v2ch06\FormatTest\FormatTest.java
?????目錄???????????0??2012-10-13?07:26??源碼\v2ch06\ProgressMonitorInputStreamTest\
?????文件????????3507??2007-09-23?13:35??源碼\v2ch06\ProgressMonitorInputStreamTest\ProgressMonitorInputStreamTest.java
?????目錄???????????0??2012-10-13?07:26??源碼\v2ch06\TabbedPaneTest\
?????文件?????????700??2000-10-04?06:08??源碼\v2ch06\TabbedPaneTest\Mercury.gif
?????文件????????2228??2000-10-04?06:08??源碼\v2ch06\TabbedPaneTest\Neptune.gif
?????文件????????4227??2007-11-12?10:43??源碼\v2ch06\TabbedPaneTest\TabbedPaneTest.java
?????文件????????2059??2000-10-04?06:08??源碼\v2ch06\TabbedPaneTest\Uranus.gif
?????文件????????1891??2000-10-04?06:08??源碼\v2ch06\TabbedPaneTest\Mars.gif
?????文件?????????527??2000-10-04?06:04??源碼\v2ch06\TabbedPaneTest\red-ball.gif
?????文件????????2954??2000-10-04?06:08??源碼\v2ch06\TabbedPaneTest\Venus.gif
?????文件????????3421??2000-10-04?06:08??源碼\v2ch06\TabbedPaneTest\Earth.gif
?????文件????????4878??2000-10-04?06:08??源碼\v2ch06\TabbedPaneTest\Saturn.gif
............此處省略761個文件信息
- 上一篇:JAVA名片管理系統140219
- 下一篇:簡單的學生信息管理系統java源碼
評論
共有 條評論