Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

invokeLater with JTreeTable == event-dispatch thread?

Thread view: 
soup_or_power@yahoo.com - 23 Nov 2005 13:17 GMT
Hi
The following invokeLater doesn't print the path info in a JTreeTable.
However,  if I use Thread.sleep it is able to expand the paths. Please
note that the JTreeTable is created in the main thread. Can someone
please enlighten me about event-dispatcher thread. Thank you

javax.swing.SwingUtilities.invokeLater(new Runnable()

               {

                       public void run() {

                                   Vector pathList = ttsDefaults.getPathList();

                                    int startRow=0;

                                    String prefix="";

                                    TreePath path=null;

                                    for (Enumeration e = pathList.elements();
e.hasMoreElements();) {

                                        startRow = 0;

                                        prefix = (String) e.nextElement();

                                        System.out.println("prefix=***********************" +
prefix);

                                        path = treeTable.getTree().getNextMatch(prefix.trim(),
startRow, javax.swing.text.Position.Bias.Forward);

                                        if (path != null) {

                                            System.out.println("path = ********************" +
path.toString());

                                        }

                                        if (path != null ) {

                                            treeTable.getTree().expandPath(path);

                                        }

                                    }

                            } //run

               }); //invoke
zero - 23 Nov 2005 16:48 GMT
> Hi
> The following invokeLater doesn't print the path info in a JTreeTable.
> However,  if I use Thread.sleep it is able to expand the paths. Please
> note that the JTreeTable is created in the main thread. Can someone
> please enlighten me about event-dispatcher thread. Thank you

<ugly layout code snipped>

When you post code please make it readable by changing the tabs into 1 to 3
spaces (depending on how long the lines are).  What you posted is just too
hard to read.

Also, for swing specific questions I suggest comp.lang.java.gui or sun's
own forum at http://forums.java.sun.com/index.jspa


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.