Disable selection color in datagrid/list/tilelist?

I have a datagrid and would like to disable the selection
color. I disable the rollover color by using useRollOver to
false.

MXML
<mx:DataGrid id="dg"
selectionColor="dg.getStyle('backgroundColor')"/>
AS
dg.setStyle("selectionColor",
dg.getStyle("backgroundColor"));

Similar Messages

  • Getting system selection colors

    Hi,
    I am trying to implement the TreeCellRenderer interface. In doing that, I need to take care of the condition when a node is selected by the user, by changing the background and foreground colors of the node.
    Can somebody tell me how to get the default system selection colors?
    In List Renderers, this can be done by calling the getSelectionBackground () method.
    However, no such method exists for JTrees.
    Any ideas?
    ~Y

    Color c = UIManager.getColor("Tree.selectionBackground");
    The tree color keys are these:
    Tree.background
    Tree.foreground
    Tree.selectionBackground
    Tree.selectionBorderColor
    Tree.selectionForeground
    UIDefaults d = UIManager.getDefaults();
    that gets a hashtable (UIDefaults extends Hashtable) so you could use that to get a set of keys and create a list of keys for the L&F you are using. Most key names are pretty obvious what type they are (colors, fonts, etc.)

  • Multi color gradient for touch and selected color of spark mobile list

    multi color gradient for touch and selected color of spark mobile list
    how to get dat?

    or how about a bitmap as the background for the touch and selected color for the items in a list.

  • List Selection Color

    Hi,
         I have two list boxs 'tracklist and racelist' in which we have setted a selection color. We uesd to refresh the datas in listbox every one minute. When the cursor is idle over an entry in the Track or Race list while the data refreshes, thst entry is not displayed until the cursor is moved.That its rollover color changed to white. How to overcome this.
    Regards,
    Jayagopal.

    Hi,
                 I have applied a fixed selection color only.
    Thanks,
    Jayagopal.

  • Selection color disappears after refreshing the list control

    Hi,
    I have two list boxs 'tracklist and racelist' in which we have setted a  selection color. We uesd to refresh the datas in listbox every one  minute. When the cursor is idle over an entry in the Track or Race list  while the data refreshes, thst entry is not displayed until the cursor  is moved.That its rollover color changed to white. How to overcome this.
    Regards,
    Jayagopal.

    Hi,
                 I have applied a fixed selection color only.
    Thanks,
    Jayagopal.

  • How to find if all items in a list containing the selected color

    Hi
    I'm using the code below to check what color the user has selected. This is only working when my item got one color. Now I would like to change my code so each item can have one or more colors (seperated by semicolon). I guess
    I have to use string.IndexOf but I don't know how to use it in the .Where scentence below to return all the items that got the selected color.
    Thanks, Sigurd F
    var sampleDataGroups = await SampleDataSource.GetGroupsAsync();
    sampleDataGroups = sampleDataGroups.Where<SampleDataGroup>(Item => Item.Color == KeywordColorList.SelectedValue.ToString()).ToList();

    If the Color property of the SampleDataGroup class contains a string with different colours separated by a semicolon you could use the following code to determine whether the KeywordColorList.SelectedValue property is amont these colours:
    var sampleDataGroups = await SampleDataSource.GetGroupsAsync();
    sampleDataGroups = sampleDataGroups.Where<SampleDataGroup>(Item => Item.Color.Split(';').Contains(KeywordColorList.SelectedValue.ToString())).ToList();
    Compilable sample code:
    var sampleDataGroups = new List<SampleDataGroup>
    new SampleDataGroup { Color = "blue"},
    new SampleDataGroup { Color = "blue;red;green"},
    new SampleDataGroup { Color = "red;green"},
    string selectedValue = "blue";
    sampleDataGroups = sampleDataGroups.Where<SampleDataGroup>(Item => Item.Color.Split(';').Contains(selectedValue)).ToList();
    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

  • It's possible to disable custom color from color picker?

    Hi guys!
    I've searched in the threads about color picker but I found anything about it...
    It's possible to disable the option to select a custom color? I work in a enterprise who makes softwares to brazilian clients, and not everybody understands english phrases...
    Another way it's to translate the option, but I don't know if is possible too.
    Thanks!

    You definitely need to add the stylesheet to the Scene, not to anything else. If you take my example and change
    scene.getStylesheets()...
    to
    root.getStylesheets()...
    you'll see that it won't work any more.
    The difference between this and the css you used is that the css you used is applied to the display of the color picker button; you need to apply styles to the popup (the color palette), which is not contained in your VBox or AnchorPanes. Notice how the font has changed for the name of the color in the button, but it hasn't changed for the "Custom Color" label you are trying to remove.
    Somewhere there is some code that is adding the VBox you are subclassing to a Scene, and setting that scene into a stage. Your best option (perhaps second best option, see below) is to find that code so you can add the stylesheet to the Scene itself.
    If you're working within a framework someone else has written, and can't access or change the code where the scene is defined, you have another option that I can see. Every Node has a scene property that refers to the scene to which that node belongs. So you could observe changes to that property and when it's updated, add the stylesheet to the scene.
    So here is a hack to make my original hack work, in the event that you cannot access the scene directly, for some reason:
    final String suppressCustomColorCss = getClass().getResource( "noCustomColorPicker.css").toExternalForm();
    colorPicker.sceneProperty().addListener(new ChangeListener<Scene>() {
    @Override
      public void changed(ObservableValue<? extends Scene> observable,
      Scene oldScene, Scene newScene) {
      if (newScene != null) {
      List<String> cssClasses = newScene.getStylesheets();
      if (!cssClasses.contains(suppressCustomColorCss)) {
      cssClasses.add(suppressCustomColorCss);
    This code basically says "when the color picker becomes part of a new scene, add the stylesheet to that scene".
    At this point, you're applying hack on top of hack to get the effect you need. I think if I were in this situation I would just go ahead and define my own color picker. All you really need is a MenuButton, a property to hold the selected color, and a popup with a layout of controls to choose an arbitrary color. It would be a bit of work, but shouldn't be too hard. If you take this option (which I think may be your best bet), it's more work now but it will be clear what you are doing - when you (or other programmers on your team) come back to the code later you'll understand how it works much better.
    You should also file a couple of feature requests. One for API to enable/disable the option to choose a custom color, as this seems like a reasonable piece of functionality to have. The other should be for properly internationalized text for the labels in the color picker, as these are currently just hard coded into the source code in English.

  • Disabled foreground color in JComboBox

    what's the correct way to set the disabled foreground color of a jcombobox? i don't want to set the disabled color for the entire ui to the same color, but for one jcombobox specifically. i searched the web and found many posts with the same question, but no real solution. this one has been giving me nightmares and i thought i'd share what i've found. the solution seems to be quite simple: wrap the combobox label in a panel. that way the panel gets the disabled colors, but the coloring of the label of the combobox remains. here's the solution in short in case others need it:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.DefaultListCellRenderer;
    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.ListCellRenderer;
    public class MyComboBox extends JComboBox {
      public MyComboBox() {
        super();
        setRenderer( new ColorCellRenderer());
      public static void main(String s[]) {
        JFrame frame = new JFrame("ComboBox Example");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        final JComboBox cb = new MyComboBox();
        cb.addItem( "ComboBox Item 1");
        cb.addItem( "ComboBox Item 2");
        cb.addItem( "ComboBox Item 3");
        cb.setForeground( Color.blue);
        final JButton bt = new JButton ("disable");
        bt.addActionListener( new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            cb.setEnabled( !cb.isEnabled());
            if( !cb.isEnabled()) {
              cb.setForeground( Color.red);
              bt.setText( "enable");
            } else {
              cb.setForeground( Color.blue);
              bt.setText( "disable");
        frame.getContentPane().setLayout( new FlowLayout());
        frame.getContentPane().add( bt);
        frame.getContentPane().add( cb);
        frame.pack();
        frame.setVisible(true);
      class ColorCellRenderer implements ListCellRenderer {
        protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
        public Component getListCellRendererComponent(JList list, Object value,
            int index, boolean isSelected, boolean cellHasFocus) {
          JLabel label = (JLabel) defaultRenderer
              .getListCellRendererComponent(list, value, index,
                  isSelected, cellHasFocus);
          JPanel wrapper = new JPanel();
          wrapper.setLayout( new BorderLayout());
          wrapper.add( label, BorderLayout.CENTER);
          return wrapper;
    }if anyone knows a way to remove the dropdown button of a disabled combobox without leaving a blank space when you simply hide the button, feel free to extend this :-)
    Edited by: Lofi on Mar 20, 2010 10:46 PM

    i thought i'd share what i've found. the solution seems to be quite simple: wrap the combobox label in a panel.Brilliant! I'm sure this will be useful to others who find this solution here.
    Your code does have some unnecessary overheads though, like constructing a new JPanel in every call to getListCellRendererComponent, and holding a separate renderer as a field. I've attempted to clean it up for brevity and efficiency.import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.DefaultListCellRenderer;
    import javax.swing.JCheckBox;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    public class DisabledForegroundListCellRenderer extends DefaultListCellRenderer {
      private final JPanel wrapper = new JPanel(new BorderLayout());
      public DisabledForegroundListCellRenderer() {
        wrapper.add(this);
      @Override
      public Component getListCellRendererComponent(JList list, Object value,
              int index, boolean isSelected, boolean cellHasFocus) {
        super.getListCellRendererComponent(list, value,
                index, isSelected, cellHasFocus);
        return wrapper;
      // Test rig
      public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            new DisabledForegroundListCellRenderer().makeUI();
      public void makeUI() {
        String[] data = {"One", "Two", "Three"};
        final JComboBox combo = new JComboBox(data);
        combo.setRenderer(new DisabledForegroundListCellRenderer());
        final JCheckBox check = new JCheckBox("Combo enabled");
        check.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            boolean selected = check.isSelected();
            combo.setForeground(selected ? Color.BLUE : Color.RED);
            combo.setEnabled(selected);
        check.doClick();
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.add(check, BorderLayout.NORTH);
        frame.add(combo, BorderLayout.SOUTH);
        frame.pack();
        frame.setVisible(true);
    }I've also changed the class name, as to me "ColorCellRenderer" would rather imply something that renders either the foreground or the background (or both) on the basis of the value parameter.
    if anyone knows a way to remove the dropdown button of a disabled combobox without leaving a blank space when you simply hide the buttonThat would require a custom UI delegate, not a custom renderer. And really, I wouldn't bother -- I would just use a JComboBox and a disabled (or maybe uneditable) JTextField, held in a CardLayout, and swap them instead of disabling the combo.
    Shall take a look at how the combo UIs reserve space for the button though :)
    luck, db
    Edited by: DarrylBurke -- changed wrapper to private final, it shouldn't be static

  • How to disable selection of root node in JTree

    Hi all! Thanks for taking a minute to read my post!
    I am writing a really basic JTree for showing a list of items.
    Here is some of the code:
    /** Create a basic tree **/
    DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Title");
    DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);
    JTree tree = new JTree(treeModel);
    /** Method to return the string of the current highlighted selection **/
    public String getSelectionString()
    DefaultMutableTreeNode node =
    tree.getSelectionPath().getLastPathComponent();
    return (String)node.getUserObject();
    I would like to disable selection of the root node of my JTree.
    Thus, if I make a call to getSelectionString() above, it would return null instead of the string that represents the root label.
    I have read the following forum on disabling various TreePaths and TreeNodes in a JTree:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=224691
    This forum suggests implementing the TreeSelectionListener interface and the TreeSelectionModel class and over-riding the addSelectedPath() methods. I tried this suggestion, and I was able to enable and disable the different children of the Jtree, but the root of the JTree would not disable.
    I suppose that I could just simply remove the visibility of the root node, but I really want to avoid that option if possible.
    Wait --- let me be clear ---- I want to disable the selection of the root node only - still allowing selection of all its children.
    Any suggestions?
    Am I missing something really simple here?
    Did I explain my problem clearly?
    Thanks in advance!
    jewels

    simply try this..
    in the
    public void valueChanged(javax.swing.event.TreeSelectionEvent event);
    method of TreeSelectionListener impelentation get the
    TreePath tp = event.getPath();
    from TreePath get the component and then remove the selection from the treePath if it is the node u were checking/root node in this case
    tree.getSelectionModel().removeSelectionPath(tp);
    Try out....

  • Default selection color

    Need some help with the following:
    Meshes in an 3D annotation are selectable, clicking a mesh changes it's color. double clicking a mesh selects all meshes in the annotation and draws some kind of wire frame box around all meshes in the scene.
    I want to:
    A: disable / remove the 'selection' color when I click a mesh.
    B: I don't want any selection / wire frame box when I double-click a mesh.
    Thanks in advance!
    W. Zwiers

    Did you want to disable just the color, or selection completely? There is "runtime.overrideSelection = true" to disable selection, then you can use mouseEvents to track what is clicked.
    Grayson

  • Selection Color of JSlider

    I am making a GUI for a little software game.
    But i have a problem with my slider. I want to change the selection color from the tumb from the standard "beautiful" purple to another color.
    I've tried following settings , with UIManager.put("Slider.background",new ColorUIResource(Library.SETCOLOR)):
    Slider.background
    Slider.focus
    Slider.foreground
    Slider.highlight
    Slider.horizontalThumbIcon
    Slider.majorTickLength
    Slider.shadow
    Slider.trackWidth
    Slider.verticalThumbIcon
    SliderUI
    Slider.border     
    Slider.focusInsets     
    None of these settings worked.
    I also tried all the settings listed on the following URL :
    http://forums.e-plus.com.au/thread.jsp?forum=3&thread=93
    But they did'nt work either.
    Please help me out??

    Look in the documentation in the styles section.
    Sincerely,
    Michael
    El 15/05/2009, a las 5:26, kRizzl0r <[email protected]> escribió:
    >
    hi there,
    >
    i was wondering why the TextField's selection color in AIR is 
    different from the one in the flashplayer - and if there is a way to 
    change it?
    who chose a grey tone as highlight color, and an even lighter grey 
    when the TextField lost its focus? seems like a strange decision to 
    me..
    >
    cheers
    >

  • Changing the disabled foreground color of a disabled JList

    I am using a JList inside JScrollPane. If the list is disabled the foreground color of list changes to grey. How can I change this disabled foreground color.
    regards,
    nirvan.

    Well, a JList uses a JLabel as the default renderer. So you can try using the UIManager to set the "Label.disabledForeground" color to whatever you want. Of course this will also affect disabled labels.
    Or, you can create a custom renderer for the list and control the disabled color in the renderer.

  • JTextArea  / Disabling selection

    Im getting a bit frustrated with this, hence my post....
    I have a JTextArea, in which will contain various text.
    The component should not be editable, and likewise should not be selectable.....
    I still have not found a way to disable text selection in a JTextArea, in fact any subclass of JTextComponent for that matter.
    why setEnabled(false) does not prevent selection is beyond me........
    I had a similar problem once before, and my solution was to set selection color to thed, which worked just fine, despite not really solving the problem....
    I would probably go ahead and use this technique again, however I have a different situation here, Im using a translucent background, (0,0,0,0) and setting selection color to this value does not seem to work...
    Is there a way to totaly disable selection???
    Should I possibly use a different component to handle the task, which does not support selection, ( Ihavent found anything yet). I need to have line wrap so a few of the more basic components are out of question....
    Im hoping some would give me some suggestions on this, they will be greatly apreciated, and as always adequately rewared....
    Thanks
    J.Prisco

    I had a non-editable JEditorPane which I didnt want to select its text, if I'd set it to setEnabled(false) whenever I would've cross a hyperlink, The cursor would not change to a Hand-Cursor (because the comp. is disabled)
    So, What I did was just "disabling" the selection (not the comp.) by setting my own Caret as follows:
            JEditorPane lbl = new JEditorPane();
            lbl.setCaret(new javax.swing.text.Caret()
                public void install(javax.swing.text.JTextComponent c){}
                public void deinstall(javax.swing.text.JTextComponent c){}
                public void paint(Graphics g){}
                public void addChangeListener(ChangeListener l){}
                public void removeChangeListener(ChangeListener l){}
                public boolean isVisible(){return false;}
                public void setVisible(boolean v){}
                public boolean isSelectionVisible(){return false;}
                public void setSelectionVisible(boolean v){}
                public void setMagicCaretPosition(Point p){}
                public Point getMagicCaretPosition(){return new Point(0,0);}
                public void setBlinkRate(int rate){}
                public int getBlinkRate(){return 10000;}
                public int getDot(){return 0;}
                public int getMark(){return 0;}
                public void setDot(int dot){}
                public void moveDot(int dot){}
            });Again I remind you that this will only work good for non-editable text components...
    Cheers
    Eyal

  • How set disable select matrix column header

    How set disable select matrix column header same Inventory-->Pick List Form
    Thanks Advance.

    Hi ,
    do u mean Price List Form Header...
    If Yes Means Try the Following,
    select case pVal.FormType
    case "155"
    Select Case pVal.Before_Action
    case True
    select case pval.ItemUid
    case "3"
    Select Case pVal.EventType
    Case SAPbouiCOM.BoEventTypes.et_CLICK
    if pval.row = 0  Then BubbleEvent = False : Exit Sub
    End Select
    End Select
    End Select
    Regards,
    Ganesh k

  • Applescript - Selecting Last Group in List

    Hello,
    I'm trying to select the Guest User in System Preferences.  I've gotten to the Users & Groups pane, but I need some way to select the last group (guest user) without saying something like "Group 4" since I'll be using this on computers with variable amounts of users.  I tried this:
    tell application "System Preferences"
                                  set current pane to pane "com.apple.preferences.users"
                        end tell
                        select last child of list 1 of application "System Preferences"
    but it didn't work.  Any suggestions?
    Thanks!

    I'm just going to disable the guest user using a shell script, but I'm still having the same issue trying to access "Login Options" at the bottom of that box.  I've tried to see if there are any anchors (tabs) I could select by doing this:
    get the name of every anchor of pane id "com.apple.preferences.users"
    But it's not working.

Maybe you are looking for

  • IMac G5 17" is DOA... drive not visible in Disk Utility

    About a week after my computer went out of warranty (OS 10.3.9), I have been experiencing random complete system meltdowns every 5 or 6 months. It begins while using the search feature, the beachball spins for 8-10 minutes then pulls search results.

  • PDF Error

    Hi All, I am getting one error in Adobe forms... When I create a form and execute with out activation it is generating the PDF document ... when I do the same with activation it is giving system error....Can any  one suggest me how to overcome ..

  • What should I use BCS or directly connect to sql server to get data.

    Hi All, I have a requierment where the data is in the sql server. We  are using sharepoint webpart to show the data from the sql. Should i get the data from the sql server using connection string. Is there any better way to get data from Sql server t

  • Missing $IAS_ORACLE_HOME/Apache/Apache/conf/oprocmgr.conf

    Hi all, As per my problem AppsLocallogin shows blank page or HTTP-403. I got metalink 372096.1 note which will definitly resolve my issue but the problem is I m getting the the oprocmgr.cof file is missing under #IAS_ORACLE_HOME/Apache/Apache/conf Is

  • Troubles to locate where is the "I agree"

    I purchased a program from iTunes Store and when it was downloaded (the program), appeared a message that I need to agree with a TERMS AND CONDITIONS... I clicked this message, went to the page, but I CANNOT FOUND WHERE IS THE "I AGREE" term to click