Java settings Jpane background image l

Source: Internet
Author: User

Package Loginclient;import Java.awt.borderlayout;import Java.awt.eventqueue;import java.awt.graphics;import Java.awt.image;import Javax.swing.imageicon;import Javax.swing.jframe;import Javax.swing.jpanel;import Javax.swing.border.emptyborder;import Java.awt.color;public class Loginclient extends JFrame {private JPanel contentpane;/** * Launch the application.  */public static void Main (string[] args) {Eventqueue.invokelater (new Runnable () {public void run () {try {loginclient frame = new Loginclient (); frame.setvisible (true);} catch (Exception e) {e.printstacktrace ();}}});} /** * Create the frame. */public loginclient () {setdefaultcloseoperation (jframe.exit_on_close); SetBounds (+, +); ContentPane =    New JPanel (); Contentpane.setbackground (New Color (0, 206, 209)), Contentpane.setborder (New Emptyborder (5, 5, 5, 5)); Setcontentpane ( ContentPane); contentpane.setlayout (null); JPanel panel = new JPanel () {@Override protected void paintcomponent (Graphics g) {                 ImageIcon icon = new ImageIcon ("Src//1.png");                  Image img = icon.getimage ();              G.drawimage (IMG, 0, 0, icon.geticonwidth (), Icon.geticonheight (), Icon.getimageobserver ());  }          }; Panel.setbounds (+, +, +);p anel.setbounds ((), Contentpane.add (panel);//this.add (panel,          Borderlayout.center);          This.setdefaultcloseoperation (Jframe.exit_on_close);  This.setvisible (TRUE); }}

Java settings Jpane background image l

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.