sc33
版主
发贴: 128
积分: 30
|
于 2003-09-23 17:10
程序代码如下: package demo.panel;
import java.awt.*; import javax.swing.*; import webstartdemo.*;
public class AboutPanel extends JPanel { JLabel jLabel1 = new JLabel();
public AboutPanel() { try { jbInit(); } catch(Exception ex) { ex.printStackTrace(); } } void jbInit() throws Exception {
//不能正常引用资源 jLabel1.setIcon(new ImageIcon(this.getClass().getResource("image/about.jpg"))); //上句如何写
jLabel1.setBounds(new Rectangle(1, 0, 639, 434)); this.setLayout(null); this.add(jLabel1, null); } }
about.jpg 在Jar包中demo/image/目录下
谢谢!
|