Suganthi Velliah

Greenhorn
+ Follow
since Apr 30, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Suganthi Velliah

Please tell me where the flaw is?
14 years ago
I have done as follows. But I am getting ClassCastException in the return statement.Even I tried with JTextField also. I am getting the same exception
In the NonRootEditor class I have written as follows:



14 years ago
Thanks Rob.
It reallly helped me a lot.

I have another doubt.

When I click on the Parent and child nodes I am able to edit the node with MyTextField. I want Parent nodes to be of legth 15 where as the child nodes to be of length 20. How can I achieve this?

With the following code, I am getting both Parent and Child nodes to be of size 20. But I want different sizes. Please help me out!!!





14 years ago
Hi,

Does anyone have idea on how to make some specific nodes in JTree as non editable.

My tree structure is as follows:

Root 1
|
Parent 1
|
Child 1
......
Child n
.....
|
Parent n

Root 2
Root 3
......
Root n

where I want the nodes Root 1, Root2....Root n to be non editable.
But the Parent nodes and child nodes to be editable.
The tree has popup which has options for renaming these nodes.
So I have set as follows

tree.setEditable(true);

How to make nodes Root 1, Root2....Root n to be non editable?

14 years ago
Thanks Maneesh

I have solved the problem.

We already have cutomized JTextField for restricting the keystrokes once it reaches the maximum length.

I have done as follows:

MyTextField textField = new MyTextField(16);
TreeCellEditor editor = new DefaultCellEditor(textField);

tree.setEditable(true);
tree.setCellEditor(editor);
14 years ago
Hi All,

I have a doubt in JTree.

I have a Tree structure as follows:

Parent1
|
Child 1
Child 2
Child 3

Where I get popup on right click of the node with options Add, Remove & Rename. So I can rename the node. The node name’s length should be <=16 characters. So while renaming the node, I want to stop the keystrokes if it reach 16 characters.

Do you have any idea to do this?
14 years ago
thanks Paul. I will try this
14 years ago

Hi All,

i want to sort the nodes of Jtree alphabetically. I have tried but it is not working.

My tree structure is as follows:

Root Node
|
Parent Node 1
|
Child 1
Child 2
.....
Child n
Parent Node 2
|
Child 1
Child 2
.....
Child n

.....
Parent Node n

The tree is featured with a popup which appears while right clicking on the node which gives options for adding a node, removing a node and renaming a node.

So whenever a node is added or removed or renamed I want to display the nodes in a sorted order. I want to sort the nodes alphabetically at branch level.

ie. Parent nodes level and child nodes level.

It would be very helpful if you provide me with some good way to do this.
Thanks in advance
14 years ago
Thank you all !!!

I have written the follwing code and garbage collection is happening properly and memory leakage problem is almost solved.

panel.removelAll(); //(panel is nothing but a JPanel) which removes all the components from the container and dispatches all the events also
panel = null; //After removing all from the panel and making it null ensures the panel to be garbage collected.


14 years ago

Joe Ess wrote:

William Brogden wrote:
Does your GUI involve any event listeners?
Improperly disposed of listeners are a prime cause of memory leaks with GUI apps.
Bill



original post here



Yeah. Event Listeners are used in the application. How to dispose the listeners? Sorry for questioning you a lot. I am new to Swing thats why
14 years ago
Hi All,


We are facing memory leak problem while running our application. We are using JProfiler to identify the rerason and found the follwing:

1) While making Outer class objects as null it is not getting garbage collected. Since inner classes are referring to Outer class.
How to make the objects garbage collected in this case?

2) We have a lot of Swing Components. They are also not gettiing garbage collected. What could be the possible reasons?

Your response will be very helpful
Thanks in advance.
15 years ago
Hi All,



While calculating logarithm values in JDK1.4 it returns some unpredicted values. As Math.log() returns double so there is loss of precision and exact log base 10 values cannot be calculated.



For a CR in TP, a formula was given as:


DispCode = Int ( -1 * log10( abs(LsbRsln)))

which is written in Java as,


int dispcode = (int) (-1 * (Math.log(Math.abs(Double.parseDouble(lsbrsln))) / Math.log(10)));



For example, if lsbrsln = 0.001, the formula is expected to return 3, instead it returns 2. The following part of the formula



Math.log (Math.abs (Double.parseDouble(0.001))) / Math.log(10) is returning -2.999999� and finally the formula is returning 2 while casting it into int.



In JDK1.5 we have Math.log10 method itself for calculating logbase10 values. But since we need to support JDK1.4 also we were not able to use that also.

Please let me know if you have the solution.
15 years ago
Hi All,



While calculating logarithm values in JDK1.4 it returns some unpredicted values. As Math.log() returns double so there is loss of precision and exact log base 10 values cannot be calculated.



For a CR in TP, a formula was given as:


DispCode = Int ( -1 * log10( abs(LsbRsln)))

which is written in Java as,


int dispcode = (int) (-1 * (Math.log(Math.abs(Double.parseDouble(lsbrsln))) / Math.log(10)));



For example, if lsbrsln = 0.001, the formula is expected to return 3, instead it returns 2. The following part of the formula



Math.log (Math.abs (Double.parseDouble(0.001))) / Math.log(10) is returning -2.999999� and finally the formula is returning 2 while casting it into int.



In JDK1.5 we have Math.log10 method itself for calculating logbase10 values. But since we need to support JDK1.4 also we were not able to use that also.

Please let me know if you have the solution.
15 years ago
hi Paul,

Thanks for your reply. Sorry for the late reply since I was little busy
Thanks for clearing my doubt Paul.
Could you tell me the new features intoduced in EJB3.0?