JSplistPane 的使用

package com.swing; 
import javax.swing.*;
/*
 * JSplistPane 的使用
 */
class jsplitpane extends JFrame{
    public static void main(String[] args){
        jsplitpane jsp=new jsplitpane();
    }
        
    public jsplitpane(){
        JLabel jl=new JLabel(new ImageIcon("images/ciba.jpg"));
        String[] list={"Red","Green","Blue","Yellow"};
        JList jlist= new JList(list);
        //拆分窗格
        JSplitPane jsp=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,jlist,jl);
        //分隔条添加窗格显示控制按钮
        jsp.setOneTouchExpandable(true);
        this.add(jsp);
            
            
            
        this.setTitle("JSplistPane的使用");
        this.setSize(800,500);
        this.setLocation(100, 100);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);
    }
}

081159686.jpg

你可能感兴趣的:(import,public,Yellow)