本帖最后由 chenweionline 于 2008-02-29 13:31:47 编辑

解决方案 »

  1.   

    书是好书
    只可惜放的电子书只不过是china-pub各章阅览+光盘的源代码而已
      

  2.   

    呵呵,我觉得这套书比其他讲GUI的书籍有价值的地方在于卷ⅠAWT的前7章,毕竟讲具体组件的书籍或文章比比皆是,但是能够系统介绍AWT/Swing里绘制、图像处理方式的就不多了。
      

  3.   

    下载了,好是好东西。但是我遇到一个问题:在21,22章里复制过来的好几个代码都有这个问题。比如下面这段
    public class HTMLListenerTest extends JFrame {
    private JEditorPane editorPane = new JEditorPane();public HTMLListenerTest() {
    Container contentPane = getContentPane();
    String url = "file:" + System.getProperty("user.dir") +
    System.getProperty("file.separator") +
    "java.util.Hashtable.html";try { 
    editorPane.setPage(url);
    }
    catch(IOException ex) { ex.printStackTrace(); }contentPane.add(new JScrollPane(editorPane), 
    BorderLayout.CENTER);editorPane.setEditable(false);editorPane.addHyperlinkListener(new HyperlinkListener() {
    public void hyperlinkUpdate(HyperlinkEvent e) {
    try { 
    editorPane.setPage(e.getURL());
    }
    catch(IOException ex) { ex.printStackTrace(); }
    }
    });
    }
    public static void main(String args[]) {
        GJApp.launch(new HTMLListenerTest(), 
    "JEditorPane",300,300,450,300);
    }
    }
    class GJApp extends WindowAdapter {
    static private JPanel statusArea = new JPanel();
    static private JLabel status = new JLabel(" ");
    static private ResourceBundle resources;public static void launch(final JFrame f, String title,
    final int x, final int y, 
    final int w, int h) {
    launch(f,title,x,y,w,h,null); 
    }
    public static void launch(final JFrame f, String title,
    final int x, final int y, 
    final int w, int h,
    String propertiesFilename) {
    f.setTitle(title);
    f.setBounds(x,y,w,h);
    f.setVisible(true);statusArea.setBorder(BorderFactory.createEtchedBorder());
    statusArea.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
    statusArea.add(status);
    status.setHorizontalAlignment(JLabel.LEFT);f.setDefaultCloseOperation(
    WindowConstants.DISPOSE_ON_CLOSE);if(propertiesFilename != null) {
    resources = ResourceBundle.getBundle(
    propertiesFilename, Locale.getDefault());
    }f.addWindowListener(new WindowAdapter() {
    public void windowClosed(WindowEvent e) {
    System.exit(0);
    }
    });
    }
    static public JPanel getStatusArea() {
    return statusArea;
    }
    static public void showStatus(String s) {
    status.setText(s);
    }
    static Object getResource(String key) {
    if(resources != null) {
    return resources.getString(key);
    }
    return null;
    }
      }
    在Eclipse3.2里编译的时候就会报错:已定义类型GJApp。
    不知为什么?我看来看去觉得没错啊,但就是报错。LZ你能不能帮忙看看呢?
      

  4.   

    已经不用SWING了,SWT的功能强大很多,而且使用方便
      

  5.   

    现在缺的是SWT方面的书,不过还是帮楼主顶一下
      

  6.   

    书是好书 
    只可惜放的电子书只不过是china-pub各章阅览+光盘的源代码而已