Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Rajesh Kumar

Greenhorn
+ Follow
since Nov 16, 2001
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 Rajesh Kumar

Dear Friends,
Is there anyway to see the JDBC Drivers installed in my system ?
for ex : i java odbc driver, and microsoft sql server jdbc driver...etc.,
Can I see the list of all drivers ?
Is there anyway to develop a java program to see this ?
If anyone having any idea, please share ur ideas.
Yours kind cooperation would be greatly appreciated.
Thanks in advance
Yours
Rajesh
Dear Mr.Schreckmann,
Thank you very much.
Your reply helped me alot.
Millions of Thanks to you.
Yours
Rajesh

Originally posted by Dirk Schreckmann:
Here's a hint...
Inside class A, make this change:

Now, frame c will be disposed of, if frame b has created one. Otherwise you'll still throw an exception.
Was this enough of a hint?

17 years ago
Dear Friends,
In my application, I have 3 Frames. like A.java, B.java, and C.java
I have to close C.java Frame using a button click from A.java.
When i am trying to close C Frame from A Frame,
it is saying java.nullpointer exception.
for eg : I have 3 Frame classes like A, B and C.
B Frame will be opened using a button click from A Frame.
C Frame will be opened using a button click from B Frame.
I have to close C Frame using a Button click from A Frame.
I am new to java. Please help me.
Thanks in advance.
Looking forward to hearing from
My A.java, B.java and C.java programs are like this.
All the Frames are opening fine. only problem is while closing C Frame from A Frame
=======================
A.Java
=======================
import java.awt.*;
import java.awt.event.*;
public class A extends Frame implements ActionListener
{
B b;
C c;
Button showBChild, closeCChild;
A()
{
setLayout(new FlowLayout());
showBChild = new Button("Show B Frame");
add(showBChild);
showBChild.addActionListener(this);
closeCChild = new Button("Close C Frame");
add(closeCChild);
closeCChild.addActionListener(this);
setVisible(true);
setSize(300,300);
show();
}
public void actionPerformed(ActionEvent ae) {
if(ae.getSource() == showBChild) {
b = new B();
}
if(ae.getSource() == closeCChild) {
c.dispose();
}
}
public static void main(String args[]) {
new A();
}
}
=======================
B.Java
=======================
import java.awt.*;
import java.awt.event.*;
public class B extends Frame implements ActionListener
{
C c;
Button showChild;
B()
{
setLayout(new FlowLayout());
showChild = new Button("Show C Frame");
add(showChild);
showChild.addActionListener(this);
setVisible(true);
setSize(300,300);
show();
}
public void actionPerformed(ActionEvent ae) {
if(ae.getSource() == showChild) {
c = new C();
}
}
public static void main(String args[])
{
new B();
}
}
=======================
C.Java
=======================
import java.awt.*;
import java.awt.event.*;
public class C extends Frame
{
C()
{
setLayout(new FlowLayout());
setVisible(true);
setSize(300,300);
show();
}
}
=========================
Looking forward to hearing from.
17 years ago
Dear John,
I am deeply grateful to you for your kind cooperation.
I made changes in closeChildFrame method. It is ok. but it is giving problem when i call that method.
please see this one.
Thank you very much.
Yours
Rajesh
jMenuItem_close.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
closeChildFrame();
}
});
public void closeChildFrame(B_Frame child)
{
System.out.println("close()");
child.hide();
child.dispose();
}
error : cannot be applied to closeChildFrame();
please help me, what changes shall i do to avoid this error.
I am new to java.
Thanks once again.

Originally posted by John Utting:
Rajesh,
You are trying to invoke the instance methods
hide() and dispose() using the class reference (B_Frame) rather than using an object of the class.
Try the following:
public void closeChildFrame(B_Frame child)
{
System.out.println("close()");
child.hide();
child.dispose();
}
When youi call the closeChildFrame() method pass a reference to an object of type B_Frame.
Hope this helps.

17 years ago
Dear friends,
please help me.
I have to close B_Frame (Child frame) from A_Frame (Parent) with a button click.
In A_Frame.java (Parent Frame) I used like this :
public void closeChildFrame()
{
System.out.println("close()");
B_Frame.hide();
B_Frame.dispose();
}
Compilation error :
non-static method hide() cannot be referenced from a static context B_Frame.hide();
^
non-static method dispose() cannot be referenced from a static context
B_Frame.dispose();

please help me.
your kind cooperation would be greatly appreciated.
Thanks in advance.
17 years ago
Dear Friends,
I am getting the following exception when i run my server program, which interacts with database.
if anyone knows about this, please help me
Thank you very much.
yours Rajesh
Current Java thread:
at sun.jdbc.odbc.JdbcOdbc.getDataInteger(Native Method)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataInteger(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataInteger(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getInt(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.buildTypeInfo(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
17 years ago
Dear Friends,
Is it possible to use JDBC Type-4 driver for MS Access ?
Is there any type-4 driver provider for MS Access ?
If anyone knows about this., please participate in this discussion.
Thanks in advance
yours
Rajesh
I believe that Visual Cafe is the best IDE for java especially for begineers.
The beginer can learn java very easily, if he can able to use visual cafe.
Try with Visual Cafe and Editplus.
17 years ago
Dear Friends,
please help me.
My RMI Serverprogram is suddenly shutting down after running for 2 hours. and showing the following log file.
My server program will inserts records in database.(Continuous database interaction)
please help me. i am stuck with this problem. i cannot find the solution.
Thanks in advance.
yours rajesh

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x41166aa5
Function name=(N/A)
Library=(N/A)
NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for possible
reason and solutions.
Current Java thread:
at sun.jdbc.odbc.JdbcOdbc.getDataInteger(Native Method)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataInteger(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataInteger(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getInt(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.buildTypeInfo(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at DBUtil.getConnection(DBUtil.java:10)
at TestTable.isProtocol(TestTable.java:112)
at Test.set(Test.java:138)
at Test.trans_Tr0(Test.java:362)
at Test.run(Test.java:311)
at java.lang.Thread.run(Unknown Source)
Dynamic libraries:
0x00400000 - 0x00405000 C:\WINNT\system32\java.exe
0x77F80000 - 0x77FF9000 C:\WINNT\System32\ntdll.dll
0x77DB0000 - 0x77E0A000 C:\WINNT\system32\ADVAPI32.dll
0x77E80000 - 0x77F36000 C:\WINNT\system32\KERNEL32.DLL
0x77D40000 - 0x77DAF000 C:\WINNT\system32\RPCRT4.DLL
0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
0x6D420000 - 0x6D4EF000 C:\Program Files\JavaSoft\JRE\1.3.1\bin\hotspot\jvm.dll
0x77E10000 - 0x77E75000 C:\WINNT\system32\USER32.dll
0x77F40000 - 0x77F7C000 C:\WINNT\system32\GDI32.DLL
0x77570000 - 0x775A0000 C:\WINNT\system32\WINMM.dll
0x75E60000 - 0x75E7A000 C:\WINNT\System32\IMM32.DLL
0x6D220000 - 0x6D227000 C:\Program Files\JavaSoft\JRE\1.3.1\bin\hpi.dll
0x6D3B0000 - 0x6D3BD000 C:\Program Files\JavaSoft\JRE\1.3.1\bin\verify.dll
0x6D250000 - 0x6D266000 C:\Program Files\JavaSoft\JRE\1.3.1\bin\java.dll
0x6D3C0000 - 0x6D3CD000 C:\Program Files\JavaSoft\JRE\1.3.1\bin\zip.dll
0x6D340000 - 0x6D348000 C:\Program Files\JavaSoft\JRE\1.3.1\bin\net.dll
0x75050000 - 0x75058000 C:\WINNT\system32\WSOCK32.dll
0x75030000 - 0x75044000 C:\WINNT\system32\WS2_32.DLL
0x75020000 - 0x75028000 C:\WINNT\system32\WS2HELP.DLL
0x77840000 - 0x7784C000 C:\WINNT\System32\rnr20.dll
0x77980000 - 0x779A4000 C:\WINNT\system32\DNSAPI.DLL
0x777E0000 - 0x777E8000 C:\WINNT\System32\winrnr.dll
0x77950000 - 0x77979000 C:\WINNT\system32\WLDAP32.DLL
0x777F0000 - 0x777F5000 C:\WINNT\system32\rasadhlp.dll
0x77830000 - 0x7783E000 C:\WINNT\system32\RTUTILS.DLL
0x74FD0000 - 0x74FE1000 C:\WINNT\system32\msafd.dll
0x75010000 - 0x75017000 C:\WINNT\System32\wshtcpip.dll
0x10000000 - 0x1000D000 C:\Demo\Server\Utility.dll
0x6D290000 - 0x6D29A000 C:\Program Files\JavaSoft\JRE\1.3.1\bin\JdbcOdbc.dll
0x1F7F0000 - 0x1F825000 C:\WINNT\system32\ODBC32.dll
0x76B30000 - 0x76B6E000 C:\WINNT\system32\comdlg32.dll
0x70BD0000 - 0x70C34000 C:\WINNT\system32\SHLWAPI.DLL
0x71780000 - 0x7180A000 C:\WINNT\system32\COMCTL32.DLL
0x775A0000 - 0x777E0000 C:\WINNT\system32\SHELL32.DLL
0x1F8E0000 - 0x1F8F6000 C:\WINNT\system32\odbcint.dll
0x77820000 - 0x77827000 C:\WINNT\system32\VERSION.dll
0x759B0000 - 0x759B6000 C:\WINNT\system32\LZ32.DLL
0x77A50000 - 0x77B45000 C:\WINNT\system32\ole32.dll
0x77BE0000 - 0x77BEF000 C:\WINNT\System32\SECUR32.DLL
0x1F840000 - 0x1F85A000 C:\WINNT\system32\odbccp32.dll
0x78140000 - 0x7815A000 C:\WINNT\system32\msv1_0.dll
0x77920000 - 0x77942000 C:\WINNT\system32\imagehlp.dll
0x72A00000 - 0x72A2D000 C:\WINNT\system32\DBGHELP.dll
0x690A0000 - 0x690AB000 C:\WINNT\system32\PSAPI.DLL
Local Time = Sat Feb 09 12:43:06 2002
Elapsed Time = 11822
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.3.1-b24 mixed mode)
#
17 years ago
Dear Friends
I am facing pblm while converting ascii to dec.
at present my program is supporting to this..
ascii dec
a 61
but, when i give "aa" it is still saying 61 as decimal.
how can i make my program to get this type of result
aa 6161
aaa 616161
is it possible.
please help me.
Thanks in advance
Yours
Rajesh
17 years ago
Dear Roy Ben Ami,
Can I run like this ?
java HelloWorld.class ?

Originally posted by Roy Ben Ami:
oops.
java HelloWorld

17 years ago
Dear Friends
I am new to Java
A Strange Doubt.
Can I run my java program like this...
java HelloWorld.class
My HelloWorld program is like this
class HelloWorld
{
public static void main(String args[])
{
System.out.println("Hello World ");
}
};
After Compiling ...Can i Run the program as like
java HelloWorld.class ?
If anyone having idea...Please participate in this discussion.
Thanks in advance
Yours
Rajesh
17 years ago
Hi Friends
I am new to Java
My java class file size is 15 k now.
Is there anyway to reduce the size of class file.
I heard that the efficient way of doing programming is doing program which generates less size of class name.
is there anybody knows how to do the programming which will creates the less size class name ?
please give me some programming techniques.
Thanks in advance
Yours
Rajesh
17 years ago
Read the Tutorial in the following URL
http://java.sun.com/docs/books/tutorial/uiswing/index.html
If u got any doubts while doing programming please post ur question or doubt in the following discussion forum.
http://forum.java.sun.com
There is a discussion forum forum for swings at above url.
u will get immediate response for ur doubt.
If u got anymore doubts please send ur doubt to the following email.
mailingtutorial@canada.com
I will try to solve ur pblm
Cheers
17 years ago
Hai Friends
I am new to Java
I have a doubt.
I have 2 Frames like..Frame1 and Frame2
In Frame1 a Button called "OK"
When i click that button (OK) from Frame1 ....the second Frame should open as a MODAL Frame.
Is it possible to Call another Frame class as MODAL ?
If anybody knows about this...please help me.
What shall i do in Frame1 and Frame 2 to make Frame2 as MODAL Frame.
Thanks in advance
Yours
Rajesh
17 years ago