|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
以下为代码
- package Learn.Swing_GUI;
- import java.awt.*;
- import javax.swing.*;
- public class Demo_jinshan extends JFrame{
-
- //定义组件
- JSplitPane jsp;
- JList jlist;
- JLabel jl1;
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Demo_jinshan demo6=new Demo_jinshan();
- }
-
- //构造函数
- public Demo_jinshan(){
- //创建组件
- String []words= {"bird","long","package","hamberger","computer","pen","sock","quilt","bookcase"};
- jlist=new JList(words);
-
- jl1=new JLabel(new ImageIcon("./images/Icarus.png"));
-
- //创建可拆分窗格
- jsp=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
- jsp.setOneTouchExpandable(true);
- //设置布局管理器
-
- //添加组件
- this.add(jsp);
-
- //设置窗体
- int width=1280;
- int height=720;
- this.setTitle("词霸");
- this.setSize(width, height);
- this.setLocation((1920-width)/2, (1080-height)/2);
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- //显示窗口
- this.setVisible(true);
- }
- }
复制代码
图片分辨率700*943 |
|