Problem changing scroll bar color using UIManager

I am using the following code to change the color of a JScrollBar just before instantiating a JScrollPane:
[ code ]
//set colors
UIManager.put("ScrollBar.thumbLightShadow", ltGrn );
UIManager.put("ScrollBar.thumb", grn );
UIManager.put("ToolBar.thumb", ltGrn );
UIManager.put("ScrollBar.thumbDarkShadow", darkGrn );
UIManager.put("ScrollBar.thumbShadow", darkGrn );
UIManager.put("ScrollBar.thumbHighlight", ltGrn );
//instantiate
JScrollPane scrollPane = new JScrollPane( table );
//reset UIManager
UIManager.put("ScrollBar.thumbLightShadow", null );
UIManager.put("ScrollBar.thumb",null );
UIManager.put("ToolBar.thumb", null );
UIManager.put("ScrollBar.thumbDarkShadow", null );
UIManager.put("ScrollBar.thumbShadow", null );
UIManager.put("ScrollBar.thumbHighlight", null );
[ /code ]
where ltGrn, darkGrn, and grn are various shades of green.
Everything works fine, UNTIL I open another JFrame that is part of the same program. After doing this, the original scroll bar above is still green, EXCEPT the border of it has changed to Metal Theme puple from green. In addition, if that second JFrame has any JScrollBars of it's own, they are Metal Theme purple with a green border! It seems to be a bug since only one part of the JScrollBar changes. If anyone has any suggestions on this I thank you in advance.
AC

When I execute the following I see identical modified scrollbars on the two frames that are created within this little app. I am relatively new to Java, so the design might not be great here, but the code will compile and run as is. You can use this to see if you still see the effect you have described. I am using version 1.4.1_03 on Red Hat Linux 8.0.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.plaf.*;
public class Frame extends JFrame implements ActionListener
     JButton btnOne = new JButton("First Frame");
     JButton btnTwo = new JButton("Second Frame");
     public static void main(String[] args)
          Frame f = new Frame();
          f.setSize(300, 300);
          f.show();
     public Frame()
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          redesignScroll();
          // This method resets the default colors for the scrollbars..
          btnOne.addActionListener(this);
          btnTwo.addActionListener(this);
          Container contentPane = getContentPane();
          contentPane.setLayout(new GridLayout(2, 1, 5, 5));
          contentPane.add(btnOne);
          contentPane.add(btnTwo);          
     public void actionPerformed(ActionEvent e)
          if (e.getSource() == btnOne)
               new FirstPopUp();
          else new SecondPopUp();
     private void redesignScroll()
          final Color cBkd = new Color(97, 115, 87);
          UIDefaults defaults = UIManager.getDefaults();
          defaults.put("ScrollBar.thumbHighlight",
                    new ColorUIResource(Color.darkGray));
          defaults.put("ScrollBar.thumbShadow",
                    new ColorUIResource(Color.black));
          defaults.put("ScrollBar.shadow",
                    new ColorUIResource(Color.black));
          defaults.put("ScrollBar.background",
                    new ColorUIResource(cBkd));
          defaults.put("ScrollBar.darkShadow",
                    new ColorUIResource(Color.black));
          defaults.put("ScrollBar.thumb",
                    new ColorUIResource(cBkd));
          defaults.put("ScrollBar.highlight",
                    new ColorUIResource(Color.black));     
     private class FirstPopUp extends JFrame
          private JScrollPane sp;
          private String text = "Hello World!  First Pop Up!\n ";
          private JTextArea area;
          FirstPopUp()
               area = new JTextArea();
               int i = 0;
               while (i < 20)
                    area.append(text);
                    i++;
               sp = new JScrollPane(area);
               getContentPane().add(sp);
               setSize(200, 200);
               show();
     private class SecondPopUp extends JFrame
          private JScrollPane sp;
          private String text = "Hello World!  Second Pop Up!\n ";
          private JTextArea area;
          SecondPopUp()
               area = new JTextArea();
               int i = 0;
               while (i < 20)
                    area.append(text);
                    i++;
               sp = new JScrollPane(area);
               getContentPane().add(sp);
               setSize(200, 200);
               show();
}

Similar Messages

  • Changing scroll bars to buttons

    Hello all, I use Macromedia Dreamweaver Mac for my wepage
    editing, I was wondering if anyone knows any helpful tutorials or
    instructions on how to replace the ugly grey scroll bars in your
    frames with arrow buttons or the like. Thanks much !!

    You can control the colours of the scroll bar elements using
    CSS which means you can effectively 'hide' the scroller etc. You
    can find more info here:
    http://websitetips.com/articles/css/scrollbars/
    You can do it .... but should you? I'd agree with Micha,
    avoid it if possible and perhaps revisit your design, i dislike
    having many scrollables within a page especially when the
    containers are not dimensioned relative to thier content (don't
    make me scroll when I shouldn't have to).
    Karen

  • Problem changing default key bindings using Oracle Terminal

    Hello,
    I'm facing a problem changing default key bindings using Oracle Terminal. I changed
    some bindings, saved them in forms60/fmrusw.res, started the generation and saved again.
    I thought that's it but it wasn't. It took no effect at all in Forms (even after recompilation) although reopening the file in Terminal showed the changes. I'm using Forms in German, which means that even the key bindings displayed in Forms are translated i.e. STRG+F1 instead if CTRL+F1,
    but I can't find a german version of this resource file, so i think it's the same resource file for all supported languages. But what is needed for the changes to take effect ?
    Thanks in advance
    STD
    null

    Hi,
    is it client/server you are working?
    if so you should not be using the fmrusw.res file because I guess your NLS_LANG is German_Germany.WE8ISO8859P1 or something like that. This means the terminal that is being opened is fmrdw.res instead of fmrusw.res and this file should be edited using Oracle Terminal.
    if you are working via the web implementation than you can open the file fmrweb.res in a text editor and change the keybindings in there. If you need to have the PC like key bindings on the web just open the fmrpcweb.res and see if it contains the German texts. If so you can either copy this file over the frmweb.res file or you can specify term=fmrpcweb.res in the serverargs parameter.
    Hope this helps.
    Kind regards,
    Frank van der Borden
    Oracle Support Services
    Netherlands

  • Where is the scroll bar that used to be on the left hand side of the screen?

    Am very aggrevated at itunes 11.0   trying to search through my 16000 songs on my ipod.  there is no vertical scroll bar that used to be on the right hand side of the screen.  How do I get it back?????

    Thanks! That solved it.

  • Scroll bar color of Visual Composer : how to change it ?

    Hello Comunity,
    I am developing application using Visual Composer within EP7.01 SP6, and I can not manage to find how to change the original blue of Visual Composer application for scroll bar.
    Does anyone knows where to change this color ? I believe it is a general color that is defined somewhere that needs to be change in the portal theme editor in the Visual Composer part, but I did not find it...
    Any help appreciated !
    Thanks a lot.
    Fabien.

    Hi
    Its not inside Visual Composer application. You have to do it at Enterprise Portal level.
    Also inside VC model you need to select 'Flash Runtime' from tools (Options).
    Basically you need to change theme settings in content administration of VC.
    Regards
    Sandeep

  • Scroll Bar Color

    Is it possible to change the rather anemic lookin gray scroll bars in Lion back to the more visible blue color os Snow Leopard?

    Maybe! I wouldn't bank on it though, seems to be a design choice.
    I'm no fan of it myself (in fact I still mostly use Snow Leopard because its visually and functionally better designed, but there you go!).

  • Problems with scroll bars in list view

    Hello,
    I am using Xcelsius 2008 (Build Number 12,2,166).  I am still having trouble with scroll bars on my list view control. Other list views in my dashboard seem to be ok. It seems that this list view is not ignoring the blank cells in my excel file. I have gone through many things to correct this problem. I have added a new list view, I have copied other list views that work correctly but still no success. It seems that the "Ignore Blank Cells" property is not working correctly. Does anyone have a solution for this?
    Much Thx!

    Hi Yusufel,
    Please check the data whether the cells are really blank or having any space which could not be seen, etc.
    With best wishes
    BaaRaa.

  • How can I change the bar color (data series) in a chart on the iPad version?

    The number of different. colors used in a char (line, bar, pie, ...)  appears to be limited to six, quite short for my needs, however, Excel imported charts show up in the original colors (12)...  until I change the chart type (to get a homogenous look with the rest of the content) it gets changed to the 6 basic colors. Any clue on how to modify individual series colors? Note that I am asking about the iOS version.
    Thnx

    Does any one know how you can adjust the font size (point size) for the file
    names.
    Sadly enough you can't chance that, feel free to add a feature request for
    that, the more there ask for the bigger chance it will be realized.
    It would be great if the colors for the image name (background and font color)
    could be changed so the contrast could also be increased so it is also easier
    to read.
    And this the cheerful part, go to Bridge preferences General tap and play
    with the sliders for user interface and Image Backdrop until your satisfied.
    BTW using the slider for thumbnail size bottom right of the Bridge window to
    increase the thumbs does not increase the font but makes it nevertheless a
    little clearer.

  • Scroll bar color to set to same as the color specfied in .cfg color scheme

    Hi Nimphius
    I set the in .cfg file color scheme to Khaki and my manager likes the color for all forms across but I can not set same color to scroll bar, I tried to give the back ground property to r140g142b123 but forms not taking it.
    Can you please help me how to set get same color (Khaki) to scroll bar.
    Please reply if anybody face same kind of problem.
    Thanks in advance
    Murthy

    This is problem with Oracle forms, They design something and that might not work with other colors.
    When they put color scheme to Khaki, Dont they think to give same visual attribute to give in property pallte,
    Last time I had tought time integrating web utils built-in.
    I do not know what to do get out of this silly stupid color issue.
    I appreciate if any of forms designers thought of this issue.
    Any feed back is welcome.
    Thanks in advance.
    Murthy

  • Vertical Scroll bar not using all view port space

    I'm developing an ADF application in 11g to be used on a PC and under the browser on an IPAD.  My top page layout has a panel group layout of scroll.  When the page renders in IE it does not consume all the available viewport.  The vertical scroll bar stops about an inch above the bottom of the page.  On the IPAD, when I have the device in portrait orentation, I only get about half the window area.  I need to have the page render in all the available space on the viewport, especially on the IPAD.  Can anyone tell me how I can get the page to render and take up all the available space in the viewport?   

    I did try that.  I was having some issues with trying to put everything I had on the page inside of one.  I think it actuall turned out to be something else.  I was messing around with things on the page fragment.  ADF was adding a scroll bar but not using the whole page to do so.  I took the scroll panel off the page fragment and off of any other page fragment including the actual JSF page.  When I set a large heigth for the page on my top panel group, which I had on the main page that contained the bonded task flow region, I got the browser to create the scroll bar for me for the whole page.  It fixed the problem on the PC and it also fixed the issue I had with the page rendering on the IPAD.  The IPAD now allowed the whole page to be scrolled by sliding your finger. 

  • Multiple scroll bars when using cl_gui_custom_container

    Hi,
    when my custom container ref to cl_gui_custom_container i'm seeing two horizontal and two vertical scroll bars.
    can anybody explain me why?
    thanks
    pratyush

    Hi,
    You might be using splitter container, that is you are logically splitting your container into parts in the program.In that case, scroll bars will be displayed.
    just check it.
    Regards,
    Sowjanya

  • Since 10.4.4 safari has problem with scroll bar visualization...

    after the install of x.4.4 i have a strange occurance with safari. as seen here: http://dcxkid.case.edu/Picture%201.png the scroll bar becomes part of the web page image, and scrolls with the page, but becomes dysfunctional as a scroll bar. if i scroll back up, it sometimes goes away... if i wait when the page first loads, the scroll bar may completely disappear. what gives? any ideas or suggestions?
    pb 12''' 1.5 768mb ram   Mac OS X (10.4.4)  

    The same thing happened to me sometime in November, I think. It was working, and now it only zooms in except when I spin the wheel rapidly down through multiple detents (logitech mouse). Double checked it in a newly created account. Same thing happens. Works fine in Firefox but I like using Safari.

  • Changing highlight text color / using Highlighters

    I've subclassed JTextArea, and among other things, am trying to add the functionality for drawing the active selection even when the TextArea doesn't have focus. I've overridden processFocusEvent like so:
    public void processFocusEvent(FocusEvent e){
            Highlighter h = this.getHighlighter();
             if (e.getID() == e.FOCUS_GAINED){
                //remove the inactive highlight
                h.removeAllHighlights();
            //this will put the selection highlight back in for us, among other things,
            //if we just gained focus.
            super.processFocusEvent(e);
            //now add the inactive-selection highlight if we just lost focus
            if (e.getID() == e.FOCUS_LOST){
                try {
                    h.addHighlight(
                            this.getSelectionStart(),
                            this.getSelectionEnd(),
                            new DefaultHighlighter.DefaultHighlightPainter(
                                new Color(212,212,212)
                } catch (Exception ex){
                    ex.printStackTrace();
        }and it works quite nicely. Notice that I draw the inactive selection gray.
    There's a slight problem with this: JTextArea doesn't treat the text in the highlighted section any differently, as opposed to how it would when the component is focused (i.e. rendering it in the highlighted text color). I'm guessing this is because it knows that it's not focused, and therefore assumes that there's no highlighting to be drawn. So as a result, all text in the text area is rendered in the same color --- the foreground color --- when the textArea doesn't have focus, regardless of what is being highlighted. For this reason, setSelectedTextColor() has no effect.
    But I want to be able to change the highlighted text color, since, in theory, the user's system could be configured to show text in the exact same gray that I'm highlighting with. I want to just be able to set it to be white or black.
    I am rather averse to using a TextPane, since what I'm writing is designed to edit plain text, and a TextArea has many wheels that I don't want to reinvent, like setTabSize(), for example.
    Clearly, there is code already in place somewhere to draw text a different color for highlighted portions of a TextArea. Is there some way I could perhaps trick only the drawing code into thinking that it has focus? What is the cleanest way to accomplish what I want, i.e. the way that involves rewriting the least amount of functionality?
    Any suggestions/leads would be greatly appreciated.

    Here's a better way to keep the selection visible. All those hard-coded colors are a big no-no, but this is just to demonstrate the technique.
    import java.awt.Color;
    import javax.swing.text.DefaultCaret;
    import javax.swing.text.Highlighter;
    import javax.swing.text.DefaultHighlighter;
    * usage:
    * textComponent.setCaret(new GhostCaret());
    public class GhostCaret extends DefaultCaret
      private static final Highlighter.HighlightPainter unfocusedPainter =
          new DefaultHighlighter.DefaultHighlightPainter(new Color(230, 230, 210));
      private boolean isFocused;
      protected Highlighter.HighlightPainter getSelectionPainter()
        return isFocused ? SimpleHighlighter.defaultPainter : unfocusedPainter;
      public void setSelectionVisible(boolean hasFocus)
        if (hasFocus != isFocused)
          isFocused = hasFocus;
          super.setSelectionVisible(false);
          super.setSelectionVisible(true);
          getComponent().setSelectedTextColor(isFocused ? Color.WHITE : Color.BLACK);
    }

  • How do I change the default colors used by Flex charts controls?

    Default 28 colors in mx.charts.styles.HaloDefaults.
    I want to add some colors, How should I do?

    I'm tryint to solve the same problem. There is a solution to reset the array (or to change in your case) HaloDefaults.defaultColors on the preinitialize event for example for Application.
    <s:Application ... preinitialize="onPreinitialize()">
    <fx:Script>
            <![CDATA[
         import mx.charts.styles.HaloDefaults;
         use namespace mx_internal;
         import mx.core.mx_internal;           
         public static const myDefaultColors:Array = [ 0xff000b, 0xc87eb];
         private function onPreinitialize():void{
              HaloDefaults.defaultColors = myDefaultColors;
         ]]>
    </fx:Script>
    <!-- Some chart -->
    </s:Application>

  • Change Chapter Bar Color

    Hello,
    I was wondering if it is possible to change the color of the Chapter Bar Title bar that appears in an ibook when you tap the screen when viewing it from an ipad (the bar which allows you to return to the Library, return to the Table of Contents, view MyNotes, Search, or Bookmark).
    Right now the bar is in black (which I assume is the basic) but I would like it to be in white.
    Any suggestions?
    Thank you,
    Santiago

    this'll get you part of the way
    import javax.swing.*;
    import java.awt.*;
    class Testing
      Color titleBarColor = Color.RED;
      public void buildGUI()
        UIManager.put("activeCaption", new javax.swing.plaf.ColorUIResource(titleBarColor));
        UIManager.put("inactiveCaption", new javax.swing.plaf.ColorUIResource(titleBarColor));
        JDialog.setDefaultLookAndFeelDecorated(true);
        javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme(new NoBumpsTheme());
        JDialog dialog = new JDialog(new JFrame(),true);
        dialog.setSize(400,300);
        dialog.setLocationRelativeTo(null);
        dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
        dialog.addWindowListener(new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent e) {
            System.exit(0);
        dialog.setVisible(true);
      class NoBumpsTheme extends javax.swing.plaf.metal.DefaultMetalTheme
        public javax.swing.plaf.ColorUIResource getPrimaryControlHighlight(){
          return new javax.swing.plaf.ColorUIResource(titleBarColor);
        public javax.swing.plaf.ColorUIResource getPrimaryControlDarkShadow(){
          return new javax.swing.plaf.ColorUIResource(titleBarColor);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }run the code, should be OK.
    with the dialog showing, click the taskbar, so it becomes 'inactive' - the bumps reappear (this bit needs work)

Maybe you are looking for

  • Validation check for BP external id type and id number

    Hi, I need to validate the external Id type and Id no. ( from table BUT0ID) based on some conditions from the WebUI while adding a new id type and also during deletion of that id. I have found out 2 Badi's BUPA_IDENT_UPDATE, BUPA_IDENT_CHECK Will the

  • The Downloaded PDF file does not contain the Signature through BSP pages

    HI, We have an requirement for Distributing the FORM 16 to all Employee's through our Website, where the user will login and download his own FORM 16 ( TDS Certificate) This FORM 16 ( TDS Certificate ) is generated in SAP ( ECC 6.0 ) in Payroll Modul

  • Help with JFrames:Two JFrames dont paint properly

    Hello Guys.I am new here and I would like to ask for some help. I have a problem with me Java application. My main Class is the MainGUI class which has some selection components and is a JFrame.When the user presses the "proceed" button, it will make

  • How do I reduce file size in Preview?

    how do I reduce size in Preview? Tools > Adjust Size is greyed out. I have a scan of receipts at 300 dpi that's 5.3 MB. I want to reduce for e mail.

  • Headphone is not working

    I have updated my IPad with latest OS and facing problem while listening songs connected thru headphone. On speaker, I'm able to hear them. I don't know what is the problem.