Problem, errors in JTree.expandPath(TreePath)
I got errors when doing JTree.expandPath(TreePath), and I have no idea, whats wrong with my code, I printed out the TreePath, and it looks alright, I just dont know why it doesnt work.
Now, if only this answer wasn't three years late, i'm sure you'd be getting all the dukes you deserve. Seriously, why resurrect a three year old thread with a potentially incorrect answer?
Similar Messages
-
Extreme JTree.expandPath frustration
I've read through about 80 posts on this subject and cannot solve my problem. I am trying to dynamically select a node in a JTree. I'm using a custom TreeModel to model an XML file. I select the node with the following code:
jTree.setExpandsSelectedPaths(true);
jTree.setSelectionPath(treePath);
jTree.expandPath(treePath);
jTree.scrollPathToVisible(treePath);I know the node is being selected b/c a subsequent action is taken via the tree listener, and a call to jTree.getSelectionPath() shows the expected treePath. The problem is that graphically the treePath is niether expanded nor highlighted.
If I call jTree.getRowForPath(jTree.getSelectionPath())
-or- jTree.getRowForPath(treePath) I get "-1" which according to the Javadocs can only happen "if any of the elements in path are hidden under a collapsed parent". But I've eliminated this possibility by expanding the entire tree.
Can anyone please help.
Thanks,
bbMy problem turned out to be a problem in a custom equals method. A cruel bug elsewhere in the code was fooling me into thinking the listener was triggering correctly.
I'm not sure I understand your question but this might help. The TreePath[] needs to include the Node objects that comprise the path you want to select. In my case I have no reference to the actual Nodes so I have to create a new TreePath[] that has identical nodes (but not the actual nodes). The actual nodes and the identical nodes do contain a reference to the same encapsulated object. I can therefore walk the tree row-by-row and compare the object encapsulated by the actual Node to the object encapsulated by the identical node. When a match is found I expand that row and continue the search until I reach the end of the TreePath[]. Here is roughly what the code might look like:
"path" is the identical TreePath, "getElement()" returns a reference to the encapsulated object.static void selectNode(TreePath path) {
TreePath select = path;
TreePath rowPath = null;
int row = 0;
int i = 1; // ignore the root
Element element1, element2;
while (row < tree.getRowCount()) {
while (i < select.getPathCount()) {
rowPath = tree.getPathForRow(row);
if(i >= rowPath.getPathCount()) i = rowPath.getPathCount()-1;
element1 = ((AdapterNode)(rowPath.getPathComponent(i))).getElement();
element2 = ((AdapterNode)(select.getPathComponent(i))).getElement();
if(element1.equals(element2)) {
if(i == select.getPathCount() - 1) break;
tree.expandRow(row);
i++;
row++;
break;
tree.setSelectionRow(row);
tree.scrollRowToVisible(row);
} -
Jtree expandPath is not working
Hi All,
I am performing following opertion on jtree
First i am taking path of selected jtree node.
i am updating jtree
then i am trying to expand jtree on the basis of selected path.
but it is not getting expanded at all.pls help
code --->
TreePath treePath=tree.getSelectionPath().getParentPath();
// below line refreshing tree with new value
TreeStructure.CreateTreeStructure(connDialog.getConnection(), tree, connDialog.getServerName().getText());
tree.expandPath(treePath);
// tree.setSelectionPath(treePath);
tree.setVisible(true);do u got the solution for ur problem?
if no
this thread show the error source
http://forum.java.sun.com/thread.jspa?threadID=674858
else
tell me the solution -
ZEN Vision 'Hardware Problem' error mess
Model No: ZEN Vision - PMC-HD0002
Error occurred as a result of a firmware upgrade.I can access 'recovery mode' &?have attempted several further firmware upgrades.It loads, rebuilds, reboots, starts then the 'hardware problem' error message returns.The device is currently stating, in 'recovery mode', that the following firmware is loaded v.42.0_0.0.9.I have removed all data (format all), run 'clean up' & 'rebooted' then upgraded firmware but with no success.?Any ideas will be greatly received & appreciated.hi.
i have exactly the same problem.
did you manage to find any answer?
how did you access the recovery mode?
your response will be greatly appreciated.
thanks! -
Ipod cannot be restored because of unknown problem (Error 1437)"
One day when I was listening my ipod when I pass the other song ipod screen freeze and I reset it and when its open all the songs and videos are gone Then I connect it to my laptop and I took the Error says "iTunes has detected an iPod that appears to be corrupted" When I try to restore it through itunes, I take an error message says "ipod cannot be restored because of unknown problem (Error 1437)" And the ipod is not recognised in itunes after this message..Then I searched the help files; I updated my itunes to the latest version, also restart my computer and change the usb port Im trying.. Also tried to update the serial control drivers but nothing's changed..One time I tried to do it in safe mode.. Nothings Changes... I everything I found in apple help files.. I see lots of unanswered questions in many months but Please HELP
Well it could be dead forever or you might just need some simple repairs. The problem i have seen in some is that when dropped the hard drive either comes loose (easy to fix) or gets killed (little more expensive).
There could be other problems but i have seen those problems more often than something drastic like the whole board dieing.
try here for repairs
http://www.iresq.com/ -
? MacBook 2006 w/Snow Leopard; HP B210 printer; print problem; error message: "One or more components of the HP printing software are corrupted or missing..." Reinstalled software but Mac will not cause printer to print. My MacBook Pro works fine with same wireless printer.
Hi ArielAce , thanks for getting back to me!
I would recommend downloading and running the HP Print and Scan Doctor.
Please keep me posted!
Please click “Accept as Solution " if you feel my post solved your issue, it will help others find the solution.
Click the “Kudos, Thumbs Up" on the right to say “Thanks" for helping!
Jamieson
I work on behalf of HP
"Remember, I'm pulling for you, we're all in this together!" - Red Green. -
DVD Studio burning problem error message: "remove the VIDEO_TS folder from the Build Location"; where is build location?
Thanks Shane I followed your instructions and it turned out pretty well. One quick question, Im working with DVD Studio Pro 4, how do i implement a theme into my project? I cant even fin where thay are located. Thanks.
-
Problem in refreshing JTree inside Jscrollpane on Button click
hi sir,
i have problem in refreshing JTree on Button click inside JscrollPane
Actually I am removing scrollPane from panel and then again creating tree inside scrollpane and adding it to Jpanel but the tree is not shown inside scrollpane. here is the dummy code.
please help me.
import javax.swing.*;
import java.awt.*;
import javax.swing.tree.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.WindowListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Test
public static void main(String[] args)
JFrame jf=new TestTreeRefresh();
jf.addWindowListener( new
WindowAdapter()
public void windowClosing(WindowEvent e )
System.exit(0);
jf.setVisible(true);
class TestTreeRefresh extends JFrame
DefaultMutableTreeNode top;
JTree tree;
JScrollPane treeView;
JPanel jp=new JPanel();
JButton jb= new JButton("Refresh");
TestTreeRefresh()
setTitle("TestTree");
setSize(500,500);
getContentPane().setLayout(null);
jp.setBounds(new Rectangle(1,1,490,490));
jp.setLayout(null);
top =new DefaultMutableTreeNode("The Java Series");
createNodes(top);
tree = new JTree(top);
treeView = new JScrollPane(tree);
treeView.setBounds(new Rectangle(50,50,200,200));
jb.setBounds(new Rectangle(50,300,100,50));
jb.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ae)
jp.remove(treeView);
top =new DefaultMutableTreeNode("The Java ");
createNodes(top);
tree = new JTree(top);
treeView = new JScrollPane(tree);
treeView.setBounds(new Rectangle(50,50,200,200));
jp.add(treeView);
jp.repaint();
jp.add(jb);
jp.add(treeView);
getContentPane().add(jp);
private void createNodes(DefaultMutableTreeNode top) {
DefaultMutableTreeNode category = null;
DefaultMutableTreeNode book = null;
category = new DefaultMutableTreeNode("Books for Java Programmers");
top.add(category);
book = new DefaultMutableTreeNode("The Java Tutorial: A Short Course on the Basics");
category.add(book);
book = new DefaultMutableTreeNode("The Java Tutorial Continued: The Rest of the JDK");
category.add(book);
book = new DefaultMutableTreeNode("The JFC Swing Tutorial: A Guide to Constructing GUIs");
category.add(book);
book = new DefaultMutableTreeNode("Effective Java Programming Language Guide");
category.add(book);
book = new DefaultMutableTreeNode("The Java Programming Language");
category.add(book);
book = new DefaultMutableTreeNode("The Java Developers Almanac");
category.add(book);
category = new DefaultMutableTreeNode("Books for Java Implementers");
top.add(category);
book = new DefaultMutableTreeNode("The Java Virtual Machine Specification");
category.add(book);
book = new DefaultMutableTreeNode("The Java Language Specification");
category.add(book);
}hi sir ,
thaks for u'r suggession.Its working fine but the
properties of the previous tree were not working
after setModel() property .like action at leaf node
is not working,I'm sorry but I don't understand. I think you are saying that the problem is solved but I can read it to mean that you still have a problem.
If you still have a problem then please post some code (using the [code] tags of course). -
Can anyone list problems/errors when uploading data using BDC's and BAPI's?
Can anyone list the problems/errors when uploading data using BDC's and BAPI's?
Hi,
If you are actually creating a BDC to load data pls be more specific.
Data format incorrect. Tab delimited/ etc
Dates in wrong formats
Currency incorrect formats
Missing screens
Wrong transaction code
File not found,
Missing Mandatory fields,
Screen resoultion.
You should always use refresh for your Bdcdata table.
Loop at internal table.
refresh Bdcdata.
regards,
sowjanya. -
Again same problem error 0xE8000003 pls help again i don't know it keep doing that
Again same problem error 0xE8000003 pls help again i don't know it keep doing that please help with that
Hello sartip fatah,
The following article provides further information regarding this error, and steps to help resolve it.
iOS: Unknown error containing '0xE' when connecting to a Windows PC
http://support.apple.com/kb/TS3221
Cheers,
Allen -
I have a problem "error en la llamada"
I have a problem "error en la llamada"
I am having similar problems - cannot export a video made w/ iOS7 on iPhone 5 and imported into iPhoto.latest and it refuses to export the video "cannot prepare video for export..." message.....I have completely re-built the iPhoto database with the latest tools, made a backup copy and am unable to extract this video from the original or the backup copy. The only way I can get videos off my phone is to post them as part of my PhotoStream, which is limited to 5min of video (of which the one I want to post is 7.5min)...can someone at Apple please address this?
-
Problem in Passing JTree object from Servlet pgm to browser
Dear all:
Can anybody help to resolve the problem - pass the JTree obejct from servlet (Tomcat) to IE 6.0. The JTree oject alway shows invalid charcter in IE. Following is my coding.
import java.io.*;
import java.awt.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.swing.*;
import java.net.URL;
import java.sql.*;
import java.lang.*;
import java.util.*;
import javax.swing.tree.*;
//* Testing1 give it null
public class SimpleServer extends HttpServlet
DefaultMutableTreeNode top;
DefaultMutableTreeNode EX01;
DefaultMutableTreeNode EX02;
DefaultMutableTreeNode QB01;
DefaultMutableTreeNode QB02;
DefaultMutableTreeNode N2BS;
DefaultMutableTreeNode N2TS;
//StringTokenizer st2, st1;
String query;
Connection con ;
Statement statm;
ResultSet res, backupRes;
//RowSet res, backupRes;
TreeSet treeset ;
String [] tempArray;
//ServletContext sc ;
ObjectOutputStream out ;
DefaultMutableTreeNode temp_node;
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
resp.setContentType("text/html");
// resp.setContentType("application/octet-stream");
System.out.println("create main node") ;
out = new ObjectOutputStream(resp.getOutputStream());
out.writeObject(this.set_NodeMain()); //no DB access,
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
try
System.out.println("doPost " );
doGet(req,resp);
finally
public DefaultMutableTreeNode set_NodeMain()
top = new DefaultMutableTreeNode("Tandem");
EX01 = new DefaultMutableTreeNode("EX01");
EX02 = new DefaultMutableTreeNode("EX02");
QB01 = new DefaultMutableTreeNode("QB01");
QB02 = new DefaultMutableTreeNode("QB02");
N2BS = new DefaultMutableTreeNode("N2BS");
N2TS = new DefaultMutableTreeNode("N2TS");
top.add(EX01);
top.add(EX02);
top.add(QB01);
top.add(QB02);
top.add(N2BS);
top.add(N2TS);
return top;
}JMO - I hate seeing things like this in code:
Just use whitespace to separate the methods.
You can't just send a JTree to a browser. A browser has no idea how to render a Java object.
Put that JTree inside an applet and make it part of a JSP. That'll work.
MOD -
I using Windows 7, try to restore my mini Ipad to factory settings... never jailbrake or somthing like that, still have the problem error 3194!!! for restore, some one help? Thank you
Try going into the control panel, add/remove programs. Uninstall iTUnes, Apple mobile device service, apple application support. Then redownload and reinstall iTunes and see if it'll work
If the computer sees your iPad you know the cable and connection is good, so the issue has to be software. -
HT201210 pls solve my problem error 3194
pls solve my problem error 3194
Hello,
Check this:
This device is not eligible for the requested build (Also sometimes displayed as an "error 3194")
Update to the latest version of iTunes. Mac OS X 10.5.8 (Leopard) users may need to download iTunes 10.6.3.
Third-party security software or router security settings can also cause this issue. To resolve this, followTroubleshooting security software issues.
Downgrading to a previous version of iOS is not supported. If you have installed software to performunauthorized modifications to your iOS device, that software may have redirected connections to the update server (gs.apple.com) within the Hosts file. Uninstall the unauthorized modification software from the computer.
Edit out the "gs.apple.com" redirect from your hosts file, and then restart the computer for the host file changes to take affect. For steps to edit the Hosts file and allow iTunes to communicate with the update server, see iTunes: Troubleshooting iTunes Store on your computer, iPhone, iPad, or iPod—follow steps under the heading Blocked by configuration (Mac OS X / Windows) > Rebuild network information > The hosts file may also be blocking the iTunes Store. If you do not uninstall the unauthorized modification software prior to editing the hosts file, that software may automatically modify the hosts file again on restart.
Avoid using an older or modified .ipsw file. Try moving the current .ipsw file (see Advanced Steps > Rename, move, or delete the iOS software file (.ipsw) below for file locations), or try restoring in a new user to ensure that iTunes downloads a new .ipsw.
Hope it helps, -
Ich benutze einen Mac mit OS X Yosemtite 10.10.1 und möchte Adobe CC installieren. Es kommt aber folgende Fehlermedldung:
Problem "Error 22" : Die Installation auf Volumen, auf dem die Gross/Kleinschreibung berücksichtigt wird, wird nicht unterstützt. Wählen Sie ein anderes Volumen für die Installation aus.(Fehlercode 22)
An was liegt das?Hallo,
zu diesem Thema hat es einige threads hier im Forum gegeben. Um diese zu finden könntest Du die Such-Funktion des Forums nutzen.
Zwei Links von Adobe führe ich hier an:
http://helpx.adobe.com/x-productkb/global/mac-os-yosemite-compatability.html und ein Erklärungsversuch:
http://helpx.adobe.com/de/x-productkb/global/error-licensing-stopped-mac-os.html >>> Lösung 7: (nur Acrobat 9) Führen Sie eine Neuinstallation auf einem Dateisystem aus, das nicht zwischen Groß- und Kleinschreibung unterscheidet.
Hans-Günter
Maybe you are looking for
-
Hi folks, I hope this is right here, I've got a problem with my firefox since a few days. It is lagging for a while after starting it. It takes a lot of time longer for it to answer pressed keys or other input. After a few minutes after starting it,
-
Multi level Product group reg.
Hi dudes, i am having BOM levels A->B->C , in the A materials group i have 5000 materials ,i want to take all these under a product group. Also in B materials group i have 5000 materials how create multi level product groups taking materials as membe
-
Is there a way to require a password when visiting a page made with iWeb like there was with Homepage?
-
I welcome reports on Audible File usage.
As many may know, bookmarking has been between poor and useless on Shuffles. I returned my Shuffle and picked up a 6GB Mini. Bookmarking works perfectly on my Mini. Nano/Audible Users? Dare I ask?
-
Output Module - Video for Windows - trouble selecting Audio Format
Good day, people. Need help setting up AE to output .AVI with customized audio format, in my case it should be .mp3, but I would accept anything but the default uncompressed audio. (audio Output Format button is disabled when Video for Windows is sel