Drawing a tree

I need to actually "draw" out a tree. By draw I mean display it in a certain way according to an array. I basically have the tree structure the way I want it except for one thing. Right now my tree outputs like this:
+-Root
  +-SubB
    +-LEAF1
    +-LEAF2
  +-LEAF3
  +-SubA
    +-LEAF4
    +-LEAF5You can tell who's children belong to who. I however need to add vertical bars to connect pluses that aren't right under each other. My output SHOULD look like this:
+-Root
  +-SubB
  | +-LEAF1
  | +-LEAF2
  +-LEAF3
  +-SubA
    +-LEAF4
    +-LEAF5I'm not too sure how to go about adding in these vertical bars though. I imagine I should probably do it while I'm building the tree but I think it may be easier to just put them in the right place once I have what I already have.
Edited by: JFactor2004 on Nov 2, 2007 3:38 PM

Hey all, thanks for the insight. I had a burst of inspiration of my own while I was taking a break and came up with a solution. Its a little bit gross and basically does it in three steps but it works. Did I mention its gross...
import java.util.*;
import java.util.Map.Entry;
public class DrawTree
     public static class Node
          String name="";
          int myIndex;
          int nextIndex;
          int myLevel;
          ArrayList<Node> nexts = new ArrayList<Node>();
          public String toString()
               return name;
     ArrayList<Node> all = new ArrayList<Node>();
     ArrayList<Node> list = new ArrayList<Node>();
     public void linker(Node n)
          Iterator<Node> it = all.iterator();
          while(it.hasNext())
               Node temp = it.next();
               if(temp.nextIndex == n.myIndex)
                    all.get(all.indexOf(n)).nexts.add(all.get(all.indexOf(temp)));
                    linker(temp);
     public void adder(Node n,int level)
          if(n!=null)
               n.myLevel = level;
               list.add(n);
               Iterator<Node> it = n.nexts.iterator();
               while(it.hasNext())
                    Node temp = it.next();
                    adder(temp,level+1);
     public int correctIndex(Node n)
          String name = n.name;
          int i=0;
          while(i<name.length() && (name.charAt(i)==' '||name.charAt(i)=='|'))
               i++;
          return i;
     public boolean moreOnBranch(int index)
          for(int i=index+1;i<list.size();i++)
               if(list.get(i).myLevel==list.get(index).myLevel)
                    return true;
               if(list.get(i).myLevel<list.get(index).myLevel)
                    return false;
          return false;
     public void format(int index)
          int i = index+1;
          int place = correctIndex(list.get(index));
          String build = list.get(index).name.substring(0,place);
          String theRest = list.get(index).name.substring(place);
          build+="+-"+theRest;
          list.get(index).name=build;
          while(i<list.size() && list.get(i).myLevel>list.get(index).myLevel)
               if(moreOnBranch(index))
                    int spot = correctIndex(list.get(i));
                    String builder = list.get(i).name.substring(0,place);
                    String other = list.get(i).name.substring(place);
                    builder+="| "+other;
                    list.get(i).name=builder;
               else
                    int spot = correctIndex(list.get(i));
                    String builder = list.get(i).name.substring(0,place);
                    String other = list.get(i).name.substring(place);
                    builder+="  "+other;
                    list.get(i).name=builder;
               i++;
     public String[] draw(int[] parents, String[] names)
          //turn each pair into a Node and add it to a list of nodes
          Node root = null;
          for(int i=0;i<parents.length;i++)
               Node n = new Node();
               n.name = names;
               n.nextIndex = parents[i];
               n.myIndex = i;
               if(n.nextIndex == -1)
                    root = n;
               all.add(n);
          //find root, recurse through adding nexts
          linker(root);
          //preorder addition to list
          adder(root,0);;
          //put them in the right format
          for(int i=0;i<list.size();i++)
               format(i);
          String thingToReturn[] = new String[list.size()];
          for(int i=0;i<list.size();i++)
               thingToReturn[i]=list.get(i).name;
          return thingToReturn;

Similar Messages

  • Looking for tree drawing API

    Hello
    I made a k-children tree algorithm in Java. Now I'm looking for a ready-made API/classes for drawing the tree.
    Anyone knows any good tree drawing APIs?
    I searched google for hours and couldn't find anything.
    Thank you

    Here are some links that you may find usefull:
    An interactive canvas component where you can paint any shapes:
    https://jcanvas.dev.java.net/
    A graph library:
    http://jung.sourceforge.net/
    Another graph library:
    http://graph.netbeans.org/

  • Tutorial for drawing tree branch

    I am tracing a tree. I was wondering if anyone has seen any tutorials on how to draw vector trees and branches?
    Please help! Thank you!

    Just for the fun of it/ I started one myself. When I was in kindergarden I use to love to do this drawing and then add the leaves. One by one and my teacher thought that was very Japanese like and then showed me how to create the idea of volume by using variation in the colors to make shadows.
    She showed me a lot even though she wasn't an artist herself she loved art and was a wonderfully inspiring person.
    At any rate it takes tie i would say about an hour to draw the whole tree maybe two.
    If you need more branches you can easily add the them by using the scissor tool and then add the branch with the pen tool.
    I hink drawing by hand is the best and i would not try in this case to trace anything, a little patience with yourself and it will be a unique piece.
    I think I will finish this just for the fun of it and keep it around.

  • Double Click in ALV TREE doesn't get triggered

    Hello All,
    Double click event on item in a alv tree report doesn't get triggered. I thought I was doing everything right. Please help me out.
    Look at the code below and tell me what else I need to do.
    <b>FORM register_events .
    Event registration: tell ALV Tree which events shall be passed
    from frontend to backend.
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event,
            l_event_receiver TYPE REF TO lcl_tree_event_receiver.
    Frontend registration:  get already registered tree events
      CALL METHOD g_alv_tree->get_registered_events
        IMPORTING
          events = lt_events.
    Frontend registration: add additional event ids
      l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
      APPEND l_event TO lt_events.
    Frontend registration: provide new event table to alv tree
      CALL METHOD g_alv_tree->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    Register events on backend (ABAP Objects event handling)
      CREATE OBJECT l_event_receiver.
      SET HANDLER l_event_receiver->node_double_click FOR g_alv_tree.
      SET HANDLER l_event_receiver->item_double_click FOR g_alv_tree.
      SET HANDLER l_event_receiver->on_function_selected FOR g_toolbar.
    ENDFORM.                    " register_events</b>
    When I double click on item on the report double click event doesnt trigger. what could be the problem? Any sample programs?
    Thanks,
    Chandni

    Hi,
    Here is a sample code for you.
    report ztree.
    TABLES : vbak.
    DATA: BEGIN OF mylist OCCURS 50. " Internal table hierarchy
    INCLUDE STRUCTURE snodetext.
    DATA: END OF mylist.
    DATA: f15 TYPE c.
    DATA :
    BEGIN OF gt_sales OCCURS 0,
    vbeln LIKE vbak-vbeln,
    kunnr LIKE vbak-kunnr,
    matnr LIKE vbap-matnr,
    arktx LIKE vbap-arktx,
    END OF gt_sales.
    SELECT-OPTIONS : s_vbeln FOR vbak-vbeln.
    START-OF-SELECTION.
    SET PF-STATUS 'ZTREE1'.
    SET TITLEBAR 'T1'.
    Fill internal table with pseudo-data
    PERFORM fill_itab.
    Hierarchy output
    PERFORM main.
    *& Form FILL_ITAB
    text
    --> p1 text
    <-- p2 text
    FORM fill_itab .
    *Fill the gt_sales table
    SELECT vkvbeln vkkunnr vpmatnr vparktx INTO CORRESPONDING FIELDS OF
    TABLE gt_sales
    FROM ( vbak AS vk INNER JOIN vbap AS vp ON vkvbeln = vpvbeln )
    WHERE vk~vbeln IN s_vbeln.
    SORT gt_sales BY vbeln kunnr.
    *Fill the root
    mylist-name = 'Report Tree List'.
    mylist-color = 1.
    mylist-intensiv = '1'.
    mylist-text = 'Report Tree List'.
    mylist-tlength = 16.
    mylist-tlevel = 1.
    mylist-tcolor = 1.
    mylist-tintensiv = '1'.
    mylist-text1 = 'using "RS_TREE_CONSTRUCT" function'.
    mylist-tlength1 = 50.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    LOOP AT gt_sales.
    ON CHANGE OF gt_sales-vbeln.
    mylist-name = 'level1'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = 'Sales Document no:'.
    mylist-tlength = 20.
    mylist-tlevel = 2.
    mylist-tcolor = 7.
    mylist-tintensiv = '1'.
    mylist-text1 = gt_sales-vbeln.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDON.
    ON CHANGE OF gt_sales-kunnr.
    mylist-name = 'level2'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = 'Customer no:'.
    mylist-tlength = 20.
    mylist-tlevel = 3.
    mylist-tcolor = 5.
    mylist-tintensiv = '1'.
    mylist-text1 = gt_sales-kunnr.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 3.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDON.
    mylist-name = 'level3'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = gt_sales-matnr.
    mylist-tlength = 15.
    mylist-tlevel = 4.
    mylist-tcolor = 4.
    mylist-tintensiv = '0'.
    mylist-text1 = gt_sales-arktx.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDLOOP.
    ENDFORM. " FILL_ITAB
    *& Form MAIN
    text
    --> p1 text
    <-- p2 text
    FORM main .
    PERFORM hierarchy. " construct & draw the tree
    ENDFORM. " MAIN
    *& Form HIERARCHY
    text
    --> p1 text
    <-- p2 text
    FORM hierarchy .
    PERFORM build_tree.
    PERFORM draw_tree.
    ENDFORM. " HIERARCHY
    FORM BUILD_TREE *
    Builds the tree from internal table *
    Uses the Function module RS_TREE_CONSTRUCT *
    FORM build_tree.
    CALL FUNCTION 'RS_TREE_CONSTRUCT'
    TABLES
    nodetab = mylist
    EXCEPTIONS
    tree_failure = 1.
    ENDFORM. "build_tree
    FORM DRAW_TREE *
    Builds the tree from internal table *
    Uses the Function module RS_TREE_DISPLAY *
    FORM draw_tree.
    sy-lsind = 0.
    CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    EXPORTING
    callback_program = 'ZREPORT_TREE'
    callback_user_command = 'NODE_SELECT'
    IMPORTING
    f15 = f15.
    ENDFORM. "draw_tree
    FORM NODE_SELECT *
    Handles selection of nodes *
    FORM node_select TABLES knoten STRUCTURE seucomm
    USING command
    CHANGING exit
    list_refresh.
    Processing of commands for hierarchy list
    CASE command.
    WHEN 'DISP'.
    CASE knoten-id.
    WHEN '000002'.
    *Display Sales Order
    SET PARAMETER ID 'AUN' FIELD knoten-text1.
    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    WHEN '000003'.
    *Display Customer
    SET PARAMETER ID 'KUN' FIELD knoten-text1.
    CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
    ENDCASE.
    ENDCASE.
    list_refresh = 'X'.
    ENDFORM. "node_select

  • Building netui:tree from XML

              Hi,
              I am trying to build a Tree in Workshop 8.1 using netui:tree tag (for data in
              an XML file).
              The BEA docs say that we have to assign the TreeNode object to the 'tree' attribute
              in the netui:tree tag.
              What is the best way to translate the XML doc into a TreeNode object(s)?
              Thanks,
              Ajay
              

              "Ajay Oruganti" <[email protected]> wrote:
              >
              >Hi,
              >
              >I am trying to build a Tree in Workshop 8.1 using netui:tree tag (for
              >data in
              >an XML file).
              >
              >The BEA docs say that we have to assign the TreeNode object to the 'tree'
              >attribute
              >in the netui:tree tag.
              >
              >What is the best way to translate the XML doc into a TreeNode object(s)?
              >
              >
              >Thanks,
              >Ajay
              Did you resolve your problem?
              I have the similar one.
              So. I can draw my tree for my data, but if i receive second xml document with
              new data and try repaint the tree, i have the same tree, whitout changes.
              Can you help me?
              Best regards
              Hubert.
              

  • Tree list display

    hi,
    i have one problem.
    i have displayed an alv grid.now i want when user select any
    row the corresponding value
    of that particular row should display in tree like structure
    under different heading i.e. under one heading there should be
    some field ,under another heading some other field and so on.
    also with expand node and compress node .
    can u plz provide any sample program.i want it with function module.
    like rs_tree_construct' and others.

    REPORT  ZTEST13 MESSAGE-ID znew .
    TREE HIRRARCHY REPORT **********************
    TABLES : vbak.
    DATA: BEGIN OF mylist OCCURS 50. " Internal table hierarchy
    INCLUDE STRUCTURE snodetext.
    DATA: END OF mylist.
    DATA: f15 TYPE c.
    DATA : BEGIN OF gt_sales OCCURS 0,
            vbeln LIKE vbak-vbeln,
            kunnr LIKE vbak-kunnr,
            matnr LIKE vbap-matnr,
            arktx LIKE vbap-arktx,
            ERNAM LIKE VBAK-ERNAM,
          END OF gt_sales.
    *SELECT-OPTIONS : s_vbeln FOR vbak-vbeln.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD S_VBELN.
    SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    INITIALIZATION.
    V_TEXT1 = 'SALES ORDER NO'.
    START-OF-SELECTION.
    SET PF-STATUS 'ZTREE1'.  " create in t-code se41
    SET TITLEBAR 'T1'.
    PERFORM fill_itab.
    PERFORM main.
    FORM fill_itab .
    SELECT vkvbeln vkkunnr VKERNAM vpmatnr vp~arktx INTO CORRESPONDING
    FIELDS OF
          TABLE gt_sales
          FROM ( vbak AS vk INNER JOIN vbap AS vp ON vkvbeln = vpvbeln )
          WHERE vk~vbeln IN s_vbeln.
          SORT gt_sales BY vbeln kunnr.
    mylist-name = 'Report Tree List'.
    mylist-color = 1.
    mylist-intensiv = '1'.
    mylist-text = 'Report Tree List'.
    mylist-tlength = 16.
    mylist-tlevel = 1.
    mylist-tcolor = 1.
    mylist-tintensiv = '1'.
    *mylist-text1 = 'using "RS_TREE_CONSTRUCT" function'.
    mylist-tlength1 = 50.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    LOOP AT gt_sales.
    ON CHANGE OF gt_sales-vbeln.
    mylist-name = 'level1'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = 'Sales Document no:'.
    mylist-tlength = 20.
    mylist-tlevel = 2.
    mylist-tcolor = 7.
    mylist-tintensiv = '1'.
    mylist-text1 = gt_sales-vbeln.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDON.
    ON CHANGE OF gt_sales-kunnr.
    mylist-name = 'level2'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = 'Customer no:'.
    mylist-tlength = 20.
    mylist-tlevel = 3.
    mylist-tcolor = 5.
    mylist-tintensiv = '1'.
    mylist-text1 = gt_sales-kunnr.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 3.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDON.
    mylist-name = 'level3'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    *mylist-text = gt_sales-matnr.
    mylist-tlength = 15.
    mylist-tlevel = 4.
    mylist-tcolor = 4.
    mylist-tintensiv = '0'.
    mylist-text1 = gt_sales-arktx.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    MYLIST-COLOR = 2.
    MYLIST-INTENSIV = '0'.
    MYLIST-TEXT = GT_SALES-ERNAM.
    MYLIST-TLENGTH = 20.
    *MYLIST-TLEVEL = 4.
    APPEND mylist.
    *MYLIST-NAME = 'LEVEL4'.
    *MYLIST-COLOR = 2.
    *MYLIST-INTENSIV = '0'.
    *MYLIST-TEXT = GT_SALES-ERNAM.
    *MYLIST-TLENGTH = 20.
    *MYLIST-TLEVEL = 4.
    *APPEND MYLIST.
    ENDLOOP.
    ENDFORM. " FILL_ITAB
    FORM main .
    PERFORM hierarchy. " construct & draw the tree
    ENDFORM. " MAIN
    FORM hierarchy .
    PERFORM build_tree.
    PERFORM draw_tree.
    ENDFORM. " HIERARCHY
    FORM BUILD_TREE *
    FORM build_tree.
    CALL FUNCTION 'RS_TREE_CONSTRUCT'
    TABLES
    nodetab = mylist
    EXCEPTIONS
    tree_failure = 1.
    ENDFORM. "build_tree
    FORM DRAW_TREE *
    FORM draw_tree.
    sy-lsind = 0.
    CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    EXPORTING
    callback_program = 'Ztest13'
    callback_user_command = 'NODE_SELECT'
    *(001)
    IMPORTING
    f15 = f15.
    ENDFORM. "draw_tree

  • X11 drawing problem after 10.6.3 update.

    The latest software update has caused drawing problems in the only X11 application that I need to use.
    The application (among other things) draws a tree diagram where boxes are drawn around text. The boxes are connected with lines. The boxes may be filled with a background color.
    The issue is that the box outlines, which should be black, either do not get drawn entirely, or are partially drawn. Further more, as the window is resized the outline is drawn with various colors with portions potentially missing. (This is very basic stuff, not likely to be deprecated.)
    If I could upload images I could show the effect, since we have a number of workstations without the 10.6.3 update.
    Would the moderator (or someone) direct me to the appropriate web site where I could file a bug report about this?
    Thanks.
    Additional Info:
    This app has been working just fine since 1996 till yesterday, when I updated to 10.6.3. The application also works fine with the latest Ubuntu release, the failure is only on Mac OS X 10.6.3.

    Filed Apple Bug Report 7814332.
    REF: https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/wa/signIn

  • Constructing Binary tree

    So this is my first post here and i am beginning to like this forum.
    Can anybody help me on how to construct Binary tree from inorder and postorder traversals,i just want to know the algorithm so that i can apply it.
    Please help.

    I would like to pick a minor little nit with this analysis. The algorithm that has been proposed assumes that all the nodes are all distinct and that having selected the root from the end of the post-order listing that it is POSSIBLE to find it in the in-order list. What if you find multiple copies of this node?
    If multiple copies of the root are found, you must have a method to distinguish, which one is the proper dividing point. In the worst possible case, the problem can not be solved at all. For example suppose my post-order and my in-order lists were these:
    a a a a a
    a a a a a
    The shape of the tree is indeterminant in this case.
    If you allow different tree nodes to contain identical values your recursive algorithm needs some modification.
    The fix is this:
    1) allow your recursive algorithm to fail (and report back any success or failure)
    This can and happen if the two lists that you passed in are incompatible. For example they could have different nodes in them.
    2) when you pick the root off the end of the post order list, you search for it in the in-order list, you could find multiple matches or you could find no matches. You must explore each of these independently because each one could lead to a possible different solution, or could lead to no solution. Of course in the case of no matches, you must report back a failure.
    Depending on your needs, you can either stop the first time that you have successfully assembled a tree that matches the two supplied inputs, or you can have it grind on and have it enumerate all the possible tree arrangements that could have generated from the two traversals that you started with.
    It might help to visualize if you write out all the possible trees with just the three nodes AAB. There are 15 of them, 5 with B at the root, 5 with A at the root and B in the left and 5 with B in the right. It is easy to draw the trees and to immediately write both their in-order and their post-order traversals.
    Any traversal is just a list of the 3 nodes and there are 3 arrangements, AAB, ABA, and BAA. There are exactly 9 ordered pairs of these traversals so you can't get all 15 trees from the 9 pairs.
    Sho nuff, three ordered pairs are unambiguous and generate a single unique tree(e.g. in:BAA post:ABA) and six of them come from ambiguous pairs of trees (e.g. in:ABA post:ABA - you can't tell if this is a tree ABA all leaning to the left or all leaning to the right)
    Enjoy

  • Cannot refresh netui:tree

    So. I can draw my tree for my data, but if i receive second xml document with
              new data and try repaint the tree, i have tree, whitout changes.
              Anyone has idea?
              Best regards
              Hubert.
              

    how to solve this problem? I also have this problem.

  • Inserting a JTextField in a JTree as a child

    Hi ..
    Is it possible to insert a JTextField in a JTree as a child... this is because i want edit the names assigned to children in a JTree at runtime..?
    If yes could you please tell me how or refer me to any resources indictating how this is done...
    Thanks in anticipation
    Sandro

    I'm heading out now so I'm not able to go in and test in order to get specific examples for you but you should be able to set the individual cells in the JTree as editable. This should give you the functionality you're looking for.
    At the very least, swing is broken into MVC (model, view, control) architecture so you might need to find the class responsible for the tree's view and change a method there that allows the tree cells to be editable.
    Specificly, try something like
    JTree myTree = new JTree();
    myTree.setEditable( true );
    if that doesn't work, try looking into the TreeCellRenderer (the class that handles drawing the tree) and overwriting the interface method it contains (interface should only contain one method) so that the component it returns is editable. You would then have to use your TreeCellRenderer as the renderer for the tree.
    public class MyCustomTreeCellRenderer extends DefaultTreeCellRenderer{
        public Component getTreeCellRendererComponent( parameters ){
            return super.getTreeCellRendererComponent( parameters ).setEditable( true );
    }//end of inner class
    myTree.setCellRenderer( new MyCustomTreeCellRenderer );
    You can further change how your CellRenderer works if you need to implement more complex changes. What I've given you here should give you the basis for what you want to do.
    Hope this helps.
    - Kevin

  • Help with JScrollPane

    I have a JScrollPane that I need to add multiple components to. That includes 5 JButtons, and 5 Jtree's.
    I need to add all of the components at once, making the JTree's visible and invisible by clicking the JButton's. My first problem is when I try to add multiple objects to the JScrollPane using the default layout manager. The last object added is always stretched to fill the entire viewport. This makes the objects first added un-viewable. So I decided to first add all of the objects to a Box then add the Box to the scrollpane.
    My second problem occurs when I make a JTree visible, aftering adding it to the Box. It draws the tree completely from top to bottom as it should, but clips the right end of titles on the nodes. The horizontal scroll adjusts enought so that you can scroll far enough to the right, but the titles are cut off.
    If I add one of the JTree's directly to the JScrollPane it behaves as it should, showing the complete node titles.
    I've tried revalidating, updating, and repainting without success.
    So, first question is can multiple objects be added to a JScrollPane using the default layout manager, without having the last object hide the previously added objects?
    Secondly, does anyone know why nodes in a JTree would be clipped when added to a Box then added the Box added to a JScrollPane. And more importantly how to fix it.
    Any help would be appreciated,
    Thanks,
    Jim

    Hi there
    Im not sure on exactly what you are trying to do.
    But if you want multiple components in one JScrollPane
    I would use a JPanel that I would add to the JScrollPane
    On that JPanel I would then add my components.
    I would also use GridBagLayout instead of any other layout manager. Thats because it is the most complex
    layout manager and it will arrange the components as I whant.
    If you whant to be able to remove a component from the view by making them invisible. I think I would consider
    JLayeredPane.
    on a JLayeredPane you add components on different layers. Each component is positionend exactly with setLocation or setBounds. This is the most exact thing to use. The JLayeredPane uses exact positioning of its components. which can be usefull when you use
    several components that will be visible at different times
    /Markus

  • Reading explain plan

    Hi
    I need some help with explain plan...tried some documents but didnt get the clarity...here is the query...
    explain plan for
    select ename,dname,grade
    from emp,dept,salgrade
    where emp.deptno=dept.deptno
    and emp.sal between salgrade.losal and salgrade.hisal;
    and here is the explain plan for this query..
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | | | |
    | 1 | NESTED LOOPS | | | | |
    | 2 | NESTED LOOPS | | | | |
    | 3 | TABLE ACCESS FULL | SALGRADE | | | |
    |* 4 | TABLE ACCESS FULL | EMP | | | |
    | 5 | TABLE ACCESS BY INDEX ROWID| DEPT | | | |
    |* 6 | INDEX UNIQUE SCAN | PK_DEPT | | | |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
    4 - filter("EMP"."SAL"<="SALGRADE"."HISAL" AND "EMP"."SAL">="SALGRADE"
    ."LOSAL")
    6 - access("EMP"."DEPTNO"="DEPT"."DEPTNO")
    Note: rule based optimization
    21 rows selected.
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE
    1 0 COLLECTION ITERATOR (PICKLER FETCH) OF 'DISPLAY'
    [i suppose it will remove all the spaces....so sorry .... :-( ]
    now i have some questions regarding this like...
    1. wat does these * mean with 4 and 6
    2. how we come to know that which part got executed first and others after that.....as we draw a tree to represent all the steps....
    3. wat is this Predicate Information
    4. wat info is given at the last titled "Execution Plan"
    please help
    thanks
    Sidhu

    Sidhu,
    1. wat does these * mean with 4 and 6It means that predicates are applied during this step. You'll see that there is a 4 and a 6 in the predicate informatiion, to specify the actual predicates being applied. The star is to indicate the presence of a predicate.
    2. how we come to know that which part got executed
    first and others after that.....as we draw a tree to
    represent all the steps....This example is taken from an AskTom thread. In this thread he described in great detail how such a tree should be read. I cannot do it better.
    3. wat is this Predicate InformationThe filters that are applied to restrict the result set.
    4. wat info is given at the last titled "Execution
    Plan"You were probably autotracing the 'select * from table(dbms_xplan.display)' itself. So this section is not relevant.
    Regards,
    Rob.

  • How to display XML file in java swing

    hi all
    now i do my M.Sc., project on data maining.this time i have one problem,thats i can't display XML file in swing frame.so any one know this plz give me that idea or code.
    Thanks to all.
    RSK

    One way of doing that is to use JDOM...
    u create an xml tree, and then output using XMLOutputter class...it will be displayed in text...im not sure if thats what u want...however, if u do want to represent it visually then u may need to draw a tree...u may use the Graphics2D for that...there are alot of ways to do such thing, and the 2 possibilities arent the best...depends on what u want...elaborate more pls.

  • Terminal issues with environmental variables

    I am having an issue with persisting environmental variables during a session. I am running an app that requires the sequential running of 3 scripts setenv.sh, build.sh, run.sh.
    The first script sets variables that are being used by the other scripts. The script just contains lines like
    "export ADVISOR_HOME=/Applications/Blaze/Advisor65;"
    if i add echo the variables name in the script they are set, but immediately after or with env they are gone.
    From my understanding (not much) these should persist as long as the window is open. Is there any setting that is being set in OS X that is sandboxing scripts? It would seem to be security-minded but is causing problems.
    Also is there any way to temporarily disable the requirement to prefix a command call with ./ in os x. Many of the included scripts are calling methods in the same directory and I am having to alter a lot of scripts to include ./
    Thanks in advance,
    walter

    walter deane wrote:
    I am having an issue with persisting environmental variables during a session. I am running an app that requires the sequential running of 3 scripts setenv.sh, build.sh, run.sh.
    The first script sets variables that are being used by the other scripts. The script just contains lines like
    "export ADVISOR_HOME=/Applications/Blaze/Advisor65;"
    if i add echo the variables name in the script they are set, but immediately after or with env they are gone.
    Do you mean you echo them from within the script and then they are gone after the script ends? That would be normal. If you want them to persist through the other scripts, you could combine the scripts. The problem is that you're setting them in one process and expecting them to persist in another process. Unless the second is a child of the first, that won't work. I think it would work if you executed the second two scripts from within the first script because they would then be children of the first process. Does that make sense? I'm not sure of the correct terminology here and I can't draw a tree which is what I want to do! Another option might be to source setenv.sh rather than running it (i.e. wouldn't need to be executable) - the same way the shell does when starting up, I think.
    From my understanding (not much) these should persist as long as the window is open.
    I don't think it has anything to do with windows. It is just when the process exits. If you set such variables at the command line, they'll persist until the window closes because they'll persist until the process exits which is usually when the window closes. At least, in the simplest cases. But it isn't the window staying open or not that's important. It's that everything else done in the window happens to inherit the environment from the parent process. In truth, this often isn't the case anyway, but I expect that's the source of the misunderstanding.
    Is there any setting that is being set in OS X that is sandboxing scripts? It would seem to be security-minded but is causing problems.
    Nothing special that I know of. There is stuff for something like this in Leopard but you'd have to enable it and I'm not sure it applies here.
    Also is there any way to temporarily disable the requirement to prefix a command call with ./ in os x. Many of the included scripts are calling methods in the same directory and I am having to alter a lot of scripts to include ./
    You can do this but it is extremely insecure. Essentially, you can add the current directory to PATH. (PATH=$PATH:./; export PATH) It would be much, much better - much, much safer - to edit the scripts. Can you not use sed to edit them? If there is some sort of pattern, there's no need to do it by hand.
    If this is an application you plan to share, you should certainly not consider changing PATH in this way unless you are aiming to produce an application with maximum destructive potential! If you don't plan to share, of course, it is your call!
    - cfr

  • How to display xml attributes in Layout (indesign cs2)

    Hi,
    Javascript
    Indesign CS2
    PC Version
    Any one tell me, i want to display the ids in the margin. i read xml attribute, but i didn't know how to display to the margin. Help me.

    One way of doing that is to use JDOM...
    u create an xml tree, and then output using XMLOutputter class...it will be displayed in text...im not sure if thats what u want...however, if u do want to represent it visually then u may need to draw a tree...u may use the Graphics2D for that...there are alot of ways to do such thing, and the 2 possibilities arent the best...depends on what u want...elaborate more pls.

Maybe you are looking for