• java下拉框,滚动条


     1 package com.soft.test;
     2 
     3 /**
     4  * 下拉列表、下拉框、滚动条的使用
     5  */
     6 
     7 import javax.swing.*;
     8 import java.awt.*;
     9 public class Dem5 extends JFrame {
    10 
    11 
    12  private JPanel jp1, jp2;
    13  private JLabel jlb1, jlb2;
    14  private JComboBox jb1;
    15  private JList jl;
    16  private JScrollPane jsp;
    17  
    18  public Dem5() {
    19   jp1 = new JPanel();
    20   jp2 = new JPanel();
    21   jlb1 = new JLabel("籍贯");
    22   jlb2 = new JLabel("旅游地点");
    23   
    24   
    25   String []jz = {"南昌","赣州","吉安","新余","鹰潭","景德镇","抚州"};
    26   jb1 = new JComboBox(jz);
    27   String []ly = {"三清山","将军园","龙虎山","庐山","腾王阁"};
    28   
    29   jl = new JList(ly);
    30   jsp = new JScrollPane(jl);
    31   jl.setVisibleRowCount(3);
    32   
    33   this.setLayout(new GridLayout(3, 1));
    34   
    35   jp1.add(jlb1);
    36   jp1.add(jb1);
    37   jp2.add(jlb2);
    38   jp2.add(jsp);
    39   this.add(jp1);
    40   this.add(jp2);
    41   this.setSize(300,300);
    42   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    43   this.setLocation(300,300);
    44   this.setVisible(true);
    45   this.setResizable(false);  
    46  }
    47  
    48  public static void main(String args[]) {
    49   
    50   Dem5 dem5 = new Dem5();
    51  }
    52 }
  • 相关阅读:
    Java基础模拟LinkedList的双向链表结构
    对thrift版本降级(mac)
    通信技术类网站
    Arista和他的EOS
    程序员的英文能力培养
    挖掘时间的价值
    写作的方法论
    SRv6相关资源汇总
    你不必有自己的写作优势领域
    20192416汇编语言学习总结
  • 原文地址:https://www.cnblogs.com/xs-yqz/p/4553818.html
Copyright © 2020-2023  润新知