- /*
- * 词霸
- */
- package com.test.swing;
- import java.awt.*;
- import javax.swing.*;
- public class Test4 extends JFrame{
- //定义组件
- JSplitPane jsp; //拆分窗格
- JLabel jlb;
- JList jlist;
- public static void main(String[] args) {
- Test4 test4 = new Test4();
- }
- //构造函数
- public Test4(){
- jsp = new JSplitPane();
- String []words = {"ah","apple","array","all"};
- jlist = new JList(words);
- jlb = new JLabel(new ImageIcon("images/aa.jpg"));
- jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jlist, jlb);//水平拆分
- jsp.setOneTouchExpandable(true);//单击扩展面板
- this.add(jsp);
- this.setIconImage(new ImageIcon(("images/t.gif")).getImage());//设置窗体图标
- this.setTitle("词霸");
- this.setSize(510, 260);
- this.setVisible(true);
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- }
Java图形界面——窗体图标设置、拆分窗格
最新推荐文章于 2023-04-20 14:44:32 发布