/* * 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