Image interface programming Simple form creation

Source: Internet
Author: User

/* *  Image Interface Programming  * JFrame  forms  * JPanel  Panels  * JLabel  tags  *  JButton  buttons  * JLabel  tags  * ImageIcon  icons  *  *   * */package fish;import java.util.*;import javax.swing.imageicon;import  javax.swing.jbutton;import javax.swing.jframe;import javax.swing.jlabel;import  Javax.swing.jpanel;import javax.swing.jtextfield;public class fish{public static void  main (String[] args) {/*----------------------------frame----------------------------*///Create a form file JFrame  w = new jframe ();//Create Panel Jpanel p = new jpanel ();//Create label Jlabel l  = new jlabel ("We are progressing");//Create button Jbutton btn = new jbutton ("file");// Create a text Jtextfield text = new  jtextfield (10);//Create an icon imageicon icon =   new imageicon ("Aboutus.png");//Create a label jlabe1 , used to display the picture Jlabel img = new jlabel icon;//Add the label to the panel p.add (l);//Add a panel to the form W.add (p);// Add text to the form p.add (text),//Add the button to the Panel p.add (BTN),//Add the icon tag to the panel P.add (IMG);//close the form, Also close the Java background w.setdefaultcloseoperation (3);//Set form position w.setlocation (100, 50);//window size cannot be changed w.setresizable (false);// Set the form size w.setsize (800, 600);//Set the title W.settitle ("Talent");//Set the form to be visible w.setvisible (true);}}


This article is from the "Man On Dream Road" blog, please make sure to keep this source http://meyangyang.blog.51cto.com/12906086/1940061

Image interface programming Simple form creation

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.