Change color of an element of JList

I would like to put some elements in different color in my JList, I know how to change all the elements but not how to change just one or several.
Thanks in advance.

You need to implement your cell renderer to do that.

Similar Messages

  • Howto change color for all elements

    I want to update the formatting for some existing Keynote presentations. Applying a new Theme does most of the work, but there are some things that are not updated to the new theme. For example: background color of certain text boxes -- and the color of actual bullets for bullet points.
    In the case of these presentations:
    - the background color of the textboxes is blue and I want them all to be transparent
    - the color of the bullets is blue and I want them all to be the default color/picture of the particular theme
    I realize this is because Keynote is "respecting" textbox formatting changes I have made in the original, but it would be nice if I could over-ride this "respect" somehow. It is easy to select all the text of a Keynote presentation and apply various ways to all the text. Is there a trick for selecting all textboxes (and changing the background color of them) -- or of specifying something to the effect of, "apply the following format to all the bullets in a presentation?

    Ok, in that file, you'll find a set of parameters that looks like this.
    sfa:r="1" sfa:g="0" sfa:b="0" sfa:a=".5"
    Those stand for the red, green, and blue of a color and the last one is the opacity. This particular combination would create a red object with 50 percent opacity. Still looking for which one of these controls the background of a text box.
    You know, it looks like if you go through the file searching for sf:fill and deleting that section, then that removes the fill. Once you find the right section, one find and replace would do it for you. It's one of those things that makes me wish I was handy enough with Automator and/or Applescript.
    Message was edited by: Kyn Drake

  • How can i change the order of  elements in a JList ?

    Hi,
    i would like to know if it is possible to change the order of elements in a JList ? Maybe i could use drag and drop to do this ?
    Thanks for answering.

    The simplest way is probably to implement ur own listmodel and then supply the listitems in the order u want. Example:
    class MyListModel
              extends AbstractListModel
              implements ContactListListener {
    public int getSize() {
    return listitemcount;
    public Object getElementAt(int index) {
    //here u return the item for the index at the list
    //if u for example have an array of strings
    //which u wanna have listed in reversed order (reversed to
    //the order in the array, u could do
         return myarray[getSize()-index];
    }

  • Where did the change color option go it was in elements 10

    In older versions of photoshop elements you could go to enhance and then at the bottom of that list you could "change color" what happened to that option?  I LOVED it and used it all the time when colors did not come out correctly.

    Color Variations has been removed from PSE12 if that’s what you’re talking about:
    http://feedback.photoshop.com/photoshop_family/topics/missing_feature_option_under_enhance _adjust_colours_colour_variations_kleurvariaties_in_elements12

  • Can I change colors of the UI Elements related to WebDynPro Java

    Can I Change the colors of the UI Elements which are embedded in the view, for ex., Button, Label, Tray, etc... and Can I change other attributes like font style, size, etc...

    hi,
    just check out these links , may not be precise to your question but are useful
    Changing the colours of Table and Group Headers in Web Dynpro
    How to change color of label in web dynpro?
    /people/sap.user72/blog/2006/04/25/colourful-table-in-web-dynpro
    Regarding Design of background color in a Web Dynpro Table
    Colors in WD - Java
    displaying color for a particular column item in a table
    hope it helps
    regards

  • How to change color of selected label from list of labels?

    My Problem is that I have a list of labels. RowHeaderRenderer is a row header renderer for Jtable which is rendering list items and (labels).getListTableHeader() is a method to get the list. When we click on the label this code is executed:
    getListTableHeader().addMouseListener(new MouseAdapter()
    public void mouseReleased(MouseEvent e)
    if (e.getClickCount() >= 1)
    int index = getListTableHeader().locationToIndex(e.getPoint());
    try
    if (((ae_AlertEventInfo)theAlerts.values().toArray()[index]).ackRequiredFlag)
    AcknowledgeEvent ackEvent = new AcknowledgeEvent(
    this, (ae_AlertEventInfo)theAlerts.values().toArray()[index]);
    fireAcknowledgeEvent(ackEvent);
    ((HeaderListModel)listModel).setElementAt(ACK, index);
    catch(Exception ex) {;}
    Upon mouse click color of the label should be changed. For some period of time ie. Upto completion of fireAcknowledgeEvent(ackEvent);
    This statement is calling this method:
    public void handleAcknowledgeEvent(final AcknowledgeEvent event)
    boolean ackOk = false;
    int seqId = ((ae_AlertEventInfo)event.getAlertInfo()).sequenceId;
    if (((ae_AlertEventInfo)event.getAlertInfo()).ackRequiredFlag)
    try
    // perform call to inform server about acknowledgement.
    ackOk = serviceAdapter.acknowledge(seqId,
    theLogicalPosition, theUserName);
    catch(AdapterException aex)
    Log.error(getClass(), "handleAcknowledgeEvent()",
    "Error while calling serviceAdapter.acknowledge()", aex);
    ExceptionHandler.handleException(aex);
    else
    // Acknowledge not required...
    ackOk = true;
    //theQueue.buttonAcknowledge.setEnabled(false);
    final AlertEventQueue myQueue = theQueue;
    if (ackOk)
    Object popupObj = null;
    synchronized (mutex)
    if( hasBeenDismissed ) { return; }
    // mark alert event as acknowledged (simply reset ack req flag)
    ae_AlertEventInfo info;
    Iterator i = theAlerts.values().iterator();
    while (i.hasNext())
    info = (ae_AlertEventInfo) i.next();
    if (info.sequenceId == seqId)
    // even if ack wasn't required, doesn't hurt to set it
    // to false again. But it is important to prevent the
    // audible from playing again.
    info.ackRequiredFlag = false;
    info.alreadyPlayed = true;
    // internally uses the vector index so
    // process the queue acknowledge update within
    // the synchronize block.
    final ae_AlertEventInfo myAlertEventInfo = event.getAlertInfo();
    SwingUtilities.invokeLater(new Runnable()
    public void run()
    myQueue.acknowledge(myAlertEventInfo);
    myQueue.updateAcknowledgeButtonState();
    // here we should stop playing sound
    // if it is playing for this alert.
    int seqId1;
    if (theTonePlayer != null)
    seqId1 = theTonePlayer.getSequenceId();
    if (seqId1 == seqId)
    if (! theTonePlayer.isStopped())
    theTonePlayer.stopPlaying();
    theTonePlayer = null;
    // get reference to popup to be dismissed...
    // The dismiss must take place outside of
    // the mutex... otherwise threads potentially
    // hang (user hits "ok" and is waiting for the
    // mutex which is currently held by processing
    // for a "move to summary" transition message.
    // if the "dismiss" call in the transition
    // message were done within the mutex, it might
    // hang on the dispose method because the popup
    // is waiting for the mutex...
    // So call popup.dismiss() outside the mutex
    // in all cases.
    if(event.getSource() instanceof AlertEventPopup)
    popupObj = (AlertEventPopup)event.getSource();
    else
    popupObj = thePopups.get(event.getAlertInfo());
    thePopups.remove(event.getAlertInfo());
    SwingUtilities.invokeLater(new Runnable()
    public void run()
    // search vector elements to determine icon color in main frame
    String color = getColor();
    fireUpdateEvent(new UpdateEvent(this, blinking, color));
    // Call dismiss outside of the mutex.
    if (popupObj !=null)
    if(popupObj instanceof AlertEventPopup)
    ((AlertEventPopup)popupObj).setModal(false);
    ((AlertEventPopup)popupObj).setVisible(false); // xyzzy
    ((AlertEventPopup)popupObj).dismiss();
    else
    // update feedback... ack failed
    SwingUtilities.invokeLater(new Runnable()
    public void run()
    myQueue.setInformationMessage("Acknowledge failed to reach server... try again");
    return;
    Code for RowHeaderRenderer is:
    class RowHeaderRenderer extends JLabel implements ListCellRenderer
    JTable theTable = null;
    ImageIcon image = null;
    RowHeaderRenderer(JTable table)
    image = new ImageIcon(AlertEventQueue.class.getResource("images" + "/" + "alert.gif"));
    theTable = table;
    JTableHeader header = table.getTableHeader();
    setOpaque(true);
    setHorizontalAlignment(LEFT);
    setForeground(header.getForeground());
    setBackground(header.getBackground());
    setFont(header.getFont());
    public Component getListCellRendererComponent( JList list, Object value,
    int index, boolean isSelected, boolean cellHasFocus)
    int level = 0;
    try
    level = Integer.parseInt(value.toString());
    catch(Exception e)
    level = 0;
    if (((ae_AlertEventInfo)theAlerts.values().toArray()[index]).ackRequiredFlag)
    setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    this.setHorizontalAlignment(JLabel.CENTER);
    this.setVerticalAlignment(JLabel.CENTER);
    setIcon(image);
    else
    setBorder(BorderFactory.createLineBorder(Color.gray));
    setText("");
    setIcon(null);
    return this;
    I tried but when i am clicking a particular label, the color of all labels in the List is being changed. So can you please assist me in changing color of only the label that is selected and the color must disappear after completion of Upto completion of fireAcknowledgeEvent(ackEvent);

    im a bit confused with the post so hopefully this will help you, if not then let me know.
    I think the problem is that in your renderer your saying
    setBackground(header.getBackground());which is setting the backgound of the renderer rather than the selected item, please see an example below, I created a very simple program where it adds JLabels to a list and the renderer changes the colour of the selected item, please note the isSelected boolean.
    Object "value" is the currentObject its rendering, obviously you may need to test if its a JLabel before casting it but for this example I kept it simple.
    populating the list
    public void populateList(){
            DefaultListModel model = new DefaultListModel();
            for (int i=0;i<10;i++){
                JLabel newLabel = new JLabel(String.valueOf(i));
                newLabel.setOpaque(true);
                model.addElement(newLabel);           
            this.jListExample.setModel(model);
            this.jListExample.setCellRenderer(new RowHeaderRenderer());
        }the renderer
    class RowHeaderRenderer extends JLabel implements ListCellRenderer
        JTable theTable = null;
        public Component getListCellRendererComponent(JList list, Object value,
                                                      int index, boolean isSelected, boolean cellHasFocus){
            JLabel aLabel = (JLabel)value;
            if (isSelected){
                aLabel.setBackground(Color.RED);
            }else{
                aLabel.setBackground(Color.GRAY);
            return aLabel;       
    }

  • Need to change colors of lines in an Omniportlet Line Chart

    I am running Oracle Portal on a 10g Web server. I have created an Omniportlet and I am displaying data in a line chart. Is it possible for me to define the colours of the lines in the linechart?

    Hi I didn't changed colors in line chart but I managed to redesign lot of omniportlets.
    What you can do is to re-define CSS.
    Add an HTML portlet in your page with some CSS embedded.
    To catch wich class are to be re defined, I recommand you to use firefox with the extension Webdevelopper.
    Use the "Informations - display element information" functionnality to catch wich class are used for your chart.
    Then redefine those classes in your custom CSS.
    Hope that will help

  • Change color of List link

    Hi,
    I'm trying to change the color of the links in one of my Lists. Can somebody please tell me how to do this? I'm not sure where to put it or what the syntax is.
    Thanks,
    Nora

    Take a look at:
    Change color of row links
    Basically, create a class for your links and change the attributes using the :link,:visited,and :hover pseudo-classes. Even better, apply a class to the UL element, such as "myList" then add the following to your css:
    ul.myList li a:link,ul.myList li a:visited{color:#00ff00;text-decoration:none;}
    ul.myList li a:link,ul.myList li a:hover{color:#ff0000;text-decoration:underline;}
    That way you don't have to repeat the 'class=".." ' for every link in your li, thus reducing the size of the page.
    Thanks,
    Tyler

  • How to create moving, fading and changing color movie

    Hi
    I want to make a simple movie where a graphic shaped as a !
    (exp. mark) randomly appears on canvas, fading in and out and
    changing colors. I have studied the tutorial but I need a little
    help. Can you help me?

    re-sizing frames, stacking video tracks and motion keyframes. The way I would imagine >accomplishing this, would be a very tedious process, and I was wondering if there might be some >more efficient way.
    This is how you would do it.
    There's no "canned" way to control the various elements.
    My suggestion is to put on the coffee pot, get started, then reap the benefits of your work.
    BTW: I liked the vid as I've been to most of those places in NZ.
    Al

  • Changing color of Image in PSE 8.0

    I have a logo design that is black on white.  I'd like to change the black to another color - in this case, blue.  I wqas able to do it, but it ended up being quite convoluted.  What are some simple ways to change the color of a selected area in Elements 8.  I'm using a PC, BTW.
    Thanks!

    Thank you.  I found another way that's even simpler.  I chose the paint brush, set the mode to lighten, and then just painted over the image with blue - the white didn't pick up any of the blue, but the black did.
    Date: Tue, 22 Feb 2011 17:02:09 -0700
    From: [email protected]
    To: [email protected]
    Subject: Changing color of Image in PSE 8.0
    1. Select the black (use the magic wand if it's all one color).
    2. Layer>New Adjustment Layer>Hue Saturation.
    3. Turn on the colorize checkbox in the layers panel, and move the sliders till you see the color you want.
    >

  • Changing colors of individual bars in a XY Graph

    I am using an XY Graph (bar style) to display 50 voltages. I have limit settings (low alarm,low warning, high warning, high alarm)that I would like to impose on each of the 50 bars in the XY graph. My problem is that any way I try it the limits are only imposed on the first bar on the graph and all the following bars change colors along with the first bar no matter what value they have. Is it possible to control the properties of individual bars inside an XY Graph ??

    > I am using an XY Graph (bar style) to display 50 voltages. I have
    > limit settings (low alarm,low warning, high warning, high alarm)that I
    > would like to impose on each of the 50 bars in the XY graph. My
    > problem is that any way I try it the limits are only imposed on the
    > first bar on the graph and all the following bars change colors along
    > with the first bar no matter what value they have. Is it possible to
    > control the properties of individual bars inside an XY Graph ??
    >
    The short answer is no. All of the elements in a plot use the same
    colors to draw. To get the display you want, you need four plots.
    Write a subVI that takes in your array and returns the four that you
    need. It will index the elements and generates a value in four othe
    r
    arrays such that three of them are NaN and the fourth contains your
    value depending on the alarm status keeping the same X value with all
    four plots. As an example, if the value is lower than the low alarm
    limit, the value will be placed in the low array and NaNs in the other
    three arrays.
    Now wire the four arrays to the graph as a multiplot, you will either
    use a build array or a Build Clustered array depending on the XY type.
    The plots will overlay, with only one point being non-NaN for each X
    location. It will use the color for plot 0, 1, 2, or 3 depending on
    which array the value was in.
    Greg McKaskle

  • Need to change color of template

    I directed a client to a template site and they picked a template that was a PSD (attached) and I turned it into a working website. Now they tell me they want it to be blue instead of the green that it is. I am not sure where to start. I guess I need go to each layer and change the color to a variation of blue. Is there a quick way to do this? I am not even sure how to change colors. Any help would be greatly appreciated.
    Thanks!

    You do not need to do this for each layer. Just the ones with the color elements of the webpage,and only those that are visible. (eyeball on in layers panel)
    When you select the layer,then you go to the Image menu,Adjustments,and select Variations. You can interactively experiment until you find what's best.
    My layer thumbnails are large so I can see at a glance what element I'm looking at. Use the Layers Panel menu to get to Panel Options and select Large Thumbnails.
    Of course back up that template before loading into PS in case you need to do it over.
    That should get you started.

  • Set color of inactive elements

    Hii all
    I have a table layout form
    I have a field which called status(T ,I, O)
    When i click a button the status of those elements which satisfy a condition is changed to T
    and the elements with status T are disabled
    now i want to change the color of the elements which are disabled
    like     Inactive record elements will be black foreground, r100g50b0 background.(orange)
    how can i do it ??
    plzz help
    mandar

    Loop through the records of your database block.
    Check if the item is disabled (Get_item_property).
    If true than change the back ground color of the record (Set_block_property(...,CURRENT_ROW_BACKGROUND_COLOR,...))

  • Need help changing colors in a photo.

    I am trying to help some artists in mexico with their weaving. We are using elements 11 on vista 7. We would like to change colors in a piece to see if they are pleasing to the eye. Is it possible to change colors thoughout the whole piece at once? Using a brush to paint over each and every area would be so time consuming as their work is quite intricate. If this is not possible on Elements does Adobe have another sotware that would accomplish this task. Thank you for your time.

    I did not know I had to go to expert as i have never used this type of program before.The help was just telling me the tools were on the left side. I thank you for pointing me in the right direction. I have a feeling it will be easier for me to learn Chinese.

  • Changing color scheme on Transitions and Themes

    I would like to use the Newscast theme to create an iMovie; however, I CANNOT use the red color scheme for my audience.  How do I change the color scheme for the transitions?
    thanks in advance for any advise!

    sararandazzo8 wrote:
    …  How do I change the color scheme for the transitions?
    short answer: you can't.
    long answer: most animations and 'moving' elements within iM are realized with a technology called QUARTZ. those animations are 'hardwired' in iM. You'd need a Developer-tool, tons of expertise and have to ignore the EULA you signed on installation/usage of iMovie, changing these parts of iLife.
    I tried to change colors and fonts in some preset Titles - technically possible, but not within 'normal' usage
    Make a enhancement suggestion, allowing iM to use plug-ins, add-ons, 'Jam Packs' in future versions of iMovie:
    http://www.apple.com/feedback/imovie.html

Maybe you are looking for

  • .m2v file not playing in Quicktime Pro

    I just purchased Quicktime Pro 7.6. I have a bunch of MPEG2 (.m2v) files that worked on my old iMac and am trying to get them to work on my new iMac. When I open the MPEG2 files using Quicktime, I get a "the file is not a movie file" error. Again, th

  • IPhone 6: colour filters in Camera and Photos fail

    Today was the first day I was able to put my shiny new iPhone 6 through its paces by taking lots of pictures with and without filters. I've really come to appreciate the Noir filter as it renders objects abstract and brings out texture and creates at

  • SAP IBP and SAP S&OP on HANA

    I am trying to understand the relationship between SAP S&OP on HANA and SAP IBP. I see the latest version of S&OP on HANA is 3.0 SP02. Is this actually the 'S&OP' part of the IBP 4.0 application suite, or does IBP 4.0 have a specific, different, S&OP

  • How to remove a bug/virus that was embedded in a Mozillas update?

    After an update from Mozilla, I caught a bug that made certain pages unable to be viewed, and made the touch pad/mouse flip settings left/right side. I have ran Norton on this laptop since I bought it, and it find nothing. Malware finds nothing. I've

  • PDF conversion toolbar doesn't display

    I'm using Acrobat V9.5.5 w/ Internet Explorer V10.0.5. The PDF conversion toolbar doesn't display even though it's enabled under add ons. Looking for a resolution. Thanks.