JAVA Streaming layout Manager

Source: Internet
Author: User

//Streaming layout ManagerImportjava.awt.*;Importjavax.swing.*; Public classJiemian2extendsjframe{//Defining ComponentsJbutton[] an = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};  Public Static voidMain (string[] args) {//to run this class of construction methodsJiemian2 Jiemian =NewJiemian2 (); }         PublicJiemian2 () {//Create buttonAn[0] =NewJButton ("Plum"); an[1] =NewJButton ("Fruit Shop")); an[2] =NewJButton ("Potato chips")); an[3] =NewJButton ("Biscuit"); an[4] =NewJButton ("Chocolate"); an[5] =NewJButton ("Cashew"); an[6] =NewJButton ("Rice crust"); an[7] =NewJButton ("Pistachio"); //add layout Manager to avoid adding errors//because Java defaults to the boundary layout manager, this is changed to a streaming layout manager//The second parameter is the alignment, left,right the default center alignment//this.setlayout (New FlowLayout ());         This. setlayout (NewFlowLayout (flowlayout.left)); //Add button         This. Add (an[0]);  This. Add (an[1]);  This. Add (an[2]);  This. Add (an[3]);  This. Add (an[4]);  This. Add (an[5]);  This. Add (an[6]);  This. Add (an[7]); //Set Window caption         This. Settitle ("Streaming layout FlowLayout"); //Set the width height of the window         This. SetSize (300,300); //The Settings window appears for the location of the screen         This. setlocation (100,100); //no pulling the big pull small         This. setresizable (false); //releasing a resource after closing a window         This. Setdefaultcloseoperation (Jframe.exit_on_close); //Output Window         This. setvisible (true); }    }

JAVA Streaming layout Manager

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.