对JLabel 设置大小
package import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.*;
public class ChaiFen extends JFrame{
JLabel bq=null;
public static void main(String args[]){
ChaiFen a=new ChaiFen();
}
public ChaiFen(){
String[] sj={"ruaijankai","liufei","dabi","yello","me"};
JList lb=new JList(sj);
bq=new JLabel(new ImageIcon("Picture/me.jpg"));
bq.setSize(100,200);// 这句话怎么没用啊------------------------------------------------------------------
JSplitPane cf=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,lb,bq);
cf.setOneTouchExpandable(true);//搜索左右两个部分。
this.add(cf);
this.setTitle("hello");
this.setLocation(200,180);
this.setSize(600, 500);
this.setVisible(true);
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}