Hi,
I have written a program that will draw a line.
I want a save button which would help me to save the picture in GIF or JPG format.
the program that I hv written to draw the lines is as below:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Lines extends JFrame
{
private
String s = (" Using javaStrings ");
public Lines()
{
super(" Drawing Lines ");
setSize(500,165);
show();
}
public void paint( Graphics g)
{
g.setColor(Color.blue);
g.fillRect(20,120,50,5);
g.setColor(Color.blue);
g.fillRect(100,120,50,5);
g.setColor(Color.blue);
g.fillRect(170,120,50,5);
g.setColor(Color.blue);
g.fillRect(240,120,50,5);
g.setColor(Color.blue);
g.fillRect(300,120,50,5);
g.setColor(Color.green);
g.fillRect(70,100,30,5);
g.setColor(Color.green);
g.fillRect(150,100,20,5);
g.setColor(Color.green);
g.fillRect(220,100,20,5);
g.setColor(Color.green);
g.fillRect(290,100,10,5);
g.setColor(Color.red);
g.fillRect(20,150,350,5);
}
public static void main(String[] args)
{
Lines app= new Lines();
app.addWindowListener( new WindowAdapter ()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
}
}
Kindly help me out in saving the image that is been displayed after running this program.
Regards,
Vijju