Tree Applet

hi there
i would like to desgin a tree applet that goes into my web page. When someone clicks on one of the children (a file) i would like that file to open in another frame in my web page. Could anyone help me? I am not the greatest programmer in the world, but am trying my best! Cheers, Rupz

I am usually all for helping poeple through their technical problems on this forum, but I am sorry.... Asking for people to give you the code to solve your problems is just plain lazy.
I told you what classes you needed to use, all you have to do is search around looking for some examples on how to use those classes.
Don't be lazy! Give it try and when what you try just doesn't work, then come back here and see if someone can help you out.
There are a handfull of people that post very regularily on these forums that have great ideas and great tips to help people out. But it is really frustrating when people come on here looking for a full solution to their problem and seem unwilling to even try and come up with a solution on their own.
Sorry to rant.
Bryan

Similar Messages

  • Tree view applet

    hi there
    i would like to desgin a tree applet that goes into my web page. When someone clicks on one of the children (a file) i would like that file to open in another frame in my web page. Could anyone help me? I am not the greatest programmer in the world, and would appreciate some code to get me started, thanks Rupz

    Why not start by looking at some examples of JTree so you can see how it works. It is a fairly complex little component and telling you how to use it is way out of the scrope of a forum question. But there are many examples on the internet as to how to use it.
    Bryan

  • Connect to applet method via JS

    hi,
    i have two frames in my web page. One with my tree applet in it, and the other to display some pdfs. What i want to have is when to user clicks on a pdf button, i want to pass some information back to my applet via javascript. I am using Acrobat writer which allows me to use javascript. The code is use to send the information
    onClick=SimpleTree.Rupz(Introduction.pdf);
    Rupz is a public method in my applet that needs a string
    I embed my applet in the html using
    <APPLET code="SimpleTree.class" name ="SimpleTree" width="150" height="400"></APPLET>
    However when i do this i get the error
    ReferenceError: SimpleTree is not defined
    Could someone please tell me what is goign wrong?
    Thanks
    Rupesh
    [email protected]

    See chapters 25 and 25
    http://java.sun.com/j2se/1.4/docs/guide/plugin/developer_guide/contents.html#contents

  • HELP! tell applet which node it should be displaying

    hello there!
    I have written a tree applet that goes into a left frame of a webpage. If a node of the tree is clicked on, a pdf file will open in the right hand frame. These pdf files are interlinked, and a user can move from one pdf to another by clicking on the pdf. If a user does this, i would like the tree to expand to its appropraite node to let the user know what node they are looking at. Please help, how would i do this?
    Regards Rupesh
    email: [email protected]

    Hello there yonnac2,
    It sounds like you are unable to charge your phone when connecting it to your computer. I would use the troubleshooting for charging issues in the following article named:
    iPhone and iPod touch: Charging the battery
    http://support.apple.com/kb/HT1476
    Inspect the connector at the bottom of the phone:
    Make sure that there are no bent pins in the connector.
    Make sure that the connector is free from debris.
    If there are bent pins or debris, please contact Apple Support.
    Otherwise, continue troubleshooting.
    Make sure that the outlet you're using works.
    Make sure that the Apple USB cable and Apple USB power adapter work.
    Plug the device in to power and let it charge for up to 30 minutes. If you don't have an Apple USB power adapter, try connecting to a computer's high-power USB 2.0 port (not a keyboard). The computer must be on.
    If the device still exhibits an issue, try turning your device off and then on again while connected to power.
    If the issue is persists, please contact Apple Support.
    Thank you for using Apple Support Communities.
    Take care,
    Sterling

  • Applet not loading in netscape

    hi all,
    i have created a jsp page which is displaying three frames. among the three frames one frame is displaying tree applet.i have deployed the application in tomcat server.
    when i invoke the application in IE every thing is working fine but when i am trying to use netscape 8.1 and firefox 2.0 , it doesnot load my applet and ask for " Install missing plugins."
    plz tell where is the problem and how could i solve the problem.
    thanks & regards.

    hi guys,
    i got the solution.
    thanks & regards

  • OER Applet Error - A non-fatal error occurred when fetching an entity id

    Suddenly I have a problem when I want to run 'graphic representation of related items' applet from Oracle Enterprise Repository 11.1.1.2. Thinkmap console shows up wit following message:
    Error: A non-fatal error occurred when fetching an entity id :  : Remote Error: Login required to view information.
    Error: A non-fatal error occurred when loading entities :  : Remote Error: Login required to view information.
    Error: cannot set initial center entity : java.lang.NullPointerException
    I suspect it's some issue with JRE, since everything worked fine few weeks ago. I've also tried to downgrade to JRE 1.5, but I still get the same error. I've tured on debugging and in java console I get this:
    Trace level set to 5: all ... completed.
    basic: Starting applet teardown
    basic: Finished applet teardown
    basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@16aa42e
    basic: Applet loaded.
    basic: Applet resized and added to parent container
    basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 762277 us, pluginInit dt 123357325 us, TotalTime: 124119602 us
    +network: Cache entry not found [url: http://somesrv.domain.si:7101/oer/thinkmap/gui.jsp, version: null]+
    network: Connecting http://somesrv.domain.si:7101/oer/thinkmap/gui.jsp with proxy=DIRECT
    network: Connecting http://somesrv.domain.si:7101/oer/thinkmap/gui.jsp with cookie "flashline.authtoken=-5cfd1072-1298307490b--7ff5; flashline.userlogin=; flashline.username=user1"
    network: Server http://somesrv.domain.si:7101/oer/thinkmap/gui.jsp requesting to set-cookie with "JSESSIONID=tbGzMsGDKnnn5pRnK9B9vT1TMf7PKLljxnpJHjVBcQLpnLLBnlhf!835222537; path=/; HttpOnly"
    basic: Applet initialized
    basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@16aa42e
    basic: Applet made visible
    basic: Starting applet
    basic: completed perf rollup
    network: Connecting http://somesrv.domain.si:7101/oer/thinkmap/my.tas with proxy=DIRECT
    network: Connecting http://somesrv.domain.si:7101/oer/thinkmap/my.tas with cookie "flashline.authtoken=-5cfd1072-1298307490b--7ff5; flashline.userlogin=; flashline.username=user1"
    basic: Applet started
    basic: Told clients applet is started
    network: Connecting http://somesrv.domain.si:7101/oer/thinkmap/my.tas with proxy=DIRECT
    network: Connecting http://somesrv.domain.si:7101/oer/thinkmap/my.tas with cookie "flashline.authtoken=-5cfd1072-1298307490b--7ff5; flashline.userlogin=; flashline.username=user1"
    network: Server http://somesrv.domain.si:7101/oer/thinkmap/my.tas requesting to set-cookie with "JSESSIONID=GVQ8MsGDGTzVGyQTn81n2wQ6hsLJB1p0GBwQD8VhnJJKhr3glNdt!835222537; path=/; HttpOnly"
    network: Connecting http://somesrv.domain.si:7101/oer/thinkmap/my.tas with proxy=DIRECT
    network: Connecting http://somesrv.domain.si:7101/oer/thinkmap/my.tas with cookie "flashline.authtoken=-5cfd1072-1298307490b--7ff5; flashline.userlogin=; flashline.username=user1"
    network: Server http://somesrv.domain.si:7101/oer/thinkmap/my.tas requesting to set-cookie with "JSESSIONID=LdmyMsGDmRt4CQlw6KKxprRVF0KGMXxjpr38h2dRnYGnTNp2jx5J!835222537; path=/; HttpOnly"
    Browse tree doesn't work either..message in Java console is:
    +network: Cache entry not found [url: http://somesrv.domain.si:7101/oer/com.flashline.cmee.servlet.enterprisetab.AssetTree?depth=2&top=true&cattypeid=100&registrationstatus=100&target=results, version: null]+
    network: Connecting http://somesrv.domain.si:7101/oer/com.flashline.cmee.servlet.enterprisetab.AssetTree?depth=2&top=true&cattypeid=100&registrationstatus=100&target=results with proxy=DIRECT
    network: Connecting http://somesrv.domain.si:7101/oer/com.flashline.cmee.servlet.enterprisetab.AssetTree?depth=2&top=true&cattypeid=100&registrationstatus=100&target=results with cookie "flashline.authtoken=-5cfd1072-1298307490b--7ff5; flashline.userlogin=; flashline.username=user1"
    network: Server http://somesrv.domain.si:7101/oer/com.flashline.cmee.servlet.enterprisetab.AssetTree?depth=2&top=true&cattypeid=100&registrationstatus=100&target=results requesting to set-cookie with "JSESSIONID=HxQCMsKTpGpv3Wrr2vhqHWK06pDR4tpk6QjC1BWJyYSsP7TwLvlJ!835222537; path=/; HttpOnly"
    Anybody has an idea what is wrong and how to resolve this problem.
    Thnx in advance.
    Edited by: Teki on 7.7.2010 10:19

    I figured out what is causing this problem: When connecting OER with LDAP according to documentation (http://download.oracle.com/docs/cd/E15523_01/doc.1111/e16580/extauth.htm#CEGHHGAG ) you have to disable cookie login functionality. Now i figured that 'graphic representation of related items' and 'browse tree' applets are not working if there is no cookie for user. So in order for those two applets to work I have to enable enterprise.security.cookielogin.allow and enterprise.authentication.ldap.enabled (or manually check the Enable automatic Login box).
    Is there any other setting or workaround that would ensure that mentioned applets would work properly without enable automatic login option checked?! And what is the problem if I do have LDAP authentication and cookie login enabled (why is explicitly stated in documentation that I should disable cookie login with LDAP authentication?) Can someone from Oracle clarify this please?
    Edited by: Teki on 7.7.2010 11:43

  • Swing tree updates

    Hi,
    I wrote a swing tree applet that gets notified by a server when to add new nodes to the tree and who the new node's parent is. I can find the parent node and insert the new node into the tree fine. The problem is when my program first starts I receive all the new nodes sequentially about two seconds apart. The tree looks all wacky as the nodes are being added. I'm not sure of the proper method of updating the tree so the new node just appears in the proper location and the tree expands properly. I've tried many different techniques but none produce the desired results. Can someone advise on the correct technique to use to update the tree UI when a new node is inserted in the tree? Also, do you know a web site that contains a swing tree that I can view using my browser. I am having a problem viewing my tree on Solaris using Netscape 6.0 and I'd like to confirm if it is Netscape 6 or not since the tree works as usual using Netscape 4.7.
    Many thanks.

    This example should solve your problem:
         DefaultMutableTreeNode dmtn = _getActionsNode(); // returns a DefaultMutableTreeNode
         DefaultTreeModel dtm = new DefaultTreeModel(dmtn);
         getActionsTree().setModel(dtm); // this is the JTree
    Hope this helps.

  • DEVELOPMENT TEAM: OAS App-cartdrige doesn't start!!

    Please Developement Team..
    in my configuration(NT SP4,DEV 6 prod.+ Jinitiator 11711,OAS
    4.7.00+ 4.0.7.1.0 patch,Oracle 8.1.5) the static_jinit html work
    fine troght OAS listener.
    But trought html cartridge it doesn't run..
    the message is "Can not service this request, please try again
    later.."
    inside wrb.log i see:
    sagittarius `Broker` 550 1 0x10fff
    `OWS-04759: No host is available to create Cartridge
    test/web_cart. `
    sagittarius `Dispatcher` 445 1
    0x2fff `OWS-04517: Error indicated by broker in getting
    cartridges of type test/web_cart. `
    sagittarius `Dispatcher` 445 1
    0x2fff `OWS-04511: Error in grabbing cartridge type
    test/web_cart from the subsystem. `
    sagittarius `Dispatcher` 445 1
    0x2fff `OWS-04512: Request
    7CEDE6D1D702-C13F-E000-26122BC101BD has internal error due to
    Error 4511. `
    sagittarius `Broker` 550 1 0x10fff
    `OWS-04759: No host is available to create Cartridge
    test/web_cart. `
    sagittarius `Dispatcher` 445 1
    0x2fff `OWS-04517: Error indicated by broker in getting
    cartridges of type test/web_cart. `
    sagittarius `Dispatcher` 445 1
    0x2fff `OWS-04511: Error in grabbing cartridge type
    test/web_cart from the subsystem. `
    sagittarius `Dispatcher` 445 1
    0x2fff `OWS-04512: Request
    7DEDE6D1D702-C13F-E000-26122BC101BD has internal error due to
    Error 4511. `
    ... it seems the catridge doesn't up..WHY??
    On my OAS tree applet ALL application server and http listener
    are green flags, only application tree are all red flags.
    I don't know what to do..
    thanks
    null

    Hi,
    Refer the thread started by you at http://forum.java.sun.com/thread.jsp?forum=17&thread=501024&start=0&range=15#2375485
    There are no duke dollars assigned to your post there ,hence once again a reply to your post.
    -Amol

  • Forms-cartridge doesn't start!!...

    this is my problem...
    in my configuration(NT SP4,DEV 6 prod.+ Jinitiator 11711,OAS
    4.7.00+ 4.0.7.1.0 patch,Oracle 8.1.5) the static_jinit html work
    fine troght OAS listener.
    But trought html cartridge it doesn't run..
    the message is "Can not service this request, please try again
    later.."
    inside wrb.log i see:
    sagittarius `Broker` 550 1 0x10fff
    `OWS-04759: No host is available to create Cartridge
    test/web_cart. `
    sagittarius `Dispatcher` 445 1
    0x2fff `OWS-04517: Error indicated by broker in getting
    cartridges of type test/web_cart. `
    sagittarius `Dispatcher` 445 1
    0x2fff `OWS-04511: Error in grabbing cartridge type
    test/web_cart from the subsystem. `
    sagittarius `Dispatcher` 445 1
    0x2fff `OWS-04512: Request
    7CEDE6D1D702-C13F-E000-26122BC101BD has internal error due to
    Error 4511. `
    sagittarius `Broker` 550 1 0x10fff
    `OWS-04759: No host is available to create Cartridge
    test/web_cart. `
    sagittarius `Dispatcher` 445 1
    0x2fff `OWS-04517: Error indicated by broker in getting
    cartridges of type test/web_cart. `
    sagittarius `Dispatcher` 445 1
    0x2fff `OWS-04511: Error in grabbing cartridge type
    test/web_cart from the subsystem. `
    sagittarius `Dispatcher` 445 1
    0x2fff `OWS-04512: Request
    7DEDE6D1D702-C13F-E000-26122BC101BD has internal error due to
    Error 4511. `
    ... it seems the catridge doesn't up..WHY??
    On my OAS tree applet ALL application server and http listener
    are green flags, only application tree are all red flags.
    I don't know what to do..CAN anyone help me??
    thanks
    null

    In our case, we had to install OAS 4.0.7.x and developer server 6.0 in the SAME oracle home.
    With D2K server 2.1, you had to install in SEPARATE oracle home (even tough the manual did not say so) in order to be able to relink the executables. In 6.0, we said to ourselves (even tough the manual said to install in same OH) that we better not follow the manual and do like 2.1: WRONG
    In 6.0 you NEED to install in same OH
    null

  • Canvas Update Problem

    Apologies in advance if this is a really obvious error on my part.
    I have a tree applet with a scrollpane, I populate the scrollpane with my canvas.
    I am trying to dynamically show changes to the tree based on user interaction (i.e. add/remove folders).
    What I am doing is creating new instance of the canvas and re-adding it to the scrollpane, every time there is a change however the changes aren't being drawn out?
    Any help on this matter would gratefully received.
    Regards
    Les,

    Les,
    I do not think it is good idea to remove/add the Canvas. Since Canvas look provided with paint(Graphics) implementation it is much better to keep using the same instance of Canvas but make the changes paint(Graphics) implementation. However if you want to go with remove/add please call doLayout() and valdiate() against container you added your Canvas.

  • Scrolling issues in appelt with java 1.6

    Hi Everybody,
    I have an applet client. Home page of client contains one html frame set which contains two frames.
    Where each frames conations one applet.
    One frame (on left side of page) contains one applet which is a tree applet.
    This tree applet uses AWT panel as container and contain tree structure of network device(nodes).
    Tree applet contains thousands of nodes so it has a scroll bar.
    I think scroll bar is not of applet panel .it is of the html frame that contains applet.
    When clicked on any node in tree applet it shows report for that node in other applet (on right side of page)
    When I go to left applet and come back to right tree applet scroll bar for tree applet disappear and position of nodes also get changed.
    This applet works fine with client JRE 1.5
    Problem comes for JRE 1.6
    Can any one help me to work this out.
    Regards,
    Abhijit.
    Edited by: Abhijit_Khatal on Jul 15, 2009 10:46 PM

    Same problem here Safari 5.0.6 , Intel Mac 10.5.8, Java 1.6
    Can't get java working in all browsers!
    Any help is welcome

  • Is there a way of doing this without using an inner class

    hi, i have developed a tree applet but it takes ages to load on my machine. I was wondering if i could get rid of the inner class that is created when "valuechanged" is called (line 28). I am posting my whole code, i hope someone can help. Cheers Rups
    [email protected]
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.event.TreeSelectionEvent;
    import java.net.*;
    import java.applet.AppletContext;
    import java.util.Enumeration;
    public class SimpleTree extends JApplet  {
    JTree tree = new JTree();
      public void init() {
       new SimpleTree();
      public SimpleTree() {
      //  WindowUtilities.setNativeLookAndFeel();
        Container content = getContentPane();
        Object[] hierarchy =
          { "Some Useful Web Links ",
            new Object[] { "Microsft","http://www.microsfot.com"},
            new Object[]{"Yahoo", "http://www.yahoo.com"}
        DefaultMutableTreeNode root = processHierarchy(hierarchy);
        final JTree tree = new JTree(root);
        tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
        tree.addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode)
        tree.getLastSelectedPathComponent();
        String hoopla = tree.getLastSelectedPathComponent().toString();
        if (node == null) return;
        if (node.isLeaf()) {
           try {
               getAppletContext().showDocument(new URL("file://c:/webstuff/"+hoopla),
    "viewer1");
             }catch(Exception f) {
                System.out.println("" + f);           
        content.add(new JScrollPane(tree), BorderLayout.CENTER);
        setVisible(true);
      public DefaultMutableTreeNode processHierarchy(Object[] hierarchy) {
        DefaultMutableTreeNode node =
          new DefaultMutableTreeNode(hierarchy[0]);
        DefaultMutableTreeNode child;
        for(int i=1; i<hierarchy.length; i++) {
          Object nodeSpecifier = hierarchy;
    if (nodeSpecifier instanceof Object[]) // Ie node with children
    child = processHierarchy((Object[])nodeSpecifier);
    else
    child = new DefaultMutableTreeNode(nodeSpecifier); // Ie Leaf
    node.add(child);
    return(node);
    public static void main(String [] args) {
    JFrame f = new JFrame("") ;
    Container contentPane = f.getContentPane();
    contentPane.setLayout(new FlowLayout());
    SimpleTree ta = new SimpleTree() ;
    ta.init() ;
    f.addWindowListener(new ExitListener());
    f.setSize(250,500);
    contentPane.add(ta,BorderLayout.CENTER);
    f.setVisible(true) ;

    import java.awt.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.event.TreeSelectionEvent;
    import java.net.*;
    import java.applet.AppletContext;
    import java.util.Enumeration;
    public class SimpleTree extends JApplet implements TreeSelectionListener  {
          JTree tree = new JTree();
          public void init() {
          new SimpleTree();
          public SimpleTree() {
    //  WindowUtilities.setNativeLookAndFeel();
          Container content = getContentPane();
          Object[] hierarchy =
          { "Some Useful Web Links ",
            new Object[] { "Microsft","http://www.microsfot.com"},
            new Object[]{"Yahoo", "http://www.yahoo.com"}
          DefaultMutableTreeNode root = processHierarchy(hierarchy);
          final JTree tree = new JTree(root);
          tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
          tree.addTreeSelectionListener( this );
            tree.addTreeSelectionListener(new TreeSelectionListener() {
            public void valueChanged(TreeSelectionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode)
            tree.getLastSelectedPathComponent();
            String hoopla = tree.getLastSelectedPathComponent().toString();
            if (node == null) return;
            if (node.isLeaf()) {
            try {
            getAppletContext().showDocument(new URL("file://c:/webstuff/"+hoopla),
            "viewer1");
            }catch(Exception f) {
            System.out.println("" + f);           
          content.add(new JScrollPane(tree), BorderLayout.CENTER);
          setVisible(true);
          public void valueChanged(TreeSelectionEvent e) {
          DefaultMutableTreeNode node = (DefaultMutableTreeNode)
             tree.getLastSelectedPathComponent();
          String hoopla = tree.getLastSelectedPathComponent().toString();
          if (node == null) return;
          if (node.isLeaf()) {
             try {
                getAppletContext().showDocument(new URL("file://c:/webstuff/"+hoopla),
                                    "viewer1");
             }catch(Exception f) {
                System.out.println("" + f);           
          public DefaultMutableTreeNode processHierarchy(Object[] hierarchy) {
          DefaultMutableTreeNode node =
             new DefaultMutableTreeNode(hierarchy[0]);
          DefaultMutableTreeNode child;
          for(int i=1; i<hierarchy.length; i++) {
             Object nodeSpecifier = hierarchy[ i ];
             if (nodeSpecifier instanceof Object[])  // Ie node with children
                child = processHierarchy((Object[])nodeSpecifier);
             else
                child = new DefaultMutableTreeNode(nodeSpecifier); // Ie Leaf
             node.add(child);
          return(node);
          public static void main(String [] args) {
          JFrame f = new JFrame("") ;
          Container contentPane = f.getContentPane();
          contentPane.setLayout(new FlowLayout());
          SimpleTree ta = new SimpleTree() ;
          ta.init() ;
    //      f.addWindowListener(new ExitListener());
          f.setSize(250,500);
          contentPane.add(ta,BorderLayout.CENTER);
          f.setVisible(true) ;
    }

  • XML : Transform DOM Tree to XML String in an applet since the JRE 1.4.2_05

    Hello,
    I build a DOM tree in my applet.
    Then I transform it to XML String.
    But since the JRE 1.4.2_05 it doesn't work.
    These lines failed because these variables became final:
    org.apache.xalan.serialize.CharInfo.XML_ENTITIES_RESOURCE = getClass().getResource("XMLEntities.res").toString();
    org.apache.xalan.processor.TransformerFactoryImpl.XSLT_PROPERTIES = getClass().getResource("XSLTInfo.properties").toString();The rest of the code :
    DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = domFactory.newDocumentBuilder();
    Document domXML = builder.newDocument();
    // I build my DOM Tree
    StringWriter xmlResult = new StringWriter();
    Source source = new DOMSource(domXML);
    Result result = new StreamResult(xmlResult);
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.setOutputProperty(javax.xml.transform.OutputKeys.INDENT,"yes");
    xformer.transform(source,result);Is there any other way to get an XML String from a DOM tree in an applet ?
    I'm so disappointed to note this big problem.

    Does anyone have an idea why I get this error message when try to use transform in an applet?
    Thanks...
    java.lang.ExceptionInInitializerError
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at org.apache.xalan.serialize.SerializerFactory.getSerializer(Unknown Source)
         at org.apache.xalan.transformer.TransformerIdentityImpl.createResultContentHandler(Unknown Source)
         at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Unknown Source)
         at matrix.CreateMtrx.SaveDoc(CreateMtrx.java:434)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at thinlet.Thinlet.invokeImpl(Unknown Source)
         at thinlet.Thinlet.invoke(Unknown Source)
         at thinlet.Thinlet.handleMouseEvent(Unknown Source)
         at thinlet.Thinlet.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.RuntimeException: The resource [ XMLEntities.res ] could not load: java.net.MalformedURLException: no protocol: XMLEntities.res
    XMLEntities.res      java.net.MalformedURLException: no protocol: XMLEntities.res
         at org.apache.xalan.serialize.CharInfo.<init>(Unknown Source)
         at org.apache.xalan.serialize.SerializerToXML.<clinit>(Unknown Source)
         ... 28 more

  • Display tree in applet

    i have a program to convert Xml to tree structure. But i am not able to call it in JSP. So i want to convert to applet. how to convert it.
    package TreeGen;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import java.io.File;
    import java.io.IOException;
    import org.w3c.dom.Document;
    import org.w3c.dom.DOMException;
    import org.w3c.dom.Element;
    // Basic GUI components
    import javax.swing.JApplet;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    // GUI components for right-hand side
    import javax.swing.JSplitPane;
    import javax.swing.JEditorPane;
    // GUI support classes
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.event.KeyEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.WindowAdapter;
    // For creating borders
    import javax.swing.border.EmptyBorder;
    import javax.swing.border.BevelBorder;
    import javax.swing.border.CompoundBorder;
    // For creating a TreeModel
    import javax.swing.tree.*;
    import javax.swing.event.*;
    import java.util.*;
    import java.applet.*;
    public class TreeGen extends JPanel
         static Document document;
         boolean compress = false;
         static final int windowHeight = 660;
         static final int leftWidth = 300;
         static final int rightWidth = 640;
         static final int windowWidth = leftWidth + rightWidth;
         public TreeGen()
         EmptyBorder eb = new EmptyBorder(5,5,5,5);
         BevelBorder bb = new BevelBorder(BevelBorder.LOWERED);
         CompoundBorder cb = new CompoundBorder(eb,bb);
         this.setBorder(new CompoundBorder(cb,eb));
         JTree tree = new JTree(new DomToTreeModelAdapter());
         JScrollPane treeView = new JScrollPane(tree);
         treeView.setPreferredSize(
              new Dimension( leftWidth, windowHeight ));
         final
         JEditorPane htmlPane = new JEditorPane("text/html","");
         htmlPane.setEditable(true);
         JScrollPane htmlView = new JScrollPane(htmlPane);
         htmlView.setPreferredSize(
              new Dimension( rightWidth, windowHeight ));
         tree.addTreeSelectionListener(
              new TreeSelectionListener()
              public void valueChanged(TreeSelectionEvent e)
                   TreePath p = e.getNewLeadSelectionPath();
                   if (p != null)
                   AdapterNode adpNode =
                        (AdapterNode) p.getLastPathComponent();
                   htmlPane.setText(adpNode.content());
         JSplitPane splitPane =
              new JSplitPane( JSplitPane.HORIZONTAL_SPLIT,
                                  treeView,
                                  htmlView );
         splitPane.setContinuousLayout( false );
         splitPane.setDividerLocation( leftWidth );
         splitPane.setDividerSize(1);
         splitPane.setPreferredSize(
                   new Dimension( windowWidth + 10, windowHeight+10 ));
         this.setLayout(new BorderLayout());
         this.add("Center", splitPane );
         //return menuBar;
         } // constructor
         public static void main(String argv[])
              DocumentBuilderFactory factory =
                   DocumentBuilderFactory.newInstance();
              try {
              DocumentBuilder builder = factory.newDocumentBuilder();
              document = builder.parse("C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/parser1/sample.xml");
                   makeFrame();
              } catch (SAXException sxe){
                   System.out.println("ERROR");
              Exception x = sxe;
              if (sxe.getException() != null)
                   x = sxe.getException();
              x.printStackTrace();
              } catch (ParserConfigurationException pce) {
                   pce.printStackTrace();
              } catch (IOException ioe) {
              ioe.printStackTrace();
         } // main
         public static void makeFrame()
              //JApplet app = new JApplet();
              //app.add
              JFrame frame = new JFrame("DOM Echo");
              frame.addWindowListener(
              new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {System.exit(0);}
              final TreeGen echoPanel =
              new TreeGen();
              frame.getContentPane().add("Center", echoPanel );
              frame.pack();
              Dimension screenSize =
              Toolkit.getDefaultToolkit().getScreenSize();
              int w = windowWidth + 10;
              int h = windowHeight + 10;
              //TreeGen tg = new TreeGen();
              //MenuDemo demo = new MenuDemo();
              //frame.setJMenuBar(demo.createMenuBar());
              //frame.setContentPane(demo.createContentPane());
              //Display the window.
              frame.setSize(w, h);
              frame.setVisible(true);
         } // makeFrame
         static final String[] typeName = {
              "none",
              "Element",
              "Attr",
              "Text",
              "CDATA",
              "EntityRef",
              "Entity",
              "ProcInstr",
              "Comment",
              "Document",
              "DocType",
              "DocFragment",
              "Notation",
         static final int ELEMENT_TYPE = 1;
         static final int ATTR_TYPE = 2;
         static final int TEXT_TYPE = 3;
         static final int CDATA_TYPE = 4;
         static final int ENTITYREF_TYPE = 5;
         static final int ENTITY_TYPE = 6;
         static final int PROCINSTR_TYPE = 7;
         static final int COMMENT_TYPE = 8;
         static final int DOCUMENT_TYPE = 9;
         static final int DOCTYPE_TYPE = 10;
         static final int DOCFRAG_TYPE = 11;
         static final int NOTATION_TYPE = 12;
    static String[] treeElementNames = {
              "slideshow",
              "slide",
              "title", // For slideshow #1
              "slide-title", // For slideshow #10
              "item",
         boolean treeElement(String elementName) {
         for (int i=0; i<treeElementNames.length; i++) {
              //System.out.println(treeElementNames);
              if ( elementName.equals(treeElementNames[i]) )
              return true;
         return false;
         public class AdapterNode
         org.w3c.dom.Node domNode;
         public AdapterNode(org.w3c.dom.Node node)
              domNode = node;
         public String toString()
              String s = typeName[domNode.getNodeType()];
              String nodeName = domNode.getNodeName();
              if (! nodeName.startsWith("#"))
              s += ": " + nodeName;
              if (compress)
              String t = content().trim();
              int x = t.indexOf("\n");
              if (x >= 0) t = t.substring(0, x);
              s += " " + t;
              return s;
              if (domNode.getNodeValue() != null)
              if (s.startsWith("ProcInstr"))
                   s += ", ";
              else
                   s += ": ";
              // Trim the value to get rid of NL's at the front
              String t = domNode.getNodeValue().trim();
              int x = t.indexOf("\n");
              if (x >= 0) t = t.substring(0, x);
              s += t;
              return s;
         public String content()
              String s = "";
              org.w3c.dom.NodeList nodeList = domNode.getChildNodes();
              for (int i=0; i<nodeList.getLength(); i++)
              org.w3c.dom.Node node = nodeList.item(i);
              int type = node.getNodeType();
              //System.out.println(type);
              AdapterNode adpNode = new AdapterNode(node); //inefficient, but works
              if (type == ELEMENT_TYPE)
                   if ( treeElement(node.getNodeName()) ) continue;
                   s += "<" + node.getNodeName() + ">";
                   s += adpNode.content();
                   s += "</" + node.getNodeName() + ">";
              else if (type == TEXT_TYPE)
                   s += node.getNodeValue();
              else if (type == ENTITYREF_TYPE)
                   s += adpNode.content();
              else if (type == CDATA_TYPE)
                   StringBuffer sb = new StringBuffer( node.getNodeValue() );
                   for (int j=0; j<sb.length(); j++)
                   if (sb.charAt(j) == '<')
                        sb.setCharAt(j, '&');
                        sb.insert(j+1, "lt;");
                        j += 3;
                   else if (sb.charAt(j) == '&')
                        sb.setCharAt(j, '&');
                        sb.insert(j+1, "amp;");
                        j += 4;
                   s += "<pre>" + sb + "\n</pre>";
              return s;
         public int index(AdapterNode child)
              int count = childCount();
              for (int i=0; i<count; i++)
              AdapterNode n = this.child(i);
              if (child.domNode == n.domNode) return i;
              return -1; // Should never get here.
         public AdapterNode child(int searchIndex)
              org.w3c.dom.Node node =
                   domNode.getChildNodes().item(searchIndex);
              if (compress)
              int elementNodeIndex = 0;
              for (int i=0; i<domNode.getChildNodes().getLength(); i++)
                   node = domNode.getChildNodes().item(i);
                   if (node.getNodeType() == ELEMENT_TYPE
                   && treeElement( node.getNodeName() )
                   && elementNodeIndex++ == searchIndex)
                   break;
              return new AdapterNode(node);
         public int childCount()
              if (!compress)
              return domNode.getChildNodes().getLength();
              int count = 0;
              for (int i=0; i<domNode.getChildNodes().getLength(); i++)
              org.w3c.dom.Node node = domNode.getChildNodes().item(i);
              if (node.getNodeType() == ELEMENT_TYPE
              && treeElement( node.getNodeName() ))
                   ++count;
              return count;
         public class DomToTreeModelAdapter
         implements javax.swing.tree.TreeModel
         public Object getRoot()
              return new AdapterNode(document);
         public boolean isLeaf(Object aNode)
              AdapterNode node = (AdapterNode) aNode;
              if (node.childCount() > 0) return false;
              return true;
         public int getChildCount(Object parent)
              AdapterNode node = (AdapterNode) parent;
              return node.childCount();
         public Object getChild(Object parent, int index)
              AdapterNode node = (AdapterNode) parent;
              return node.child(index);
         public int getIndexOfChild(Object parent, Object child)
              AdapterNode node = (AdapterNode) parent;
              return node.index((AdapterNode) child);
         public void valueForPathChanged(TreePath path, Object newValue)
         private Vector listenerList = new Vector();
         public void addTreeModelListener(TreeModelListener listener)
              if ( listener != null
              && ! listenerList.contains( listener ) )
              listenerList.addElement( listener );
         public void removeTreeModelListener(TreeModelListener listener)
              if ( listener != null )
              listenerList.removeElement( listener );
         public void fireTreeNodesChanged( TreeModelEvent e )
              Enumeration listeners = listenerList.elements();
              while ( listeners.hasMoreElements() )
              TreeModelListener listener =
                   (TreeModelListener) listeners.nextElement();
              listener.treeNodesChanged( e );
         public void fireTreeNodesInserted( TreeModelEvent e )
              Enumeration listeners = listenerList.elements();
              while ( listeners.hasMoreElements() )
              TreeModelListener listener =
                   (TreeModelListener) listeners.nextElement();
              listener.treeNodesInserted( e );
         public void fireTreeNodesRemoved( TreeModelEvent e )
              Enumeration listeners = listenerList.elements();
              while ( listeners.hasMoreElements() )
              TreeModelListener listener =
                   (TreeModelListener) listeners.nextElement();
              listener.treeNodesRemoved( e );
         public void fireTreeStructureChanged( TreeModelEvent e )
              Enumeration listeners = listenerList.elements();
              while ( listeners.hasMoreElements() )
              TreeModelListener listener =
                   (TreeModelListener) listeners.nextElement();
              listener.treeStructureChanged( e );
    pls help.
    ramya

    There's already some applet code in there, although it's commented out. Did you add that?
    Anyway, the general principle for turning an app into an applet, is to replace the main() method with the Applet's (or JApplet's) init(), start(), and stop() methods. Also you won't be able to read data off the file system; use resources instead. (e.g., java.lang.Class.getResource)
    I'm not sure what this has to do with JSP.
    When you post code, please wrap it in &#91;code]&#91;/code] tags.

  • Tree in java applet

    Please help
    i want to create a tree (the leaves label come from database ) in java applet... how can i start ?

    This is for a school assignment isn't it?
    The tutorial has how to read from a database, and about trees in it. There are even ready make classes for tree structures. So crack your book and give it a read, click on the tutorial link, and open the API... if it's not worth it to you, then why should it be to us?

Maybe you are looking for

  • Dunning letter problem

    I need to show in the Dunning letter the assigned standard bank for incoming payment of the business patner. How to do ? Giuseppe

  • IPod Shuffle 4th-Gen NOT recognized by iTunes

    I have this Shuffle that won't be recognized by iTunes and it has no music in it. When I connect it to my iMac it only shows up as a flash drive with a lonely file called "iPod Control." I tried deleting this file just to see what would happen but it

  • Why won't my MacBook Pro connect to my wifi?

    I have a MacBook Pro running OS X 10.8.5.  My ISP is BT Vision so have a open reach fibre modem and a BT HomeHub. All my other wifi devices (iPhone 4S, 5S and Ipad 3) connect to my home network and internet first time every time! However, my MacBook

  • How to find out if a transportation/accomodation request has been changed?

    Hello all, I need to know if one transportation/accomodation request has been changed after being created. I am using the TRIP standard transaction to plan the travel request without any external agency integration. My problem is that if I change any

  • SRM MDM CATALOG

    Hello I am implementing SRM 5.0 with SRM MDM catalog and I have some doubts. How can I create catalogs and publish it for users in SRM? The catalogs are created in SRM accessing MDM catlog or only in MDM. ? Thanks Nilson