Sam

Greenhorn
+ Follow
since Jun 23, 2000
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 Sam

Does "\n" (carriage return) works with g.drawString() method?
I have tried and found , its not working ? Lets say if I have
to draw a string on the applet in a loop line after line , how will I ? Can somebody Tell me. I tried this line in a loop which is not working :
g.drawString("Something\n",100,100);
thanx in advance.
Regards,
23 years ago
Does "\n" (carriage return) works with g.drawString() method?
I have tried and found , its not working ? Lets say if I have
to draw a string on the applet in a loop line after line , how will I ? Can somebody Tell me. I tried this line in a loop which is not working :
g.drawString("Something\n",100,100);
thanx in advance.
Regards,
23 years ago
Thanx Rob, The job has been done.
Thanx once again!!!
Cheers ,
23 years ago
Hi Friends,
I'm facing a layout problem and I have to make the applet ready and give it to my boss urgently. So help me out !!! Following is the code. I have created three panels(all with GridLayout) and my applet also have GridLayout. I have added the panels on the applet and they are ok. The problem is with two buttons. I wanna add them below the three panels, in the center. Thats the problem and I'm not able to solve it since I'm not very proficient with layout managers. Help me out!!
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Rest extends Applet {
Checkbox c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12;
Panel p1,p2,p3,p4;
Label l1,l2,l3;
Button b1,b2;
Label l4,l5,l6;
public void init()
{
setLayout(new GridLayout(1,3));
l1=new Label("PIZZAS");
l2=new Label("FAST FOOD");
l3=new Label("BURGERS");
l4=new Label("");
l5=new Label("");
l6=new Label("");
b1=new Button("SUBMIT");
b2=new Button("CANCEL");
c1=new Checkbox("1");
c2=new Checkbox("2");
c3=new Checkbox("3");
c4=new Checkbox("4");
c5=new Checkbox();
c6=new Checkbox();
c7=new Checkbox();
c8=new Checkbox();
c9=new Checkbox();
c10=new Checkbox();
c11=new Checkbox();
c12=new Checkbox();
p1=new Panel();
p2=new Panel();
p3=new Panel();
p4=new Panel();
pp=new Panel();
p1.setLayout(new GridLayout(5,0));
p1.add(l1);
p1.add(c1);
p1.add(c2);
p1.add(c3);
p1.add(c4);
p2.setLayout(new GridLayout(5,0));
p2.add(l2);
p2.add(c5);
p2.add(c6);
p2.add(c7);
p2.add(c8);
p3.setLayout(new GridLayout(5,0));
p3.add(l3);
p3.add(c9);
p3.add(c10);
p3.add(c11);
p3.add(c12);
p4.setLayout(new GridLayout(1,5));
p4.add(l4);
p4.add(l5);
p4.add(b1);
p4.add(l6);
p4.add(b2);
add(p1);
add(p2);
add(p3);
setLayout(new FlowLayout());
add(p4);
}
}
Thanks in advance
23 years ago
Hi Friends,
I'm facing a layout problem and I have to make the applet ready and give it to my boss urgently. So help me out !!! Following is the code. I have created three panels(all with GridLayout) and my applet also have GridLayout. I have added the panels on the applet and they are ok. The problem is with two buttons. I wanna add them below the three panels, in the center. Thats the problem and I'm not able to solve it since I'm not very proficient with layout managers. Help me out!!
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Rest extends Applet {
Checkbox c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12;
Panel p1,p2,p3,p4;
Label l1,l2,l3;
Button b1,b2;
Label l4,l5,l6;
public void init()
{
setLayout(new GridLayout(1,3));
l1=new Label("PIZZAS");
l2=new Label("FAST FOOD");
l3=new Label("BURGERS");
l4=new Label("");
l5=new Label("");
l6=new Label("");
b1=new Button("SUBMIT");
b2=new Button("CANCEL");
c1=new Checkbox("1");
c2=new Checkbox("2");
c3=new Checkbox("3");
c4=new Checkbox("4");
c5=new Checkbox();
c6=new Checkbox();
c7=new Checkbox();
c8=new Checkbox();
c9=new Checkbox();
c10=new Checkbox();
c11=new Checkbox();
c12=new Checkbox();
p1=new Panel();
p2=new Panel();
p3=new Panel();
p4=new Panel();
pp=new Panel();
p1.setLayout(new GridLayout(5,0));
p1.add(l1);
p1.add(c1);
p1.add(c2);
p1.add(c3);
p1.add(c4);
p2.setLayout(new GridLayout(5,0));
p2.add(l2);
p2.add(c5);
p2.add(c6);
p2.add(c7);
p2.add(c8);
p3.setLayout(new GridLayout(5,0));
p3.add(l3);
p3.add(c9);
p3.add(c10);
p3.add(c11);
p3.add(c12);
p4.setLayout(new GridLayout(1,5));
p4.add(l4);
p4.add(l5);
p4.add(b1);
p4.add(l6);
p4.add(b2);
add(p1);
add(p2);
add(p3);
setLayout(new FlowLayout());
add(p4);
}
}
Thanks in advance
23 years ago
Hi Friends,
Please ignore the subject matter of this topic, i'm sure its not strange at all. just bcoz i'm in need of a urgent solution thats why I gave the subject name - strange.
Here is my problem :
I have created 2 Checkbox instances and 3 panels , now I wanna
add these two checkboxes on all the three panels and later 3 panels on the applet but its not happening !! Or is it that - to put 2 checkboxes on each of the panels, i will have to create 6 Checkbox instances ? Cant I work with 2 Checkbox instances only becoz if i have 2 Checkbox instances , cant I put these two on different panels ? Whats the reason ? Following is the code :
import java.awt.*;
import java.applet.*;
public class Rest extends Applet {
Checkbox c1,c2;
Panel p1,p2,p3;
public void init()
{
setLayout(new FlowLayout());
c1=new Checkbox("1");
c2=new Checkbox("2");
p1=new Panel();
p2=new Panel();
p3=new Panel();
p1.setLayout(new GridLayout(4,0));
p1.add(c1);
p1.add(c2);
p2.setLayout(new GridLayout(4,0));
p2.add(c1);
p2.add(c2);
p3.setLayout(new GridLayout(4,0));
p3.add(c1);
p3.add(c2);
add(p1);
add(p2);
add(p3);
}
}

please let me know. Thanx iun advance.
Regards

[This message has been edited by Sam (edited January 02, 2001).]
23 years ago
Hi Friends,
I'm working on a Linux platform and I need to connect
to a database using Type I, i.e., JDBC-ODBC Driver since I do
not have other drivers availble nor I wanna use them.
Now for making connection to a DB using JDBC ODBC, I'll need a
DSN. And the problem is that on Linux , I cant make DSN names, so whats the solution ???
Can anyone help ?
thanx in advance
Thanks Preethi, got it!!
Thanx once again!!!
23 years ago
Hi Preethi,
Please let me know urgently how you will store objects in an array
Regards,

Originally posted by Preethi Suryam:
Hi Sam!
u can acheive it using arrays instead of vectors.hope this information is more than enough.
Regards!
Preethi


23 years ago
Hi Friends,
I made up an applet the background color of which goes on changing continuously. Following is the code :
/*<applet code="ChangeColor" width=350 height=350>
</applet> */
import java.applet.*;
import java.awt.*;
import java.util.*;
public class ChangeColor extends Applet implements Runnable {
Thread t;
Color c=new Color(125,50,125);
Color c1=new Color(70,120,0);
Vector v=new Vector();
public void init() {
t=new Thread(this);
t.start();
}

public void run() {
v.addElement(c);
v.addElement(c1);
try {
int i=0;
for(; ; ) {
setBackground((Color)v.elementAt(i));
i++;
Thread.sleep(1200);
if(i>1)
i=0;
}
} catch(Exception e) { }
}
public void paint(Graphics g)
{
g.drawString("The color must be changing every now and then",100,100);
}
}
Now I need to do the same program without using Vectors !!!
The program should be in such a way that I would be needing support only from java.applet and java.awt packages.
Can anybody help me out ???
Thanx in advance.
[This message has been edited by Sam (edited December 20, 2000).]
23 years ago
Consider the following code :
class ABC
{
public static void main(String gh[])
{
int i=0
i=i++
System.out.println(i);
}
}
Guess the output !!!
Its 0 even after incrementing befre printing. Why guys, I wanna
know !!!
Help out.
regards,

[This message has been edited by Sam (edited November 06, 2000).]
23 years ago
Hi, I have a small code which I'm not able to compile due to the declaration of a static variable. Here it is :
class ABC {
public static void main(String gh[])
{
static int b=10;
System.out.println(b);
}
}
I'm just printing the value of a static variable but its giving me 3 errors. If however, I make b non-static , then it works fine.
Can anyone let me know why is this ?
thanks in advance.
Regards,
23 years ago
Hi guys,
Why do we explicitly override update() method when repaint() automatically gives call to update() ? I think, the purpose is that no flickering is there when the output is shown to the appletviewer / browser.
However, when we call repaint() and doesn't explicitly override update() in our program, then what repaint() does, it first clears the screen, i.e., whatever previously drawn on the applet gets cleared and then it calls update() which then calls the paint() method.
But when we explicitly override update() in our program, then what repaint() does is that without clearing what is previously drawn on the applet , it calls update() which in turn calls repaint(). Thus, previously drawn things doesn't get cleared.
If I don't override update(), flickering is there. And if do , previously drawn things doesn't get cleared.
Anyone has the way out ?
Thanx in advance.
23 years ago
Hi Milind,
Things will get more clearer if you can kindly give an example.
Waiting for the reply.
Regards,

Originally posted by Milind Kulkarni:
Hi Vikrant,
You can execute multiple SQL statements by bunching them together as a Stored Procedure and then call CallableStatement object to execute the stored procedure.
Regards,
Milind


Can Someone elucidate what is Session Tracking ?

Thanks in advance
Regards,
23 years ago