Placing pictures in the six swing of Java GUI programming (swing)

Source: Internet
Author: User

To place a picture in the graphical interface, you need to use the window splitter JSplitPane (belonging to the container class component) to the interface above the imageicon  . Split the window into two columns. A column is JList, inside entered some text, a column is jlable, above place the picture. The layout uses the Borderlayout package gui;import java.awt.borderlayout;import javax.swing.jframe;import Javax.swing.jlabel;import Javax.swing.jsplitpane;import javax.swing.jlist;import javax.swing.ImageIcon;/*** Swing Combat Window Split * Created by admin on 2017/7/10.*/public class JSplitPane extends Jframe{private jsplitpane jsplitpane;private Jlabe L jlabel;private JList jlist;public static void Main (string[] args) {JSplitPane JSplitPane = new JSplitPane ();}  public JSplitPane () {String [] words = {"Java", "Python", "golang"};jlabel = new JLabel (New ImageIcon ("D:\\image\\qq Image 20150507223217.jpg ")); jList = new JList (words);//JSplitPane splitter pane, vertical split JSplitPane = new JSplitPane ( Jsplitpane.horizontal_split, JList, JLabel); This.add (JSplitPane);//Set JFrame properties This.settitle ("project"); This.setlocation (This.setsize), this.setresizable (false); This.setdefaultcloseoperation ( Jframe.exit_on_close); this.setvisible (True);}}   

Placing pictures in the six swing of Java GUI programming (swing)

Related Article

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.