Change color of scrollpane (scrollbar)

Well i've been trying to figure out how todo this, but i failed
doing scrollPane.setBackgroundColor or foreground doesn't work
any ideas if it is even possible??
Thanks in advance!

The following code will probably show the cause of your problem, the opacity of the view.
import java.awt.Color;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuBar;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
public class BackgroundOnScrollPane {
    public static void main(String[] args) {
     SwingUtilities.invokeLater(new Runnable() {
         @Override
         public void run() {
          JFrame frame = new JFrame("Test back ground");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          final JLabel content = new JLabel(
               "This is the content of the scroll pane", JLabel.CENTER);
          content.setOpaque(true);
          JScrollPane scrollPane = new JScrollPane(content);
          scrollPane.getViewport().setBackground(Color.PINK);
          frame.add(scrollPane);
          frame.setJMenuBar(new JMenuBar());
          frame.getJMenuBar().add(
               new JCheckBoxMenuItem(new AbstractAction(
                    "Content opaque") {
                   private static final long serialVersionUID = 1L;
                    this.putValue(Action.SELECTED_KEY, content
                         .isOpaque());
                   @Override
                   public void actionPerformed(ActionEvent e) {
                    content.setOpaque((Boolean) this
                         .getValue(Action.SELECTED_KEY));
                    content.repaint();
          frame.setSize(200, 200);
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
}Piet

Similar Messages

  • Change color on a scrollbar

    Hi!
    I have tried to find an answer to this problem in several places, books and forums, everywhere. I need a code snippet on how to change color on a scrollbar. Things like:
    scrollbar-base-color
    scrollbar-face-color
    scrollbar-track-color
    ....and so on....
    I'm working on an applet basket and I simply need the color to match the color of the webpage..:)
    You can take a look at www.kennet.wasadata.com, put a sample object in the basket and it should turn up in an applet. If you put more then two things in the basket a scrollbar appears, that?s the scrollbar I need to repaint so to speak???I work with the AWT library no swing. If the webpage doesn?t load fast enough it?s due to that dying server of mine..J
    Thanks in advance.
    Kennet Carlsen

    Here is an example:
    BODY {
    SCROLLBAR-BASE-COLOR: #486591;
    By the way, this seems not to work on Moailla Firefox 0.9.3 on Windows.

  • Change color on scrollbar

    Hi.
    Is there any way to change the color on the scrollbar.
    I have tried with some css, but looks like the css editor dosent recognize my attributes.
    eks. scrollbarBaseColor="back";
    thanks in advance

    Hi,
    If you want your app's browser's scrollbar to be changed, then in your resources/stylesheet.css you would add e.g.
    body {
    scrollbar-base-color: blue;
    scrollbar-arrow-color: blue;
    . {and all the other scrollbar related props..}
    /krys
    CreatorTeam

  • Change color of the showDetailItem in panelTabbed in 11G

    Dear All,
    I have to change the color of showDetailItem in panelTabbed from gray to dark blue. But when I am trying to set the color from style the color of whole panel gets changed. I want to change the color of of the tab only.
    Please help its Urgent.
    Thanks in advance.

    I was having this same problem, and found another issue with the scroll bar coloring. The ScrollBar.thumb UI property cannot use a color that has a reduced alpha value.
    I wanted the JList hightlight and JScrollBar thumb to be a lighter version of the background color, but I found that the color.brighter() method returns a color that does not necessarily match the original color very well. For example, if you call it multiple times, the resulting color can be completely different. If I constructed a new color by lowing the alpha value of the original color (using the code below), the JList highlights were perfect, but the JScrollBar thumb had a large black "blob" in the middle of it.
    Color c = this.getBackground();  //"this" refers to a JPanel
    Color cb = new Color(c.getRed(),c.getGreen(),c.getBlue(),50);  //alpha value of 50The only way to get rid of the black "blob" on the JScrollBar thumb, is to use the following line of code where you set this property:
    UIManager.put("ScrollBar.thumb", new ColorUIResource(cb));Unfortunately, the ColorUIResource object does not appear to support altering the alpha value, so it strips it away, leaving you with the darker version of the color (completely negating your efforts to lighten the color).
    Does anyone know how to resolve this issue?

  • Changing color of arrow button in JComboBox

    Hi all,
    Can somebody please help me to change the color of arrow button in JComboBox

    The default color uses to draw the arrow is UIManager.getColor("controlShadow"), so if you put a different color there, that would be used for the arrow buttons. Of course, that color is likely used other places as well, and so any other place where it is used would get your changed color too. For example, the scrollbar buttons for the scrollbar in the popup list would likely use that color.
    Further, the current look and feel can override this; for example, the Metal L&F creates its own button, which uses its own icon which ends up using a hard-coded color of black when painting the arrow.
    : jay

  • Why do I get a program error when changing colors?

    I get a 'Could not complete your request because of a program error' when I try to change colors on both the forground/background palette or from the color picker palette.  Is there a patch for this?
    I am using Photoshop CS6 version 13.0.1.x64

    Hi. Because this forum is for beginners trying to learn the basics of Photoshop, I'm moving your question to the Photoshop General Discussion forum.

  • Images Change Colors between monitors while the UI stays the same

    Hey! Im having an issue where photoshop changes the colors when I move the window between my monitors, seen here: http://sta.sh/04y5s60vf3j This isnt due to the monitors themselves being different, it actually changes after a few seconds of moving it inbetween the monitors. The left one has been callibrated with a spyder 3 elite which I no longer have access to. I applied the file with windows color management instead of the spyder utility. The second one is new, and it is not callibrated by anything, but instead was done by hand with the built in brightness/contrast/custom RGB settings. Both of them are very close to eachother, enough so for my tastes. but when photoshop changes what the image looks like, it's causing problems. Interestingly enough, when I disable callibration for the monitor on the left, the image does not change colors between monitors, but instead always appears as it does on the right. but then they don't match up and the whole screen looked washed out because it's uncallibrated, so that doesnt do me any good. Another interesting thing to point out, is when this image is saved as a .JPG, and viewed with firefox the image appears exactly like the monitor on the LEFT (which is my main monitor) despite the left monitor being the one that is force changed. does anyone have any suggestions? It also appears that windows photoviewer is behaving the same way, though firefox does not. Meaning when I open an image in all 3 on the left monitor, they look the same, but when opened on the right monitor, windows photo viewer and photoshop both display the image as brighter and redder than firefox does. This is frustrating, because it seems photoshop is changing the image with my callibration on my left monitor to match what it looks like on the web, which it does. but it doesn't do this for the right monitor, or when the left is uncallibrated. Another issue I can see with this is even if the UI is the same shade of gray, the images are different between the monitors because of this change. Does anyone have any suggestions?
    - BD

    Alright! So I reread through all this, poked at some things on the internet, and I'm going to attempt to summarize what would be a good solution for all this (And it seems, it still won't be perfect, but to get myself into the best environment I can for not messing with images for an hour trying to make them look nice before I post them to the web. I painted something yesterday on the cintiq, popped it over to my laptop screen and it just looked washed out and terrible.)
    1. Get a X-rite EODIS3 i1 Display Pro, Callibrate laptop and cintiq. I do have the money to drop on something like this, especially if it's a time saver.
         Things I'm not sure about:
              a. There was a ton of complaints about the software not working when I checked reviews, but also a ton that said everything was great. most of them were mac users though.
              b. I'm not sure if problems would still be posed, even while calibrated, by me having a wide gamut monitor.
              c. I'm a terrible excuse for a human being and I think the colors showing up brighter on the wide gamut screen is pretty (I should just make my images this bright on a normal screen and there won't be any issues. >.>)
    2. Set Firefox to color manage (easy enough)
    3. Change my photoshop working space to sRGB (since they'll have been calibrated at this point)
    3. Accept the fact that most of the people who look at my work will be doing so on a monitor that is almost certainly uncalibrated, and I can't control what they will see on my screen, but I CAN control if the colors are -actually- what I want them to be on any properly calibrated device. which is probably the best way to go anyways.
    4. Make paintings, have fun.
    Now, you two have been going on about all sorts of interesting things in here, and it seems that calibration issue run much much deeper than I ever thought. Do either of you have recommendations for how I should tweak this list of things to do or other things I can/ should do? I'm not currently a working professional, but if I have anything to say about it, I will be within a few years (I'm going to school for illustration and studying concept design on my own time) so it'd be useful for me to get into good habits now.
    - Brendavid

  • Can anyone tell me why a picture would change color when I try to download/upload it?  It is the exact same picture- chosen the same way and when it goes to any other program it changes the color (I've tried canvas on demand and mpixpro.  I've also tried

    Can anyone tell me why this picture changes color when I try to download/upload it?  It is the exact same picture I have taken from the same location.  The image on the left is via preview and the image on the right is what is shows like when I try to download it.  I have emailed it to myself and it shows fine on the computer and in CS4, but when I look at the download via my phone or on another computer it shows the wonky color on the right.  I have checked the color space shows RGB/8 bit.  Any ideas why or how to fix it?  It isn't with any one specific session.... and I've tried it on both my desktop and my laptop- saved image to an external hard drive and to drop box.  I've tried sending the image to canvas on demand, my email, mpxipro, POST editing- all the same result.  Please HELP!!  What am I doing wrong?

    Most of the time you see something like that. The image in question has a color profile other then sRGB. Some image viewers/displayers are color managed and others are not.  So the image do not look the same in all of the applications you use. So colors seem to change.
    Try converting it to sRGB color and see if then looks the same all around. Also I think PC and Mac displays are set to different gamma something like 1.8 and 2.2
    Though I'm colorblind I even see color variations.

  • 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;       
    }

  • Changing color without modifying existing items.. problem!

    Hello,
    I'm reletively new to flash, and am trying to modify a template and am running into a problem and I don't seem to know why Flash is acting so strange.
    I am going into a movie clip to edit the color of an item, and when I do so with a tint, it overrides any additional effects such as light, and text. The color appears almost as if it were just slapped on top of everything.
    When I edit the color in advanced mode, it is really a hit-or-miss to get the correct color, and will only modify when changing the offset RGB.
    And also when doing this, the text gradually changes color, for example: there are 4 items in total that I want to edit the color of. Each item is a different colored box with text on the front (for a main Navigation of the website). --- The first item, the text will stay white. Gradually through the second and third items it starts to change, and by the fourth / last item, the text is completely blue.
    Is it possible for a portion of text to be connected somehow to an object within the animation in a movieclip? If so, is it possible to go inside and edit this? -the shape, animation, and text?
    Is there an easier way to change the color of an item inside a movie clip? I can supply additional information if needed.. files etc.
    Am I doing something wrong / completely missing something?
    Thank you very much in advance for any help and/or advice!
    New Flasher,
    Lisa

    go one level deeper than the movieclip so you're editing the shape.

  • Change color in ALV top of page

    Hi all,
    Can anyone tell me how (if it is possible) to change color in ALV top-of-page?
    Thank you in advance,
    Hagit

    Hi,
    It is not possible to change the color in ALV top of page.
    Thanks,
    Sriram Ponna.

  • My macbook pro is freezing after my screen changes color

    My screen has been freezing a lot for some reason. I will be working on anything on the computer then all of a sudden the screen will become distorted and start to change colors then do a hard freeze. I have to hold down the power button and do a hard reset. Any suggestions on what this could be?
    Model Name:          MacBook Pro
    Model Identifier:          MacBookPro6,2
      Processor Name:          Intel Core i7
      Processor Speed:          2.66 GHz
      Number of Processors:          1
      Total Number of Cores:          2
      L2 Cache (per Core):          256 KB
      L3 Cache:          4 MB
      Memory:          4 GB
      Processor Interconnect Speed:          4.8 GT/s

    MacBook Pro (15-inch, Mid 2010): Intermittent black screen or loss of video

  • How to create a radio button that changes colors

    I'm using Acrobat X and ID CS5 on Mac OS X.
    A couple of years ago someone on the forums explained to me how to create a button that changes color with each click. You can view a sample PDF at https://dl.dropboxusercontent.com/u/52882455/colorcycle.pdf. They gave me the document JS and showed me how to set the properties of the button. I've integrated the button into a particular series of PDF forms and it's worked out very well.
    Now I would like to do the same thing, but using a circle instead of a square. Can anyone tell me the best way to do this? Can I somehow set a radio button to cycle through colors in the same way? I design my forms initially in ID CS5 and then activate and format the fields in Acrobat X. I've tried using circles instead of squares in my ID document, but when I export to an interactive PDF, they're converted to squares.
    Any ideas?

    I understand how to make buttons cycle through colors-- the problem I'm having is that I'm trying to figure out how to make a circular button cycle through colors. When I export my ID document to PDF, my round button maintains it's original appearance, but when I click on it to cycle through the colors, it behaves like a square (see new PDF at https://dl.dropboxusercontent.com/u/52882455/colorcycle2.pdf).
    If I use a radio button, I can get it to cycle through colors, but I don't want it to have a black dot in the middle. Is there a way to format the radio button to not show the black dot when clicked?

  • Manually change color of Exchange calendar in iCal?

    Good evening. Got kind of an odd problem...and not really sure when it became an issue, although I think it happened after I upgraded to Lion. But for whatever reason I cannot get to the 'Get Info' part of one of my calendars that is an Exchange calendar. I can right-click on all of my iCloud calendars and get to the get info section in order to change colors, sharing, etc, but when I click the get info option on my Exchange calendar, nothing happens.
    Not sure when this became the case, because I know I used to be able to change the color.
    Was wondering if maybe there was a preference file that I could manually edit in order to change the color, or if someone else has run into this and found a solution.
    Thanks a bunch.

    Hi guys,
    "googling" I found this applescript:
    tell application "iCal"
              set color of calendar "Calendar" to choose color default color {0, 0, 0}
    end tell
    Waiting for an Apple fix, you can use this. It's wok like a charm!

  • I need help highlighting an expiration date on my Numbers '09 spreadsheet. I want the text/fill of a cell to change color when the expiration date of an item is within 180 days of the current date.

    I need help highlighting cells on my Numbers '09 spreadsheet.  I want the cell text/fill to change color when the date is 180 days or less from the current date.  I already have a cell with the current date in it.  I also know how to change the fill/text colors.  All the cells have been formatted to show date only.  I am having trouble with the formula.  I can get to the Conditional Formatting menu and select "With Dates" but after that I am lost.  Can anyone help?
    Thank you for any assistance.
    B

    Set a Conditional Format rule as shown in the illustration below. The rule has been applied to all dates in column B of the table.
    Regards,
    Barry

Maybe you are looking for