How to change the individual node Icon based on the user action?

Hi all,
I just want to change the icon of the selected node when user clicks the button.
I've gone through some examples in the tutorials and someother websites,
but it looks very big for this simple need.
Please help me in a simple way.
Thanks a lot.

Anandababu_Babu wrote:
node represents a node in a JTree.
I don't have a code for this problem, i just have a idea to implement this on my application,
for better user interaction.Read the API for JTree and follow the link to the Swing tutorial on How to Use Trees where you will find a section on Responding to Node Selection and a link to another section on Editors and Renderers. After trying out what you learn there, feel free to ask here if you have a more specific question than "I don't know how to do it"
luck, db

Similar Messages

  • How to change the user of a cancelled background (batch) job?

    Hi All,
    I have a batch job which is being cancelled as the reference user account is locked. I want to update the job with a new user.
    How can I change the user for a cancelled job? I am able to change the user for a scheduled job (by right clicking the job >> Change) but not for a cancelled job.
    I am getting the error: "<<Job Name>> cannot be changed due to its status" when trying to change the cancelled job.
    Please help.
    Thanks
    Vijay

    Hi Vijay,
    change the user of a cancelled background (batch) job
    1) Goto <b>SM37</b>
    2) Select the cancelled job and goto menu bar select <b>Job</b> )&#61664; click on change.
    3) Click on step tab
    4) Select the job and click on change tab. Change the user name and save.
    regards,
    kanthi

  • How to change the user for an event job as SAP_MONITORING_STARTUP_DISPATCH

    Hi experts!
    We change the user that execute all our jobs. I can change the user JOB-BW for JOB-BI for this job SAP_CCMS_MONI_BATCH_STARTUP_DP, but the problem is when this job is executed by event for this other job SAP_MONITORING_STARTUP_DISPATCH, but i can't change the user JOB-BW for JOB-BI for this event
    Could you tell me, how i do the change user for this job.
    Best Regards
    Ramon Sanchez

    Hi!
    My problem have been solved. The job SAP_CCMS_MONI_BATCH_STARTUP_DP is automatically created by
    Job SAP_CCMS_MONI_BATCH_DP. It is an event triggered job to handle the startup-methods which are to be processed in batch.
    The event is SAP_MONITORING_STARTUP_DISPATCH; I only select the job in SM37 and specify this event and after made the search the job  SAP_CCMS_MONI_BATCH_STARTUP_DP i only change the user.
    Thank you all for your help!
    Ramon Sanchez

  • How to change JTree's node icon manually?

    Hi, I'm currently making messenger application using awt and swing. I've searched in google and here(got this), but till now I haven't got solution.
    I want to change user's status icon in the buddy list if the user's status is changed(such like offline and online).
    But for now I want to try to change the icon directly by pressing a button first before thinking about listener for the status.
    I have this tree
         CustomCellRenderer rosterTreeRenderer = new CustomCellRenderer();
            DefaultMutableTreeNode rosterRoot = new DefaultMutableTreeNode("root");
            DefaultMutableTreeNode rosterGroup = null;
             rosterGroup = new DefaultMutableTreeNode("group 1");
             rosterRoot.add(rosterGroup);
             rosterGroup.add(new DefaultMutableTreeNode("abc"));
             rosterGroup.add(new DefaultMutableTreeNode("dce"));
             rosterGroup = new DefaultMutableTreeNode("group 2");
             rosterRoot.add(rosterGroup);
             rosterGroup.add(new DefaultMutableTreeNode("zzz"));
             rosterGroup.add(new DefaultMutableTreeNode("xxx"));
             rosterGroup.add(new DefaultMutableTreeNode("yyy"));
                rosterTree.setCellRenderer(rosterTreeRenderer);This is the cell renderer
    public class CustomCellRenderer extends DefaultTreeCellRenderer
         private static final long serialVersionUID = 1L;
         public CustomCellRenderer(){
            public Component getTreeCellRendererComponent( JTree tree, Object value,
                    boolean isSelected, boolean expanded, boolean leaf, int row,
                    boolean hasFocus )
              DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
              String     labelText = (String)node.getUserObject();
              if (isSelected)
                   System.out.println("selected");
                   this.setIcon(UIManager.getIcon("Tree.openIcon"));
                   //((DefaultTreeModel) tree.getModel()).nodeChanged(node);
            else if (leaf) {
                this.setIcon(UIManager.getIcon("Tree.leafIcon"));
              } else if (expanded) {
                   this.setIcon(null);
              } else {
                   this.setIcon(null);
              setText(labelText);
              return this;
        public Color getBackgroundNonSelectionColor() {
            return(null);
        public Color getBackground() {
            return(null);
    }Whenever I click the user, the user's icon change, the first phase of my testing is working.
    But after that I'm confused, how can I change the icon when I click a button at the roster frame. How to invoke and send parameter to change icon of specified user? I already read DefaultTreeCellRenderer javadoc but still haven't found clue to what I wanted, most of the methods noted with "Overridden for performance reasons".
    I've already searched for several days for this problem.. Hope someone can help me..
    Thanks

    Sorry I don't know how to delete my question from other forum. I also don't know about crossposting rule(I don't go into javaranch).
    I'm learning java by google and I'm really confused now, everyone I asked in real life doesn't know the solution. I'm doing a thesis making chat messenger, my lecturer also doesn't know how to solve my problem.
    Sorry I really don't know about the crosspoting rule. I only read the rule from each forum.
    Can someone help me please? :(

  • How to change the user status from CJ01 transaction

    Hello All,
    I am doing a BDC in CJ01 transaction where there is a field called "User Status" .
    This field is not editable. However the requirement is to populate this field with some value based on some other entries.
    Is there any Function module / BAPI to update user status from CJ01.
    Thanks in advance.
    Regards
    Indrajit

    Hi Anbu
        Thanks for your kindness.
         I had got the proper badi definition ( RECN_CONTRACT ) before. I have try to implement the badi in my implementation YCL_IM_RECN_CONTRACT and below is my example codes. It can update the user status when the SAVE button is pressed. My example codes are below:
    METHOD if_ex_recn_contract~check_all.
      DATA:
          cl_recn_contract   TYPE REF TO cl_recn_contract.
      DATA: r_status_mngr TYPE REF TO if_reca_status_mngr.
      DATA: lv_status_profile TYPE j_stsma.
      DATA: lt_status TYPE re_t_status,
                ls_status TYPE LINE OF re_t_status.
      DATA: r_message TYPE REF TO if_reca_message_list.
      cl_recn_contract ?= io_object.
      CHECK if_before_store = 'X'.
      CALL METHOD cl_recn_contract->if_reca_has_status~mo_status_mngr->get_current_status
        IMPORTING
          ed_status_scheme = lv_status_profile
          et_status        = lt_status.
      lv_status_profile = 'ZBCIA01'.
      CALL METHOD cl_recn_contract->if_reca_has_status~mo_status_mngr->set_status_profile
        EXPORTING
          id_status_profile = lv_status_profile.
      READ TABLE lt_status INTO ls_status INDEX 2.
      ls_status-stat = 'E0001'.
      ls_status-inact = ''.
      MODIFY lt_status FROM ls_status INDEX 2.
       CALL METHOD cf_reca_message_list=>create
         RECEIVING
           ro_instance = r_message.
      CALL METHOD cl_recn_contract->if_reca_has_status~mo_status_mngr->set_status
        EXPORTING
          it_status           = lt_status
          if_only_user_status = 'X'
          io_msglist          = r_message.
      REFRESH lt_status.
    ENDMETHOD.

  • HT5622 How can I change the user of the IPad??

    Any body knows how to change the user of the IPad 1

    Sure.  Erase the old user's information by doing:
    Settings > General > Reset > Erase All Content and Settings
    Then the new user will set up the iPad as if it just came out of the box.

  • How to change the node's icon in a tree when the node collapse or expand?

    how to change the node's icon in a tree when the node collapse or expand?

    Hi,
    You may need to use custom skin for that.
    -Arun

  • Palete Image trace: How to change the default settings for icon?

    Hi!
    New palette and action Image tracer is a good step forward and work better, thank you.
    This palette has a built-in icons, which significantly accelerate the selection. How do I change the default action?
    I know that you can save presets, but this is different. The icons are even faster and more practical.
    eg I want to icon B & W automatically have enabled the option "Ignore White".
    Best Regards!

    No, there's no way to do that, and that's because Lightroom works best as a single catalogue. You have metadata fields like Job which can track individual assignments.
    What you could do is create an empty catalogue with settings as you want, then copy the file each time you want to set up a new catalogue.

  • How to change the default JAD Icon image in JStudio

    Dear friends,
    I have one dought,how to change the default icon JAD image in jstudio application.Its very important to me.And one find answer please tell .

    Dear friends,
    I developed one application in jstudio.And need to set an special icon for my application.While i download my application in to mobile. The icon should be displayed in the mobile.To show my application as unique from other applications.But i dont know how to set an icon for my application. If any one find answer please reply as soon as possible.
    Thank you

  • How to change the icon for print dialog?

    Hello,
    I have a JTable, and with the print() method, I'm able to bring up the Print dialog and successfully print the contents of the table. Example:
    myTable.print( JTable.PrintMode.FIT_WIDTH, myHeaderFormat, myFooterFormat );This works great, but one small detail I'd like to change is the icon in the top-left corner of the dialog. The icon is currently the default Java coffee cup icon, while the rest of my application uses my custom icon. I couldn't find any documentation in the API or tutorials that Java has listed which shows how to change the icon, so I'm not even sure if it's possible (but why shouldn't it be?).
    My question is this: Is it possible to change the default icon in the print dialog? Or do I have to either make my own print dialog somehow, or use a third-party print dialog?
    Thanks

    tjacobs01: Appreciate the assistance (despite your sass). I've already searched the API, tutorials, and this forum. I'm already well aware of the setIconImage() method for JFrame -- after all, that's how I set the icon for my other frames as I previously mentioned. However, I want to set the icon for the print dialog called from the print() method of JTable.
    How would I use setIconImage() for the print() method of JTable? The print() method returns a boolean value, not a JFrame, so I'm just not sure how to implement what you're saying.
    Thanks

  • How to change the icon of coffee on the titile bar

    Hi!
    I am having this problem that
    how to change the icon of coffee on the titile bar
    if someone know how please respond
    Asif

    Next time please post your question in the appropriate forum, since this forum discusses the Java3D API.
    The answer is use the Frame.setIconImage method.

  • How to change the Icon for a JFileChooser ?

    Has anyone figured out how to change the icon for an instance of JFileChooser from the coffee cup to something else?
    I'm on 1.4
    Thanks,
    Ken

    Never mind. I figured it out.
    You have to use an instance of JFrame in the call to showXxxxDialog(Component c). Set the icon of the JFrame to what you want the JFileChooser's icon to be.

  • How to change the web icon in the browser window

    i have created my site and cant find how to change the icon in the browser window (like they have done at the top of this page with the Adobe icon before the  Adobe Forums: text )would anyone be kind enough to give me some help??

    Do you mean the favicon?
    I only just recently learned about favicons myself - so if you google the word you'll get lots of resources for it. Bascially it's a little icon file that sits at the root directory of your site that the browsers find and display for you. As long as the file is there (*named favicon.ico*) it will show up automatically if I'm correct in what I've read.
    Is this the thing you're looking for? (edit: it also shows up in your bookmarks list in firefox - if this is the one you want that's the favicon file)

  • How to change the JFrame's titlebar's icon's context menu's font?

    Hi everyone.
    I want to know how to change the font of the text that appears in the context menu originated from right clicking at the icon that's all the way to the left in the titlebar of JFrames that use the default look and feel for decoration (JFrame.setDefaultLookAndFeelDecorated(true); // which uses the Metal L&F, Ocean theme).
    I searched around and found nothing. I thought that I could use what I learned at https://forums.oracle.com/message/9221826, but I couldn't come up with something that worked.
    Thanks in advance.t

    After some more messing around, I finally made it! I like Java so much that it makes me a bit sad how hard it is to do stuff like this. Anyway, I found a method here to recursively change the font of all components from a JFileChooser, but it doesn't work on the JPopupMenu (now I know the name) that pops up from the titlebar's icon. So I messed around with that method, used some casting, and was able to change the JMenuItems' font:
    public static void setSubComponentFont (Component comp[], Font font) {
        for (int x = 0; x < comp.length; x++) {
            if (comp[x] instanceof Container) {
                setSubComponentFont(((Container)comp[x]).getComponents(), font);
            try {
                //comp[x].setFont(font);
                if (comp[x].toString().contains("JMenu")) {
                    for (Component y : ((JMenu)comp[x]).getPopupMenu().getComponents()) {
                        if (y.toString().contains("JMenu")) {
                            y.setFont(font);
            } catch (Exception ex) {}
    I was inspired to use .toString().contains() by this thread.
    I also did this with nested loops, so the path to the menu items can be seen:
    for (Component a : frame.getLayeredPane().getComponents()) {
        System.out.println(a.toString());
        if (a.toString().contains("MetalTitlePane")) {
            for (Component b : ((Container)a).getComponents()) {
                System.out.println(b.toString());
                if (b.toString().contains("SystemMenuBar")) {
                    for (Component c : ((Container)b).getComponents()) {
                        System.out.println(c.toString());
                        for (Component d : ((JMenu)c).getPopupMenu().getComponents()) {
                            System.out.println(d.toString());
                            if (d.toString().contains("JMenu")) {
                                d.setFont(font);
    Every System.out.println() gives a hint to what should go on the following if condition, so they should be used one at a time. This doesn't work for the JFileChooser's title font though. When I have time I'll either look further into it or ask another question.
    So, if someone else needs it like I did, here it is. As a tip, System.out.println() and .toString() are your friends! That's how I learned what was contained in each object, and what path I needed to take to get to the objects of interest.
    Thanks anyway!

  • How to change the icon of the Frame(JFrame)

    my doubt is,
    how to change the by default icon(sun coffee cup) icon of a frame to a small user defined icon.
    thank you,
    Ranjith.M

    Take a look at this method:
    http://java.sun.com/j2se/1.4/docs/api/java/awt/Frame.html#setIconImage(java.awt.Image)

Maybe you are looking for

  • Creation of XML dynamically helppppppppppppp

    hello all i had developed an application in java .corresponding to that i want to create xml that take its value of attributes dynamically Can anybody help me out how to proceed to this problem thanks in advance bye

  • Items not appearing in cascading dynamic list (not maximum items)

    Hi I am having an issue with cascading prompts in Crystal Reports 2008.  I have two cascade levels in this report.  The report worked fine for a few months until we recently noticed some items were not showing up on the first list.  In the database,

  • Transaction propagation from Oracle 8i or 9i to OC4J V2?

    We have a very large Oracle 8i (8.1.6)-based application that uses PL/SQL exclusively for business logic; there are a few hundred user packages. We are considering a gradual introduction of EJB's into the mix, most likely via OC4J V2 when it is relea

  • Batch file and JSP

    how can i call a batch file from JSP ??? possible ?

  • I am in shock my N85 recognized by the NSU !!!! Fi...

    Wow you can imagine how surprised I was when a few seconds ago i nonchalantly connected for the n-th time my n85 to the NSU and it came back recognizing my phone as N85 with the latest firmrware which is 10.045 () WOHO, we are going to get us a nice