Background color of a list item implemented as Tlist

Hi,
I have one form with 3 blocks each holding one list item. The list item that has the focus should have a different background color from the other 2 list items. I thought to implement this with visual attributes I assign in the when-new-block-instance trigger. This however only partially works.
What happens is the following :
At startup focus is in the first block. This block's when-new-block-instance trigger is fired :
SET_ITEM_PROPERTY('BK_LIST.LIST',VISUAL_ATTRIBUTE ,'VA_INDICATOR');
SET_ITEM_PROPERTY('BK_LIST2.LIST',VISUAL_ATTRIBUTE ,'VA_ENABLED_LIST');
SET_ITEM_PROPERTY('BK_LIST3.LIST',VISUAL_ATTRIBUTE ,'VA_ENABLED_LIST2');
and the list correctly gets it's yellow background. (defined in va_indicator)
Va_enabled_list and va_enabled_list2 both have a white background, difference between them is the font size)
Now when we move focus to the 2nd block we get a different behaviour. This is the trigger defined on the 2nd block :
SET_ITEM_PROPERTY('BK_LIST.LIST',VISUAL_ATTRIBUTE ,'VA_ENABLED_LIST');
SET_ITEM_PROPERTY('BK_LIST2.LIST',VISUAL_ATTRIBUTE ,'VA_INDICATOR');
SET_ITEM_PROPERTY('BK_LIST3.LIST',VISUAL_ATTRIBUTE ,'VA_ENABLED_LIST2');
So I except the first block to get a white background again and the second block to get it's yellow background. However only the selected row in the tlist changes it's background color. (this in both blocks)
I do not understand why the first time (at form startup) the background color is set for the whole item and the second time only for the selected record.
I tried to use the property background_color but the colors are different from what I see in my color palette in that case. If I use the same color codes I also use in my visual_attributes the final result on the screen is different...
Secondly the result is the same, at form startup the item's background is set, as from the second call only the current salected record in the tlist will change from background color.
Forms are running C/S and are developed in Forms 6i. One way to get the result I need is by navigating back & forward to my application in Windows using Alt-Tab. At that moment the correct background colors are suddenly applied... Is there a way to force a similar sort of screen refresh ?
Thanks for any hints, workarounds, tips or solutions !
Kris
Message was edited by:
[email protected]

Hi,
I still don't have a clue how I could solve this one.
It works leaving the block (so making it white again) but it does not work entering the block. (giving the list item another background color). The problem is not about the whithe color. If I do my tests with other colors (red-yellow) the problem remains.
Best Regards,
Kris

Similar Messages

  • How to change the selection background color of the selected item in the popup menu of the choice box ?

    How to change the selection background color of the selected item in the popup menu of the choice box ?
    By defaut, the selection background color likes "blue", but if I want it to be "yellow" for example, how should I do ?
    Thanks

    The id is applied by (I think) the skin class of the ChoiceBox. You don't need to define it.
    You have to apply the css in an external style sheet. You can apply the external style sheet to any parent of your choice box, or to the scene (the most usual way to do it).
    Example:
    import java.util.ArrayList;
    import java.util.List;
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.control.ChoiceBox;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    public class ChoiceBoxTest extends Application {
      @Override
      public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("Example 2");
        final ChoiceBox<String> choiceBox = new ChoiceBox<>();
        List<String> tempResult = new ArrayList<String>();
        for (int i = 0; i < 10; i++) {
          tempResult.add("Item " + i);
        choiceBox.getItems().setAll(tempResult);
        VBox root = new VBox();
        root.getChildren().add(choiceBox);
        final Scene scene = new Scene(root, 300, 250);
        scene.getStylesheets().add("choiceBox.css");
        primaryStage.setScene(scene);
        primaryStage.show();   
      public static void main(String[] args) {
        launch(args);
    choiceBox.css:
    @CHARSET "UTF-8";
    #choice-box-menu-item:focused  {
    -fx-background-color: yellow ;
    #choice-box-menu-item .label {
    -fx-text-fill: black ;
    Message was edited by: James_D

  • How to Color code the list items if Issue Tracking lists in Sharepoint 2010 SP1

    Hi, Can any one guide me in making the list tasks color coded according to the status of the issue.
    as if issue is Resolved ( green line ), Active ( red line ) etc.
    example as following:
    I have read a lot of blogs, but none have step by step guide. a step by step guide will be excellent. Thanks in advance.
    http://blog.pathtosharepoint.com/2009/02/26/highlight-rows-in-sharepoint-lists/
    http://blog.pathtosharepoint.com/2008/09/01/using-calculated-columns-to-write-html/
    etc
    Thanks.

    Do you have SharePoint Designer 2010 installed?
    Open your site in sharepoint designer
    click lists and libraries
    click the name of your list
    in "views" on the right, click "new..." and give it a name.
    in this new view of the list, click in one of the cells of the actual list of issues, so that the contextual ribbon at the top will give you all the options you need.
    Click "Conditional Formatting" in the ribbon.  This will let you pick "row".
    Then you just have to define your conditions:
    if priority is equal to (3) Low, then pick yellow as the background color.  Do the same type of thing to create the other 2 conditions.
    Laura Rogers
    SharePoint911: SharePoint Consulting
    Blog: http://www.sharepoint911.com/blogs/laura
    Twitter: WonderLaura
    Books:Beginning SharePoint 2010: Building Business Solutions with SharePoint
    Using InfoPath 2010 with Microsoft SharePoint 2010 Step by Step

  • List items do not refresh correctly.

    In a form that i have developed there are two list items. I
    want among others to chenge their appearance (background color
    basicaly) according to witch one has th focus each time.
    So I've put this code on the items, in WHEN-NEW-ITEM-INSTANCE
    triger:
    * LIST1
    SET_ITEM_PROPERTY('LIST1',VISUAL_ATTRIBUTE,'SELECTED');
    SET_ITEM_PROPERTY('LIST2',VISUAL_ATTRIBUTE,'GREYED');
    * LIST2
    SET_ITEM_PROPERTY('LIST2',VISUAL_ATTRIBUTE,'SELECTED');
    SET_ITEM_PROPERTY('LIST1',VISUAL_ATTRIBUTE,'GREYED');
    The Visual Attributes have the colors that i would like to
    appear on the items.
    This does not work (while it was working on Forms 5.0). It
    seems to be a refresh problem, because when you open another
    form that covers this one, or you minimize and maximize it the
    colors are assigned corectly.
    Thanks in advance for your help.
    null

    Panagiotis Lygnos (guest) wrote:
    : In a form that i have developed there are two list items. I
    : want among others to chenge their appearance (background color
    : basicaly) according to witch one has th focus each time.
    : So I've put this code on the items, in WHEN-NEW-ITEM-
    INSTANCE
    : triger:
    : * LIST1
    : SET_ITEM_PROPERTY('LIST1',VISUAL_ATTRIBUTE,'SELECTED');
    : SET_ITEM_PROPERTY('LIST2',VISUAL_ATTRIBUTE,'GREYED');
    : * LIST2
    : SET_ITEM_PROPERTY('LIST2',VISUAL_ATTRIBUTE,'SELECTED');
    : SET_ITEM_PROPERTY('LIST1',VISUAL_ATTRIBUTE,'GREYED');
    : The Visual Attributes have the colors that i would like to
    : appear on the items.
    : This does not work (while it was working on Forms 5.0). It
    : seems to be a refresh problem, because when you open another
    : form that covers this one, or you minimize and maximize it the
    : colors are assigned corectly.
    : Thanks in advance for your help.
    Hi Panagiotis Lygnos ,
    I am not able to produce this problem. I create one form with
    two list item ,two visual attribute & when-new-item-instance
    trigger for these two list item as you have written above.
    But List item background color of both list item is getting
    changed according to witch one has th focus each time.
    Even I tried to call this form from some other form still I am
    getting correct result.
    Can you just try by adding synchronize in the trigger of
    both list item.
    SET_ITEM_PROPERTY('LIST1',VISUAL_ATTRIBUTE,'SELECTED');
    SET_ITEM_PROPERTY('LIST2',VISUAL_ATTRIBUTE,'GREYED');
    Synchronize;
    Bye
    Mani/-
    null

  • Spry Horizontal Menu List Items crash IE6 browser

    ****Update*****
    Apparently, it was width:100%; set on each hover over
    background color for the list items in our default stylesheet that
    was causing IE6 to crash.
    Menus are in working order in all browsers now!
    We have integrated the Spry Horizontal Menu with a website,
    and added custom styling to SpryMenuBarHorizontal.css. The menu
    works in Mozilla, Safari, and IE7. However, in IE6, after hovering
    over the navigation, the drop down menu appears, but, as soon as
    you move your mouse into the drop down to select an item from the
    list, IE6 crashes. Every time. Various Computers.
    We have tried reverting to the original
    SpryMenuBarHorizontal.css file, however, the same problem occurs.
    We haven't made any changes to the original js file
    (SpryMenuBar.js).
    Has anyone ever experienced this issue?
    Here is our customized CSS:
    @charset "UTF-8";
    /* SpryMenuBarHorizontal.css - Revision: Spry Preview Release
    1.4 */
    /* Copyright (c) 2006. Adobe Systems Incorporated. All rights
    reserved. */
    LAYOUT INFORMATION: describes box model, positioning,
    z-order
    img#nfl {
    background-image:url(/Images/slices/nfl.png);
    background-repeat:no-repeat;
    height:14px;
    width:40px;
    margin:7px auto auto 25px;
    _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,
    sizingMethod=scale src="/Images/slices/nfl.png");
    _background-repeat:no-repeat;
    _background-image:none;
    img#mlb {
    background-image:url(/Images/slices/mlb.png);
    background-repeat:no-repeat;
    height:14px;
    width:43px;
    margin:7px 20px auto auto;
    _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,
    sizingMethod=scale src="/Images/slices/mlb.png");
    _background-repeat:no-repeat;
    _background-image:none;
    img#milb {
    background-image:url(/Images/slices/milb.png);
    background-repeat:no-repeat;
    height:14px;
    width:112px;
    margin:7px auto auto auto;
    _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,
    sizingMethod=scale src="/Images/slices/milb.png");
    _background-repeat:no-repeat;
    _background-image:none;
    _margin:7px auto auto -10px;
    img#ctown {
    background-image:url(/Images/slices/ctown.png);
    background-repeat:no-repeat;
    height:14px;
    width:114px;
    margin:7px auto auto 50px;
    _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,
    sizingMethod=scale src="/Images/slices/ctown.png");
    _background-repeat:no-repeat;
    _background-image:none;
    _margin:7px auto auto 40px;
    img#nba {
    background-image:url(/Images/slices/nba.png);
    background-repeat:no-repeat;
    height:14px;
    width:43px;
    margin:7px auto auto 100px;
    _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,
    sizingMethod=scale src="/Images/slices/nba.png");
    _background-repeat:no-repeat;
    _background-image:none;
    _margin:7px auto auto 70px;
    img#nhl {
    background-image:url(/Images/slices/nhl.png);
    background-repeat:no-repeat;
    height:14px;
    width:41px;
    margin:7px auto auto 90px;
    _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,
    sizingMethod=scale src="/Images/slices/nhl.png");
    _background-repeat:no-repeat;
    _background-image:none;
    _margin:margin:7px auto auto 100px;
    img#ncaa {
    background-image:url(/Images/slices/ncaa.png);
    background-repeat:no-repeat;
    height:14px;
    width:52px;
    margin:7px auto auto 70px;
    _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,
    sizingMethod=scale src="/Images/slices/ncaa.png");
    _background-repeat:no-repeat;
    _background-image:none;
    _margin:7px auto auto 60px;
    /* The outermost container of the Menu Bar, an auto width box
    with no margin or padding */
    ul.MenuBarHorizontal
    list-style-type: none;
    cursor: default;
    width:950px;
    height:32px;
    background-image:url(/Images/slices/primaryNavSlice.png);
    background-repeat:repeat-x;
    margin:0px;
    padding:0px;
    vertical-align:middle;
    border-bottom:1px solid #000;
    /* Set the active Menu Bar with this class, currently setting
    z-index to accomodate IE rendering bug:
    http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html
    ul.MenuBarActive
    z-index: 1000;
    /* Menu item containers, position children relative to this
    container and are a fixed width */
    ul.MenuBarHorizontal li
    margin: 0px;
    padding: 0px;
    list-style-type: none;
    font-size: 100%;
    position: relative;
    text-align: left;
    cursor: pointer;
    width: 8em;
    float: left;
    /* Submenus should appear below their parent (top: 0) with a
    higher z-index, but they are initially off the left side of the
    screen (-1000em) */
    ul.MenuBarHorizontal ul
    margin: 0px;
    padding: 0px;
    list-style-type: none;
    font-size: 100%;
    z-index: 1020;
    cursor: default;
    /*width: 8.2em;*/
    width:auto;
    position: absolute;
    left: -1000em; /* without this all menus are visible without
    hover */
    /* Submenu that is showing with class designation
    MenuBarSubmenuVisible, we set left to auto so it comes onto the
    screen below its parent menu item */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
    left: auto; /* without this menus don't show up */
    /* Menu item containers are same fixed width as parent */
    ul.MenuBarHorizontal ul li
    /*width: 8.2em;*/
    width:auto;
    DESIGN INFORMATION: describes color scheme, borders, fonts
    /* Menu items are a light gray block with padding and no text
    decoration */
    ul.MenuBarHorizontal a
    display: block;
    cursor: pointer;
    padding: 0.15em 0.15em;
    text-decoration: none;
    ul#teamsMenu table#teams {
    font-family:Arial, Helvetica, sans-serif;
    color:#000;
    font-size:11px;
    width:500px;
    background-color:#fff!important;
    BROWSER HACKS: the hacks below should not be changed unless
    you are an expert
    /* HACK FOR IE: to make sure the sub menus show above form
    controls, we underlay each submenu with an iframe */
    ul.MenuBarHorizontal iframe
    position: absolute;
    z-index: 1010;
    li.ncaa_list #teams.ncaa_table {
    position:absolute;
    left:-590px;
    top:7px;
    To center the tables in the screen
    li.nfl_list #teams.nfl_table {
    position:absolute;
    top:7px;
    li.mlb_list #teams.mlb_table {
    position:absolute;
    top:7px;
    li.milb_list #teams.milb_table {
    position:absolute;
    left:-80px;
    top:7px;
    li.ctown_list #teams.ctown_table {
    position:absolute;
    top:7px;
    li.nba_list #teams.nba_table {
    position:absolute;
    left:-200px;
    top:7px;
    li.nhl_list #teams.nhl_table {
    position:absolute;
    left:-190px;
    top:7px;
    li.ncaa_list #teams.ncaa_table {
    position:absolute;
    left:-590px;
    top:7px;
    }

    I am having the same problems in IE7. I'm using the latest
    version of everything (Spry 1.6.1 and javascript file version 0.12)
    and at first I was having the problem on my drop down menus
    appearing horizontal with all the correct styles but when I changed
    the rule ul.MenuBarHorizontal ul to position: relative; the drop
    downs appear vertical now but I have no beige border around the
    whole ul anymore and I'm getting white space inbetween list items.
    http://www.wusf.usf.edu/Header_Nav_Footer_newStyleSheet.cfm
    so if anyone has any advice I'd much appreciate it. Also i'm
    using 1px width on my borders no decimals.

  • Change background color of List Title

    I am able to change the text color however, I am not able to change the background color of the Title on my List.
    The list template I am using is Vertical Unordered List without Bullets.
    Here is my code :
    <span style="color:pink"; "background-color:black">My List Title</span>.
    The text color is pink, however the background color remains blue.
    Do I need to create a new template for the list ?

    Please surround your HTML with the the following tag We need to check if your code is displaying properly.
    Scott                                                                                                                                                                                                                                                           

  • How to change the current item background color

    I m working in forms 6.0.
    I want to mak the background color of the current item (whatsoever the item name is ) as 'yellow'. How can i do that.How can i accoplish that? I've tried
    set_item_property(:system.cursor_item,background_color,'yellow');
    in Pre_text_item
    set_item_property(:system.cursor_item,background_color,'white');
    in post_item_item
    at block level
    But i failed to do that
    anyone to help me plz
    Riaz Shahid

    hi riaz,
    i think instead of pre-text-item put the code in when new item instance.or try creating a visual attribute with background color as yellow and attach that using set_item_property in when new item instance or check for help on DISPLAY_ITEM built in in forms help.I think one of these should definitely help u.
    bye
    Atul

  • How can I change the background color of a menu ring?

    Hi
    Does anybody know how to change the background color of a menu ring??? (not the backround color of the first item, the background color of the list (remains always gray))
    thanks martin

    Try Preferences>>Colors>>Menu Background, but this will change ALL menu's background color.
    Hope this helps

  • Change background color in a JPopupMenu?

    Hello. I've been trying to change the background color of a JPopupMenu, so far with no success.
    I've tried:
    + invoke setBackground() along with setOpaque()
    + subclass JPopupMenu and provide the following method:
         public void paintComponent(Graphics g) {
              g.setColor(new Color(0,0,0));
              g.fillRect(0, 0,100,100);
              super.paintComponent(g);
         (Ignore the numbers in fillRect() -- I'm just trying to see any effect at all!)
    + change the relevant(??) properties in the UIManager:
         UIManager.getDefaults().put("PopupMenu.background",Color.BLUE);
         UIManager.put("PopupMenu.background",Color.BLUE);
         SwingUtilities.updateComponentTreeUI(c);
         updateUI();
         (and various combinations of similar things).
    OK, none of these seems to have any effect whatsoever. In case it matters, I am using Java 1.4.1 on Mac OSX.
    Thanks heaps for any guidance here.

    JPopupMenu just handles its JMenuItems.
    A JMenuItem is what gets painted, you can
    directly set the background color. When the
    item is selected it gets the LAF color.
    For example, change PopupMenuDemo with
        public void createPopupMenu() {
            JMenuItem menuItem;
         // set selection color before creating the items
         UIManager.put("MenuItem.selectionBackground", Color.pink); // <=== add this
            //Create the popup menu.
            JPopupMenu popup = new JPopupMenu();
            menuItem = new JMenuItem("A popup menu item");
            menuItem.setBackground(Color.red); // <=== add this
            menuItem.addActionListener(this);
            popup.add(menuItem);
            menuItem = new JMenuItem("Another popup menu item");
            menuItem.setBackground(Color.red); // <=== add this
            menuItem.addActionListener(this);
            popup.add(menuItem);
            //Add listener to the text area so the popup menu can come up.
            MouseListener popupListener = new PopupListener(popup);
            output.addMouseListener(popupListener);
        }

  • Double clicking a list item

    Hi,
    I'm just trying to perform an action by double-clicking a list item, but doesn't seem to work. code:
    WHEN-MOUSE-DOUBLE-CLICK trigger on List item (TList).
    DECLARE
    v_verwalten VARCHAR2(40);
    BEGIN
    v_verwalten := :CONTROL.LIST;
    IF v_verwalten = 'Codes verwalten'
    THEN NEW_FORM('COD_VER');
    END IF;
    END;

    Hi all,
    When the list item type is tlist, the trigger 'WHEN-LIST-ACTIVATED' will fire for "mouse double click" and "key enter".
    Try with placing the code in 'WHEN-LIST-ACTIVATED' trigger.
    Cheers,
    Zakiy

  • Incorrect list item background color in Nimbus custom ListCellRenderer

    Hi there,
    I've been doing lots of web searches trying to come up with what's going on here. It seems other people have had the same problem I've had, but in the one place that seems to nail the question directly, it doesn't seem to be resolved. The issue is that I'm using a JPanel as a ListCellRenderer for a JList. I'm using the Nimbus LAF, and my problem is that the background of the panel doesn't seem to have its background color set properly. I call setBackground on it, and it should be setting it to a DerivedColor that's pure white, but it seems to have no effect. Manually calling setBackground to white works, but it also means I've now hardcoded the color into it, which I'm trying to refrain from doing. Here's some code to reproduce the issue:
    import java.awt.Component;
    import java.awt.EventQueue;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.ListCellRenderer;
    import javax.swing.UIManager;
    import javax.swing.UIManager.LookAndFeelInfo;
    import javax.swing.border.Border;
    public class ListTest extends JFrame {
      private JScrollPane scrollPane = new JScrollPane();
      private JList list = new JList(new String[] {"TEST 1", "TEST 2"});
      private class Renderer extends JPanel implements ListCellRenderer {
        private JLabel text = new JLabel();
        public Renderer() {
          add(text);
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
          setEnabled(list.isEnabled());
          Border border = null;
          if (cellHasFocus) {
            if (isSelected) {
              border = UIManager.getBorder("List.focusSelectedCellHighlightBorder");
            if (border == null) {
              border = UIManager.getBorder("List.focusCellHighlightBorder");
          } else {
            border = UIManager.getBorder("List.cellNoFocusBorder");
          setBorder(border);
          // set renderer values
          text.setText((String)value);
          text.setFont(list.getFont());
          if (isSelected) {
            setBackground(list.getSelectionBackground());
            text.setForeground(list.getSelectionForeground());
          } else {
            // the color returned from list.getBackground() is pure white
            // but the list items appear with a grey background!
            setBackground(list.getBackground());
            // THIS works -- but is obviously hardcoded
            // setBackground(Color.WHITE);
            text.setForeground(list.getForeground());
          return this;
      public ListTest() {
        list.setCellRenderer(new Renderer());
        scrollPane.setViewportView(list);
        add(scrollPane);
        pack();
      public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
          public void run() {
            for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
              if ("Nimbus".equals(info.getName())) {
                try {
                  UIManager.setLookAndFeel(info.getClassName());
                } catch (Exception ex) { }
            new ListTest().setVisible(true);
    }Here's a StackOverflow question that is exactly what I'm experiencing, but doesn't seem to be exactly resolved: http://stackoverflow.com/questions/2787781
    Any ideas would be greatly appreciated!
    Thanks!

    // the color returned from list.getBackground() is pure white
    // but the list items appear with a grey background!
    setBackground(list.getBackground());
    // THIS works -- but is obviously hardcoded
    // setBackground(Color.WHITE);So when you hardcode the background you are using a Color object.
    Have you added any debug info to see what kind of class list.getBackground() returns?
    If it is some fancy class that extend Color, you can always create your Color object by using:
    Color background = new Color(....)
    Then all you have to do is get the RGB values from the list Color object.

  • Background color unbound list item on web

    We've got an unbound list item, which background color is changed dependent on it status (required or not). This all works fine in client/server, but on the webserver we only get a gray list.
    Has anyone a clue?

    What version of SharePoint are you using?  You mention a newer version of SharePoint but posted in the legacy forums so I'm not sure.  I'm going to take a stab that you're using SPD 2013 without the Design review.
    For your specific task, you'd really need to use Developer tools to isolate the css class.  CSS within SharePoint is a tricky beast.  If you're using Publishing sites or have activated the publishing features, then typically you'd use the system
    created Styles folder to override CSS locally.
    It's a little hard to be more precise without knowing exactly which scrollbars you want to change.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • How can I create an alt background color for items in a jlistbox or jtree

    What I'm looking to do is have a white background for say items 1,3,5, etc. and a light yellow background for items 2,4,6, etc. I was wondering how can I set an alternative background color on items in a JTree or a JList

    Use a cell renderer:
    import java.awt.*;
    import javax.swing.*;
    public class ListAlternating extends JFrame
         public ListAlternating()
              String[] items = {"one", "two", "three", "four", "five", "six", "seven"};
              JList list = new JList( items );
              list.setVisibleRowCount(5);
              list.setCellRenderer( new MyCellRenderer() );
              JScrollPane scrollPane = new JScrollPane( list );
              getContentPane().add( scrollPane );
         public static void main(String[] args)
              ListAlternating frame = new ListAlternating();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setLocationRelativeTo( null );
              frame.setVisible( true );
         class MyCellRenderer extends DefaultListCellRenderer
              public Component getListCellRendererComponent(
                   JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
                   super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                   if (!isSelected)
                        setBackground(index % 2 == 0 ? list.getBackground() : Color.LIGHT_GRAY);
                   return this;
    }

  • Change item background color on runtime

    Hello
    i have a List control in my application. What do I have to do
    to change its items background color on runtime?
    Thanks

    You have to access the style of the object and then set the
    piece of the style you want to change. You need to set
    backgroundColor.
    myList.setStyle("backgroundColor", "#ABABAB");
    #ABABAB is grey, and you can put any hex color value there
    you like.
    Hope that helps.

  • How to resize and change background color of table item

    i am using netbeans as a compiler and i am using an item (in my mobile application)called org.netbeans.microedition.lcdui.TableItem.Can i change row height and column
    width.Also i wanna change cell background color.How can i do these?
    THX FOR REPLIES

    http://www.netbeans.org/kb/50/custom-tableitem.html

Maybe you are looking for

  • Use case for showing records in report view BAM based on version number

    Hi, I have a use case to update records based on version no. Let say I have a table or data object in BAM called 'Notes'. The Notes dataobject has three fields Id, Version, Description. The Notes data is displayed in a BAM report. I need to just disp

  • Need more storage - larger internal drive, or external drive?

    Good day...here's a little background before I head into my question. I have a mid-2010 Macbook Pro with a 320 GB hard drive.  I have an 2 GB WD External Hard drive...I've partitioned 500 GB that I use for my Time Machine backups and use the remainin

  • System is not appearing in Visual composer!!

    Hi all, i have created a system on my portal to connect the R/3 backend, system is working fine but when i access visual composer by following way : http://ep62:50100/VC and clicks on find data, i am unable to find the system created by me, does anyo

  • Log and transfer idle

    I have Juast got FCE4 upgraded to do HD. I'm trying to log and transfer my AVCHD footage.  I changed my video and audio prefences. all my cips show up but if i try to play them they crash FCE.  If i try to transfer them it lookes like its loading and

  • Export Oracle 9i / Import Oracle 10g

    Dear all, I´ve a Oracle 9i installation. From this instance I create with the exp-tool a user dumpfile. Then I would like import this dumpfile into a 10g instance. With thre schematas it works only that one tell me : Only a dba can import a dumpfile