Changing the defult icon in the JTree , is it possible?

Hi
is it possible to change the defult icon in the JTree to a picture that i create?
thanks

There's another way of doing this using UIManager.put(...) on
{color:#0000ff}http://www.java2s.com/Code/Java/Swing-JFC/Installscustomicons.htm{color}
And don't you think you should have awarded the Dukes assigned to your recent threads, and recorded your thanks in both rather than only one of them?
db

Similar Messages

  • Changing the Jtree node value

    hi,
    I have created a JTree node and i want to change the nodes string.
    say for example from "child1" to "newchild1". Only the text displayed on the tree shoud be changed and the new value is got from a text box.
    uma

    You can change the value of a path using valueForPathChanged of the TreeModel:
    tree.getModel().valueForPathChanged(path, str);

  • Changing the scree size.. possible?

    I finished my game... I'm now doing the small stuff, I want to make sure that the screen size is perfect with the game so I want to change the screen size (to 1024X768)
    I looked in the API at the Toolkit and Properties classes, I've googled for about 15 minutes but I couldn't really find anything... maybe it's just not possible to change the screen resolution...
    Does anyone here know how to do it?

    Alright.. if anyone cares, I just changed all the GUI so that it will be compatible with all screen resolutions by doing everything in scale/proportion to the screen
    I'm actually glad that I didn't find the answer, this seems like a much better solution

  • Changing the safari keyboard shortcuts possible?

    So I was wondering if anyone knew a way to change the shortcuts on the keyboard for Safari, specifically I would like to change the "Command-R" function which reloads the page to "F5". I have gone throught the whole keyboard shortcuts tab in system prefs (System Preferences > Keyboard & Mouse > Keyboard Shortcuts) and added the safari menu command and my shortcut I wanted to add yada yada yada and nothing ever works no matter how many times I try or what I change. I am not sure whether or not the fact that I am the Apple Wireless keyboard has anything to do with this but I doubt it does. Any ideas?

    Hi
    I had to quit safari & reopen before it worked, but yes, it does work with F5.
    Did you choose Safari from the applications list in sys prefs-keyboard & mouse-keyboard shortcuts?
    then type Reload Page ( including the capital letters ) ? in the Menu Title box?
    then leave keyboard prefs?
    Let us know how you get on
    Andy

  • Changing the "Preffered DNS Server" possible?

    hi guys,
    I'm trying to do something pretty obscure here so bear with me:
    I have a Dreamcast and want to go online with it. I've order a Broadband Adapter for it (Yes they did make them for it!) and in order to connect to the private servers (as the official Sega servers went offline in 2007) you need to change the preferred DNS server within the Dreamcasts browser software.
    I tried it on BT Dial Up via the Dreamcasts standard Dial Up Modem but it wouldn't work and upon phoning BT support they told me it wasn't possible.
    So all I want to know is can it be done on Broadband/infinity? I just want to point the DC to another server, not my whole network. It won't mess anything else up right? Thanks for your patience!
    Tony

    The default gateway should be left at 192.168.1.254 (Home Hub default) as that is the path to the Internet. If you set it to obtain the IP address automatically, then the default gateway will be set automatically. I am assuming that you are not using static IP addresses on your network.
    The DNS should be set to manual, and you will need to enter the recommended DNS addresses (normally two of them)
    If it is left to automatic, then it actually defaults to 192.168.1.254, which is not what you want.
    There are some useful help pages here, for BT Broadband customers only, on my personal website.
    BT Broadband customers - help with broadband, WiFi, networking, e-mail and phones.

  • How to change the letter on external HDD

    My external hard drive was originally on the F drive and with this I had all my iTunes music too. However, for some reason, my computer has stopped recognizing the F drive; the following message is displayed when trying to open this drive:
    "The drive or the network connection that the shortcut 'F Drive.ink' refers to is unavailable. Make sure that the disk is properly inserted or the network resource is available, and then try again."
    The problem I now have is that the external hard drive is now the G drive and iTunes doesn't seem to recognize the path (G:\iTunes) I have told it to use, i.e., my music is not loading properly and only a small fraction is playable.
    Can anyone help me on this matter?

    Hi
    I would recommend changing the external drive letter (G:) back to F.
    Do you know how to do this?
    After the external HDD was connected you should access the disk management and there you will see the HDD (single partitions) and the other drives.
    Then you should mark the external HDD and should change the letter to F.
    Possibly the F letter was reserved for another drive.
    In such case you have to unlock the F letter by assigning another letter to the drive which uses the F letter.
    For details please check the Microsoft knowledge document;
    [How to change drive letter assignments in Windows XP|http://support.microsoft.com/kb/307844]

  • Change the backend doc type from PR to PO in BADI BBP_TARGET_OBJECTS.

    Hi,
    We have followed below approach for backend document type determination.
    1. A custom function module contains the logic to determine the backend document type of a Shopping cart line item. THis function module, performs many checks and hence cannot be called in any BADI that is executed in Foreground.
    2. I am using BADI BBP_TARGET_OBJECTS to change the follow document type by calling the custom function module.
    Issue here is, if the backend document type of a line item is Purchase requisition (2) by SAP standard, and if I try to change it to Purchase order, it gives run time error and ends up in creation of Purchase order.
    After further investigation I found that this line item (with default backend doc type as 2) has a desired vendor. If we change the desired vendor of this line item to fixed(To Partner function 19 from partner function 39), it allows us to change the doc type from Purchase requisition to purcahse order in BADI BBP_TARGET_OBJECTS.
    But changing the partner function is possible only in BBP_DOC_CHANGE BADI, and I cannot call the custom function module there, as it may impact the performance.
    Is there any other way, I can change the partner function in any of the BADIs called in background?
    Or Is there any way by which I can change the backend document type from PR to PO in BBP_TARGET_OBJECTS?

    Hi Parab
    if you swaping 39 to 19 viadoc change badi
    REQUESTER has a control on Purchase ORDER Vendor and BUYER lost a control so your business has to decide.In this case procurement department lost their control.
    Fixed vendors are like inforecord and contract negotiated for best price ..
    Muthu

  • Change the tax code issue in fs00

    Dear Sapgurus,
    in production i create one g/l code user id : mydr123 T code is fs00 g/l code number 300000 account name is sales, account group is p&l and account currency inr, tax category ">" , now i am going to change tax category * while saving the g/l system is not accepted  itsshowing error message "     1) Changing the tax code not possible; account has a balance
    2) The data contains error, you cannot save, but if i choose"-" its accepted please tell me
    Regards
    Myfriend

    Hello MyFriend,
    If you wish to make a direct posting to a tax account you must have
    the gl account active in transaction MIRO.
    Please review the online documenation located via help -> sap
    library -> materials management -> logistics invoice verification ->
    Direct postings -> direct posting to gl account
    here you can see the setttings for same in customizing are
    Setting in Customizing for Logistics Invoice Verification
    As per error message FH081, it arises only if the account had perviously
    the tax category ">" or "<". They cannot be changed anymore
    if the account has a balance. The tax categories "-", "+", "*" etc.,
    can be changed, you will get in FS02 only the warning FH011.
    Please check GL account xxxxxx with FBL3N, to see if there is a balance
    still left. To make the account balance zero, you might try transaction
    FB41, this allows you to post directly a balance to the Tax gl account
    even when the flag "Post to automatically" is set.
    I hope this helps
    Regards
    Ray

  • Change the  sales order reason for rejection for line item

    Hi,
    i want to change the  sales order reason for rejection for line item.
    iam using bapi_salesorder_change.but i unable to change the sales order.
    if possible please provide me what are the fields necessary  for changing
    sales order reason for rejection for line item.
    Regards,
    Suresh

    This is the standard config to supress printing on the rejected item. Are you using standard programs or customised ?

  • GT70, need to change the keyboard

    Hi all.
    Now that i've changed the HDD im ready to fully use my PC.
    I feel much confy with Win7.
    Well, id like to change the keyboard, and if possible with an ITALIAN.
    Yes, cause i use accented letters, that in english are missing.
    Which replacepart should i search for?
    Maybe i have to talk directly with MSI?
    Rod

    ask msi at >>How to contact MSI.<<
    or your reseller

  • Changing Certain Node Icons

    I can't seem to figure out how to change certain node icons in a JTree due to a 3 letter string. For example 2 nodes one saying "Intro" the other say "Edit - SEC" - the one with SEC has a different icon to "Intro"
    MyRenderer class, here the code which is used to check the string of the node......
    if(leaf && isSecuredFile(value)) {
    setLeafIcon(leafSecuredIcon);
    setToolTipText("This file is Secured Access Only");
    else {
    setToolTipText(null);
    return this;
    protected boolean isSecuredFile(Object value) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
    NodeRecord nodeInfo = (NodeRecord)(node.getUserObject());
    String nodeTitle = nodeInfo.NodeRecord;
    if(nodeTitle.indexOf("SEC") >= 0) {
    return true;
    return false;
    }// MyRenderer class
    I tried the above piece of code, and it compiles with no errors but when I try to run the applet it comes up not initialised with the following....
    java.lang.NoClassDefFoundError: MyRenderer
    at firstPanel.<init>(firstPanel.java:99)
    at JNavigator.jInit(JNavigator.java:55)
    at JNavigator.init(JNavigator.java:40)
    at sun.applet.AppletPanel.run(AppletPanel.java:344)
    at java.lang.Thread.run(Thread.java:484)
    However if I take out this code it works fine but I need to be able to assign different icons depending on the node title string. Therefore I need help.

    here's the whole class, if thats any help...
    public class MyRenderer extends DefaultTreeCellRenderer {
    ImageIcon leafIcon;
    ImageIcon leafSecuredIcon;
    public MyRenderer() {
    leafIcon = new ImageIcon("Leaf.gif");
    leafSecuredIcon = new ImageIcon("LeafSecured.gif");
    public Component getTreeCellRendererComponent(JTree tree, Object val, boolean sel, boolean expand, boolean leaf, int row, boolean hasFocus) {
    super.getTreeCellRendererComponent(tree, val, sel, expand, leaf, row, hasFocus);
    // sets Icons
    setLeafIcon(leafIcon);
    setClosedIcon(new ImageIcon("Folder95C.gif"));
    setOpenIcon(new ImageIcon("Folder95O.gif"));
    // set Expansion icons to + -
    ComponentUI treeUI = tree.getUI();
    if(treeUI instanceof BasicTreeUI) {
    ((BasicTreeUI)treeUI).setExpandedIcon(new ImageIcon("minus.gif"));
    ((BasicTreeUI)treeUI).setCollapsedIcon(new ImageIcon("plus.gif"));
    // decides who icon to use
    if(leaf && isSecuredFile(value)) {
    setLeafIcon(leafSecuredIcon);
    setToolTipText("This file is Secured Access Only");
    else {
    setToolTipText(null);
    return this;
    protected boolean isSecuredFile(Object value) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
    NodeRecord nodeInfo = (NodeRecord)(node.getUserObject());
    String nodeTitle = nodeInfo.NodeRecord;
    if(nodeTitle.indexOf("DOM") >= 0) {
    return true;
    return false;
    }

  • How to change the java cup icon for all the JFrames?

    Hi,
    I would like to know if I can change the Java cup defult icon that appears in the upper left corner of the JFrames in one time, instead of setting the JFrame's icon in every created JFrame.
    Regards,
    Gabriel

    Then don't set the parent to null. If you don't want a parent, just set it to
    JOptionPane.showMessage(new IconFrame(), ...
    [\code]
    where IconFrame extends JFrame and sets the icon in it's constructor.  The optionpane will then use the icon from it's parent frame.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Hide the expansion icon on a jtree.

    I need to hide the expansion icon (the "+") on a jtree.
    I tried to use DefaultTreeCellRenderer and the L&F options, but they hide all of the "+" icons of the tree. I need to hide the icons depending if the node has no-leaf icons.
    Thanx.
    pmadridb

    hi,
    you can change the property of common section view attribute. which is default in month. if u use input date component , i think you can overcome your problem..

  • How can i change the particular node color in Jtree?

    I have constructed the tree.i dont know how to set the color for the particular node then how can i change the particular node icon depends on some conditions like if we will give the input whether it is available in jtree that node icon only changed.Anyone please help me as soon as possible.

    hi,
    i saw that tutorial.from that book i dont get the particular node cell renderer.i got a cell renderer for tree only.i attached my code in this mail.pls see and help me if u will do
    mport pack.Prop;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Font;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.Properties;
    import java.util.Set;
    import java.util.StringTokenizer;
    import java.util.Vector;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.UIManager;
    import javax.swing.text.Position;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.MutableTreeNode;
    import javax.swing.tree.TreeCellRenderer;
    import javax.swing.tree.TreePath;
    public class ReadProperty3 extends JFrame{
    String str,key;
    static JTree tree;
    static Vector v;
    StringTokenizer st;
    static DefaultMutableTreeNode root;
    DefaultMutableTreeNode t;     
    public Object[] o;
    public static void main(String[] args) throws IOException {
    ReadProperty3 r = new ReadProperty3();
    Prop p=new Prop();
    JFrame f=new JFrame();
    p.show();
    Object[] o=v.toArray();
    int startRow = 0;
    String prefix =p.s;
    TreePath path = tree.getNextMatch(prefix, startRow, Position.Bias.Forward);
    //if(prefix.equals(root.getChildAt(0).toString()))
    if(prefix.equals("2000"))
         System.out.println("Node 2000 found");
         else if(prefix.equals("3000"))
              System.out.println("Node 3000 found");
         else if(prefix.equals("4000"))
              System.out.println("Node 4000 found");
         else
              System.out.println("Node not found");
         for(int i=0;i<v.size();i++)
              //((DefaultTreeModel)tree.getModel()).reload();
              DefaultTreeCellRenderer ren=(DefaultTreeCellRenderer)tree.getCellRenderer();
              Icon openIcon = new ImageIcon("C:/apache-tomcat-5.5.12/webapps/jsp-examples/images/execute.gif");
              Icon closedIcon = new ImageIcon("C:/apache-tomcat-5.5.12/webapps/jsp-examples/images/execute.gif");
              Icon leafIcon = new ImageIcon("C:/apache-tomcat-5.5.12/webapps/jsp-examples/images/read.gif");
              if(o[0].equals(p.s))
                   ren.setBackgroundSelectionColor(Color.MAGENTA);
                   ren.setBackgroundNonSelectionColor(Color.YELLOW);
                   //ren.setTextSelectionColor(Color.YELLOW);
                   //ren.setTextNonSelectionColor(Color.BLUE);
                   ren.setClosedIcon(closedIcon);
                   ren.setFont(new Font("Impact",Font.ITALIC,14));
              else if(o[1].equals(p.s))
                   ren.setLeafIcon(leafIcon);
                   ren.setFont(new Font("Impact",Font.ITALIC,10));
                   UIManager.put("Tree.leafIcon", leafIcon);
              else if(o[2].equals(p.s))
                   ren.setOpenIcon(openIcon);
                   ren.setFont(new Font("Dialog",Font.BOLD,9));
    public ReadProperty3(){
         super("JTree With Properties");
         try{
    int c = 0;
    while(c == 0){
    c = 1;
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    System.out.print("Enter file name which has properties extension :");
    str = bf.readLine();
    File f = new File(str + ".properties");
    if(f.exists()){
    Properties pro = new Properties();
    FileInputStream in = new FileInputStream(f);
    pro.load(in);
    System.out.println("Key: " + pro.keySet());
    System.out.print("Enter Key : ");
    key = bf.readLine();
    String p = pro.getProperty(key);
    st = new StringTokenizer(p,"=,");
    root=new DefaultMutableTreeNode(key);
    v=new Vector();
    while(st.hasMoreTokens())
         String val=st.nextToken();
         v.add(val);
         o=v.toArray();
         System.out.println(val);
         t=new DefaultMutableTreeNode(val);
         root.add(t);
         tree=new JTree(root);
         tree.setEditable(true);
         JScrollPane jp=new JScrollPane(tree);
         // tree.setCellRenderer(new CellRenderer());
         Container content=getContentPane();
         content.add(jp,BorderLayout.CENTER);
    setSize(250,275);
    setVisible(true);
    addWindowListener(new ExitListener());
    else{
    c = 0;
    System.out.println("File not found!");
    catch(IOException e){
    System.out.println(e.getMessage());
    }

  • 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

Maybe you are looking for

  • Aperture will not add photos to existing Facebook Albums

    I am currently using Aperture 3.4.5 .. I have a host of over 50 existing albums on my facebook and I regularly add content to them without any issues what-so-ever, however, two days ago, I tried to add 4 photos to an existing alblum using the normal

  • Call to a Russian number blocked by Skype.

    Hello, I"m also getting calls to a mobile phone blocked.  I'm calling from the USA and trying to reach Russia.  I have a subscription, so money is not the object.  What IS the problem?

  • SBO Service Manager button disabled

    Dear Experts, Hi, I try to run SBO Service Manager, it used to have dropdown drill with some options like "SBO Backup","SBO DI Server" and "License Manager". But now I see the dropdown no longer has those 3 options, but only blank and the button is t

  • Netpoint 5.9.0 and Payflow Pro

    I'm sorry if this has been asked before - i've been looking around for more information but have not found much as of yet. Simply put, I am trying to get Netpoint working with Payflow pro, and I'm not entirely sure what steps I need to follow to do s

  • Need help dissecting Intel GM45 regression

    Performance regression on Gen4 Intel GM45 GMA4500MHD https://bugs.freedesktop.org/show_bug.cgi?id=77372 Suspected components: graphics stack Gnome shell Note: The maintainer could not reproduce the bug on his Intel GM45 system. It's beyond my skills