Icons and JTree

Hi,
How can I produce my own icons to appear next to nodes in a JTree. At the moment I am using gifs I got elsewhere, but I want to design my own for custom display.
Thanks for any help,
Claire

here you are to replace the cirle or plus icon with icons homemade
^  ComponentUI ui = tree.getUI();
          if (ui instanceof BasicTreeUI) {
               ((BasicTreeUI)ui).setExpandedIcon(new ImageIcon(images.getString("TREEMIN")));
               ((BasicTreeUI)ui).setCollapsedIcon(new ImageIcon(images.getString("TREEPLUS")));
[\code]
greetings Sven                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • How to desable default close icon in jtree

    how to desable default close and open icon in jtree.

    Hi,
    On Windows it is Edit>Keyboard Shortcuts...
    Create a duplicate set and disable/modify the keyboard shortcuts that you want
    Thanks!
    ps: please mark this post as Answered if this is of help to you

  • Unable to display blinking icon for JTree

    I am unable to see blinking icon for JTree node. If I use any other image which is not blinking, then I am able to see icon.
    If blinking image is used, it shows blank image.
    Please refer to following code.
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.net.URL;
    import javax.swing.ImageIcon;
    import javax.swing.JApplet;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    public class TreeApplet extends JApplet {
    JTree tree;
    DefaultMutableTreeNode root;
    DefaultMutableTreeNode node1;
    DefaultMutableTreeNode node2;
    DefaultMutableTreeNode node3;
    DefaultMutableTreeNode node4;
    private ImageIcon errorIcon = null;
    private URL resource = null;
    private static final long serialVersionUID = 1L;
    public void init() {
         errorIcon = loadIcon("images/errorBlink.gif");
         root = new DefaultMutableTreeNode(new ProcessInfo("root", "error"));
         node1 = new DefaultMutableTreeNode(new ProcessInfo("Node1", "info"));
         node2 = new DefaultMutableTreeNode(new ProcessInfo("Node2", "warn"));
         node3 = new DefaultMutableTreeNode(new ProcessInfo("Node3", "debug"));
         node4 = new DefaultMutableTreeNode(new ProcessInfo("Node4", "error"));
         node1.add(node2);
         node3.add(node4);
         root.add(node1);
         root.add(node3);
         setLayout(new BorderLayout());
         tree = new JTree(root);
         tree.setCellRenderer(new TreeRenderer());
         add(new JScrollPane((JTree) tree), "Center");
    private class TreeRenderer extends DefaultTreeCellRenderer {
         private static final long serialVersionUID = 1L;
         public TreeRenderer() {
              this.setBackgroundSelectionColor(Color.lightGray);
              this.setBorderSelectionColor(Color.BLACK);
         public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf,
              int row, boolean hasFocus) {
              super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
              setIcon(getStatus(value));
              return this;
         private ImageIcon getStatus(Object value) {
              DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
              ProcessInfo nodeInfo = (ProcessInfo) node.getUserObject();
              String status = nodeInfo.getStatus();
              if ( status != null ) {
              if ( status.equalsIgnoreCase("error") ) {
                   return errorIcon;
              return null;
    private ImageIcon loadIcon(String name) {
         ImageIcon icon = null;
         resource = this.getClass().getResource(name);
         if ( resource != null ) {
              icon = new ImageIcon(resource);
         return icon;
    }

    1. Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.
    2. A renderer is just a "rubber stamp" used to paint on the table/tree/list/whatever. You can't display animation in an ImageIcon by setting it to a renderer. Since the JLabel subclass used as the renderer isn't a part of any visible component hierarchy, the icon won't be refreshed with new frames.
    db

  • I click on my g-mail icon and now it won't open.  Why?

    I click on my g-mail icon and it refuses to open - respond?

    Try reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: Data will not be affected.

  • I downloaded the latest update for my ipad and now it won't open.  the screen shows the itunes icon and a pic of the usb cable

    I downloaded the latest update for my ipad and now it won't open.  the screen shows the itunes icon and a pic of the usb cable

    That message means that you have to restore the iOS software because something went wrong. Follow the instructions here. I hope that you have a backup.
    iTunes: Restoring iOS software - Support - Apple

  • Lost SMS Icon and get error message Uncaught exception Index 20 = 20

    Dear All
    I have lost my SMS Icon and looking at previous forums have carried out the following techniques which do not work
    1. I have gone to Messages - Options - SmS & Email Inboxes - Seperate but this does not solve anything
        Within this step i have switched off phone taken out battery etc...
    2. I have gone to Applications - menu - "show all" but my SMS icon cannot be found
    Just to note even when i go to Messages - View Folder - SMS Inbox .....i get the error message again  
    Uncaught exception Index 20 > = 20
    Anyone able to help ? Would be greatly appreciated.
    Thanks

    You may have already figured out your fix - but yesterday I went thru the same thing with my son's phone.  Overnight he lost his SMS & MMS Icon and was receiving Uncaught Exception Index 28 >= 28.  I called Verizon Tech Support and was told there was a corrupt file in the calendar. 
    We backed up the phone using the Desktop Manager - performed a security wipe and restored his phone. 
    His phone is back up and running as it should be.  Hope this helps.
     Laura

  • The app icons and font on my iPhone 4 just went to massive making it difficult to even scroll how can I change it back, where do I go which menu? Thanks in advance

    The app icons and font on my iPhone 4 just went to massive making it difficult to even scroll how can I change it back, where do I go which menu? Thanks in advance

    Next time you accidentally use 3 fingers it will zoom again. Unless you need the feature you're better to turn it off

  • Apple TV does not work after trying to update software. Main light keeps blinking and on the screen shows itunes icon and a usb cable. What does that means?

    My Apple TV does not work after trying to install the new software update. The main light keeps blinking rapidly and on the screen it shows the itunes icon and a USB cable. What does that mean?

    The Apple TV is in recovery mode. Try to restore the Apple TV. Follow the link for instructions on the restore process.
    http://support.apple.com/kb/HT4367

  • I have installed Adobe Premiere Pro cc on my laptop, but I cant find a way to start the program. No Icon, and it is not showing up in the start meny. It is showing up in add/remove programs, but nt anywhere else.

    I have installed Adobe Premiere Pro cc on my laptop, but I cant find a way to start the program. No Icon, and it is not showing up in the start meny. It is showing up in add/remove programs, but nt anywhere else.

    If you are using a Mac, simply hit Command-Spacebar to bring up Spotlight Search.  Begin typing the name of the application and when you see what you are looking for, press enter.  You should get a hit by the second or third letter you type.  Great way to launch apps on computers that you are not familiar with.
    Windows 7 and 8 should have something similar.  I think you simply press the Windows key and begin typing.  Press enter when you see a match.
    Both Mac and Windows search tools can be customized to search for applications, files, emails and so forth.  For Windows, look for Taskbar and Start Menu Properties.  For Mac, go to Preferences Spotlight.  Turn off items you know you won't need to speed up searches.
    Make Windows 7 Start Menu Search Find Your Applications Faster

  • Photoshop CC icons and text are too small: how to adjust so they're readable? [was: Joanne]

    I have just downloaded Creative Cloud on a new computer.  The new photoshop icons and text are too small for me to see or work with.  I cannot seem to adjust this so its "useable"

    Hey Bob,
    Ive put feature requests for this in before and I know many others have as well. Is there any way to see if Adobe is actually working on this? I dont really consider this a feature request, it should be standard with the software. A feature request would be something like creative cloud libraries, not the ability to make font sizes and icons bigger.

  • IMac display issues: black icons and folders, doubled up files in finder windows, programs won't update

    HELP!
    I'm hoping someone can help with my iMac 27" purchased in 2010.  From a previous discussion I started a year ago, I have had virtually nothing but trouble with it.  After the internal hard drive crashing, I was able to install OS X on an external drive and used it for a good 8 months to drive my iMac and I took it to an expert who has replaced it with a 3tb HDD, but at some point the display has gone crazy.  I am not certain if it is hardware, i.e. graphics card or video but I'll describe the symptoms and add some pics to see if anyone has seen this before and knows what the problem may be.
    1.     90% of the screen was covered with white with just a portion of the desktop showing through.
            (This happened when I tried to reinstall OS X on the old HDD and the new one, but didn't happen when using OS X install disc)
    2.     Files, folders, photos and some icons on the dock go black
    3.     Files and photos double up when in Finder.  When I'm viewing photos, it shows them but all the previous panes and the photos are jumbled behind the
            photos.
    4.     Anything I open in Preview is completely black, but ColourSync Utility opens everything fine.
    5.     Programs won't update.  They will download onto my iMac but won't update.  Some say, because I don't have OS X 10.6.8 others just won't open.
            Including Google Chrome, opens with two tabs open but when I open a third tab the rainbow wheel just turns.  Skype won't open just gives a failure
            report.
    6.     10.6.8 Update Combo downloads but when I restart the screen is covered in white - as in 1. and I have to reinstall OS X 10.6.2 to get the screen to               clear but then all the above problems continue.
    7.     Sometimes videos don't display in Youtube, or the entire page other than the video player is covered in rainbow lines.
    8.     Some buttons are blacked out on selection pages, i.e. system preferences, or saving screens
    9.     Photos opened in FB go upside down and flicker all over the page as my mouse runs over them.
    10.   Photos won't upload into internet editing programs.
    I can't find anyone who has had the same issue in all of the discussions I've looked at, but it sounds like I have a video problem, but I wondered if it might be a software problem with flash or something.  Or I have something malicious on my computer.
    I also have an iphone 5 that faulted with the iTunes and USB icons and won't fix after trying one of those R-Sims, and I wondered if somewhere along the line it may have even had a virus/trojan/malware that has infected my external drive and then my internal drive.  A reason I have thought that is because I have used my daughter's MacPro laptop and plugged in my external drive and I noticed the windows in hers were starting to do the same thing.
    And on top of all that, my fans didn't work for over a year and I had to place an external fan at the back of the computer or it would overheat and shut down, but after resetting the SMU it started working again, but it is very noisy. I have tried to download SMC Fan Control and although it downloads to the HDD, it won't open.
    Sorry its such a long post, I do hope with all of this information someone can help me.
    Thanks so much.

    HI and Welcome to Apple Discussions...
    *Soon after, I installed Quake Wars, L4D 1, 2, Mass Effect 2, Need For Speed: Undercover, Mozilla Firefox and *Sophos Enterprise AV*. Approximately a week after installation, I began to experience malfunctions varying greatly*
    Macs get grumpy when running anti virus software. Disable or completely uninstall Sophos A/V and see if that makes a difference. A/V software on a Mac will slow the drive down more and more as time goes on.
    Also, check the vendor sites for each 3rd party software you installed to make sure they are compatible with 10.6.x
    The "hard reboots" are a result of the system freezing due to incompatible or outdated software.
    Carolyn
    Message was edited by: Carolyn Samit

  • When I turn on my iMac it comes up with the icon which I then log into. The password works and I then get the apple icon and the spinning wheel. After a minute it turns into a prohibited icon. If I log on the guest icon I get to Safari. Help!

    When I turn on my iMac it comes up with the login icons which I then choose and log into. The password works and I then get the apple icon and the spinning wheel. After about a minute the Apple icon turns into a prohibited icon. However, if I log in under the guest icon, I can access the wifi and get to Safari. I really don't know what to do next. Any help would be gratefully appreciated.

    Are you running any A-V? If it's an iMac 21.5, I don't think you're running Leopard, 10.5. Probably at least Snow Leopard, 10.6. This is the Leopard forum.
    This article says meant for 10.3.9 and eariler, but contains some still useful suggestions.
    http://support.apple.com/kb/TS1411
    Try a Safe Boot. Shift at the startup chime and expect a much longer time to boot. This will bring you to a login screen with "Safe Boot" in red.
    Look at this as well.
    http://support.apple.com/kb/TS1417

  • Date/time icon and other movable icons on menu bar cannot be loaded on startup,but it works if manually loaded

    Strange things happened since my mbp 13' (MD-101) was upgraded to 10.8.4 ----------- time icon, battery icon,and language icon (these icons can be moved when held Command key and drag) cannot be loaded on startup, but they still can be loaded when you get into System Preferences and manually  turn them on, as well as iStat Menus
    However, some other icons didn't bother, things like BetterTouchTool, NewsBar. They are immovable!! I guess it is the key factor that the icon is movable or not making the difference.
    Someone please lend me a helping hand?
    I've attached some pictures in order to make my situation easier to be understood.
    these icons can't be loaded on my loggin in.
    but they can be loaded manually
    however, these icons will be loaded on startup
    I've almost despaired to resolve it . Thanks for your help!

    I have a similar issue. When the computer goes into "Hibernate" mode -- that is, it loses power while sleeping and it writes the contents of it's memory to disk in order to boot into that exact configuration when woken up -- many of my icons when Apple-Tab'ing to another application appear as static. They look like a slightly colorized version of the "static snow" you see when tuning into a station that doesn't exist on a UHF antenna television. Also, icons in Chrome such as web sites "favorite icons" or favicon.ico (the icons that appear in the URL bar and bookmarks) will be scrambled in the same fashion , at first , until the actual icon is loaded.
    Between this, my menu bar and finder icons not displaying, and being unable to boot into safe mode, I'm getting quite ******. I have no idea what the **** is going on with my Macbook Pro. The issue of the scrambled icons actually existed prior to installing an SSD and doing a fresh install of Mountain Lion. I may end up throwing in the towl and re-installing the operating system but I'm sure SOMETHING will happen. It seems the latest update, 10.8.2, is absolute garbage.
    What the ****, Apple? And I really don't want to take the computer to the morons at the Apple Store. They are not "geniuses" by any measure.

  • I'm trying to hook up my Macbook Pro to my TV. I'm using the 'mini-display port to female HDMI" adapter. all i can see is my desktop background. no folders or icons and when i play a movie it goes blank.

    I'm trying to hook up my Macbook Pro to my TV. I'm using the 'mini-display port to female HDMI" adapter. all i can see is my desktop background. no folders or icons and when i play a movie it goes blank.

    Drag applications from your main desktop off the right side of the screen and they will appear on the TV.  This is the extended desktop mode. 
    Regards,
    Captfred

  • HT4623 I updated my ipad 3 with the ios7 update. Now the screen shows the itunes icon and a pic of the plug in (as to plug into itunes)  I can't get it to go away or to access my ipad.  Any hints?

    I updated my ipad 3 with the ios7 update.  Now the screen shows the itunes icon and a pic of the plug in (as to plug into itunes)  When I do this it wants to restore my ipad, which I have already done.  I can't get out of this screen.  Any hints on what to do next?

    Something went wrong with your update; you are in Recovery Mode.
    Follow step 1 to 6 closely to recover your iPad.
    http://support.apple.com/kb/HT1808
    Note: You may have to repeat the above a few times

Maybe you are looking for

  • Fbl3n from alv

    Hello everyone, I have arequiment where in i need to call and run fbl3n from a alv list. I already builded the alv list which contains 3 different G/L account numbers ,company code(same for all) and date field. Now When i click ( I made the G/l accou

  • How to Calculate the Stock aging report in BW

    Dear All, Please let me know the process to calculating the Stock Aging report in BW. And what are date field need to be consider and what are customer exits used to populated different agings in Stock like 0-30 days etc. Thanks Regards, Sai

  • How to reset password if you can't boot from DVD?

    I just bought a second external disk drive and installed Leopard on it. When it asked me if I wanted to import my information from my internal drive, I said OK, not realizing that since I had a blank password on this drive (running 10.2.8), that woul

  • One SAP R/3 to Multiple Business One (B1I) Sites

    Hi, I would really appreciate your assistance. I would like to confirm the various settings when you have one SAP R/3 system connected to multiple (3) Business One systems with B1i. In SAP R/3 we have created the following: Logical System: B1I00 Firs

  • How to get rid of border in the RowSetBrowser

    I use the RowSetBrowser object with rounded corners option switched off like this: RowSetBrowser.setUseRoundedCorners(false); This creates the web page where the records are shown within the table with ugly border. How to get rid of this table border