標籤:frame hex java list bsp 技術分享 public str close
import java.awt.Color;import javax.swing.ImageIcon;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JList;import javax.swing.JSplitPane;public class fenye1 extends JFrame{ JLabel jl; JList js; JSplitPane jp; public static void main(String[] args) { // TODO Auto-generated method stub fenye1 f1=new fenye1(); } public fenye1() { String [] a={"軟體開發","軟體測試","資料採礦"}; jl=new JLabel(new ImageIcon("image/23.jpg")); jl.setBackground(Color.pink); jl.setOpaque(true); js=new JList(a); jp=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,js,jl); jp.setOneTouchExpandable(true); this.add(jp); this.setTitle("擔心ss"); this.setSize(400,320); this.setLocation(100, 180); this.setResizable(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); } }
JSplitPane的簡單實現