Java drop-down box, scroll bar

Source: Internet
Author: User

1 Package com.soft.test;2 3 /**4 * drop-down list, drop-down box, scroll bar usage5  */6 7Import javax.swing.*;8Import java.awt.*;9  Public classDem5 extends JFrame {Ten  One  A  PrivateJPanel jp1, JP2; -  PrivateJLabel jlb1, jlb2; -  PrivateJComboBox jb1; the  PrivateJList JL; -  PrivateJScrollPane jsp; -   -   PublicDem5 () { +JP1 =NewJPanel (); -JP2 =NewJPanel (); +JLB1 =NewJLabel ("Hometown"); AJLB2 =NewJLabel ("Tourist Locations"); at    -    -String []JZ = {"Nanchang","Ganzhou","Jian","Xinyu","Yingtan","Jingdezhen","Fuzhou"}; -JB1 =NewJComboBox (JZ); -String []ly = {"Sanqingshan","General Park","Lung Fu Shan","Lushan","Teng Wang ge"}; -    inJL =NewJList (ly); -JSP =NewJScrollPane (JL); toJl.setvisiblerowcount (3); +    -    This. setlayout (NewGridLayout (3,1)); the    * Jp1.add (JLB1); $ Jp1.add (JB1);Panax Notoginseng Jp2.add (JLB2); - Jp2.add (JSP); the    This. Add (JP1); +    This. Add (JP2); A    This. SetSize ( -, -); the    This. Setdefaultcloseoperation (jframe.exit_on_close); +    This. setlocation ( -, -); -    This. setvisible (true); $    This. setresizable (false);  $  } -   -   Public Static voidMain (String args[]) { the    -DEM5 DEM5 =NewDEM5 ();Wuyi  } the}

Java drop-down box, scroll bar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.