Java GUI simple Billiard Game Model

Source: Internet
Author: User
Tags stub

Finish the effect:

1  Packagecom.neuedu.test;2 3 ImportJava.awt.Frame;4 ImportJava.awt.Graphics;5 ImportJava.awt.event.WindowAdapter;6 Importjava.awt.event.WindowEvent;7 8 ImportCom.neuedu.utill.GameUtill;9 Ten  Public classTaiqiuextendsFrame { One      Public voidLoadFrame () { Asetlocation (100, 100); -SetSize (800,600); -Settitle ("Billiards"); theSetresizable (false); -SetVisible (true); -Addwindowlistener (NewWindowadapter () { -  + @Override -              Public voidwindowclosing (windowevent e) { +                 //TODO auto-generated Method Stub ASystem.exit (0); at             } -              -         }); -     } - @Override -      Public voidPaint (Graphics g) { in         //TODO auto-generated Method Stub -G.drawimage (Gameutill.getimage ("Com/neuedu/img/zhuomian.png"), 10, 50,NULL); toG.drawimage (Gameutill.getimage ("Com/neuedu/img/0.png"), 200,200,20,20,NULL); +G.drawimage (Gameutill.getimage ("Com/neuedu/img/1.png"), 250,200,20,20,NULL); -G.drawimage (Gameutill.getimage ("Com/neuedu/img/2.png"), 200,250,20,20,NULL); theG.drawimage (Gameutill.getimage ("Com/neuedu/img/3.png"), 300,350,20,20,NULL); *G.drawimage (Gameutill.getimage ("Com/neuedu/img/4.png"), 400,180,20,20,NULL); $G.drawimage (Gameutill.getimage ("Com/neuedu/img/5.png"), 500,200,20,20,NULL);Panax NotoginsengG.drawimage (Gameutill.getimage ("Com/neuedu/img/6.png"), 650,200,20,20,NULL); -G.drawimage (Gameutill.getimage ("Com/neuedu/img/7.png"), 480,200,20,20,NULL); theG.drawimage (Gameutill.getimage ("Com/neuedu/img/8.png"), 580,300,20,20,NULL); +G.drawimage (Gameutill.getimage ("Com/neuedu/img/9.png"), 360,300,20,20,NULL); AG.drawimage (Gameutill.getimage ("Com/neuedu/img/10.png"), 550,350,20,20,NULL); theG.drawimage (Gameutill.getimage ("Com/neuedu/img/11.png"), 350,250,20,20,NULL); +G.drawimage (Gameutill.getimage ("Com/neuedu/img/12.png"), 300,400,20,20,NULL); -G.drawimage (Gameutill.getimage ("Com/neuedu/img/13.png"), 400,300,20,20,NULL); $G.drawimage (Gameutill.getimage ("Com/neuedu/img/14.png"), 200,250,20,20,NULL); $G.drawimage (Gameutill.getimage ("Com/neuedu/img/15.png"), 100,200,20,20,NULL); -          -          the     } -    Public Static voidMain (string[] args) {WuyiTaiqiu TQ =NewTaiqiu (); the tq.loadframe (); - } Wu}
1  PackageCom.neuedu.utill;2 3 ImportJava.awt.Image;4 ImportJava.awt.image.BufferedImage;5 Importjava.io.IOException;6 ImportJava.net.URL;7 8 ImportJavax.imageio.ImageIO;9 Ten  Public classGameutill { One        Public StaticImage getImage (String imgpath) { AURL u = gameutill.class. getClassLoader (). getresource (Imgpath); -BufferedImage img =NULL; -           Try { theIMG =imageio.read (u); -}Catch(IOException e) { -             //TODO auto-generated Catch block - e.printstacktrace (); +         } -           returnimg; +            A       } at}

Java GUI simple Billiard Game Model

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.