Andre Uhres

Greenhorn
+ Follow
since Nov 23, 2008
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 Andre Uhres

Evgeny Krylov wrote:

Melki Joe wrote:Hi Craig Wood,

I too have a problem in JTree that is I want to move the JTree nodes to another JTree without changing its structure. but only the selected nodes should move. Help me in this issue.

Thank you.


Hi Melki Joe .
See my solution


Your code might be of public interest, if only it were compilable. Here ist only one example of many broken statements in your code:
11 years ago

Evgeny Krylov wrote:Any info about? I mean dnd entire subtree of tree not only leaf.


TreeDnd.jar (the source code is also included in the jar file)
11 years ago

Sasika Thiranga wrote:I have form with jtable and Button call print.What i want to do is
print the contents of a jtable with landscape when print button click.
And i don't want print defualt setting form to display.
I can't manage this... any suggestions?


Please try this:
11 years ago
We use a custom cell renderer, something like this:
11 years ago

Gregg Bolinger wrote:Then changing the name of 'user' will change the name of the nodes label.


To refresh the GUI we also need to call nodeChanged:
defaultTreeModel.nodeChanged(node);
11 years ago

Alan Brooks wrote:This is being done already and does not help


Could you please post a short independant and compilable example?
11 years ago
Each time, before calling populateTree(), we should initialize again "rootNode" and "treeModel" and set the "treeModel" to the tree:
11 years ago

Olivier Legat wrote:How can I decide which components are on top?


We can implement a special container for the Draggables and dispatch mouse events from the Draggables to the container.
In "mouseReleased", the container can go through it's components:
Component[] comps = getComponents();
and assign zorder 0 (=top) to the last component intersecting the mouse position.
That way we are able to cycle through overlapping labels with mouse clicks.

To simple make the pressed Draggable come to top, we can add this in mousePressed of Draggable:
11 years ago

Olivier Legat wrote:I'm trying to place a "draggable" Component inside a Panel. What I mean by that is I want to be able to have something like a JLabel for example that can moved around the Panel from one position to another


With JPanel(null) and using label.setLocation(..), we can drag any JLabel having a MouseMotionListener and a MouseListener.

As an example, here is a simple "Draggable" class which can wrap any JComponent that we want to make draggable. It contains a main method to show how to use it:
11 years ago
You may want to consider this parser:Parser for mathematical formulas
11 years ago

Originally posted by pete stein:
But I'm guessing that you are already quite familiar with Swing programming, correct?


Correct. I wouldn't recommend a Gui builder for beginners.
11 years ago
I use the NetBeans Gui builder, but coding from scratch is better for advanced features.
11 years ago
One way is using setValueAt:
11 years ago