Java drawing-Drawing pictures

Source: Internet
Author: User

Here is the main point is to draw pictures, so-called drawing pictures, is the external picture information loaded into memory and then by the Java compiler to draw, generally feel compared to B/s development some trouble, not to say the principle of trouble, their principles are actually the same, not the same is the complexity of their implementation process, to rewrite the method , loading pictures, displaying pictures, etc. However, there is a certain significance, there is a point to note that is the path of loading, must not load errors, responsible for the memory of a large problem.

Package Huitu;import Java.awt.*;import javax.swing.*;p ublic class H1 extends jframe{/** * @param args */public static void Main (string[] args) {H1 c1= new H1 (); Mypanel mp=null;public H1 () {Mypanel mp=new mypanel (); This.add (MP); This.setsize (400,300); this.setvisible (True);}} Class Mypanel extends jpanel{//override JPanel method public void Paint (Graphics g) {//Call parent class to complete initialization super.paint (g);//Get Picture image im= Toolkit.getdefaulttoolkit (). GetImage (Panel.class.getResource ("/duanwu.jpg")); G.drawimage (IM, +, +, );}}


Java drawing-Drawing pictures

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.