以下是个简单的图片显示程序 ,为什么没有显示图片我已经在该项目下建了个folder名为images 并把图片赋值进去了,求高手指导!!import javax.swing.*;import java.awt.*;
public class Test5 extends JFrame{
JSplitPane jsp;
JLabel jl1;
JList jlist;
public static void main(String[] args) {
// TODO Auto-generated method stub
Test5 t5=new Test5(); }
public Test5()
{
String []words={"man","girl","boy"};
jlist=new JList(words);
jl1=new JLabel(new ImageIcon("images/ttt.gif"));//图片已放。
jsp=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,jlist,jl1);
jsp.setOneTouchExpandable(true);
this.add(jsp);
this.setLocation(200,200);
this.setSize(400, 300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}}
public class Test5 extends JFrame{
JSplitPane jsp;
JLabel jl1;
JList jlist;
public static void main(String[] args) {
// TODO Auto-generated method stub
Test5 t5=new Test5(); }
public Test5()
{
String []words={"man","girl","boy"};
jlist=new JList(words);
jl1=new JLabel(new ImageIcon("images/ttt.gif"));//图片已放。
jsp=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,jlist,jl1);
jsp.setOneTouchExpandable(true);
this.add(jsp);
this.setLocation(200,200);
this.setSize(400, 300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}}
解决方案 »
- 大家看看怎样能提取这个关键字(PNR)?
- 关于java.io.EOFException问题,希望大家看看
- IO流请求返回 报错 错误代码问题!~!·
- 设置环境变量问题(菜,不要BS,汗-_-!!)
- CSDN的高手都到哪去了?!!! 再不解决,小弟要跳楼了。。。。在线等待
- 请问哪里有比较好的学习java的书?
- 谁能告诉我update()与paint()之间的关系,,是不是刷新图像时闪烁与他有关
- 谁能把这个Applet下载下来吗?我用NetAnts不行。请指教!http://www4.cmbchina.com/javahq/fenshi.htm
- 访问数据库出现堆栈溢出,是何原因?
- jbuilder求教?
- java算术题
- Java调用批处理bat文件产生的乱码问题
确定图片名称是ttt.gif在我机器上运行无误。