Rendered Nodes in JTree, Look&Feel Problem

Hallo,
I make a small JTree and write my own TreeNodeRenderer which renders in each case a simple JPanel with Titled-Border an 2 JLabels.
If I adjust Metal Look&Feel the rendered Nodes are displayed correctly. (The JPanels size is about 300x200 pixels)
With other L&Fs (windows, motif, plastic from jgoodies) there is only the title of the TitledBorder displayed.
I meet the Problem as i programmed a more complicated JTree with rendered TreeNodes.
Do you know the problem and a solution? I don't want to setting up Metal look for my application.
The following link contains the source of the example in an executable jar file:
http://home.arcor.de/Thomas-Pfaff/treetest.jar
thanks for all answers

I found the answer of my question....
http://onesearch.sun.com/search/clickthru?qt=TreeCellRenderer&url=http%3A%2F%2Fbugs.sun.com%2Fbugdatabase%2Fview_bug.do%3Fbug_id%3D4656280&pathInfo=%2Fonesearch%2Findex.jsp&hitNum=1&col=support-all

Similar Messages

  • Custom Look&Feel problems with ComboBoxEditor

    hi, im trying to create a custom look and feel and have some problems with the ComboBoxEditor. the non-editable combobox works fine, but the editable makes problems. if i select an item from the dropdown, the value doesn't get updated in the editor and trying to select text results in this error:java.lang.IllegalArgumentException: Invalid location
         at javax.swing.text.JTextComponent.getSelectedText(JTextComponent.java:1453)
         at javax.swing.text.JTextComponent$AccessibleJTextComponent.getSelectedText(JTextComponent.java:2192)
         at javax.swing.text.JTextComponent$AccessibleJTextComponent.caretUpdate(JTextComponent.java:1885)
         at javax.swing.text.JTextComponent.fireCaretUpdate(JTextComponent.java:356)
         at javax.swing.text.JTextComponent$MutableCaretEvent.fire(JTextComponent.java:3165)
         at javax.swing.text.JTextComponent$MutableCaretEvent.mouseReleased(JTextComponent.java:3220)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
         at java.awt.Component.processMouseEvent(Component.java:5100)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)im using this code
    import java.awt.Component;
    import javax.swing.ComboBoxEditor;
    import javax.swing.JTextField;
    public class PlastikComboBoxEditor extends JTextField implements ComboBoxEditor {
         private Object value ;
         public Component getEditorComponent() {
              return this;
         public void setItem(Object anObject) {
              value = anObject ;
              super.setText(value.toString());
         public Object getItem() {
              return value ;
    }has anyone a clue how to fix this?

    as always. just got the idea a few minutes after posting. the problem was, that i cached the TextFieldUI in the textfieldui class instead of creating a new UI for every textfield. now it works fine.

  • Look & Feel problem one iview differs

    Hi there,
    I have got a problem displaying one iview, one of the iviews in our portal uses a different background color. This color is not mentioned in the theme used within the portal.
    I checked the sap.useWebDynproStyleSheet parameter in the visual administrator which is set to default (false) so all the iviews should use the portal theme.
    How is it posible that this particular iview-application uses this different style. Is there some kind of override?
    thanks
    Ron

    Ron
    If you are using an iview which is build using an application say for example as JSP application and you forced the colors in the application then the iview will show the color which is coded in the JSP.
    Thanks
    Lakshmi
    Reward Points if useful !!

  • Look & Feel Problem when switching to JRE1.6.0_10 (GTK error on fedora 9)

    Hi,
    I have switched a Swing app I'm developping from openjdk to sun jdk1.6.0_10 in order to track memory leacks (the profiler I wish to use tells me openjdk is not stable enough to get itself installed).
    Now I have problems displaying some of the GUI components : background in some JPanel herited classes (propertysheet l2fprod component), buttons on combo boxes.
    I get these messages in the console :*
    +(<unknown>:6330): Gtk-WARNING **: Attempting to add a widget with type GtkButton to a GtkComboBoxEntry (need an instance of GtkEntry or of a subclass)+
    +(<unknown>:6330): Gtk-CRITICAL **: gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed+
    +(<unknown>:6330): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed+
    +(<unknown>:6330): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed+
    As far as I know it's running fine under XP with jre 1.6.0_07. The problems occurs at runtime with jre1.6.0_10 on Fedora9. It's okay if I launch it with openjdk (but I can't use my profiler !). I didn't try other jre versions on my Linux box neither I know if the problem occurs under XP with jre1.6.0_10.
    Here's the config I have this problem on :_
    OS/Desktop : Fedora 9 (kernel 2.6.25.14.fc9.i686), GNOME 2.22.3
    VM : Java HotSpot(TM) Client VM version 11.0-b15
    Library path:
    /usr/java/jre1.6.0_10/lib/i386/client:/usr/java/jre1.6.0_10/lib/i386:/usr/java/jre1.6.0_10/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
    Boot class path:
    /usr/java/jre1.6.0_10/lib/resources.jar:/usr/java/jre1.6.0_10/lib/rt.jar:/usr/java/jre1.6.0_10/lib/sunrsasign.jar:/usr/java/jre1.6.0_10/lib/jsse.jar:/usr/java/jre1.6.0_10/lib/jce.jar:/usr/java/jre1.6.0_10/lib/charsets.jar:/usr/java/jre1.6.0_10/classes
    Any Ideas ?
    Edited by: squiggly on Oct 24, 2008 1:59 AM

    I have no experience with cscript, but by typing cscript in a command prompt i get:
    Microsoft (R) Windows Script Host Version 5.7
    Copyright (C) Microsoft Corporation. All rights reserved.
    Usage: CScript scriptname.extension [option...] [arguments...]
    Options:
    //B         Batch mode: Suppresses script errors and prompts from displaying
    //D         Enable Active Debugging
    //E:engine  Use engine for executing script
    //H:CScript Changes the default script host to CScript.exe
    //H:WScript Changes the default script host to WScript.exe (default)
    //I         Interactive mode (default, opposite of //B)
    //Job:xxxx  Execute a WSF job
    //Logo      Display logo (default)
    //Nologo    Prevent logo display: No banner will be shown at execution time
    //S         Save current command line options for this user
    //T:nn      Time out in seconds:  Maximum time a script is permitted to run
    //X         Execute script in debugger
    //U         Use Unicode for redirected I/O from the consoleDoesn't this mean that the script file name should come before the option (//Nologo)?
    I run XP SP 3.

  • GUI screwed up sometimes with Custom Look & Feel

    Hello,
    i've got a few problems with my JApplet. Im using a custom Look and Feel (Kunststoff, http://www.incors.org/index.php3 very nice) - my problem is that sometimes (often) my gui is screwed up - some parts like a JPane are not rendered in the custom look & feel, they are still default, but the buttons are. Or my whole dialog looks like a little puzzle - small pieces are cut out.
    I have no idea how to avoid these bugs, im not certain that this is because of the custom look and feel because i seem to have the same problems with the metal look and feel from java.
    I tryed to put a repaint() in my initiliaze of my dialog classes at the very end, but no success either...
    Any help would be greatly appreciated.

    Hello,
    i've got a few problems with my JApplet. Im using a custom Look and Feel (Kunststoff, http://www.incors.org/index.php3 very nice) - my problem is that sometimes (often) my gui is screwed up - some parts like a JPane are not rendered in the custom look & feel, they are still default, but the buttons are. Or my whole dialog looks like a little puzzle - small pieces are cut out.
    I have no idea how to avoid these bugs, im not certain that this is because of the custom look and feel because i seem to have the same problems with the metal look and feel from java.
    I tryed to put a repaint() in my initiliaze of my dialog classes at the very end, but no success either...
    Any help would be greatly appreciated.

  • Jtree Select node and change leafs icon problem

    Hi All,
    i create a tree and implement a TreeSelectionListener:
    my mission is whenever i select a node i need to change the icon of this node (for now.later i will have to find if it have childrens).
    import java.awt.Color;
    import java.awt.Component;
    import java.util.Enumeration;
    import java.util.NoSuchElementException;
    import java.util.Vector;
    import javax.swing.ImageIcon;
    import javax.swing.JTree;
    import javax.swing.event.TreeExpansionEvent;
    import javax.swing.event.TreeExpansionListener;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.TreeModel;
    import javax.swing.tree.TreeNode;
    import javax.swing.tree.TreePath;
    public class TreeView{
         DefaultMutableTreeNode top;
         JTree tree ;
         Color frameColor;
         public static ImageIcon NoTSelIcon;
         public static ImageIcon SelIcon;
        public static String[] name= new String[8];
         public TreeView(Color BackColor) {
              // TODO Auto-generated constructor stub
            top =  new DefaultMutableTreeNode("Diagnostics");
            this.frameColor=BackColor;
             SelIcon = createImageIcon("../Resource/Images/Select.gif");
             if (SelIcon == null)
                 System.err.println("Tutorial icon missing; using default.");
             NoTSelIcon = createImageIcon("../Resource/Images/NotSelc.gif");
               if (NoTSelIcon == null)
                 System.err.println("Tutorial icon missing; using default.");
         public Component createTreeComponents(){
                //Create the nodes.
                 createNodes(top);
            //Create a tree that allows one selection at a time.
            tree = new JTree(top);
            //TREE LISTENERS
            //Treeselction listener
            Handler hObject = new Handler();
            tree.addTreeSelectionListener(hObject);
           //Tree expand/collapse listener
            HandlerExpansionListener hObjectExpan = new HandlerExpansionListener();
            tree.addTreeExpansionListener(hObjectExpan);
    //       tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
            //set tree background
            tree.setBackground(frameColor);
             tree.setCellRenderer(new OverrideTreeCellRenderer(frameColor,SelIcon,NoTSelIcon));
            return tree;
          private void createNodes(DefaultMutableTreeNode top) {
                 DefaultMutableTreeNode category = null;
                 DefaultMutableTreeNode SubCategory = null;
                 DefaultMutableTreeNode SubCategoryBasee = null;
                 DefaultMutableTreeNode SubSubCategoryBasee = null;
                 category = new DefaultMutableTreeNode("Dfe");
                 top.add(category);
                 //Sub test visible
                 SubCategory = new DefaultMutableTreeNode("Test Visible");
                 category.add(SubCategory);
                 SubCategory.add(new DefaultMutableTreeNode("Son 1"));
                 SubCategory.add(new DefaultMutableTreeNode("Son 2"));
                 SubSubCategoryBasee = new DefaultMutableTreeNode("Test Base");
                 SubSubCategoryBasee.add(new DefaultMutableTreeNode("Grandson 1"));
                 SubSubCategoryBasee.add(new DefaultMutableTreeNode("Grandson 2"));
                 SubCategory.add(SubSubCategoryBasee);
          class Handler implements TreeSelectionListener {
                   public void valueChanged(TreeSelectionEvent arg0) {
                        // TODO Auto-generated method stub
                        System.out.println("treeSelect event ");
                        TreePath trph;
                        trph=arg0.getNewLeadSelectionPath();
                        int count=trph.getPathCount();
                        DefaultMutableTreeNode Selnode = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
                        String Name = (String)Selnode.getUserObject();
                        setSelected(Selnode,true);
                        int number_ofnodes=getNodeCountBelow((TreeModel)tree.getModel() , Selnode, false);
                        System.out.println("The Number of nodes under "+Name+"="+number_ofnodes);
                        tree.setCellRenderer(new IconRenderer(SelIcon,NoTSelIcon,frameColor));
          class HandlerExpansionListener implements TreeExpansionListener {
                   public void valueChanged(TreeSelectionEvent arg0) {
                        // TODO Auto-generated method stub
                        DefaultMutableTreeNode node = (DefaultMutableTreeNode)  tree.getLastSelectedPathComponent();
                        if (node == null) return;
                      }     // The inner class
                   public void treeCollapsed(TreeExpansionEvent arg0) {
                        // TODO Auto-generated method stub
                        System.out.println("treeCollapsed event ");
                   public void treeExpanded(TreeExpansionEvent arg0) {
                        // TODO Auto-generated method stub
                        System.out.println("treeExpanded event ");
          /** Returns an ImageIcon, or null if the path was invalid. */
             protected static ImageIcon createImageIcon(String path) {
                  //ImageIcon imcon= new ImageIcon(path);
                  //return imcon;
                 java.net.URL imgURL = TreeView.class.getResource(path);
                 if (imgURL != null) {
                     return new ImageIcon(imgURL);
                 } else {
                     System.err.println("Couldn't find file: " + path);
                     return null;
             DefaultMutableTreeNode newnode;
             public void setSelected(DefaultMutableTreeNode Selnode ,boolean isSelected)
                    Enumeration Enchilds=Selnode.children();//ENUMRATE ALL CHILDS FOR THIS NODE
                 if (Enchilds != null)
                      while (Enchilds.hasMoreElements())
                           newnode=(DefaultMutableTreeNode)Enchilds.nextElement();
                           String NameSel = (String)newnode.getUserObject();
                           setSelected(newnode,isSelected);
             //GETTING THE TREE DEPTH
             public int getNodeCountBelow(TreeModel model, Object node, boolean includeInitialNode)
                 int n = includeInitialNode ? 1 : 0;
                 for (int i = 0; i < model.getChildCount(node); i ++)
                     n += getNodeCountBelow(model, model.getChild(node, i), true);
                 return n;
    import java.awt.Color;
    import java.awt.Component;
    import java.util.Enumeration;
    import java.util.NoSuchElementException;
    import javax.swing.Icon;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    public class IconRenderer extends DefaultTreeCellRenderer {
         private static final long serialVersionUID = 1L;
         Icon SelectedIcon;
         Icon NotSelectedIcon;
         Color BackgroundColor;
         boolean Selected=false;
         boolean Leaf=false;
         boolean IsItaChild=false;
         DefaultMutableTreeNode SelctedNode=null;
        public IconRenderer(Icon SelIcon,Icon NoTSelIcon,Color Bacground) {
             SelectedIcon = SelIcon;
             NotSelectedIcon = NoTSelIcon;
             BackgroundColor=Bacground;
             setBackgroundNonSelectionColor(BackgroundColor);
        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);
             Selected=sel;
             Leaf=leaf;
             DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
             String s2 = (String)node.getUserObject();
       return this;
    }my problem is :
    when i select a node the the method "getTreeCellRendererComponent"
    start to run on the entire tree from buttom to top and than from top to buttom.
    for me it waste of time because if has say 100 nodes it wont botthers me.
    but i have 20000 nodes and more its take a time.
    and for all this nodes i have to make compares.
    is there a way to force the DefaultTreeCellRenderer to not run the entire tree???
    Thanks

    You need to make sure that your TreeModel interprets your group nodes to be non-leaf nodes (one of the methods in the TreeModel interface is called isLeaf). If you are using a DefaultTreeModel with DefaultMutableTreeNode objects, you can use the askAllowsChildren property of DefaultTreeModel and the allowsChildren property of DefaultMutableTreeNode to control this. See the API for more details:
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/tree/DefaultTreeModel.html
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/tree/DefaultMutableTreeNode.html

  • JFileChooser problems in GTK look&feel

    Hi,
    the JFileChooser dialog is just ugly and not acceptable when using the GTK look&feel, there are so many layout problems and display errors. It also does not look like the native dialog. I'm using Ubuntu Linux 7.10 and Gnome 2.20.
    My application uses the GTK look&feel, because most of the normal widgets look nice. Is there a way to use the same JFileChooser dialog layout as it is in the Metal look&feel when using the GTK look&feel? This would be an acceptable workaround...
    Thanks,
    Stefan

    I don't believe it will be supported under any platform but *nix platforms.  The GTKLookAndFeel currently requires native theme information which is not available on the Windows platform.                                                                                                                                                                                                                                                                                                                                                                                       

  • Problem inserting new node into JTree with depthFirstEnumeration()

    Hello,
    I'm currently trying to use depthFirstEnumeration() to add and delete nodes for a simple JTree. I've written a method to handle this, but it keeps coming back with an exception saying that 'new child is an ancestor'.
    All I'm trying to do is add and delete nodes from a JTree using add and remove buttons within a swing program. When a user adds the new node the JTree needs to be updated with new labels in sequential order dependent upon a depthFirst traversal of the JTree.
    My current code for the add button is as follows,
    public void actionPerformed(ActionEvent event) 
            DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
            Enumeration e = rootNode.depthFirstEnumeration();
            if(event.getSource().equals(addButton))
                if (selectedNode != null)
                    while (e.hasMoreElements()) {
                    // add the new node as a child of a selected node at the end
                    DefaultMutableTreeNode newNode = (DefaultMutableTreeNode)e.nextElement();
                     // treeModel.insertNodeInto(newNode, selectedNode, selectedNode.getChildCount());
                    //System.out.print(newNode.getUserObject() + "" + newNodeSuffix++);
                    String label = "Node"+i;
                    treeModel.insertNodeInto(newNode, selectedNode, selectedNode.getChildCount());
                    i++;
                      //make the node visible by scrolling to it
                    TreeNode[] totalNodes = treeModel.getPathToRoot(newNode);
                    TreePath path = new TreePath(totalNodes);
                    tree.scrollPathToVisible(path);
                    //System.out.println();
            else if(event.getSource().equals(deleteButton))
                //remove the selected node, except the parent node
                removeSelectedNode();           
        } As you can see in the above code, I've tested the incrementing of the new nodes in a System.out.print() statement and they appear to be incrementing correctly. I just can't see how to correctly output the labels for the nodes.
    Any help and advice always appreciated.

    This is about the 5th posting on the same question. Here is the link to the last posting so you can see what has already been suggested so you don't waste your time making the same suggestion.
    http://forum.java.sun.com/thread.jspa?threadID=704980
    The OP doesn't seem to understand that nodes don't just rename themselves and that renderers will only display the text of the current node. If you want the text displayed to changed, then you need to change the text associated with each node, which means iterating through the entire tree to update each node with new text. Then again, maybe I don't understand the question, but the OP keeps posting the same question without any additional information.

  • Customizing ADF Faces Look & Feel. Some questions & suggestions

    Hi everybody,
    We are developing an application with ADF Faces using JHeadStart. For the moment, I am studying the way we must modify the JHS templates to adapt each element to our needs.
    As it's told in the JHeadStart Developer's Guide, there are two ways to customize Look & Feel:
    1) Modifying the templates
    2) ADF Skinning
    I'm using both methods, but I feel that thay are not good enough to adapt the L&F to our customer requirements.
    My main problem now is in the ADF Table customization. I want to use ADF Table because it offers us a lot of features that are not in the jsf table (the selection column, the table overflow...), and is very usefull combined with the generated JHS code. But at the same time, it doesn't offer a lot of functionality in the look & feel customization. Using JSF Table, I can set the CSS style for headers, rows, columns, the table, I can set the border, cellspacing and cellpadding. But I cannot do
    any of these thing (or at least, I don't see how) with the ADF Table.
    Our customer (a government) have a strict definition of the look & feel of his web applications. They want we use their CSS styles definition file, so they can modify at once the Look & Feel of all their applications. Modifying the L&F through skinning generate other styles, not use the style classes in our CSS (o so I think).
    So, the questions:
    1) There is any way to set the suitable styles for the ADF Table components (headers, rows)?
    1bis) Why, If I have defined a new skin, with only just a few selectors, some styles from oracle are applied? Maybe because the render kit in the 'adf-skins.xml' is "oracle.adf.desktop"? If it is true, how can I make that they are not used, I must implement a render kit or can I use another existent?
    2) Can I decide how looks the select column (for example a button instead of a radio button)? Can I decide where does it goes (right or left)?
    3) There is any way to hidden the text Show/Hide of the showDetail in the table (the tableOverflow), as I can change the icons through skinning? If it is not possible, How can I overwrite the text. I need it in Catalan, but it is shown in English for this locale. Where is the message bundle I should overwrite?
    4) There is any way to force a tree to start fully expanded?
    5) There is anywhere documentation about the javascript functions used in ADF and their meaning? I think for example in the previous question. If I knew which javascript function I should call for expand the tree and its parameters, I could put the call in the onload event of the body.
    6) I use a selectInputDate. I have skinned the launch-icon, and I would like to do a similar thing in the chooseDate that is opened in a new window. But It seems not to be affected for my skinning directives (if I put a chooseDate in the same page, its L&F follow the skinning rules I've defined). I don't know if this dialog is an ADF feature or a JHS generated feature.
    7) There is any way to keep unmodified the id I've choosed for a component? (I mean, an inputText with id="hello" in a form with id="form" will have in the HTML an id = "form:hello", but I would like it to be simply 'hello')
    8) How can I control the position and the size of a dialog (the chooseDate dialog or a dialog I've created)? In the cases I've been testing, it seems the dialog is forced to resize depending on the content. I would like to know if I can establish a fixed size.
    9) There is any way to open a non-modal dialog? (which I could keep open at the same time that another instance of the same dialog)
    For the moment, I think I have no more question. But give me time.... :-D
    The suggestion I've to do is basically more flexible components for a better customization (for example, the styles settings I've talked about previously). ADF components are nice and powerful, but I think they should generate pages that follow the tendencies in the web development: tableless pages (I cannot understand the utility of the objectSpacer existing the margins), use of CSS for layout...
    Any answer, comment or suggestion will be welcome.
    Carles.
    Message was edited by:
    cbios

    I have been able to make the UIX 2.2 and ADF Faces LAF look near identical by updating the oracle-desktop.xss file within UIX 2.2 as follows
    <!-- Change the accent color ramp to tan -->
    <style name="DarkAccentBackground">
    <!--<property name="background-color">#cccc99</property>-->
    <property name="background-color">#d2d8b0</property>
    </style>
    There are still some differences:
    1) A black line appears on the ADF Faces on the 'menu1' facet selected tab below the text. DON'T KNOW HOW TO REMOVE THIS FROM ADF Faces or add it to UIX 2.2!!!
    2) In UIX 2.2 a bulleted list uses the HTML <li> tag. In ADF Faces it doesn't use the HTML <li> tag rather it constructs the bulleted list using lower level HTML tags with the 'bullet' becoming an image, in my browser this means the disc is smaller in Faces. The motivation for this change I think is explained via this post. Since I have no control over how this specific HTML tag is rendered it forces me to replace the /adf/images/bltdscn.gif file in adf-faces-impl.jar with a larger disc!
    http://www.thescripts.com/forum/thread96839.html
    May update this again if there are other things I notice.

  • Set for specific nodes in JTree specific rowheight

    Hi,
    I got a JTree with different components for the nodes userobject.
    some nodes got JTextAreas as userobject. Those nodes got the same height as all other nodes. This is the problem ... the nodes who contains JTextAreas should have a larger rowheight - to paint their content well. But there is only a method to specify the of the height of all rows in a JTree, anyone knows a good solution?
    thx
    null
    Message was edited by:
    Olek

    From the JTree.setRowHeight documentation:
    "Sets the height of each cell, in pixels. If the specified value is less than or equal to zero the current cell renderer is queried for each row's height."
    So try tree.setRowHeight(0);

  • JTree look,why it si different in the same application

    Hi,
    I have app that consists of two panels ,in each panel i have placed jtree component(each jtree has its own model-source)
    First panel is OK:
    http://img135.imageshack.us/img135/5049/goodmx7.jpg
    Unfortunately, in the second panel when i cretae new jtree using absoltely the same method,its look is completely different:
    http://img135.imageshack.us/img135/4403/badrg8.png
    How to make the second jtree looks like the first one?

    cichy410 wrote:
    I have app that consists of two panels ,in each panel i have placed jtree component(each jtree has its own model-source)When you say "I have app" do you mean you wrote the app or got it from somewhere?
    If the former, post some code and ask a specific question about what you don't know or understand. Better still, post a SSCCE that clearly demonstrates your problem.
    If the latter, you might consider asking the source, since we know nothing about it. Of course, I'm assuming you have the right to use the code.
    db

  • Changing shell, look & feel dynamically in desktop backing file

    (I apologize if this post is showing up twice - I tried posting with
    google groups but it doesn't appear at forums.bea.com, so I wanted to
    post again using xnews to make sure it shows up.)
    I have a backing file that I am using with my desktop and I need to be
    able to change the shell and look & feel dynamically, based on the page
    that is currently active. I am doing the following in the preRender()
    method:
    String newLAF = "myLookAndFeel";
    String newShell = "myShell";
    // here is where I would determine the appropriate LAF and shell based on the current page
    customizationContext = new CustomizationContext(Locale.getDefault(), request);
    customizationContext.setVisitorMode(true);
    DesktopView desktopView =
    PortalBeanManager.getPortalCustomizationManager().getDesktopView(customizationContext, webAppName, new PortalPath(portalPath), new DesktopPath(desktopPath));
    DesktopInstanceId dii = desktopView.getDesktopInstanceId();
    DesktopInstance di = PortalBeanManager.getPortalCustomizationManager().getDesktopInstance(customizationContext, dii);
    LookAndFeelDefinitionId lookAndFeelId = null;
    for(int i = 0, n = lookAndFeelDefinitions.length; i < n; i++) {
    if(newLAF.equals(lookAndFeelDefinitions.getDefinitionLabel())) {
    lookAndFeelId = lookAndFeelDefinitions[i].getLookAndFeelDefinitionId();
    break;
    di.setLookAndFeelDefinitionId(lookAndFeelId);
    ShellDefinitionManager shellManager = PortalBeanManager.getShellDefinitionManager();
    ShellDefinitionId shellId = null;
    ShellDefinition[] shellDefinitions = getShellDefinitions(webAppName, request.getLocale(), request);
    for(int i = 0, n = shellDefinitions.length; i < n; i++) {
    String shellName = shellManager.getShellView(customizationContext, shellDefinitions[i].getShellDefinitionId()).getMarkupView().getMarkupDefinition().getName();
    if(newShell.equals(shellName)) {
    shellId = shellDefinitions[i].getShellDefinitionId();
    break;
    di.setShellDefinitionId(shellId);
    PortalBeanManager.getPortalCustomizationManager().updateDesktopInstance(customizationContext, di);
    This works just fine, but I once the portal renders itself in my
    browser, I usually have to refresh the page before the changes to the
    shell and look & feel are visible. I would like to do this in the
    init() method of the backing file but I do not know how to determine
    the current active page from within init.
    I would appreciate any help you all could give me in finding a solution
    so I do not have to refresh the page in order to see the shell and look
    & feel changes. Thanks in advance!
    Andy

    We essentially have 2 "portals" running inside 1 .portal file. We'd
    like to be able to use single sign on and entitlements to allow/restrict
    access to various parts of the 2 portals (where certain books are
    consider part of portal "A" and others part of portal "B"). If you are
    logged in as a super-user, you will be able to access everything. If
    you are logged in as user type "A" you can only access portal "A," and
    similarly for user type "B" and portal "B."
    Portals A and B have each have a distinct header, footer (i.e. shell),
    and look and feel (skeleton and skin). If a super-user is looking at
    portal A, the portal should have portal A's header, footer, and look and
    feel, and similarly for portal B.
    How would you recommend we accomplish this? Would it make more sense
    (and is it possible) to have the header and footer jsps determine what
    content to render based on the current book or page, and then use the
    code you suggested below to change the look and feel dynamically?
    Thanks,
    Andy
    jolleyc wrote:
    in order to pick up the changes for that request you will need to do a redirect back to the server (our login examples shwo you how to do this). this is because the control tree has already been retrieved from the database (so you need to go back and get a new version).
    I quick note: If you plan on doing this a lot this is quite a heavy process. if you just need to change the lookAndFeel on the fly you can look at the following ( i t think this is in the tutorial portal)
    A) Modify the shell to include a jsp and backing file
    <netuix:header>
    <netuix:jspContent backingFile="com.acme.DynamicLookAndFeelHeaderBacking" contentUri="/portlets/lookAndFeel/dynamicLookAndFeelHeader/dynamicLookAndFeelHeader.jsp"/>
    </netuix:header>
    B) backing file looks like
    public void init(HttpServletRequest request, HttpServletResponse response)
    // Get the session from the request
    HttpSession session = request.getSession();
    // Get the LookAndFeel object from the PrimaryTheme in the request
    LookAndFeel lookAndFeel = LookAndFeel.getLookAndFeel(request);
    if (request.getParameter("defaultButton") != null)
    session.setAttribute("skin", "default");
    if (request.getParameter("textButton") != null)
    session.setAttribute("skin", "text");
    if (request.getParameter("classicButton") != null)
    session.setAttribute("skin", "classic");
    String selectedSkin = (String) session.getAttribute("skin");
    if (selectedSkin != null)
    lookAndFeel.setSkin(selectedSkin);
    lookAndFeel.setSkeleton(selectedSkin);
    lookAndFeel.reinit();

  • Unable to update nodes in JTree

    Hi all,
    I have a JTree, which I have passed in a DefaultMutableTreeNode in the constructor. I have added 3 elements inside this "root". So the JTree looks like this :
    Root
    ->Element 1
    ->Element 2
    ->Element 3
    However, when I want to actually delete these 3 nodes and add in another 2 nodes, it doesn't work for me, a sample :
    //JTree which is created, using DefaultMutableTreeNode
    DefaultMutableTreeNode node = new DefaultMutableTreeNode("Root");
    //add 3 nodes inside first
    node.add(new DefaultMutableTreeNode("Element 1"));
    node.add(new DefaultMutableTreeNode("Element 2"));
    node.add(new DefaultMutableTreeNode("Element 3"));
    JTree jtree = new JTree(node);
    //get the root (which has 3 elements now)
    DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode)jtree.getModel().getRoot();
    //delete the 3 elements
    rootNode.removeAllChildren();
    //then add in another 2 more nodes
    rootNode.add(new DefaultMutableTreeNode("New Element 1"));
    rootNode.add(new DefaultMutableTreeNode("New Element 2"));
    The jtree created does display the first 3 elements, however when after adding in 2 more new elements, the tree doesnt change.
    Any tips and comments will be greatly appreciated! Thanks.

    Oops, yeah. My mistake was, The tree should have a model, instead of just nodes connecting to nodes... that's why it wasnt able to update... i've should used a model from the start. its the correct way isnt it :) i can continue my project now .. thanks all

  • [JProgressBar][Look&feel] Change the color

    I want to change the color of my JProgressBar :
    I have tried :
    UIManager.put("ProgressBar.foreground", new ColorUIResource(255, 0, 0));
    progressBar.updateUI();
    and
    progressBar.setForeground(Color.RED);[b]
    When I use the default look&feel, it works but with a custom look&feel (com.birosoft.liquid.LiquidLookAndFeel), the color isn't changed.
    Does anybody has an idea ?
    thanks in advance
    sylvain_2020

    hi,
    you're right but when I do :
    <b>this.progressBar.setForeground(Color.RED);
    this.progressBar.updateUI();</b>
    Nothing changes. I found that the probleme comes from the look & feel that I used since the color is changed when I don't specify any look and feel ...
    Do you know how I could resolve this ?
    Sylvain

  • Getting incorrect JComboBox color through UIManager in Nimbus Look&Feel

    Hello all,
    As I implementing a multi columns JComboBox, I need to provide my own custom ListCellRenderer.
    * @author yccheok
    public class ResultSetCellRenderer extends javax.swing.JPanel implements ListCellRenderer {
        // Do not use static, so that our on-the-fly look n feel change will work.
        private final Color cfc  = UIManager.getColor("ComboBox.foreground");
        private final Color cbc  = UIManager.getColor("ComboBox.background");
        private final Color csfc = UIManager.getColor("ComboBox.selectionForeground");
        private final Color csbc = UIManager.getColor("ComboBox.selectionBackground");
        private final Color cdfc = UIManager.getColor("ComboBox.disabledForeground");
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            System.out.println("UIManager.getColor(ComboBox.selectionForeground) = " + UIManager.getColor("ComboBox.selectionForeground"));
            System.out.println("UIManager.getColor(ComboBox.selectionBackground) = " + UIManager.getColor("ComboBox.selectionBackground"));
            this.setBackground(isSelected ? csbc : cbc);
         this.setForeground(isSelected ? csfc : cfc);
            jLabel1.setBackground(isSelected ? csbc : cbc);
         jLabel1.setForeground(isSelected ? csfc : cfc);
            jLabel2.setBackground(isSelected ? csbc : cbc);
         jLabel2.setForeground(isSelected ? csfc : cfc);
            jLabel3.setBackground(isSelected ? csbc : cbc);
         jLabel3.setForeground(cdfc);
            final ResultType result = (ResultType)value;
            jLabel1.setText(result.symbol);
            jLabel2.setText(result.name);
            final String type = result.typeDisp != null ? result.typeDisp : result.type;
            final String exch = result.exchDisp != null ? result.exchDisp : result.exch;
            jLabel3.setText(type  + " - " + exch);
            return this;
    }I try to get the selection colors of JComboBox through UIManager.
        private final Color csfc = UIManager.getColor("ComboBox.selectionForeground");
        private final Color csbc = UIManager.getColor("ComboBox.selectionBackground");However, I realize that while I am in Nimbus Look & Feel, the above 2 return me null.
    May I know is there any workaround to overcome this? Or I had missed out something?
    Thanks.
    Edited by: yccheok on Oct 21, 2010 10:39 AM

    because "c" is instance of UIResource:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.plaf.*;
    public class NimbusComponentColorTest {
      public JComponent makeUI() {
        final Color c = UIManager.getColor(
            "ComboBox:\"ComboBox.renderer\"[Selected].background");
        System.out.format("c instanceof UIResource: %s", c instanceof UIResource);
        JLabel label01 = new JLabel("label01");
        /* //com/sun/java/swing/plaf/nimbus/AbstractRegionPainter.java
        protected final Color getComponentColor(...) {
          // we return the defaultColor if the color found is null, or if
          // it is a UIResource. This is done because the color for the
          // ENABLED state is set on the component, but you don't want to use
          // that color for the over state. So we only respect the color
          // specified for the property if it was set by the user, as opposed
          // to set by us.
          if (color == null || color instanceof UIResource) {
              return defaultColor;
          } else if(saturationOffset!=0||brightnessOffset!=0||alphaOffset!=0) {
        label01.setOpaque(true);
        label01.setBackground(c);
        JLabel label02 = new JLabel("label02");
        label02.setOpaque(true);
        label02.setUI(new javax.swing.plaf.metal.MetalLabelUI());
        label02.setBackground(c);
        JLabel label03 = new JLabel("label03") {
          @Override public void paintComponent(Graphics g) {
            g.setColor(c);
            g.fillRect(0,0,getWidth(),getHeight());
            super.paintComponent(g);
        JLabel label04 = new JLabel("label04");
        label04.setOpaque(true);
        label04.setBackground(new ColorUIResource(Color.RED));
        JPanel p = new JPanel();
        p.add(label01); p.add(label02); p.add(label03); p.add(label04);
        return p;
      public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
          @Override public void run() { createAndShowGUI(); }
      public static void createAndShowGUI() {
        try {
          for (UIManager.LookAndFeelInfo laf:UIManager.getInstalledLookAndFeels())
            if ("Nimbus".equals(laf.getName()))
              UIManager.setLookAndFeel(laf.getClassName());
        } catch (Exception e) {
          e.printStackTrace();
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        f.getContentPane().add(new NimbusComponentColorTest().makeUI());
        f.setSize(200, 100);
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }

Maybe you are looking for

  • Switching phones #'s for phones on my plan under contract?

    My husband recently took a position with his company that will give him a cell phone.  He would like to port his phone # over to his company account (which is also Verizon).  I have an added line on the account already that is not under contract.  Co

  • Performing a specific calculation in a pivot table with BI Publisher 10g

    I am using BI Publisher 10g and new on it and I need to integrate a specific calculation measure in a pivot table The logic uses two measures that already exist in the report (Demand & PAB) and the required calculation is represented by a new measure

  • DVD Formats

    I'm in the process of having a friend take an old VHS tape of mine and make a DVD from it. I want to be able to play this DVD on my mac mini (combo drive). Would also like to play on my commercial dvd player. He is asking me about which format of DVD

  • Installing support for Oracle Designer Objects in an existing repository

    We have been using SCM to store Forms and other files for our development work. Now I want to use Repository Reports in the Repository Object Navigator, this requires me to install support for Oracle Designer Objects. Can I use the Repository Adminis

  • Multiple Database Users

    Dear Experts I have created 3 database users (SCOTT, X, and Y). SCOTT user has all the database. I wanted to give the full rights to X and Y on the objects of SCOTT, so, I issued the command SQL>grant all on emp to X; Connecting X, i have to give sch