java下拉框,捲軸

來源:互聯網
上載者:User

標籤:

 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下拉框,捲軸

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.