/** |
* 功能:拆分窗格JSplitPane |
*/ |
package com.jiemian; |
import java.awt.*; |
import javax.swing.*; |
public class Text8 extends JFrame{ |
JLabel jl1; |
JSplitPane jsp; |
JList jlist; |
public static void main(String[] args) { |
|
Text8 text8 = new Text8(); |
} |
|
public Text8(){ |
|
//创建组件 |
jl1= new JLabel( new ImageIcon( "images\\61050-102.jpg" )); |
|
String []word={ "boy" , "key" , "girl" , "information" , "comfortable" , "gread" }; |
jlist= new JList(word); |
|
//拆分窗格 |
jsp= new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,jlist,jl1); |
//设置可变化 |
jsp.setOneTouchExpandable( true ); |
|
this .add(jsp); |
|
this .setSize( 300 , 300 ); |
this .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
this .setVisible( true ); |
|
|
} |
} |