import java.awt.*;
import javax.swing.*;
public class Ciba extends JFrame{
JSplitPane jsp;
JList jList;
JLabel jLabel;
String []c={"apple","boy","cat","dog"};
public static void main(String[] args) {
// TODO 自动生成的方法存根
Ciba ciba=new Ciba();
}
public Ciba()
{
try{
//jLabel=new JLabel(new ImageIcon("/java/src/images/ciba.gif"));
ImageIcon ii=new ImageIcon("/java/src/images/ciba.gif ");
jLabel=new JLabel(ii);
}
catch (Exception e)
{
e.printStackTrace();
}
jList=new JList(c);
jsp=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,jList,jLabel);
jsp.setOneTouchExpandable(true);
this.add(jLabel);
this.setTitle("test");
this.setVisible(true);
this.setSize(500, 400);
this.setLocation(500,200);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
这是代码。。