Java plotting project_image is drawn using a gallery and java plotting

Source: Internet
Author: User
Tags gety

Java plotting project_image is drawn using a gallery and java plotting

Recently, I have been studying how to "Draw" Images with letters in a text editing tool.

You may not know what I want to say after reading this?

I want to know it.

Article 1: kitten

Source image:Http://www.cnblogs.com/hongten/gallery/image/143365.html

Second: Lin yuner

Source image:Http://www.bkjia.com/uploads/allimg/140726/1639254396-1.png

Third: Guo Jing

Source image:Http://www.cnblogs.com/hongten/gallery/image/143367.html

Fourth: Christine Stewart

Source image:Http://www.cnblogs.com/hongten/gallery/image/143368.html

Fifth: ME

Source image:Http://www.cnblogs.com/hongten/gallery/image/143369.html

As the program is still being debugged, first make some diagrams for everyone to see.

Release of program source code:Java Plotting Program _ use picture to draw out _ source code release

========================================================== ======================

More reading, and english is important.

I'm Hongten

========================================================== ======================


Use JAVA to draw a graph program and draw a straight line

Import java. awt .*;
Import java. awt. event .*;
Import java. util .*;
Import javax. swing .*;

Public class Drawline extends JFrame {
Private Draw dr;

Private JButton b1;

Private Color cc;

Public Drawline (){
B1 = new JButton ("change ");
B1.addActionListener (new ActionListener (){
Public void actionreceivmed (ActionEvent e ){
Cc = JColorChooser. showDialog (Drawline. this, "please a color ",
Cc );
Dr. setColor (cc );
}
});
Dr = new Draw ();
Dr. setBackground (Color. white );
Container c = getContentPane ();
C. setLayout (new FlowLayout ());
C. add (dr );
C. add (b1 );
SetSize (600,500 );
Show ();
}

Public static void main (String args []) {
Drawline dl = new Drawline ();
Dl. addWindowListener (new WindowAdapter (){
Public void windowClosing (WindowEvent e ){
System. exit (0 );
}
});
}
}

Class Line {
Public int x0, y0, x1, y1;

Public Color color; // Save the color
}

Class Draw extends JPanel {
Vector lines = new Vector ();

Line cur;

Color changeColor;

Public Draw (){
SetPreferredSize (new Dimensions (500,500 ));
AddMouseListener (new MouseAdapter (){
Public void mousePressed (MouseEvent e ){
// If (cur = null)
Cur = new Line ();
Cur. x0 = e. getX ();
Cur. y0 = e. getY ();
Cur. color = changeColor;
}

Public void mouseReleased (MouseEvent e ){
Cur. x1 = e. getX ();
Cur. y1 = e. getY ();
Lines. add (cur );
Cur = null;
}
});
AddMouseMotionListener (new MouseMotionAdapter (){
... The remaining full text>

A simple drawing program using Java

The following is a small program I used to do. I hope to help you!

Package menu;
Import java. awt .*;
Import java. awt. event .*;

Import javax. swing .*;
Public class DaYin extends JFrame implements ActionListener {

Public DaYin (){
Container c = this. getContentPane ();
C. setLayout (new BorderLayout ());
JMenuBar jmb = new JMenuBar ();
JMenu jm = null;
Jm = new JMenu ("file ");
Jmb. add (jm );
Jm = new JMenu ("edit ");
Jmb. add (jm );
Jm = new JMenu ("print ");
JMenuItem jmi = new JMenuItem ("print preview ");
Jmi. addActionListener (this );
Jm. add (jmi );
Jmb. add (jm );
Jm = new JMenu ("help ");
Jmb. add (jm );
This. setJMenuBar (jmb );

This. setSize (1024,768 );
This. setVisible (true );
This. addWindowListener (new WindowAdapter (){
Public void windowClosing (WindowEvent e ){
System. exit (0 );
}
});
}

Public static void main (String [] args ){
New DaYin ();

}

Public void update (Graphics g ){
G. setColor (Color. black );
String title [] = {"abstract", "subject", "subitem or account name", "debit amount", "credit amount "};
String danwei [] = {"Thousand", "Hundred", "Ten", "Ten", "Thousand", "Hundred", "Ten", "Yuan ", "angle", "points "};
Int csx = 200; // print the initial coordinates of x
Int csy = 200; // print the initial coordinates of y
Int x = csx;
Int y = csy;
Int a = x + 20; // print the initial coordinates of the font x
Int B = y + 20; // print the initial coordinates of the font y.
Int row = 7; // print several horizontal lines in total
Int cul = 5; // print several vertical bars in total
Int hangju = 30; // Vertical spacing between the line and the line
Int lieju = 100; // Horizontal spacing between lines
Int yy = hangju * row + y;
Int c = yy + 20;
G. setFont (new Font ("chunk... the remaining full text>

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.