Nikhilesh Gandhi

Greenhorn
+ Follow
since Feb 07, 2004
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 Nikhilesh Gandhi

Hi !
I want to display a digital clock in my application but i acn only get the current system time .
I does not refresh.
here is the code i am using it is a part of a longer prg but here is only what is relevant

public static class ttask extends TimerTask
{
public void run()
{
int time = calendar.get(Calendar.SECOND);
System.out.println(time);
}
}
public static void main(String[] args)
{
Timer myTimer = new Timer();
ttask myTask = new ttask();
myTimer.schedule(myTask,1000,500);
InternalFrameDemo frame = new InternalFrameDemo();
try
{
Thread.sleep(5000);
}
catch(InterruptedException exc)
{}

}
}
20 years ago
Hi !
I want to display a digital clock in my application but i acn only get the current system time .
I does not refresh.
here is the code i am using it is a part of a longer prg but here is only what is relevant
public static class ttask extends TimerTask
{
public void run()
{
int time = calendar.get(Calendar.SECOND);
System.out.println(time);
}
}
public static void main(String[] args)
{
Timer myTimer = new Timer();
ttask myTask = new ttask();
myTimer.schedule(myTask,1000,500);
InternalFrameDemo frame = new InternalFrameDemo();
try
{
Thread.sleep(5000);
}
catch(InterruptedException exc)
{}

}
}
20 years ago
Hi
I need to populate my JTable from mySql.Is it possible to see the differnt values in boxes of the table.
I am using a simple Jtable not the demo.
One more thing i cannot make the column heads visible.
20 years ago
Hi
I need to populate my JTable from mySql.Is it possible to see the differt values in boxes of the table.
I am using a simle Jtable not the demo.
One more thing i cannot make the column heads visible.
20 years ago
Hi
I am using internal frames and cant enter the data in to the db.
keep getting the same error is there any tutorial on internal frames and JDBC.
I need to run the telephone dialer from my java prg.
Dont kno how to go about it at all
I am using Internal frames and hava loaded the telephone button on the toolbar but i cant load the dialer from there.
20 years ago
import java.awt.*;
import javax.swing.*;
import java.applet.*;
/*
<applet code =" Info.Class" width= 300 height=300 >
</applet>
*/
public class Info extends JApplet {

Container contentPane = getContentPane();

JButtonEnter = new JButton("Enter");
JButtonCancel = new JButton("Cancel");
JLabel Luna = new JLabel(" User Name");
JLabel Luco = new JLabel(" User Code");
JLabel Lupd = new JLabel(" User Password");
JLabel Lust = new JLabel(" User Status");

JTextFieldTuna = new JTextField();
JTextFieldTuco = new JTextField();
JTextFieldTupd = new JTextField();
JTextFieldTust = new JTextField();
public void init() {
Insets insets = contentPane.getInsets();
contentPane.setLayout(null);

contentPane.add(Luna);
Luna.setBounds(15 + insets.left, 40 + insets.top, 105, 20);
contentPane.add(Tuna);
Tuna.setBounds(115 + insets.left, 40 + insets.top, 105, 20);
contentPane.add(Luco);
Luco.setBounds(15 + insets.left, 65 + insets.top, 105, 20);
contentPane.add(Tuco);
Tuco.setBounds(115 + insets.left, 65 + insets.top, 105, 20);
contentPane.add(Lupd);
Lupd.setBounds(15 + insets.left, 90 + insets.top, 105, 20);
contentPane.add(Tupd);
Tupd.setBounds(115 + insets.left, 90 + insets.top, 105, 20);
contentPane.add(Lust);
Lust.setBounds(15 + insets.left, 115 + insets.top, 105, 20);
contentPane.add(Tust);
Tust.setBounds(115 + insets.left, 115+ insets.top, 105, 20);
}
}
20 years ago
use this code but first create a datasource using control panel /jdbcodbc
and select configure after selecting the required DB.
Create a table using the name in the coce or adjust to your requirements
import java.sql.*;
class temp
{

public static void main(String args[])
{
Connection conn;
Statement stat;
ResultSet rs;

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc dbc:Friend");
stat = conn.createStatement();
rs = conn.createStatement().executeQuery("select * from Friend");

while(rs.next())
{
System.out.println(rs.getString(1)+" "+rs.getString(2));
}
String Name="linus",Phone="6360073";

//String Query="insert into Friend values ('Mihir','455747')";
String Query="insert into Friend Values ('" +Name+ "','" +Phone+ "')";
stat.executeUpdate(Query);
conn.close();
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
}