Disable border for JTree on focus

Hi,
How can I disable the border showing on a JTree-Cell when a cell receive the focus?
I don't want to extends from DefaultTreeCellRenderer.
Is this a special client property or how can I disable this ( blue ) border ( CrossPlatformLookAndFeel ).
Regards,
Olek

One idea is to use a custom TreeCellRenderer
http://download.oracle.com/javase/6/docs/api/javax/swing/tree/TreeCellRenderer.htmlWhat I would do is just
class MyRenderer implements TreeCellRenderer
}and then take a look at the DefaultTreeCellRenderer source code to see how they implemented.
Although, I would recommend looking at Apache's implementation instead of Suns (Oracles) since it tends to be much more readable code.
http://svn.apache.org/repos/asf/harmony/enhanced/archive/classlib/java6/modules/swing/src/main/java/common/javax/swing/tree/DefaultTreeCellRenderer.javaAnd obviously from there you would need to customize the behavior when its selected.
Hope this helps!
Brandon

Similar Messages

  • How to Use different icons for JTree in the same level

    Hi guys, i come cross a problem with JTree. The module need a JTree which need to represent items in the same level using different icons. For example:
    [Icon for Root]Root
    |
    |_____________[Icon for Table] TABLES
    |
    |_____________[Icon for Index] INDEXS
    |
    |_____________[Icon for Views] VIEWS
    As i know, the default behavior for JTree is using the same icon for all leaves and
    the same icon for all node that has children. How can i achieve that?
    Thansk a lot!

    subclass DefaultTreeCellRenderer. if you overwrite the method below, then you can set the icon to whatever you want....!
        public Component getTreeCellRendererComponent(JTree tree, Object value,
                                    boolean sel,
                                    boolean expanded,
                                    boolean leaf, int row,
                                    boolean hasFocus) {
         String         stringValue = tree.convertValueToText(value, sel,
                               expanded, leaf, row, hasFocus);
            this.tree = tree;
         this.hasFocus = hasFocus;
         setText(stringValue);
         if(sel)
             setForeground(getTextSelectionColor());
         else
             setForeground(getTextNonSelectionColor());
         // There needs to be a way to specify disabled icons.
         if (!tree.isEnabled()) {
             setEnabled(false);
             if (leaf) {
              setDisabledIcon(getLeafIcon());
             } else if (expanded) {
              setDisabledIcon(getOpenIcon());
             } else {
              setDisabledIcon(getClosedIcon());
         else {
             setEnabled(true);
             if (leaf) {
              setIcon(getLeafIcon());
             } else if (expanded) {
              setIcon(getOpenIcon());
             } else {
              setIcon(getClosedIcon());
            setComponentOrientation(tree.getComponentOrientation());
         selected = sel;
         return this;
        }

  • Disable scrolling for an entire document

    Can anyone help me with a code sample that will disable scrolling for an entire document?

    Sure! You could write a script which is executed from the top level subform's ("form1" by default) Enter event and looks for all fields on the form and sets their
    doNotScroll property to true. Note that the script will have to execute on the Enter event (which will be called the moment the user sets focus to any field on the form) because any other event is too "soon" for the
    doNotScroll property setting to take effect.
    I've attached another sample form which demonstrates how to do this. Check-out the script in the form1 object's Enter event. The
    DisableScrolling method is recursive and finds all child fields within all possible container objects (such as subforms, areas, exclusion groups) found in the XFA language. For each field found which supports the
    doNotScroll property, it sets that property to true. Note the boolean variable used to guard against running this script every time focus is set to a field within the form. The script only needs to be executed once.
    Stefan
    Adobe Systems

  • How can I keep lion from generating .DS_Store files on windows network partitions, but not disable it for all network partitions?

    How can I keep lion from generating .DS_Store files on windows network partitions, but not disable it for all network partitions?  I am fimilar with changing the setting for all network partitions(defaults write com.apple.desktopservices DSDontWriteNetworkStores true), but that is undesirable when I connect my laptop to my home network. A preferable solution would be where I could control the writing of these files based on disk format (NTFS vs HFS+).

    Go to MacUpdate or CNET Downloads and search for ds_store. There are numerous utilities for preventing them from being transferred to Windows systems.

  • How can I just disable "navigation toolbar" completely for the App Tabs? I don't want to disable this for other normal tabs.

    How can I just disable "navigation toolbar" completely for the App Tabs? I don't want to disable this for other normal tabs. This is important as otherwise while I am in the app tab, i mistakenly start browsing from that tab and meaning of the app tab is completely lost...

    How can I view my full billing history for the app and music stores without iTunes installed?
    No.
    If my account has been compromised
    If you even think this may have happened, immediately change your password.
    See this -> Apple ID: Changing your password

  • How can I make a default border for a JWindow?

    I have a JWindow object that is created when a button is pressed in a JFrame. I want the JWindow to have the same type of border as the JFrame from which it's created. However, the JWindow is not created automatically with a border as the JFrame is, so I don't know how to set the border abstractly so that whatever border is used for the JFrame, per he default L&F, will also be used for the JWindow.
    I tried grabbing the border object from the JFame instance itself, but there is no such field in JFrame or any of its ancestor classes. I looked at UIDefaults, but I have no idea how this class can be used to get what I want. For example, if I use UIDefaults.getBorder(Object obj), what do I specify for the argument?
    I'd be happy with an abstract or a concrete solution. That is, either using the default Border for top level containers in the current L&F, or by grabbing an actual Border instance from a JFrame object.
    -Mark

    Also, I'm curious why you said that JFrame is not a swing component.A Swing component extends JComponent. Basically this means that all the painting of the component is done in Java. You can add Borders to any Swing component. It is called a light weight component. A light weight component cannot exist by itself on the window desktop.
    JFrame, JDialog and JWindow are top level components. They can exist on their own on the windows desktop because essentially they are Windows native components. They have been fancied up to make it easy for you to access and add other Swing components to it which is why they are found in the swing package.
    A Windows border is not the same thing as a Swing Border and there is no way to access the native windows border and use it in a Swing application (that I know of anyway). Swing Borders are not used in a normal JFrame, the Windows border is used. You can however, turn off the use of Windows decorations and use Swing painted decorations. Read the tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/frame.html#setDefaultLookAndFeelDecorated]Specifying Windows Decorations. However, this doesn't really help you with your Border problem. If you look at the source code for the FrameBorder, you will find that the "blue" color of the Border is only painted for "active" windows and a JWindow can never be the active window, only the parent JFrame or JDialog is considered active.
    Here is a simple program for you to play around with:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class FrameDecorated
         public static void main(String[] args)
              JFrame.setDefaultLookAndFeelDecorated(true);
              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
              frame.setSize(300, 300);
              frame.setVisible(true);
              Border border = frame.getRootPane().getBorder();
    //          Border border = UIManager.getBorder( "RootPane.frameBorder" );
              System.out.println( border );
              JWindow window = new JWindow(frame);
              JPanel contentPane = (JPanel)window.getContentPane();
              contentPane.add(new JTextField(), BorderLayout.NORTH);
              contentPane.setBorder( border );
              window.setSize(300, 300);
              window.setLocationRelativeTo( null );
              window.setVisible( true );
              System.out.println("Window:" + window);
              Window ancestor = SwingUtilities.getWindowAncestor(contentPane);
              System.out.println("Ancestor:" + ancestor);
              System.out.println(ancestor.isActive());
              System.out.println(frame.isActive());
    }

  • +, - button and inherited tick box is in disabled mode for account assignme

    In the attribute tab of org structure (PPOMA_BBP), we are not getting +, - button and inherited tick box is in disabled mode for account assignment category (attribute is KNT).
    We want to enter two values for the account assignment category with inherited tick box (ticked).
    Please suggest me how to get the +, - and inherited tick box (ticked) for the account assignment.
    Regards.

    Hi Imam,
    Unde attributes
    You will find one Application Toolbar...
    Overview, Select Attribute, Check Entries,Insert line,Delete line..
    So under All values you will find AcctAssigCat, Exculded, Default, Inheried
    Select the row and click on Insert Line, now you should be able to insert the new acct Assignment category
    rg
    sam

  • Disable link for a Image in Content editor web part

    Hi
    i want to disable hyperlink for a banner added using content editor web part. Instead of hiding using Target Audience, i want to disable the link.
    Please help me how can i achieve this?
    regards,
    Vinay
    Thanks and Regards, vinnu

    Hi Vinay,
    I recommend to disable the link for an image using Jquery in Content Editor web part.
    First, you need to use F12 tool in Internet Explorer(IE) to get the html tag for the image, and you’d better find the class or id value for the tag of the image.
    For example, if the class for the image is test, then the code should be:
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script type="text/javascript">
    $('.test').click(function(e) {
    e.preventDefault();
    </script>
    You can also paste the code of the image here for further research.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • How to disable html for whole swing application.

    Hi,
    As we can disable html for individual swing components , for example JLabel
    label.putClientProperty("html.disable",Boolean.TRUE);
    BasicHTML.updateRenderer(label,"html.disable");
    is there any way to disable html rendering in swing components for system wide / whole application?.
    Thanks
    Kiran

    Better use a utility method in the application like this
    public static void disableHtml(JComponent component)
    component.putClientProperty("html.disable",Boolean.TRUE);
    BasicHTML.updateRenderer(component,"html.disable");
    call disableHtml(Component u want to set html disable) for any component in the application.

  • How to disable MOH for "on Hold" button.

    CUCM 6.1
    When on a conference call if a user presses "on Hold" button, music is played for all participants and nobody can hear anything. How can I disable music on hold for all users?
    Please note, I could disable MOH for conferencing. But this is different issue. This is e.g. when everyone is in a conference (no matter what conference system, it could be ready talk, meeting place,...)and a participant receives another call and wants to answer the other call, in this situation I don't want any MOH played for other participants.
    Thanks,
    rdianat

    I first tried "suppress MOH for conference" by service--> service parameters -->select server --> select callmanager --> go to "clusterwide parameters(Feature-General) --> change the "Suppress MOH to conference Bridge" to true"
    This did not work. The reason is that these users are accessing an internet coferencing system like "ready talk" and not a cisco conferencing system, so for Cisco this does not appear to be a conference but it is like a regular call.
    I only have two callmanagers which also serve as MOH servers.
    Media Resources-->Music On-Hold Server -->Set Run Flag to "NO"
    This is explained in "MOH FAQ" from cisco.
    http://www.cisco.com/en/US/products/sw/voicesw/ps556/products_qanda_item09186a0080094766.shtml#q21
    The other way of doing this is not to assign any MOH server to the MRG or create a device pool without any MOH. (Media Resource Group set to NONE)
    Although the above disabled the MOH, still the TOH "Tone on Hold" which is beep-beeps played every 10 seconds was annoying. So I increased the interval to 20 seconds by the same instructions in "MOH FAQ" how to disable / change TOH. Go to same page explained above but to "clusterwide Parameters(Device-General) and change "Tone on Hold Timer" Value to 20.
    rdianat

  • How to disable Soundcheck for a single Album

    Hello,
    Soundcheck option in Preferences works pretty good for me, since I shuffle from classical to metal.
    But, inside a single album, say, an Opera which is meant to be fully played w/out pauses, I don't want the volume to be leveled throug Pianissimo and Forte tracks.
    Question:
    Is there any way to disable Soudcheck for a single Album so iTunes does NOT calculate peek levels on its tracks and does not set gain/loss accordingly?
    Or do I need to turn off Soundcheck on the iPod when I want to listen to that particular Album?
    I have tried "Volume level" slider but it sets the overall volume gain of the Album and not the relative level between tracks. Also the "pauseless" option (sorry, I use a localized version) is no solution.
    TIA

    Is there any way to disable Soudcheck for a single Album
    No.
    Or do I need to turn off Soundcheck on the iPod when I want to listen to that particular Album?
    Yes.

  • How to disable iMessage for a single contact?

    Hello apple communites, I have a simple and hopefully simple to answer question..
    I am curious as to how to disable iMessaging for a single contact.  My sister when she got her phone number originally had an iPhone, she has since gotten an android and kept the same phone number.  However I am running into issues with text messages to her, my phone still thinks she has an iPhone and continues to send every text as an iMessage, resulting in a failed message.  I can easily hit the "send again as a text message" option and the message/picture sends as normal.  I however find this a bit fustrating, and have tried everything I can think of to attempt to disable this.  However all the online tutorials I can find regarding disabling iMessage turns the feature off completly, I don't wish to do that. 
    I have attempted to completely delete, (including all existing all texts and call history), and then re-add the contact, but that does not work either, my iPhone still attempts to send messages to my sister as an iMessge. Any help, if any, would be appreciated. Thanks in advance.

    Your sister needs to disable iMessage on her iPhone if the iPhone is still available if she hasn't already done so.
    If she has, does she have iMessage enabled with the same Apple ID on another iOS device or on a Mac as was used to activate iMessage on her iPhone?

  • How to disable click for open a app mobile? i have picture.

    how to disable click for open a app mobile?
    How i do?
    why adobe captivate need to click for open app.
    i need to open auto.
    thank you

    Swiping down from the midle of the screen will open the search window on its upper section.

  • How to disable debugger for sapscript forms.

    How to disable debugger for sapscript forms.
    Once activated in se71-Utilities-Activate debugger I do not know how to disable it

    Thank you Rich
    I assigned you points for good answer on my preavious mail)
    . Actually my real problem is a transported the SAP script form “znalepke2” , printer definition ”nale”
    and device type “zststartsp” of a thermal printer.
    On original system (ak1) the printout is ok but on target system(ak2)
    not.
    Lateron I transported also :
    R3TR SCPD 1403(as the device type uses this character set)
    R3TR TABU TSP08 (All entries)
    R3TR TABU TSP1D(All entries)
    R3TR TABU TSP1T(All entries)
    I used also report  RSTXSCRP to traport form and device types. L
    Lately I discovered that when I performe printout preview I get also eronneous printout If I ssue an printout preview in language "EN" on system "ak1"(only on system ak1 and form preview in "SL" is oK. What steps you suggest me to solve the prolem
    Thank you in advance

  • How to disable IFD for a particular organization in MSCRM 2013?

    Hi All,
    We have a requirement to disable IFD only for a particular organization. Does MSCRM support IFD per organization?
    Thanks in advance.
    -Jai

    You cant disable IFD for a particular organization considering that its the servers which are configured for IFD and not the organizations.
    Regards, Abhishek Bakshi If you find this post helpful then please Vote as Helpful and Mark As Answer. Check my blog on https://mydynamicscrmblog.wordpress.com/

Maybe you are looking for

  • I want to capture from my Panasonic HVX200 into Final Cut!

    ...specifically, I want to be able to man my HVX200, which is connected to the publishing station via firewire, and capture it into FinalCut real-time creating a new file every time I start and stop recording. I'm not having any problems capturing in

  • OIM 11g R2 - AD provisioning based on Role and Access Policy

    Hi, for Active Direcotry integration i used some prepopulation plugin for populationg resource form (based on http://fusionsecurity.blogspot.sk/2013/01/populating-request-attributes-in-oim.html). It's work fine - requested account was fully provision

  • Page fault error while calling reports from forms

    dear friends. when a report is called from forms, just before opening up of background engine the application gets hanged with page fault. One has to forcibly shut down the application before loggin again. The error mesage generated from log file is

  • Can't install german ver. of LabVIEW 6i

    At the very beginning (after clicking "start installation") of the installation of the german academic version of LabVIEW 6i on Win2000(german), "Windows Installer" gives an error message like: "Fehler bei der Anwendung von Transformen. Sind Sie sich

  • FCPX Blade cuts are snapping to beginning/end of frame. How do I turn this off?

    Hello, My FCPX preferences are set to show subframes within project timelines. I would like to make blade cuts within subframes, however when I make a cut with the Blade tool, the cut snaps to the beginning or end of the frame that I am in. The frame