Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials


 

 

Struts Tutorials

Struts Resources

Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Java Example Java Awt AWT_java

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

6 comments so far (post your own) View All Comments Latest 10 Comments:

Plz give me steps how to run and compile awt java....where i can save and where we write program.........

Posted by smita on Monday, 08.3.09 @ 17:51pm | #89783

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.math.*;
import java.util.*;

public class PlotXY extends JFrame
{
myView view = new myView();
Vector vr = new Vector();
int ho = 0;

public PlotXY()
{
addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent ev)
{ dispose();
System.exit(0);}});


int [] a = {10, 20, 30, 40, 50};
int [] b = {15, 25, 35, 45, 55};


for (int i=0; i < 5; i++)
{
vr.add(new Point(a[i],b[i]));
}
setBounds(3,10,625,350);
view.setBounds(10,10,600,301);
getContentPane().add(view);
getContentPane().setLayout(null);
setVisible(true);
}
public class myView extends JPanel
{
BufferedImage I;
Graphics2D G;

public myView()
{
}
public void paint(Graphics g)
{
if (I == null)
{
I = new BufferedImage(getWidth(),getHeight(),BufferedImage.TYPE_INT_ARGB);
G = I.createGraphics();
}
G.setColor(new Color(213,199,181));
G.fillRect(0,0,getWidth(),getHeight());
G.setColor(Color.lightGray);
for (int y=0; y < 11; y++) G.fillRect(0,y*30,getWidth(),1);
G.setColor(Color.darkGray);
Point p1,p2;
p1 = (Point)vr.get(ho);
int x = 0;
for (int y=1; y < 5; y++)
{
p2 = (Point)vr.get(y+ho);
G.drawLine(x,p1.y+150,x+5,p2.y+150);
p1 = (Point)vr.get(y+ho);
x = x + 5;
}
g.drawImage(I,0,0,null);
}
}
public static void main (String[] args)
{
new PlotXY();
}
}

Posted by Anuj Tiwari on Monday, 06.8.09 @ 16:20pm | #88329

Impressive

Posted by Ashish Pandey on Monday, 03.31.08 @ 13:43pm | #54857

i was tired searching help on java apllets,at that time i found ur site. it is really a helpful site for new comers in java field. like me. i have got my problems solved using ur site.

Posted by Dipesh Bhavsar on Thursday, 01.24.08 @ 15:19pm | #46007

i want to know how to draw the X,Y line graphs in Java swings and how to give the input values in that graph.for Example am having 2 values like


X=0.5

and Y=727.650179531046

can u send me the code for this

Posted by Thjyagarajan on Thursday, 11.29.07 @ 16:13pm | #40885

This site is very helpful for beginners.
Thank you very much.
Bye...

Posted by varaprasad on Tuesday, 05.29.07 @ 11:46am | #17617

Ask programming questions?

 

 

Back to Tutorial

 

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name

 

 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright 2007. All rights reserved.