在这里插入代码片
```package com.deng.lesson06;
import javax.swing.*;
import java.awt.*;
public class TestComboboxDemo02 extends JFrame {
public TestComboboxDemo02(){
Container container = this.getContentPane();
//生成列表的内容 用数组来存放
String[] str = new String[]{"封魔剑魂","疾风剑豪","无双剑姬","无极剑圣"};
//列表中需要放入内容
JList jList = new JList(str);
container.add(jList);
this.setVisible(true);
this.setBounds(100,100,300,300);
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
new TestComboboxDemo02();
}
}
Swing之列表框
最新推荐文章于 2024-02-17 16:29:22 发布