kate damond

Ranch Hand
+ Follow
since Apr 17, 2001
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 kate damond

Hmm, but it didn't work for me !!!
I'm developing it in Visual Age, so it takes some chopping about to post code. Maybe I'll have to do that, cos I definitely set the default Close operation to do nothing, and it just goes off and closes all by itself, no matter what I tell it to do...
22 years ago
Hi,
I know this has been explained at length before but I don't get it ! I have a JFrame, and when it is created and initialised, I set

Then, for the window Closing event, I have a JOptionPane ConfirmDialog box pop up which asks the user if they want to save before closing.
Whichever option they choose .... it closes ! It should NEVER close ... any ideas ?
Cheers,
Kate
22 years ago
app- lication or app- let ?
22 years ago
Hi,
Listen for treeSelection events. When the selction changes, you can get at at the old LeadSelection Path through the TreeSelectionEvent...

Which is the one just unselected.
Let me know if this needs more explanation,
Cheers,
Kate
22 years ago
Yes, irritating isn't it : there should be a method like .ensureIndexIsVisible(int) like there is for Lists.
But there isn't.
You can do it as a side affect of setCaretPosition :

which is a bit cheesy... but then I suppose it's logical to only let your users start editing on the bit they can see. (Seems to work for non-editable TextArea too)
Kate
22 years ago
hi Ben,
yes, I can pick up the position of the cursor whenever it is cicked, but then what happens is I have to discard it if it did not represent a change in selected item (e.g. they just clicked to expand or collapse a branch).... alas, the tree changed event doesn't give me x-y position, and the mouse events can't tell me what sort of tree change the click represented.
So, I end up storing two sets of x-y pairs (tempX for all clicks, realX for when the last change really was a selection change) and a boolean doWeHaveAnUnrecordedTreeChangeEvent to get the position for ... all of which is clumsy and works fine, until I realised that of course, the user can alter the x-y position of the selected item for all sorts of reasons like they expanded the tree further up, they resized the window etc etc ...
I decided that keeping track of the current last selection via click was tricky, and counter to the java spirit : I should read the value as I need it - like with all the other controls.
There must be an easy method .... surely ???
Kate
22 years ago
Hi,
I have a JTree, and I pop-up different menus according to the tree's selection. What I would like to do is to take into account where on the Tree's background the user just right-
clicked.
So, I can see lots of methods for returning a TreePath, or a row given an x-y- position pair, but what I want is to return an x-y position pair, given a row or Path.
e.g.
I have : getTree().getPathForLocation(x,y);
I want : get .getLocationForPath(TreePath);
Cheers,
Kate
22 years ago
Andy,
When your user clicks your button, you have to handle ActionPerformed for the button. You do not need to handle an event for the combo, simply read its text when you handle the button ActionPerformed :

Kate
22 years ago
I did something similar : the complex data stuff goes in the user Object for each node.
I find it useful to also keep a HashMap of nodes as they are created - useful for complete-match and partial match searching.
Kate
22 years ago
Hi,
I have a JFrame containing a SplitPane. On resize of the Frame, I want the proportions of the splitPane to remain constant. This works fine, I have a ComponentAdapter listening out for changes in the size of the frame, and relocating the SplitPane's divider.
However, I need to get somehting to listen to the 'user repositions the divider' event, so I can store the new proportions.
ANy ideas?
Thanks,
Kate
22 years ago
yes - you're absolutely right. It seems so simple in retrospect : I had read 'getLastComponentPath()' as getting the last PATH in a multiple selection of paths rather than getting the last COMPONENT in a path !
It's working now, thanks
Kate
22 years ago
Hi,
I have a JTree that allows mutliple selections. I need to iterate through each of the selected nodes and do some processing on them. I thought I'd add them to a hashMap. Unfortunatley, I'm having trouble getting at the nodes themselves. looking back at a similar problem I tackled a while ago, I got round it by using tree.getLastSelectedPathComponent().
I can't generalise to get at all the selected Componenets though.
I can get at all the selected paths though. Does this help ? Can I get at the node, from its TreePath ?
Cheers,
Kate
I
22 years ago
Hi,
I want to set the cursor to WAIT_CURSOR, while my applet is waiting for data back from its servlets.
I've got as far as this (test) code ..

I was thinking that this would ... set the cursor to the egg-timer thing .... print out a load of rubbish..... set the cursor back to the default.
What it actually does is ....first print out a load of rubbish.... leave the cursor as it is until the print "Rubbish" has finished ... not update the cursor until it gets moved about after the Rubbish has finished.
Any ideas why printing stuff out takes precedence over the cursor update ?
Cheers,
Kate

22 years ago
Hi,
I have this search routine which returns a populated ArrayList. I want to display these results in some useful form so that my users can select one or two, scroll through them etc.
I thought a JList would be the sort of thing I wanted, but having read the sun api documentation I am hopelessly confused. (Actually, this documentation always leaves me feeling like this - I mean, why have as their FIRST example of a JList .."
// Create a JList that displays the superclass of JList.class" ??? )
Anyway, what I want to know is how to add each component from the arrayList that I've got, to the JList that's going to display them. I'm missing something, aren't I ? I was really hoping for a .add() method.
Perhaps Yaroslav Chinskiy can help me out - sounds like you have already doen this (very basic) step ??
Thanks,
Kate
22 years ago
Ok, I figured that out now.

Next question is that I don't seem to be able to get at my nodes correctly. I get a DefaultMutableTreeNode, but I know that my nodes were MyTreeNodeObject when I put them there.
So, how comes I can't cast back to MyTreeNodeObject ???


Cheers
Kate
22 years ago