Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!

anitha nair

Greenhorn
+ Follow
since Jul 12, 2006
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 anitha nair

hai forum,

I am have trouble to fix this up.Please help me out with your valuable suggestion.

I have an arrayList having many objects.I am saving the details of these objects in Xml format.I am trying to place the objects of same class inside a tag<class id="--"> details </class>
My code prints the similar object details twice.I could understand that its because the checking is being done in both loops.But when i do it using a single for loop i have difficulty placing the tags properly.I am providing a rough format of my code.Please suggest me how can i accomplish this idea efficiently.



Thank you all.
17 years ago
Hi forum,

Please help me trace my error.

I am displaying JTextFields in a JPanel.
tf[j] =new JTextField();
tf[j].setSize(new Dimension(50,25));
jPanel.add(tf[j],true);

tf[j].setBounds(100,(100+(j*50)),50,10);
I am able to set the size of the text fields only when the panel is having GridBagLayout.For all other layouts the textfield gets redused to small size.

I am getting only one textField in the top most left corner even if there are more than one.

Will any one please tel me what changes should i bring about in the setBound of the textField to display it all in a column.
Or do i need to set any other properties of the GridBagLayout to get it correct?

Thank you all.
17 years ago
Hi forum,

Please help me out with this problem.

I am getting the parameter types of a method in a class as

Class[] parameterTypes=method.getPrameterTypes();

I need to test if the parameter types are of primitive types i.e int or String or long etc...If its not it should show a message box.
For that i used the following code.The trouble is that it doesnt seems to test the whole conditions.It seems to check only the first condition and for all other conditions it gives a negative result.i.e for String,long,float etc it shows the message box whereas it should be executing else condition instead.Please tell me whats wrong with it.



Thank you all in advance.
[ August 08, 2006: Message edited by: Bear Bibeault ]
17 years ago
My JPanel's layout is flow layout and its preffered size is 500,5000.
seprefferedSize for the textbox doesnt seems to work also the setColum wont work.

What changs will i have to bring about in the JPanel settings in order to get the textfields dimension correct?

Please help.

Regards.
17 years ago
Hi forum,

I am displaying Jtextfields dynamically in a JPanel.My problem is that the textfields are always displayed in a default size(with very less width).The setSize method doesnt seems to work.

Iam doing it in JDEveloper and so tried giving various layout to the panel.Nothing seems to work.

please help me trace my problem.

[code]
tf = new JTextField[parameterCount];

for(int j = 0; j < tf.length; j++)

{

tf[j] =new JTextField();

tf[j].setSize(50,30);

//I TRIED THE FOLLOWING ALSO

//tf[j].setSize(new Dimension(50, 30));

//tf[j].setColumns(10);

parameterPane.add(tf[j],true);

tf[j].setBounds(100,(100+(j*50)),100,10);

} //END OF FOR LOOP
[code]

Thank you
17 years ago
Hai forum,

I tried various methods.The outputs are vague.the stackTrace is showing error in invocation,

Object result=method.invoke(instance,parameters);

I really dont understand what could be wrong with this.Please,if any one could trace it out do help me.

regards.
17 years ago
Yep.I am sorry i couldnt get you then.Heres the code where i get the method.It is quite a lengthier one.I choose JFileChooser to select the class file,upon which all the methods in that file will be displayed dynamically in a panel as radiobuttons.

The method is selected when i click a radio button.
Hope you will understand my code.Since iam a novice it might seems clumsy to you.

THE FIRST ONE IS THE CODE TO CHOOSE A CLASS FILE AND DISPLAY METHODS.It also selects a method using radio button, action of whose is given below in class MethodRadioActionListener.


AND HERES THE CODE WHICH WORKS UPON SELECTING THE METHOD UPON CLICKING A RADIOBUTTON .IT DISPLAYS TEXTFIELDS FOR USER OUTPUT.
17 years ago
This is the Emp.class iam calling.This might help you.I am calling only the first method in my previous code.

Thank you and regards.

17 years ago
Hai all,let me post the exceptions i get, so that my problem is more clear to you all.

Here i am selecting a class named Emp.class and selecting its first method "setID(int)". I am giving the parameter as 10.But i am getting the following exception.

Apart from the first 3 lines,i suppose, the rest of the exceptions are for the other methods in the class.


java.lang.ArrayIndexOutOfBoundsException: 0
java.lang.ClassCastException: java.lang.Integer
Invoked result: null
Do not support the data type
java.lang.IllegalArgumentException: wrong number of arguments
Name: null
ID: 0
Designation: null
Invoked result: null
Enter name:
Process exited.

thank you
17 years ago
hai forum,

Your previous responses on this topic 'method invocation' has greatly helped me in writing a code to invoke method dynamically.As some experts pointed out,the parameters had to be type casted.

Please help me out of my latest trouble.I invoke only a particular method 'methodName' of a particular calss instance 'instance'.But when i run the code Exceptions are thrown for all the methods of that class whereas i require exceptions connected with methodName only.

I just could not figure out my mistake, so please help me out.

Thank you.

17 years ago
Hai forum,

I am a newbie to java and i am really confused about how to invoke method dynamically.Plz help me out with your suggestions and tips,which will be valuable to me.

I get the method selected dynamically and pass that to the method invocation class.The user inputs are collected in an array inside the class.

I have troubles in the following area:

1. whenever i run the following code MethodNotfound Exception is thrown for all the methods of the Classinstance, whereas invocation is required only for the methodName method which is passed.

2.I have no idea how to check for each parameter in the array for integer or float or double etc..and pass that to invoke method.

Please help me with your ideas.

Thank you all

17 years ago
Hai forum,

I have to extract the class files of a dynamically selected jar file into a folder in local disk as well as display the class files in a combo box.I could display the class files in a combo box ,but iam having no idea as to how it should be saved into a folder.

My code is given here,

JarFile jarFile = new JarFile(path);
Enumeration entries = jarFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
if(entry.getName().endsWith(".class"))
jComboBox1.addItem(entry.getName());

//HERE I WANT TO TRANSFER THESE CLASS FILES INTO A FOLDER
} jarFile.close();


Please help,
Thank you.
17 years ago