DefaultTreeCellRenderer & LookAndFeel UI

Hi All,
I need HELP!!!
I've found small bug in DefaultTreeCellRenderer Class and Look&Feel UserInterface.
After use DefaultTreeCellRenderer for JTree, SwingUtilities.updateComponentTreeUI() method can't change UI for initialised JTrees. For new created Trees all work properly.
The next small Application show this:
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.UIManager.*;
import java.awt.*;
import java.awt.event.*;
public class TreeRendererBug extends javax.swing.JFrame {
    static private boolean DEBUG = true;
    static private LookAndFeelInfo style[];
    private javax.swing.JMenu myMenuStyle = new javax.swing.JMenu();
    private ButtonGroup groupStyleMenu = new ButtonGroup();
    private javax.swing.JMenuBar jMenuBar1 = new javax.swing.JMenuBar();
    private javax.swing.JMenu jMenu1;
    private javax.swing.JPanel jPanel1 = new javax.swing.JPanel();
    private javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
    private javax.swing.JTree jTree1 = new javax.swing.JTree();
    public TreeRendererBug() {
        try {
            LookAndFeel curStyle=  UIManager.getLookAndFeel();
            style = javax.swing.UIManager.getInstalledLookAndFeels();
            if(style != null) {
                RadioMenuListener myRadioMenuListener = new RadioMenuListener();
                for(int ii=0; ii< style.length ;ii++) {
                    if(DEBUG) System.out.println(style[ii].getClassName());
                    JRadioButtonMenuItem jRadioMenuItem = new javax.swing.JRadioButtonMenuItem(style[ii].getName(),style[ii].getName()==curStyle.getName());
                    jRadioMenuItem.setActionCommand(style[ii].getClassName());
                    jRadioMenuItem.addActionListener(myRadioMenuListener);
                    groupStyleMenu.add(jRadioMenuItem);
                    myMenuStyle.add(jRadioMenuItem);
        } catch (Exception e) {
            System.out.println("ERROR: "+e.toString());
        jMenu1 = myMenuStyle;
        jMenu1.setText("UI Style");
        jMenuBar1.add(jMenu1);
        jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, 0));
        jScrollPane1.setViewportView(jTree1);
        jPanel1.add(jScrollPane1);
        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
        setJMenuBar(jMenuBar1);
        // !!!!!!  Bug in DefaultTreeCellRenderer !!!!!!!!
        // after comment this row, L&F will be set UI style to the all JTree elements
        jTree1.setCellRenderer(new DefaultTreeCellRenderer());
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                System.exit (0); }
        pack ();
    public static void main (String args[]) {
        new TreeRendererBug ().show ();
    class RadioMenuListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            if(DEBUG) System.out.println("Command "+ e.getActionCommand() );
            try {
                UIManager.setLookAndFeel(e.getActionCommand());
                SwingUtilities.updateComponentTreeUI(TreeRendererBug.this);
                TreeRendererBug.this.validate();
            } catch (Exception exc) {
                System.out.println("ERROR: "+exc.toString());
How change UI for initialised JTree with DefaultTreeCellRenderer ?
Thank you in advance,
AT.

Hi All,
I need HELP!!!
I've help my self ! :))))
after change style is it is necessary set new CellRenderer for JTree:
    class RadioMenuListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            if(DEBUG) System.out.println("Command "+ e.getActionCommand() );
            try {
                UIManager.setLookAndFeel(e.getActionCommand());
                SwingUtilities.updateComponentTreeUI(TreeRendererBug.this);
                jTree1.setCellRenderer(new DefaultTreeCellRenderer());
                TreeRendererBug.this.validate();
            } catch (Exception exc) {
                System.out.println("ERROR: "+exc.toString());
[//code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Changing LookAndFeel for a single component

    Is it possible to change the LookAndFeel for a single component (example FileChooser) ?
    regards,
    nirvan.

    In the case of a file chooser: you can use JFileChooser which will use the current look and feel or you can use the old AWT FileDialog which will use the system's look and feel. The FileDialog naturally has less things you can do with it.Thanks for thre reply. Actually I want to use windows look and feel for the JFileChooser dialog, because the metal look and feel does not display default icons associated with file type. Right now I am switching to the windows look and feel just before the JFileChooser code and then when file choosing is done, switching back to metal look and feel. Is that alright or does that have any potential implications ?
    regards,
    nirvan.

  • How can I set a "Metal" LookAndFeel to a JFrame

    How can I set a "Metal" LookAndFeel to a JFrame?
    I�m using the JDK 5. In my pc, has that theme. I�m using Win2k

    try{
            UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
            } catch (Exception e) {
                System.out.println("Error changing Look and Feel");
            }

  • LookAndFeel issue reloading an Applet in a Web page

    Hey all,
    I have an Applet that runs on a web page (loaded by servlets and JSP's using Tomcat 3.2.1 and Apache). I created my own LookAndFeel class and have a static function in the applet that sets the LookAndFeel to my new class. Everything works fine when the Applet is first loaded. However, when you exit the applet and then reload it, the custom LookAndFeel is gone and all I get is the default Metal. If I load the applet with appletviewer, I can reload it as much as I want and it always loads my LookAndFeel class.
    The static function is as follows
    /** Static initializer to set the LookAndFeel
    static {
    try {
    UIManager.setLookAndFeel(new MyNewLookAndFeel());
    catch (Exception e) {}
    I do not get any exceptions and like I said, everything works great when loaded with appletviewer.
    I have tried adding the SwingUtilities.updateComponentTreeUI(this); in either the start(), init(), or my own createGUI() function and it still does not work.
    Any ideas? Could this be a problem with the browser caching the applet? I am using IE 5.50.

    I have the same problem
    putting them in static doesn't keep the look and feel
    putting them in the applet constructor does'nt keep it
    putting them in init() doesn't keep it
    putting them in start() doesn't keep it
    heck, even putting them in all 4 of them together doesn't keep the look and feel, it always reverts back to metal

  • What are the types of lookandfeel is available in oracle forms?

    Hi Gurus,
    What are the types of lookandfeel is available in oracle forms?
    And where i can see?For Example: &lookandfeel=oracle
    Regards
    Gopinath M

    Rosario, don't feel bad -- English is my only language, and those acronyms give me trouble sometimes, too. The quickest and easiest way to find out what they mean is to go to google.com and type in the letters. That is what I do.

  • JTREE: Writting my own DefaultTreeCellRenderer, please help

    Hi All,
    I'm trying to write my own Class extending DefaultTreeCellRenderer to get different icons on my JTREE.
    But I'm loosing background "Zebra grid" and I'm loosing mouse over highliting nodes.
    What I'm doing wrong?
    my class it is this:
    public class RendererTree extends DefaultTreeCellRenderer
        public RendererTree()
            super();
        public Component getTreeCellRendererComponent(final JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
            super.getTreeCellRendererComponent(tree,value,selected,expanded,leaf,row,hasFocus);
            if(value.toString().compareToIgnoreCase("Gestión") == 0)
                setIcon(new ImageIcon(this.getClass().getResource("/images/24x24/office-building.png")));
            else if(value.toString().compareToIgnoreCase("Gestionar") == 0)
                setIcon(new ImageIcon(this.getClass().getResource("/images/16x16/form_blue.png")));
            return this;
    }I'm setting up my render:
    jTree1.setCellRenderer(new RendererTree());Any ideas would be appreciated
    Thanks in advance!
    Edited by: henrynxd_08 on Sep 20, 2010 10:06 AM

    [http://img812.imageshack.us/img812/4056/jtree.jpg] Here my two features lost. One the highlith animation when mouse is over nodes and the other alternate darkness and ligthness coloured at background (ZEBRA).
    It is this impossible to get with my own treecellrendered ?
    thanks in advance
    Edited by: henrynxd_08 on Sep 21, 2010 10:36 AM

  • Defining different icons for TreeNode by extending DefaultTreeCellRenderer

    Hello all,
    I'm using a JTree to display project, folder and files. I'd like to have different icons for open project, close project, open folder, close folders, and files
    but i got for the root which is a project object a folder icon and for folder when it is not expanded i got project icon and the when i expand it i got a folder icon, can someone help me please
    Here is my code :
    public class MyTreeCellRenderer extends DefaultTreeCellRenderer {
         private Icon openIcon = null;
         private Icon closeIcon = null;
         private Icon leafIcon = null;
         private Icon projectOpenIcon = new ImageIcon("icons/book_open.png");
         private Icon projectCloseIcon = new ImageIcon("icons/book_blue.png");
         private Icon folderOpenIcon = new ImageIcon("icons/folder.png");
         private Icon folderCloseIcon = new ImageIcon("icons/folder_closed.png");
         private Icon fileIcon = new ImageIcon("icons/document.png");
         @Override
         public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
                   boolean expanded, boolean leaf, int row, boolean hasFocus) {
              super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row,
                        hasFocus);
              LogescoTreeNode node =
                   (LogescoTreeNode)value;
              Object obj = node.getUserObject();
              System.out.println(obj.getClass().toString());
              if(openIcon == null) {
                   openIcon = this.getOpenIcon();
                   if(openIcon != null) {
                        if(obj instanceof LProject) {
                             openIcon = projectOpenIcon;
                             this.setOpenIcon(openIcon);
                             openIcon = null;
                        } else if(obj instanceof LFolder) {
                             openIcon = folderOpenIcon;
                             this.setOpenIcon(openIcon);     
                             openIcon = null;
              if(closeIcon == null) {
                   closeIcon = this.getClosedIcon();
                   if(closeIcon != null) {
                        if(obj instanceof LProject) {
                             closeIcon = projectCloseIcon;
                             this.setClosedIcon(closeIcon);
                             closeIcon = null;
                        } else if(obj instanceof LFolder) {
                             closeIcon = folderCloseIcon;
                             this.setClosedIcon(closeIcon);
                             closeIcon = null;
              this.setLeafIcon(fileIcon);
              return this;
    }Thank you.

    Hi all,
    I changed my code a bit knowing that the renderer is global to the tree so my (openIcon == null) is called only once for the first node.
    Here is my new code :
    public class MyTreeCellRenderer extends DefaultTreeCellRenderer {
         private Icon projectOpenIcon = new ImageIcon("icons/book_open.png");
         private Icon projectCloseIcon = new ImageIcon("icons/book_blue.png");
         private Icon folderOpenIcon = new ImageIcon("icons/folder.png");
         private Icon folderCloseIcon = new ImageIcon("icons/folder_closed.png");
         private Icon fileIcon = new ImageIcon("icons/document.png");
         @Override
         public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
                   boolean expanded, boolean leaf, int row, boolean hasFocus) {
              super.getTreeCellRendererComponent(tree, value, selected,
                        expanded, leaf, row, hasFocus);
              LogescoTreeNode node =
                   (LogescoTreeNode)value;
              Object obj = node.getUserObject();
              System.out.println(obj.getClass().toString());
              if(obj instanceof LProject) {
                   this.setIcon(expanded ? projectOpenIcon : projectCloseIcon);
              } else if(obj instanceof LFolder) {
                   this.setIcon(expanded ? folderOpenIcon : folderCloseIcon);
              } else {
                   this.setIcon(fileIcon);
              return this;
         }

  • How to change  "window LookAndFeel" of applet?

    hi~~
    I have changed the LookAndFeel of Applet with following code:
    try{
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    SwingUtilities.updateComponentTreeUI(frame);
    catch(Exception e){}
    ,but WindowsLookAndFeel seem not to be shown when it run on IE.
    why no any change?

    I assume this is a windows box, and that you've tested that that look and feel exists already.
    My guess would then be that Windows has an option, somewhere, that tells windows not to
    use the LAF. It's labeled as "Do not decorate buttons", or something equally odd. Unfortunately,
    I have no idea whatsoever where the option is.

  • LookAndFeel in Applets

    Hi,
    we are writing an applet. To set the applets LookAndFeel we implemented the following code:
    static {
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    catch (Exception e) {
    If we use this applet in a browser on Windows, the applets LookAndFeel is switched to the Windows-LookAndFeel. Perfect.
    But...
    If we use the browsers Back-Button and then the Forward-Button, the LookAndFeel will switch to Metal???
    What's going wrong ?
    Is there a way to change the above code to make this work ?
    Thanks for help

    only things that works:
    putting this in the start() method
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    SwingUtilities.updateComponentTreeUI(this);
    } catch (Exception e) {
    e.printStackTrace();
    }

  • LookAndFeel in JTree

    Hi All,
    i have a small problem in LookAndFeel for my Tree. in our project we are using JDK1.1.7B and Swing1.0..It is a client requirement..Is it possible to cretae my tree like windows Explorer..i am not geting tree structure..just i am geting bullets for tree and subtree , I am not geting link to leaf nodes from subtree and link from main leafs to main root...why..i used
    public static String windowsUI = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
    try {
    UIManager.setLookAndFeel(windowsUI);
    UIDefaults def = UIManager.getDefaults();
    for (Enumeration e = def.keys(); e.hasMoreElements();)
    { String key = (String)e.nextElement();
    System.out.println(key+ ":"+def.get(key));
    }catch (Exception ex)
    System.out.println(ex);
    ..........and i tried this also
    try{
    UIManager.setInstalledLookAndFeels(UIManager.getInstalledLookAndFeels());
    }catch(Exception e){System.out.println("Exception "+e);}
    but i am geting exception like this
    Exception occurred during event dispatching:
    java.lang.NoSuchMethodError: com.sun.java.swing.plaf.windows.WindowsTreeUI$Expan
    dedIcon: method createExpandedIcon()Lcom/sun/java/swing/Icon; not found
    at
    at com.sun.java.swing.UIDefaults.get(Compiled Code)
    at com.sun.java.swing.MultiUIDefaults.get(Compiled Code)
    at PopLayersCompHashAllTree.popupLayers(Compiled Code)
    at PopLayersCompHashAllTree.<init>(PopLayersCompHashAllTree.java:38)
    at MapSketchDelAll.actionPerformed(MapSketchDelAll.java:217)
    at com.sun.java.swing.AbstractButton.fireActionPerformed(Compiled Code)
    at com.sun.java.swing.AbstractButton$ForwardActionEvents.actionPerformed
    (AbstractButton.java:924)
    at com.sun.java.swing.DefaultButtonModel.fireActionPerformed(Compiled Co
    de)
    at com.sun.java.swing.DefaultButtonModel.setPressed(DefaultButtonModel.j
    ava:230)
    at com.sun.java.swing.plaf.basic.BasicButtonListener.mouseReleased(Basic
    ButtonListener.java:191)
    at java.awt.Component.processMouseEvent(Component.java:2354)
    at java.awt.Component.processEvent(Compiled Code)
    at java.awt.Container.processEvent(Compiled Code)
    at java.awt.Component.dispatchEventImpl(Compiled Code)
    at java.awt.Container.dispatchEventImpl(Compiled Code)
    at java.awt.Component.dispatchEvent(Compiled Code)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Compiled Code)
    at java.awt.LightweightDispatcher.processMouseEvent(Compiled Code)
    at java.awt.LightweightDispatcher.dispatchEvent(Compiled Code)
    at java.awt.Container.dispatchEventImpl(Compiled Code)
    at java.awt.Window.dispatchEventImpl(Compiled Code)
    at java.awt.Component.dispatchEvent(Compiled Code)
    at java.awt.EventDispatchThread.run(Compiled Code)

    This bug is fixed in 1.5 and there is a workaround available for 1.4.2. See bug report:
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4887931

  • Problem in LookAndFeel(..JTree..)

    Hi All,
    i have a small problem in LookAndFeel for my Tree. in our project we are using JDK1.1.7B and Swing1.0..It is a client requirement..Is it possible to cretae my tree like windows Explorer..i am not geting tree structure..just i am geting bullets for tree and subtree , I am not geting link to leaf nodes from subtree and link from main leafs to main root...why..i used
    public static String windowsUI = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
    try {
    UIManager.setLookAndFeel(windowsUI);
    UIDefaults def = UIManager.getDefaults();
    for (Enumeration e = def.keys(); e.hasMoreElements();)
    { String key = (String)e.nextElement();
    System.out.println(key+ ":"+def.get(key));
    }catch (Exception ex)
    System.out.println(ex);
    ..........and i tried this also
    try{
    UIManager.setInstalledLookAndFeels(UIManager.getInstalledLookAndFeels());
    }catch(Exception e){System.out.println("Exception "+e);}
    but i am geting exception like this
    Exception occurred during event dispatching:
    java.lang.NoSuchMethodError: com.sun.java.swing.plaf.windows.WindowsTreeUI$Expan
    dedIcon: method createExpandedIcon()Lcom/sun/java/swing/Icon; not found
    at
    at com.sun.java.swing.UIDefaults.get(Compiled Code)
    at com.sun.java.swing.MultiUIDefaults.get(Compiled Code)
    at PopLayersCompHashAllTree.popupLayers(Compiled Code)
    at PopLayersCompHashAllTree.<init>(PopLayersCompHashAllTree.java:38)
    at MapSketchDelAll.actionPerformed(MapSketchDelAll.java:217)
    at com.sun.java.swing.AbstractButton.fireActionPerformed(Compiled Code)
    at com.sun.java.swing.AbstractButton$ForwardActionEvents.actionPerformed
    (AbstractButton.java:924)
    at com.sun.java.swing.DefaultButtonModel.fireActionPerformed(Compiled Co
    de)
    at com.sun.java.swing.DefaultButtonModel.setPressed(DefaultButtonModel.j
    ava:230)
    at com.sun.java.swing.plaf.basic.BasicButtonListener.mouseReleased(Basic
    ButtonListener.java:191)
    at java.awt.Component.processMouseEvent(Component.java:2354)
    at java.awt.Component.processEvent(Compiled Code)
    at java.awt.Container.processEvent(Compiled Code)
    at java.awt.Component.dispatchEventImpl(Compiled Code)
    at java.awt.Container.dispatchEventImpl(Compiled Code)
    at java.awt.Component.dispatchEvent(Compiled Code)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Compiled Code)
    at java.awt.LightweightDispatcher.processMouseEvent(Compiled Code)
    at java.awt.LightweightDispatcher.dispatchEvent(Compiled Code)
    at java.awt.Container.dispatchEventImpl(Compiled Code)
    at java.awt.Window.dispatchEventImpl(Compiled Code)
    at java.awt.Component.dispatchEvent(Compiled Code)
    at java.awt.EventDispatchThread.run(Compiled Code)
    Thanks in Advance,
    Regards
    Akula

    hi sir ,
    thaks for u'r suggession.Its working fine but the
    properties of the previous tree were not working
    after setModel() property .like action at leaf node
    is not working,I'm sorry but I don't understand. I think you are saying that the problem is solved but I can read it to mean that you still have a problem.
    If you still have a problem then please post some code (using the [code] tags of course).

  • Problem in LookAndFeel

    Hi All,
    i have a small problem in LookAndFeel for my Tree. in our project we are using JDK1.1.7B and Swing1.0..It is a client requirement..Is it possible to cretae my tree like windows Explorer..i am not geting tree structure..just i am geting bullets for tree and subtree , I am not geting link to leaf nodes from subtree and link from main leafs to main root...why..i used
    public static String windowsUI = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
    try {     
    UIManager.setLookAndFeel(windowsUI);     
    UIDefaults def = UIManager.getDefaults();     
    for (Enumeration e = def.keys(); e.hasMoreElements();)
    {  String key = (String)e.nextElement();     
    System.out.println(key+ ":"+def.get(key));
    }catch (Exception ex)
    System.out.println(ex);     
    ..........and i tried this also
    try{
    UIManager.setInstalledLookAndFeels(UIManager.getInstalledLookAndFeels());
              }catch(Exception e){System.out.println("Exception "+e);}
    but i am geting exception like this
    Exception occurred during event dispatching:
    java.lang.NoSuchMethodError: com.sun.java.swing.plaf.windows.WindowsTreeUI$Expan
    dedIcon: method createExpandedIcon()Lcom/sun/java/swing/Icon; not found
    at
    at com.sun.java.swing.UIDefaults.get(Compiled Code)
    at com.sun.java.swing.MultiUIDefaults.get(Compiled Code)
    at PopLayersCompHashAllTree.popupLayers(Compiled Code)
    at PopLayersCompHashAllTree.<init>(PopLayersCompHashAllTree.java:38)
    at MapSketchDelAll.actionPerformed(MapSketchDelAll.java:217)
    at com.sun.java.swing.AbstractButton.fireActionPerformed(Compiled Code)
    at com.sun.java.swing.AbstractButton$ForwardActionEvents.actionPerformed
    (AbstractButton.java:924)
    at com.sun.java.swing.DefaultButtonModel.fireActionPerformed(Compiled Co
    de)
    at com.sun.java.swing.DefaultButtonModel.setPressed(DefaultButtonModel.j
    ava:230)
    at com.sun.java.swing.plaf.basic.BasicButtonListener.mouseReleased(Basic
    ButtonListener.java:191)
    at java.awt.Component.processMouseEvent(Component.java:2354)
    at java.awt.Component.processEvent(Compiled Code)
    at java.awt.Container.processEvent(Compiled Code)
    at java.awt.Component.dispatchEventImpl(Compiled Code)
    at java.awt.Container.dispatchEventImpl(Compiled Code)
    at java.awt.Component.dispatchEvent(Compiled Code)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Compiled Code)
    at java.awt.LightweightDispatcher.processMouseEvent(Compiled Code)
    at java.awt.LightweightDispatcher.dispatchEvent(Compiled Code)
    at java.awt.Container.dispatchEventImpl(Compiled Code)
    at java.awt.Window.dispatchEventImpl(Compiled Code)
    at java.awt.Component.dispatchEvent(Compiled Code)
    at java.awt.EventDispatchThread.run(Compiled Code)

    you are probably setting the LookAndFeel in the wrong spot in your code. You should set it every time your window reopens instead of just in the initialization.

  • Extending DefaultTreeCellRenderer, Jlabel setOpaque(false) no effect

    Hi, im using the code below, but my JLabel component.setOpaque(false) is having no effect, is this possible?
    private class MyRenderer extends DefaultTreeCellRenderer {
                ImageIcon tabIconOnline, tabIconOffline;
                String status;
                public MyRenderer() {
                public Component getTreeCellRendererComponent(
                        JTree tree,
                        Object value,
                        boolean sel,
                        boolean expanded,
                        boolean leaf,
                        int row,
                        boolean hasFocus) {
                    JLabel jl = (JLabel)super.getTreeCellRendererComponent(
                            tree, value, sel,
                            expanded, leaf, row,
                            hasFocus);
                                     jl.setOpaque(false); // not working
                    setOpaque(false); // not working
                    tree.setOpaque(false); // not working
                                     setBackgroundSelectionColor(MyGUI.ITEM_SELECTION_COLOUR);
                    setBackgroundNonSelectionColor(null);  // not working
                    setBorderSelectionColor(new Color(10, 10, 255));
                    return jl;
        }

    heres the full code, im using:
            private class MyRenderer extends DefaultTreeCellRenderer {
                ImageIcon tabIconOnline, tabIconOffline;
                String status;
                public MyRenderer() {
                public Component getTreeCellRendererComponent(
                        JTree tree,
                        Object value,
                        boolean sel,
                        boolean expanded,
                        boolean leaf,
                        int row,
                        boolean hasFocus) {
                    JLabel jl = (JLabel)super.getTreeCellRendererComponent(
                            tree, value, sel,
                            expanded, leaf, row,
                            hasFocus);
                    DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
                    //jl.setOpaque(false);
                   // setOpaque(false);
                    tree.setOpaque(false);
                    if (node == rootNode) {
                        setForeground(new Color(255, 255, 255));
                    } else if ((node == nodeFriends) ||(node == nodeRecent)||(node == nodeIgnored)) {
                        if (leaf) {
                            setIcon(createImageIcon("images/icon_noChildren.gif"));
                        setForeground(new Color(255, 255, 255));
                        setToolTipText("To add a Friend , Right click then 'Add A Friend'");
                    } else if (node.getParent() == nodeFriends) {
                        Friend friend = (Friend)(node.getUserObject());
                        if (friend.getStatus().equals("online")) {
                            setForeground(new Color(255, 255, 255));
                            setIcon(createImageIcon("images/icon_online.gif"));
                            setToolTipText("Is " + friend.getStatus());
                        } else {
                            setIcon(createImageIcon("images/icon_offline.gif"));
                            setToolTipText("Is " + friend.getStatus());
                            setForeground(new Color(255, 255, 255));
                    } else if (node.getParent() == nodeRecent) {
                        setForeground(new Color(255, 255, 255));
                    } else if (node.getParent() == nodeIgnored) {
                        setForeground(new Color(255, 255, 255));
                        setToolTipText("You are ignoring this user");
                    if (sel) {
                        setForeground(Color.black);
                    //jl.setBackground(null);
                    setBackgroundSelectionColor(MyGUI.ITEM_SELECTION_COLOUR);
                    //setBackgroundNonSelectionColor(null);
                    setBorderSelectionColor(new Color(10, 10, 255));
                    return jl;
        }

  • Parameter lookandfeel in formsweb.cfg

    Hi!
    Possible values for parameter lookandfeel is *"Generic"* or *"Oracle"* in formsweb.cfg, is it possible to modify lookandfeel=Oracle more than colorscheme or is it possible to develop our own lookandfeel?
    Has anyone any nice GUI examples for Forms to share?
    Have looked at "The Look and Feel project", but it's to much work for us to implement in about 400 forms.
    http://fdtool.free.fr/LAF/doc/Oracle_Forms_Look_and_Feel_project.htm
    Regards
    Tobias

    Not possible.

  • JTree custom DefaultTreeCellRenderer with custom DefaultMutableTreeNode

    Is there a way to create my own version of DefaultTreeCellRenderer that does not use DefaultMutableTreeNode? I tried copying an example of a custom DefaultTreeCellRenderer but I can’t cast the "value" in getTreeCellRendererComponent() to my own version of DefaultMutableTreeNode.
    From the looks of the documentation below shouldn't I be able to do that?
    Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)

    oops,
    I found out why. I created my custom DefaultTreeCellRenderer before I populated the root node with my DefaultMutableTreeNode. So I guess, java went with the default. When I created my custom DefaultTreeCellRenderer after I populated the root node, everything worked.

Maybe you are looking for