vijayalakshmi sundararajan

Greenhorn
+ Follow
since Dec 03, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by vijayalakshmi sundararajan

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
20 years ago
Hi,
I tried doing it but still I get the same error message
vijju
Hi,
I have written this code to access data from an Excel file.
///////// the code //////////////
String url = "jdbc dbc river={Microsoft Excel Driver(*.xls)};DBQ=C:\\test.xls";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =DriverManager.getConnection(url);
//////////// the exception /////////////
Exception: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
please help me out.
bye
Regards,
Vijayalakshmi
Hi,
I tried out this code for freehand drawing using mouse.But its not working for me.Can anyone tell me where I went wrong?
the code i hv written is as below
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Painter extends JFrame
{
private int xValue = -10, yValue = -10;
public Painter()
{
super( " Hand free drawing page ");
getContentPane().add(
new Label(" Drag mouse to draw the desired picture "),
BorderLayout.SOUTH);
addMouseMotionListener(
new MouseMotionAdapter()
{
public void mouseDragger( MouseEvent e)
{
xValue = e.getX();
yValue = e.getY();
repaint();
}
}
);
setSize(300,150);
show();
}
public void paint( Graphics g)
{
g.fillOval(xValue,yValue,4,4);
}
public static void main(String arg[])
{
Painter app = new Painter();
app.addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
}
}
20 years ago