How to change icon of a node or root node of a JTree

i have a JTree with a root node, and leaf nodes. i want to change their icons. how can i do this?
thanks

Here's a search of the forums with the words 'tree', 'icon' and 'node' in the title
http://onesearch.sun.com/search/developers/index.jsp?and=jtree+icon+node&nh=10&phr=&qt=&not=&field=title&since=&col=devforums&rf=0&Search.x=28&Search.y=15
I looked at a couple and #5 seems interesting, but there are quite a few to choose from.

Similar Messages

  • How to change icon of a Folder-track?

    By Folder-track I mean the Folder in Arrange window that is created from "packing reions". Is that even possible in LogicPro7 - to change it's icon?
    I mean I know how to change icons for my audio tracks, audio-instrument tracks. And it would be nice if I can assign different icons for different Folder-tracks.
    I did not find how to do that

    It is possible... use option-command-hold on the icon of the folder in a track in the arrange and up pops the many icons to choose from.
    You can set the icon to something other than the folder.
    To make different folders I guess you would have to do some image editing
    and make your own icons but that is pretty easy.
    Put your user create icons here...
    ~/Library/Application Support/Logic/Images/Icons
    and logic will load your numbered image file instead of the default ones that
    Logic would normaly use.
    Note: 1.png is the file name of the regular folder icon.

  • How to Create Instances in the Transient Root Node and Sub Nodes from Root Node Query Method ?

    Hi All,
    I am Creating a BOPF BO with 3 Nodes,
    Node 1) ROOT -- > contains a query,
    using Root Node I have created Search UIBB Configuration in FBI.
    In testing -- > when i enter Data in the Search Criteria Fields am able to get the details in to the query method
    from Imporing parameter : 'IT_SELECTION_PARAMETERS'.
    HERE I am fetching data from a standard table and trying to fill the data in the Node : 'MNR_SEARCH_RESULT'.
    How to Append data to the Sub node 'MNR_SEARCH_RESULT' when there is no Node instance created in the ROOT Node ?
    For This  I have created an instance in the ROOT Node and Using that I tried to create Instance in the Sub Node 'MNR_SEARCH_RESULT'.
    Below is my code which i have placed in the Query method ..
    DATA : LR_DATA TYPE REF TO ZBO_S_ROOT1.
    DATA : LR_SEARCH_RES TYPE REF TO ZBO_S_MNR_SEARCH_RESULT.
    DATA : LO_CI_SERVICE_MANAGER TYPE REF TO /BOBF/IF_TRA_SERVICE_MANAGER,
            LO_TRANSACTION_MANAGER TYPE REF TO /BOBF/IF_TRA_TRANSACTION_MGR.
       LO_CI_SERVICE_MANAGER = /BOBF/CL_TRA_SERV_MGR_FACTORY=>GET_SERVICE_MANAGER( IV_BO_KEY = ZIF_BO_TEST_PO_C=>SC_BO_KEY ).
       LO_TRANSACTION_MANAGER = /BOBF/CL_TRA_TRANS_MGR_FACTORY=>GET_TRANSACTION_MANAGER( ).
    CREATE DATA LR_DATA.
    LR_DATA->KEY = LO_CI_SERVICE_MANAGER->GET_NEW_KEY( ).
    LR_DATA->ROOT_KEY   = IS_CTX-ROOT_NODE_KEY.
    LR_DATA->PIPO_MAT_ID = '100100'.
    LR_DATA->PIPO_MAT_DESC = 'MATERIAL'.
    LR_DATA->PIPO_SPRAS = 'E'.
    LR_DATA->PIPO_MATL_TYPE = 'ZPMI'.
    LR_DATA->PIPO_MATL_GROUP = 'ZKK'.
         DATA lt_mod      TYPE /bobf/t_frw_modification.
         DATA lo_change   TYPE REF TO /bobf/if_tra_change.
         DATA lo_message  TYPE REF TO /bobf/if_frw_message.
         FIELD-SYMBOLS: <ls_mod> LIKE LINE OF lt_mod.
        APPEND INITIAL LINE TO lt_mod ASSIGNING <ls_mod> .
        <ls_mod>-node        =   ZIF_BO_TEST_PO_C=>sc_node-ROOT.
        <ls_mod>-change_mode = /bobf/if_frw_c=>sc_modify_create.
        <ls_mod>-key         = LR_DATA->KEY.
        <ls_mod>-data        = LR_DATA.
    DATA : LT_CHG_FIELDS TYPE /BOBF/T_FRW_NAME.
    DATA : LS_CHG_FIELDS LIKE LINE OF LT_CHG_FIELDS.
    DATA : LV_KEY TYPE /BOBF/CONF_KEY.
    CALL METHOD IO_MODIFY->CREATE
       EXPORTING
         IV_NODE            = ZIF_BO_TEST_PO_C=>sc_node-ROOT
         IV_KEY             = LR_DATA->KEY
         IS_DATA            = LR_DATA
         IV_ROOT_KEY        = IS_CTX-ROOT_NODE_KEY
       IMPORTING
         EV_KEY             = LV_KEY .
    CREATE DATA LR_SEARCH_RES.
    LR_SEARCH_RES->KEY           = LO_CI_SERVICE_MANAGER->GET_NEW_KEY( )..
    LR_SEARCH_RES->PARENT_KEY    = LV_KEY.
    LR_SEARCH_RES->ROOT_KEY    = LV_KEY.
    LR_SEARCH_RES->MATNR    = '123'.
    LR_SEARCH_RES->ERSDA    = SY-DATUM.
    LR_SEARCH_RES->ERNAM    = SY-UNAME.
    **LR_SEARCH_RES->LAEDA    = .
    **LR_SEARCH_RES->AENAM    = .
    **LR_SEARCH_RES->VPSTA    = .
    *LR_SEARCH_RES->LVORM    = .
    LR_SEARCH_RES->MTART    = 'ZPI'.
    LR_SEARCH_RES->MBRSH    = 'ZTP' .
    LR_SEARCH_RES->MATKL    = 'MAT'.
    **LR_SEARCH_RES->BISMT    = ''
    **LR_SEARCH_RES->MEINS    =
    CALL METHOD io_modify->create
               EXPORTING
                 iv_node            = ZIF_BO_TEST_PO_C=>sc_node-MNR_SEARCH_RESULT
                 is_data            = LR_SEARCH_RES
                 iv_assoc_key       = ZIF_BO_TEST_PO_C=>sc_association-root-MNR_SEARCH_RESULT
                 iv_source_node_key = ZIF_BO_TEST_PO_C=>sc_node-root
                 iv_source_key      = LV_KEY
                 iv_root_key        = LV_KEY.
    I am Unable to set data to the Node . I did not get any error message or Dump while executing . when i tried to retrive data I got the details from the node but am unable to view those details in the FBI UI and BOBT UI while testing .
    Please provide your valuable Suggestions.
    Thanks in Adv.
    Thanks ,
    Kranthi Kumar M.

    Hi Kranthi,
    For your requirement you need only two nodes. Root Node and Result node. Use the same structure for both.
    To create Instance while search.
    Create Query method with input type which has the required fields for selection criteria.
    Fetch the data and create instance in the root node.
    Pass the new instance key as exporting parameter form Query Method.
    To Move data from ROOT to Result.
    Create a action at root node.
    Write a code to create new entries in Result node.
    Then configure the Search UIBB and display result in List UIBB. Add button and assign the action MOVE_MAT_2_RESULT.
    Create another List uibb to display data from Result node.
    Connect the UIBBs using wire schema. SEARCH -> LIST(ROOT) ---> LIST(RESULT).
    Give src node association for ROOT to RESULT Configuration.
    Regards,
    Sunil

  • How to change icons of a JTree node dynamically

    Hi all!
    I want to change icon associated with a node dynamically ( i.e. after the tree has being displayed). How can i achieve this?
    Can any one provide me a sample code snippet.
    Thanks in advance
    Murali

    I have created CustomCellRenderer and i'm calling this class as follows
    tree.setCellRenderer((TreeCellRenderer) new CustomCellRenderer(true));
    The boolean value for the constructor (in this case it's true) will be set to
    a local variable in the CustomCellRenderer class. Then upon clicking a node in the tree the boolean value (true) is set and the icon for that node should be changed as specified in the CustomCellRenderer class.
    When i click on a node all the icons of that tree are disappearing.
    Can any one help me in this issue
    public class CustomCellRenderer
              extends          JLabel
              implements     TreeCellRenderer
    private ImageIcon          grayfolderImage;
    private ImageIcon          greenfolderImage;
    private ImageIcon          bluefolderImage;
    private ImageIcon          redfolderImage;
    private ImageIcon          whitefolderImage;
    private boolean               bSelected;
    boolean logfileDeleted;
         public CustomCellRenderer()
              grayfolderImage = new ImageIcon("C:\\images\\grayFolder.gif");     
              greenfolderImage = new ImageIcon("C:\\images\\greenFolder.gif");     
              bluefolderImage = new ImageIcon("C:\\images\\blueFolder.gif");     
              redfolderImage = new ImageIcon("C:\\images\\redFolder.gif");
              whitefolderImage = new ImageIcon("C:\\images\\whiteFolder.gif");     
         public CustomCellRenderer(boolean logfileDeleted){
              this.logfileDeleted = logfileDeleted;
         public Component getTreeCellRendererComponent( JTree tree,
                             Object value, boolean bSelected, boolean bExpanded,
                                       boolean bLeaf, int iRow, boolean bHasFocus )
              // Find out which node we are rendering and get its text
              DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
              String     labelText = (String)node.getUserObject();
              this.bSelected = bSelected;
              // Set the correct foreground color
              /*if( !bSelected )
                   setForeground( Color.black );
              else
                   setForeground( Color.red ); */
              // Determine the correct icon to display
              if( labelText.equals( "ioexception001" ) )
                   setIcon( redfolderImage );
              else if( labelText.equals( "ioexception002" ) )
                   setIcon( greenfolderImage );
              else if( logfileDeleted ==true )
                   setIcon( whitefolderImage );
              else if( labelText.equals( "ioexception004" ) )
                   setIcon( redfolderImage );
              else
                   setIcon(bluefolderImage);
              // Add the text to the cell
              setText( labelText );
              return this;
         // This is a hack to paint the background. Normally a JLabel can
         // paint its own background, but due to an apparent bug or
         // limitation in the TreeCellRenderer, the paint method is
         // required to handle this.
         public void paint( Graphics g )
              Color          bColor;
              Icon          currentI = getIcon();
              // Set the correct background color
              bColor = bSelected ? SystemColor.textHighlight : Color.white;
              g.setColor( bColor );
              // Draw a rectangle in the background of the cell
              g.fillRect( 0, 0, getWidth() - 1, getHeight() - 1 );
              super.paint( g );
    }

  • How to change/update RTTI element of an existing node?

    Hello experts,
    our application calculates the whole ALV and the context at runtime.
    DATA:
      lo_node_info    TYPE REF TO if_wd_context_node_info,
      lo_context      TYPE REF TO if_wd_context_node,
      do_strdescr_alv TYPE REF TO CL_ABAP_STRUCTDESCR.
      lo_node_info = io_context->get_node_info( ).
      TRY.
          lo_node_info->remove_child_node( 'ALV_DATA' ).
          lo_node_info->get_child_node( 'ALV_DATA' ).
          lf_exist = 'X'.
        CATCH cx_wd_context.
          CALL METHOD lo_node_info->add_new_child_node
            EXPORTING
              name                         = 'ALV_DATA'
              static_element_rtti          = do_strdescr_alv
              is_static                    = abap_false
              attributes                   = lt_attribute.
      ENDTRY.
    This piece of code is called after each interaction from user. Since the ALV can change (columns can be added or removed - given in object do_strdescr_alv), I need to update/change the RTTI of node "ALV_DATA". I did not find the way how to do it. So, you can see, I remove the whole node and create it again. This works, but I am afraid about performance.
    So my quiestion is: is there a way how to change the RTTI of existing node? I only found the way how to get this object from the node (method IF_WD_CONTEXT_NODE_INFO~GET_STATIC_ATTRIBUTES_TYPE), but there is no corresponding SET method.
    Any idea?
    Thanks in advance,
    Tomas

    Hi Tomas,
    sorry, I'm not going to be able to be much help - but just wanted to point out why, in my opinion, you can't do what you want to do...
    And it all boils down to the word STATIC - when you create a node you create it with certain static attributes, and these are just that - static - you can't change them!
    You can add dynamic attributes to an existing node - but not static ones (as far as I am aware).
    This links to the how the data is stored and bound/shared - the context sharing has been built and designed so that static attributes are static.
    Sorry I couldn't help more, but I thought it was a worthwhile point to make. (perhaps it wasn't but I had to comment anyway.)
    Otherwise - I think you could dynamically alter your ALV model and context node, but might not get the ability to populate the ALV model through the inspection of your node.
    Chris

  • How to change icons in Maverick

    Those folders in Maverick look all alike. I cannot quickly see the most important folder
    So I would need to change icons
    Is there a free app for that ?

    - display XtraFinder as a menu
    When XtraFinder is running there's a menu in the Menubar:
    - colorful icons in sidebar
    Put Color Icons Back in Finder Sidebar with SideEffects for 10.9
    Here's the download page: https://www.macupdate.com/app/mac/43078/sideeffects

  • How to change data source name and context root during deployment

    Hi,
    Env:
    WLS 10.1.3
    JDev 11.1.1.6
    Hudson
    I need to deploy two instances of my ADF application on the same development enviroment. We are using Hudson to deploy. My question is how to change data source name and application context root before second deployment.
    Kuba

    I don't believe there is an inbuilt facility to do this.
    Previously how I've done this is when checking files out using Hudson jovs, before the build I then use an Ant extension called XmlTask (http://www.oopsconsultancy.com/software/xmltask/) to modify the required XML files.
    Can I ask why you're doing this in the first place please? Multi-tenancy? 2 versions of the same app?
    CM.

  • How to remove all nodes (except root node)from a Jtree?

    How to remove all nodes (except the root node)from a Jtree?

    Either:
    - remove all children of root.
    - save the root node, throws away the tree model, build a new TreeModel with the saved root, set the new TreeModel in the JTree.
    - implement your own TreeModel, which would support an emptyExceptRoot() method.
    IMHO, using the DefautlTreeModel and DefaultMutableTreeNode does lead to all sorts of small problems when the app evolves, and implementing your own TreeNode and TreeModel is not that hard and much more efficient.

  • Leaf Node to root Node Expansion

    I have constructed a tree. In initially it is closed I am giving the leaf node name in the text box. after that with the text listner how can I generate tree expansion display?

    First, get the tree model using getModel().
    Then, using the tree model, get the root node using getRoot() (cast as TreeNode).
    Then, starting with the root node,
    1. check to see if the node is the one you are looking for.
    2. If it's the one you are looking for, stop.
    3. check to see if the node is a leaf using isLeaf(node).
    4. If it's a leaf check if the stack is empty. If so, stop (you didn't find it). Otherwise, pop the next node off the stack, make it the current node and go to step 1.
    5. If it's not a leaf, get the number of children using getChildCount(node). Use getChild(node, index) to get all the children in order and push them onto the stack except the last one. Make that node the current node.
    6. Go to step 1.

  • How to change value of constant for "Disabled" Property Node?

    Hello all,
    I'm attaching a vi example of what I'm wanting to do. It is happening during the event for "Left Selectorrogrammed 1: Value change.
    Basically I've created a property node for a LED boolean control. After it is clicked, I am wanting to disable it so the user cannot change the value (I have a reset all button for use on that).
    I've created the property node for this control for Disabled.  When I am in the block diagram, I change it to write mode.
    I've rt clicked on it, and said "create constant", which it does.  However, the constant comes up every time as "Enabled". I've tried clicking all over this constant, and looking through all the properties, but I cannot figure out how to toggle through the values or set the value of this constant from "Enabled" to "Disabled".
    I see where you can edit the items of this constant...but I'm guessing there is some way to toggle this constant to the value you wish....any suggestions?
    Thanks in advance,
    cayenne
    Solved!
    Go to Solution.
    Attachments:
    laptop_test_public.vi ‏17 KB

    To change a constant value your cursor needs to be in the "finger" mode.
    You can select this by holding down shift and right-clicking on the diagram - then select the finger.
    Another way is to set Automatic Tool selection:
    Tools >> Options >> Environment >> Lock automatic tool selection
    With this option, LabVIEW will choose the tools for you.
    Play with it a bit to see how it works.
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.

  • How to change icon size in iWorks media viewer

    Hi
    I have just upgraded my wife's macbook from 10.6.8 to 10.8.2 and she uses pages a lot
    The media viewer in pages seems to have just one size for the icons of the photos. You used to be able to drage a slider to increase the size
    I have tried all the ctrl key type ideas but nothing
    Why do they delete features that are d=so useful or hide them in non obvious palecs and make it hard for the less technical user.
    I have been using pages since the first and a Apple since 1980 and support 500 machines - most using pages so I would appreciate any help.
    Mountain Lion has made Pages a little less friendly
    Yours
    Vern Dempster

    auwoo wrote:
    I just upgraded to iOS 7.0.4.  I hate it and wish I could uninstall it.  Is there any way to change from the huge icons of 4X4 on screen to old style of 4X5 size?
    You cannot.
    But how is 4x4 larger than 4x5?

  • How to change icons in new iPhone version?

    Hello everybody
    I do not like these "japanese cartoons" like new icons
    - do not object to all those who will surely "love" them -
    simply : how can I change mine?
    (once it was simply in Apple softwares...)
    best
    Orietta

    orietta.c wrote:
    how can I change mine?
    You don't, some learn to like them.

  • How to change icon size when uploading pics?

    So I'm uploading pics to facebook, into an album where I'll put multiple pics.   The problem is that when I click upload on facebook, and the "upload finder window" comes up, even though I choose icon as the view way, they are at the smallest size, and barely recognizeable.
    Note that I'm not talking about a regular finder window. I know how to get those to come to the right size. I have already set my preferences in finder to show all icons at 128x128, but it doesnt seem to affect the browser upload finder...  this problem shows up with all browsers too (safari, chrome, firefox)
    I'm at my wit's end because I have to upload multiple pictures every two or 3 hours for work, and this is jsut ridiculous.

    auwoo wrote:
    I just upgraded to iOS 7.0.4.  I hate it and wish I could uninstall it.  Is there any way to change from the huge icons of 4X4 on screen to old style of 4X5 size?
    You cannot.
    But how is 4x4 larger than 4x5?

  • How to change icons on desktop

    The applicaton icons on my disktop show Apple's generic application icon not the manufactures software icon.  How do I change this?

    You need to be much more specific. Also you shouldn't be storing much on your desktop, Apple advises against that. If you want application icons shown, put them in your Dock.

  • How to change icon size on screen

    I just upgraded to iOS 7.0.4.  I hate it and wish I could uninstall it.  Is there any way to change from the huge icons of 4X4 on screen to old style of 4X5 size?

    auwoo wrote:
    I just upgraded to iOS 7.0.4.  I hate it and wish I could uninstall it.  Is there any way to change from the huge icons of 4X4 on screen to old style of 4X5 size?
    You cannot.
    But how is 4x4 larger than 4x5?

Maybe you are looking for

  • "Request Product Service" form on apple's website doesn't work

    I'm trying to get Apple to repair my broken IPod. I go to the Request Product Service online form (http://depot.info.apple.com/ipod/), fill in all my info, and when I get to the page that asks "Describe Your Issue," I get stuck on the first part: "Se

  • ICloud Storage confusion

    I bought 25gb of iCloud storage and at the moment according to Sys Prefs on my Mac and Settings on my iPhone I have used 8.6gb of the 25gb storage. Mail accounts for 4.8gb but I am getting a standard mail out from Apple saying I can no longer get or

  • Why hashMap is not the part of collection framework

    why hashMap is not the part of collection framework ?? why Map start its own new hierarchy?? thanks

  • I  upgraded my iTunes  for Windows and all my songs are gone.

    When I upgraded my ITunes for Windows, all of my songs disappeared.  How do I get them back?

  • Home Desktop Paths in Solaris 11

    Hello Admins, I work at the Oracle Broomfield CO campus. I tested Solaris 11 on my office Solaris 10 workstation using VirtualBox to see if DNS and NIS could be properly configured to work in our infrastructure before I installed Solaris 11 as the de