Changing the color and size of JScrollBar

Hi everyone,
I have a JTextArea in a JScrollPane. I want to change the default size and color of the JScrollBar that appears. Basically, I want to customize my JScrollBar.
Is there any method to do it or do I have to write my own JScrollPane that would show the JScrollBar I want ???
Please , help me out.
Many thanks in advance.
Ramesh

The following code shows how to change several aspects of scrollbars.
Note the loop that prints out all the values that can be modified with simply puts to the UIDefaults table for scrollbars. The String "ScrollBars " can be changed to many other swing component names (minus the 'J') to examine their key/value pairs
For a more complete Look and Feel reference see - http://www.spindoczine.com/sbe/files/uts2/Chapter21html/Chapter21.htmimport java.awt.*;
import javax.swing.*;
import java.util.Enumeration;
import javax.swing.plaf.ColorUIResource;
public class UISniffer extends JFrame
   UISniffer()
      setSize(400,300);
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      UIDefaults uid = UIManager.getLookAndFeelDefaults();
      for (Enumeration e = uid.keys() ; e.hasMoreElements() ;)
         String s = (String)e.nextElement();
         if(s.indexOf("ScrollBar") != -1)
            System.out.println(s + ", "+ uid.get(s).toString());
      UIManager.put("ScrollBar.foreground",
            new ColorUIResource(new Color(255,0,0)));
      UIManager.put("ScrollBar.background",
            new ColorUIResource(Color.pink));
      UIManager.put("ScrollBar.thumb",
            new ColorUIResource(Color.red));
      UIManager.put("ScrollBar.thumbDarkShadow",  
            new ColorUIResource(new Color(128,0,0)));
      UIManager.put("ScrollBar.thumbShadow",  
            new ColorUIResource(new Color(190,0,0)));
      UIManager.put("ScrollBar.thumbHighlight",
            new ColorUIResource(new Color(255,128,128)));
      UIManager.put("ScrollBar.track",
            new ColorUIResource(new Color(190,0,190)));     
      UIManager.put("ScrollBar.width", new Integer(50));
      JTextArea t = new JTextArea(text);
      JScrollPane pane = new JScrollPane(t);
      //pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
      //pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
      setContentPane(pane);
   public static void main(String[] args)
      new UISniffer().setVisible(true);
   String text ="  The poor King look puzzled and unhappy, and struggled with the\n"+
"pencil for some time without saying anything; but Alice was too\n"+
"strong for him, and at last he panted out, `My dear! I really\n"+
"MUST get a thinner pencil.  I can\'t manage this one a bit; it\n"+
"writes all manner of things that I don\'t intend--\'\n\n"+
"   What manner of things?' said the Queen, looking over the book\n"+
"(in which Alice had put `THE WHITE KNIGHT IS SLIDING DOWN THE\n"+
"POKER.  HE BALANCES VERY BADLY')  `That's not a memorandum of\n"+
"YOUR feelings!\n\n"+
"   There was a book lying near Alice on the table, and while she\n"+
"sat watching the White King (for she was still a little anxious\n"+
"about him, and had the ink all ready to throw over him, in case\n"+
"he fainted again), she turned over the leaves, to find some part\n"+
"that she could read, `--for it's all in some language I don't\n"+
"know,' she said to herself.\n\n"+
"   It was like this.\n\n\n"+
"                            YKCOWREBBAJ\n\n"+
"            sevot yhtils eht dna ,gillirb sawT`\n"+
"              ebaw eht ni elbmig dna eryg diD\n"+
"                  ,sevogorob eht erew ysmim llA\n"+
"                 .ebargtuo shtar emom eht dnA\n\n\n"+
"  She puzzled over this for some time, but at last a bright\n"+
"thought struck her. `Why, it's a Looking-glass book, of course!\n"+
"And if I hold it up to a glass, the words will all go the right\n"+
"way again.'\n\n"+
"  This was the poem that Alice read.\n\n\n"+
"                           JABBERWOCKY\n\n"+
"            'Twas brillig, and the slithy toves\n"+
"              Did gyre and gimble in the wabe;\n"+
"            All mimsy were the borogoves,\n"+
"              And the mome raths outgrabe.\n\n"+
"            `Beware the Jabberwock, my son!\n"+
"              The jaws that bite, the claws that catch!\n"+
"            Beware the Jubjub bird, and shun\n"+
"              The frumious Bandersnatch!'\n\n"+
"            He took his vorpal sword in hand:\n"+
"              Long time the manxome foe he sought--\n"+
"            So rested he by the Tumtum tree,\n"+
"              And stood awhile in thought.\n\n"+
"            And as in uffish thought he stood,\n"+
"              The Jabberwock, with eyes of flame,\n"+
"            Came whiffling through the tulgey wood,\n"+
"              And burbled as it came!\n\n"+
"            One, two!  One, two!  And through and through\n"+
"              The vorpal blade went snicker-snack!\n"+
"            He left it dead, and with its head\n"+
"              He went galumphing back.\n\n"+
"            `And has thou slain the Jabberwock?\n"+
"              Come to my arms, my beamish boy!\n"+
"            O frabjous day!  Callooh!  Callay!'\n"+
"              He chortled in his joy.\n\n"+
"            \'Twas brillig, and the slithy toves\n"+
"              Did gyre and gimble in the wabe;\n"+
"            All mimsy were the borogoves,\n"+
"              And the mome raths outgrabe.\n\n\n"+
"  `It seems very pretty,\' she said when she had finished it, `but\n"+
"it\'s RATHER hard to understand!\'  (You see she didn't like to\n"+
"confess, ever to herself, that she couldn\'t make it out at all.)\n"+
"`Somehow it seems to fill my head with ideas--only I don\'t\n"+
"exactly know what they are!  However, SOMEBODY killed SOMETHING:\n"+
"that\'s clear, at any rate--\'";
}

Similar Messages

  • How can I change the color and size of the freehand tool in Adobe Reader on the IPAD?

    How can I change the size and color of the freehand tool in Adobe Reader for IPAD?

    One more step I didn't mention. After making your freehand drawing, you need to click Save (upper right) to let Reader know you're finished drawing. Then click on it, and the contextual menu will look like this:

  • How to change the font and size in the fillable field of an encrypted PDF file?

    hi!
    I’d like to change the font and size in the fillable field of an encrypted PDF file I-485 from www.uscis.gov/files/form/i-485.pdf
    I’m using Adobe Acrobat Pro 9 in Windows XP. I firstly tried Adobe LiveCycle Designer, but the I-485 file requires password to be opened, which I don’t know.
    Then I tried to print it to a PDF file, and use the Typewriter tool to fill in the form. But got error message while printing it to PDF file:
    This PostScript file was created from an encrypted PDF file.
    Redistilling encrypted PDF is not permitted.
    The I-485 file can be exported to unencrypted postscript file, but got the same error message while trying to open the ps file.
    I don’t know much about pdf file, can anyone please help?
    Thanks a lot!

    Ask the creator of the file for a unprotected version.

  • How do you change the font and size in descriptions in iPhoto?

    When I add a description to a photo in a slide show, it appears in only one font size and one continuous line across the frame.  Is there any way to change the font and size?  Can the description be multiple short lines instead of one long one?

    You can't.  It's hard coded into the application.  You can send a feature request to Apple via http://www.apple.com/feedback/iphoto.html.
    OT

  • How can i change the position and size of the applet

    dear fellows,
    how can i change the position and size of the applet in which form is running over the web.
    thanx
    Mochoo

    Yes, you can add the following line to your formsweb.cfg section :
    HTMLbodyAttrs=onLoad='javascript:self.moveTo(100,100)'
    if you are in SEPERATEFRAME = FALSE
    Or Set_Window_Property( FORMS_MDI_WINDOW, POSITION, X, Y ) ;
    if you are in SEPERATEFRAME = TRUE

  • FAQ: UI - How can I change the color theme, size of the text, or turn off the application frame?

    CHANGING THE INTERFACE COLOR SCHEME:
    The Photoshop CS6 default interface is dark, but if you prefer the lighter interface you are used to from earlier versions,
    you can change it back in the appearance area. There are 4 default color themes.
    Mac          Photoshop > Preferences > Interface
    Windows   Edit > Preferences > Interface
    CONFIGURING LARGER FONTS:
    For those who need larger fonts, you can also change the UI Font Size down in the type area.
    Be sure to restart Photoshop to see the changes.
    TURNING OFF THE APPLICATION FRAME
    CS6 opens now by default in "Application Frame". You can go Window>Application Frame in the main meu and uncheck this

    Select the title / text and then click on the "i" (inspector). A colored pin wheel shows up after you click on the square box directly below the font settings inside the inspector window. Then simply drag the dot to the color you want. Like this:
    click here
    Message was edited by: SDMacuser

  • Data model automatically changes the color and the report corrupts.

    we want to run six reports in a single report and users can run the report they select . So,We have 23 simple queries in datamodel and 20 pages of layout,
    it was working fine.but now if we make some changes the color in the datatmodel changes,when we try to save this the file corrupts.when we try to open the
    file it says some information missing in the report.we have reports builder10g.Is there any size limit for rdf file? because our rdf file size 944kb.
    Thank you.

    No.

  • Hover over image will change background color and size since IE8

    Hello,
    I have a problem that only occurs in IE8 without compability view.
    I have in CSS set all textlinks to change background color on hover.
    Now my sliced imageslinks also change background color and for a larger background area than the actual image.
    It filles out the area outside the sliced image.
    This hasnt happened before in any other versions of IE and it looks fine in Firefox.
    Please can some one help me !
    I have been searching net for hours.
    I tried to change the background color when hovering imagelinks. Maybe I did something wrong but it didnt help.
    BR,
    Peter

    Noone that can give me a clue?
    I have been trying to figure this out all day

  • How can i change the color and name of the Firefox Button?

    I am using Nightly only because it fits better in my choice, i dont like the orange Firefox button near the tabs and i wanna know if there is a possibily to change its color or even what is wrinten in the button, to i come back to firefox and have my own color in the button

    *App Button Color: https://addons.mozilla.org/firefox/addon/app-button-color/

  • Changing the font and color of html email codes

    I have used some codes from some of you that do protect my email address from bots so for that I am thankful. However, they all come in standard blue with the same font of which I would like to change both. Here is an example of the code that I am using, how would I change the color and font??
    Contact Me
    <script type='text/javascript'>
    Assemble Obfuscated email address and set div id='contactMe' href
    ObsArray = new Array();
    ObsArray.push('mai');
    ObsArray.push('lto');
    ObsArray.push(':');
    ObsArray.push('my'); // your break up email address starts here
    ObsArray.push('name');
    ObsArray.push('@');
    ObsArray.push('mac');
    ObsArray.push('.');
    ObsArray.push('com'); // your break up email address ends here
    function setContactMe() {
    var ObfuscatedHref = '';
    for (ii=0; ii<ObsArray.length; ii++) {
    ObfuscatedHref += ObsArray[ii];
    document.getElementById('contactMe').href = ObfuscatedHref;
    chkEmail = setInterval('checkEmail()', 100);
    function checkEmail() {
    if (document.getElementById('contactMe') != null) {
    setContactMe();
    clearInterval(chkEmail);
    </script>

    p id="contact" Contact Me use < and />either side of p and contact me - sorry couldn't get the text to show correctly.
    <script type='text/javascript'>
    Assemble Obfuscated email address and set div id='contactMe' href
    ObsArray = new Array();
    ObsArray.push('mai');
    ObsArray.push('lto');
    ObsArray.push(':');
    ObsArray.push('my'); // your break up email address starts here
    ObsArray.push('name');
    ObsArray.push('@');
    ObsArray.push('mac');
    ObsArray.push('.');
    ObsArray.push('com'); // your break up email address ends here
    function setContactMe() {
    var ObfuscatedHref = '';
    for (ii=0; ii<ObsArray.length; ii++) {
    ObfuscatedHref += ObsArrayii;
    document.getElementById('contactMe').href = ObfuscatedHref;
    chkEmail = setInterval('checkEmail()', 100);
    function checkEmail() {
    if (document.getElementById('contactMe') != null) {
    setContactMe();
    clearInterval(chkEmail);
    </script>
    <style type="text/css">
    p#contact
    font-size: 2em;
    color: #336699;
    </style>
    Just change the style into something suitable worked for me.
    Message was edited by: Hazell

  • Change the color of a particular row in a jtable

    I have a jtable and i want to change the color of one particular column and few rows to blue and underline the text depending on some condition. In my view class if a condition is true
    for( count=0;count<grdTest.getRowcount;count++)
    if(some condition true)
    grdTest.getColumnModel().getColumn(0).
    setCellRenderer(new MyTestCellRenderer(count));
    And my cell renderer
    public class MyTestCellRenderer extends DefaultTableCellRenderer {
    int rowIndex=-1;
    public MyTestCellRenderer(int rowcount) {
    super();
    rowIndex=rowcount;
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    super.getTableCellRendererComponent(table, value,
    isSelected, hasFocus, row, column);
    if(row == rowIndex)
    setText("<html> <u> <font color='blue'>" + value.toString());
    return this;
    This is behaving very wierd . If suppose there are 50 rows and all of them have the condition true then only the last one in the row color is changes.
    However if only one out othe say10 has the condition true then it changes the color and underlines the particular row,column.
    Is there any other way to do this or what i am doing wrong
    Thanks

    if(row == rowIndex)Your code is a shambles because of the lack of tags, but I don't believe I see anything being called when this boolean condition is not true. That would be a problem.                                                                                                                                                                                                                                                                                                                                                                                                           

  • Assets panel styles, can i change the color of a style to be an exact color?

    Assets panel > styles, can i change the color of a style
    to be an exact color? for example, if i want to create a navbar
    with the black and gray glass affect style, but i want to change
    the color but keep the same style of shading. each style in the
    assets panel has a default color, but i want to change the color
    and keep the style. i did change the color a little bit by
    adjusting the hue and saturation, but i can't seem to get an exact
    match of the color i am trying to duplicate. any help is greatly
    appreciated thanks

    When a style is applied to any object, the Properties panel
    at the bottom will reflect the attributes which are editable in
    that applied style. The properties which can be edited are fill and
    stroke colors also apart from adjusting the Hue and Saturation.
    Gradient colors can be modified by changing the fill color.
    The nodes in the gradient will change the color from blue to black
    or any other intended color of change. If you know the color you
    can either enter it as a 6 digit value or you can pick a color from
    an existing object.
    Hope it helps. Let me know I am missing you query
    completely.

  • How to change the font and colour of the PL/SQL Editor in forms

    Hi All,
    I am fed of viewing the small fonts in the PL/SQL Editor. I am feeling stress
    in my eyes daily...Please any body help me how to change the color and font
    of the PL./SQL editor in oracle forms 6i..Thanks in Advance...

    Hi
    Thanks for the reply..
    But I personally feel that Oracle people should have done this since
    any editor should allow us to change the font and colour...any way lets
    hope that in the future releases that may happen...
    Raghu

  • Inserting a table in a mail,how do I change the color/style of the border?

    Hello, I believe my question is clear, I just did not find how to change the color and the style of the borders of a table which I had inserted in a mail.
    Thanks in advance for your help

    Do exactly as described by guigs2.
    This image will assist...see below.
    Open Table Properties as before. Make sure to select 'Table' and then click on 'Advanced Edit' button
    In HTML Attributes tab
    * type 'bordercolor' in the 'Attribute'
    * in Value you can use the word eg: Blue or type an HTML colour string eg: #3333ff
    * click on OK to close Advanced Property editor
    * click on 'Apply' to see colour.
    * click on OK to close Table Properties.
    If you do not know HTML colour string, you can locate some here.
    In a normal Write message, click on the Text Colour icon to open a small Text Colour window. When you select the colour, it will show you the html colour string, which must have the hash tag # before the numbers and letters.

  • Programatically changing the color of buttons on LV OI

    Hi,
    I've modified the sample Operator Interface shipped with TestStand.
    Buttons are linked to subsequences, so when a button is pushed a subsequence is running (boolean buttons).
    What I would like to achieve is that, once a subsequence was called and the result was OK (pass) then the color of the button should change to green.
    If the subsequence is failed then the button should change to red.
    Thanks for any suggestions in advance.
    Solved!
    Go to Solution.

    Hi,
    You can find an example in Example Finder: "Property Nodes.vi" . It shows how you can change any properties for an object from your program.
    You can find more examples on zone.ni.com, like these:
    - Using Property Nodes to Change the Color of a Slide Bar https://decibel.ni.com/content/docs/DOC-2133
    - Programatically Change the Color and Visibility of a Boolean using Property Nodes https://decibel.ni.com/content/docs/DOC-16569
    Regards,
    Peter Vago
    AE Hungary

Maybe you are looking for

  • Flash swf that runs on every browser except in Firefox. Can anyone help me please?

    Hello. I have an flash swf in a site that runs on every browser except in Firefox. I get an warning telling me that the page requires a newer version of flash player but i already have the 10,0,32,18 and the swf was published for flash player 9. Can

  • SOAP Adapter without SOAP envelope sets contenttype to application/xml

    Hi, I wrote a adaptermodul for the SOAP adapter to create a SOAP:HEADER. I disable the SOAP envelope in the communication channel. Now I get a error from the WebService Provider because the SOAP Adapter sends with Content-Type application/xml and not

  • Double or nothing

    Still working on a calculator project. Works wonderfullly, except when I try to have more than 16 or 17 digits...and need to have 32 digit precision. Tried looking in the API, but might not be doing that right. My code is long, so I don't want to pos

  • Flash Media Server 4.5 unable to start setup on OS X 10.7

    When I downloaded a developer edition from Flash Media Server page (11 Oct 2011). I tried to follow the setup instruction in readme.htm which comes in the zip of Linux version. I logged in to terminal as root user and call './installFMS' and then the

  • PO SETTLEMENT

    HELLO EXPERTS, I have created one  PO having 3 items, 100 quantity each.( item 1 100 quantity, item 2 100 quantity, item 3 100 quantity) from the three items now I don't need 2nd item and only 50 quantity of first item. the PO was created before 3 mo