Changing scrollbar color in textarea

I would like to change the color of the scrollbar that
appears in a textarea. I have tried various methods and nothing
seems to work. I would appreciate any help on this.
Thanks,
Jothishankar

textarea has an insert method therefore you may be able to change the text color and insert it at the same position to obtain the different color. i haven't tried it just a suggestion.

Similar Messages

  • Changing scrollbar color on list widget.

    Good Afternoon,
    I need to know if its possible to change the scrollbar color of the list widget. If so, where can I find information covering this.
    Thank you.

    Repost.

  • Change scrollbar color

    I am trying to figure out away to modify the appearance of scrollbars. Ideally I would like to do this just for one particular VI, but temporarily changing the LabVIEW options would also be acceptable.
    According to this page http://zone.ni.com/reference/en-XX/help/371361E-01/lvdialog/color_options/, I should be able to change the scrollbar color from the Options Dialog Box. However, the Colors category is not present for me. (I'm using version 9.0 and the article was written for 8.6. Maybe something changed?)
    Any help would be greatly appreciated, thanks in advance! 

    That setting in the Options page actually refers to the scrollbar of the VI's front panel and block diagram scrollbar, and not to the scrollbar control. The scrollbar controls are "system" controls, and hence adapt to the operating system. If you try to customize the scrollbar in the Control Editor, you can't change to customization mode, and hence there is no method for changing the color. I know one suggestion that I've heard in the past is to use an alternate control, like a slider, which can be customized.

  • How can i change the color in textarea

    Hi to all, i am making the chat application in java , i want to show the client message in different color in text area , i have only one window which shows both client and server messages . i am sending you my program can u tell me how to change the color.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    public class cwDraft extends JFrame {
    static private JTextField enter;//user write text in this area
    private JTextField ip;
    static private JTextArea display;
         JButton b1;
         JButton connect;
    static String s=" ";
    static String s1=" ";
    static String s2=" ";
         static DatagramSocket socket;
         static DatagramPacket packet;
         cwDraft() {
              super("chat server");
              setSize(400, 300);
              Container c = getContentPane();
              //c.setLayout(new FlowLayout());-
              display=new JTextArea();
              display.setToolTipText("display area");
              c.add(new JScrollPane(display),BorderLayout.CENTER);
              ip=new JTextField("127.0.0.1",15);
              ip.setToolTipText("enter ip here");
              c.add(ip,BorderLayout.EAST);
              enter=new JTextField(30);
              enter.setToolTipText("enter message");
         c.add(enter,BorderLayout.NORTH);
              b1 = new JButton("Send");
              b1.setToolTipText("send message");
              b1.addActionListener(new B1Listener());
              connect=new JButton("connect");
              connect.setToolTipText("connect to other computer");
              c.add(connect,BorderLayout.SOUTH);
              connect.addActionListener(new ConnectListener() );
              //enter=new JTextField();
              c.add(b1,BorderLayout.WEST);
              show();
              addWindowListener(
              new WindowAdapter() {
              public void windowClosing(WindowEvent e) {
              System.exit(0);
         } // constructor
         public static void main(String[] args) {
              new cwDraft();
              try {
                   socket = new DatagramSocket(3082);
              } catch(Exception ex) {
                   ex.printStackTrace();
              do {
                   byte data[] = new byte[100];
                   packet = new DatagramPacket(data, data.length);
                   try {
                        socket.receive(packet);                    
                   //display.append(s2);
                   } catch(Exception ex) {
                        ex.printStackTrace();
                   s1 = new String(packet.getData(), 0, packet.getLength());
                   //System.out.println(s);
                   display.append(packet.getAddress() +"says"+ s1 +"\n");
              } while(true);     
         } // main
         private class B1Listener implements ActionListener {
              public void actionPerformed(ActionEvent e) {
                   s = enter.getText();          
                   byte data[] = s.getBytes();
                   try {
                   //     packet1 = new DatagramPacket(data, data.length);
                        packet = new DatagramPacket(data, data.length, InetAddress.getByName(ip.getText()), 3082);
                        socket.send(packet);
                        display.append(packet.getAddress() +"says"+ s +"\n");
                   } catch(Exception ex) {
                        ex.printStackTrace();
                   //enter.setText(s2);
              } // actionPerformed
         } // B1Listener
    private class ConnectListener implements ActionListener {
    public void actionPerformed(ActionEvent e) {
         //String s1=" ";
         byte data[]=s.getBytes();
         try {
                        packet = new DatagramPacket(data, data.length, InetAddress.getByName(ip.getText()), 3082);
                        display.append("connected to:" + packet.getAddress() +"\n");
    catch(Exception ex) {
                        ex.printStackTrace();
    } // class

    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.Color;
    public class MultiColouredText extends JFrame {
       public MultiColouredText() {
       StyledDocument doc = new DefaultStyledDocument();
       JTextPane pane = new JTextPane(doc);
       pane.setEditable(false);
       pane.setFont(new java.awt.Font("Verdana", 0 , 16));
       MutableAttributeSet mas = new SimpleAttributeSet();
          try {
             StyleConstants.setForeground(mas, Color.yellow);
             StyleConstants.setBackground(mas, Color.blue);
             doc.insertString(doc.getLength(), " Hello ", mas);
             StyleConstants.setForeground(mas, Color.blue);
             StyleConstants.setBackground(mas, Color.yellow);
             doc.insertString(doc.getLength(), " World ", mas);
             StyleConstants.setForeground(mas, Color.red);
             StyleConstants.setBackground(mas, Color.green);
             doc.insertString(doc.getLength(), " And ", mas);
             StyleConstants.setForeground(mas, Color.green);
             StyleConstants.setBackground(mas, Color.red);
             doc.insertString(doc.getLength(), " Farewell ", mas);
          catch (Exception ignore) {}
       getContentPane().add(pane);
       setSize(250,56);
       show();
       public static void main(String[] args) {
          new MultiColouredText();
    }

  • Change label color for Textarea

    Hello All,
    I have a text area and I'd like to change the color of the label. I've seen multiple suggestions on the forum including...
    <span style="color:RED"><Invoice Comments</span> but nothing seems to work, any advice?
    Just to clarify I'm adding this in the actual label name field.
    Thanks!
    Edited by: blue72TA on May 13, 2011 6:38 AM
    Edited by: blue72TA on May 13, 2011 6:38 AM
    Edited by: blue72TA on May 13, 2011 9:15 AM

    Jure2 wrote:
    Hi blue72TA,
    I think the problem is the "&lt;" sign in your label. Escape it with &amp;lt; like this:
    &lt;span style="color:RED;">&lt;Invoice Comments&lt;/span>JureAlmost! It's giving me...
    <Invoice Commentswhen I try to get rid of the less than "<" the whole label disappears?
    Edited by: blue72TA on May 13, 2011 9:08 AM

  • How can I change scrollbar colors? It's hard to see the menu selection/color when scrolling through bookmarks, for example.

    How can I make clearer the menu highlight selections, for example when scrolling through my bookmarks. The light blue color is hard to see in Windows 7. How do I change that color?? Running FF 3.6.6
    == This happened ==
    Every time Firefox opened

    " Is there anyway I can define individually as to what color should be related to each text in ring menu?"
    Well not with a ring and not programatically.
    The best I can suggest is a picture ring, see below.
    Ben
    Message Edited by Ben on 11-18-2005 02:16 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Picture Ring.JPG ‏5 KB

  • Flash CS5 How does one change background color in TextArea Component

    I'm trying to change the background color of a TextArea Component.  Does anyone know how to do this?
    function processXML(e:Event):void {
      var strTextBox:String;
      myText.visible=true;
      myText.setStyle("contentBackgroundColor", 0x000000);  //Does not work..nor does   myText.setStyle("backgroundColor",0x000000);
      myXML = new XML(e.target.data);
      strTextBox = "<a href='" + myXML.Branch[0].linkURL + "'> More Info...</a>";
      myText.htmlText=strTextBox;

    for that one you have use styles:
    var newFormat:TextFormat = new TextFormat;
       newFormat.bold = true;
       newFormat.size = 18;
       newFormat.color = 0xFFFFFF;  //I'm wanting white font on black background.
       //apply the format:
    myText.setStyle("textFormat",newFormat);
       myText.visible=true;
      myText.textField.background=true;
      myText.textField.backgroundColor=0x000000;

  • How to change scrollbar's color in combobox?

    Hi, I changed the combobox's background color to black. But since the little arrow in the scrollbar on the right side of the combobox is black, this makes the arrow vanish. I couldn't find any method in API that can change the color of the arrow/scrollbar. Does anyone know? thanx.

    Hi,
    i think it's possible but only with HTML-result report (where you can add your own 'onclick' handler...)

  • How can I change the color of scrollbar of firefox 3.6.13

    I want to change the scrollbar color of firefox3.6.13 .

    Wouldn't it be nice if you could keep the Firefox home page, but change the colour? Unfortunately this isn't possible. But what is possible is changing your home page to a different page.
    For more information see [[How to set the home page|How to set the home page]]

  • How to change the color of text in Teat Area

    Pls tell me how can i print two different lines in two different colors inside the same text area.
    Because whenever i set the color it sets the color for the complete text area.
    I want to print "Hello..." with color red and "Hi..." with color green in the same text area.
    Pls help me out...

    hi,
    u should use swing component JTextPane instead of textarea to change the color of the text.
    for eg:
    JTextPane textPane;
    JScrollPane panescrollpane;
    textPane=new JTextPane();
    panescrollpane=new JScrollPane(textPane);
    panescrollpane.setVisible(true);
    String[] initString =
    request+newline
    String[] initStyles =
    { "regular"
    Style def = StyleContext.getDefaultStyleContext().
    getStyle(StyleContext.DEFAULT_STYLE);
    Style regular = myClient.textPane.addStyle("regular", def);
    StyleConstants.setFontFamily(def, "SansSerif");
    StyleConstants.setForeground(regular,Color.orange);
    Document doc = textPane.getDocument();
    try {
    for (int i=0; i < initString.length; i++) {
    doc.insertString(doc.getLength(), initString,
    textPane.getStyle(initStyles[i]));
    } catch (BadLocationException ble) {
    // System.err.println("Couldn't insert initial text.");
    Hope this helps..
    regards,
    Kalpana.

  • Change background color

    HI guys,
    I have a question:
    In the Form 6I exists a Text Item with own scrollbar.
    Are there any options to change background color on scrollbar attached to that item?
    Thanks in advance,
    John.
    Message was edited by:
    IMJL

    In the Form 6I exists a Text Item with own scrollbar.If you rae talking about text item, you can set property word yes and vertical scroll = yes
    For second question ,as Francois said, the answer is No

  • How do i do change the color(complete newbie)

    i want to have a special button inside the applet which will automatically change the color from red to yellow,
    HELP!!!
    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    public class Cookie extends Applet
        implements AdjustmentListener {
        private Scrollbar slider;
        private int sliderValue;
        public void init () {
            slider = new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,51);
            add(slider);
            slider.addAdjustmentListener(this);
        public void paint (Graphics g) {
            showStatus("Scrollbar value is " + sliderValue);
              g.setColor(Color.black);
              g.drawRect(60, 60, 60, 100);
              g.setColor(Color.red);
              g.fillRect(60, 160-sliderValue, 60, sliderValue);
            g.fillRect(60, 60, 60, sliderValue);
        public void adjustmentValueChanged(AdjustmentEvent e) {
            sliderValue = slider.getValue();
            repaint();
    }

    This seems awfully familiar!
    Add a boolean to keep track of color.
    Your "special button" will have fire off an actionEvent, in actionPerformed set your boolean to true or false.
    In the paint method check for true or false of the boolean and setColor accordingly.

  • How to change the color to  JScroollBar?

    Hi All
         I have a applet with his look an feel set to Metal,
    in the applet I used a JScrollPane but I need to change the color
    only to the ScrollBar. But I don not how.
    Can anybody can tell mi how to do this
    I will appreciate your response

    UIManager.put("ScrollBar.background", Color.red );
    UIManager.put("ScrollBar.thumb", Color.blue );These properties must be set before the frame containing the scrollbar is made visible.

  • Changing the color of text while mouse listener.

    Hi all. working on an assignment for school and I need a little hint.
    I am creating an applet to basically input names in txt blocks, and then you hit a button that will move the names to a text area. Well the instructor asked us to use a mouse listener to change the color of the labels on the txt blocks. Basically when you hover your mouse over the button it is supposed to change the color of the button (for and back ground), and change the color of the labels on the txt blocks.
    I just did a general setForground(color.blue);
    for my labels default color and it seemed to do the trick, I used the following code to try to change the color of both the buttons and the txt block labels, but only the button works.
    Please assist..
    public class Assignment2 extends java.applet.Applet implements ActionListener, MouseListener {
    public void mouseExited(MouseEvent e){
    //Colors Back
    setForeground(Color.blue);
    btnAdd.setForeground(Color.red);
    btnAdd.setBackground(Color.yellow);
    //Clear Status bar
    showStatus("");
    public void mouseClicked(MouseEvent e) {
    //empty Method
    public void mousePressed(MouseEvent e){
    //empty method
    public void mouseReleased(MouseEvent e){
    //empty method

    HI,
    Sorry for delay. I was not on my seat.
    I've modified your code and the label colors are changing now on the mouse over or out events.
    I did this only for a single label i.e. "First Name". Just have a look on the code and do the same for the rest labels.
    If u feel any problem, then revert to me.
    Bye
    (Dhananjay Singh)
    Here's Your Code
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ColorText extends java.applet.Applet implements ActionListener, MouseListener {
        //Declare components
        TextField txtName = new TextField(25);
        TextField txtLast = new TextField(25);
        TextField txtAdd = new TextField(30);
        TextField txtCity = new TextField(15);
        TextField txtState = new TextField(2);
        TextField txtZip = new TextField(10);
        Label fName = null;
        Label lName = null;
        Label address = null;
        Label citi = null;
        Label state = null;
        Label zip = null;
        Button btnAdd = new Button("Display Address");
        TextArea txaAdd = new TextArea(10, 30);
        //Declare variables
        String strName;
        String strLast;
        String strAdd;
        String strCity;
        String strState;
        String strZip;
        public void init() {
            //Create labels
            fName = new Label("First Name");
            lName = new Label("Last Name");
            address = new Label("Address");
            citi = new Label("City");
            state = new Label("State");
            zip = new Label("Zip");
            fName.addMouseListener(new MouseListener() {
                public void mouseEntered(MouseEvent e) {
                    fName.setBackground(Color.RED);
                public void mouseClicked(MouseEvent e) {
                public void mouseExited(MouseEvent e) {
                    fName.setBackground(Color.YELLOW);
                public void mousePressed(MouseEvent e) {
                public void mouseReleased(MouseEvent e) {
            setForeground(Color.blue);
            Font g = new Font("Serif", Font.BOLD, 14);
            setFont(g);
            add(fName);
            add(txtName);
            add(lName);
            add(txtLast);
            add(address);
            add(txtAdd);
            add(citi);
            add(txtCity);
            add(state);
            add(txtState);
            add(zip);
            add(txtZip);
            add(btnAdd);
            add(txaAdd);
            txtName.requestFocus();
            //Colors and Fonts
            Font fntName = new Font("Serif", Font.BOLD, 14);
            setBackground(Color.lightGray);
            txtName.setFont(fntName);
            txtName.setForeground(Color.blue);
            txtAdd.setFont(fntName);
            txtAdd.setForeground(Color.blue);
            txtLast.setFont(fntName);
            txtLast.setForeground(Color.blue);
            txtCity.setFont(fntName);
            txtCity.setForeground(Color.blue);
            txtState.setFont(fntName);
            txtState.setForeground(Color.blue);
            txtZip.setFont(fntName);
            txtZip.setForeground(Color.blue);
            btnAdd.setForeground(Color.RED);
            btnAdd.setBackground(Color.yellow);
            //listeners
            btnAdd.addActionListener(this);
            txtName.addActionListener(this);
            txtLast.addActionListener(this);
            txtAdd.addActionListener(this);
            txtCity.addActionListener(this);
            txtState.addActionListener(this);
            txtZip.addActionListener(this);
            btnAdd.addMouseListener(this);
        public void actionPerformed(ActionEvent e) {
            //Actions
            String strOutputLine; //Declare local variable
            //Assign text fields
            strName = txtName.getText();
            strLast = txtLast.getText();
            strAdd = txtAdd.getText();
            strCity = txtCity.getText();
            strState = txtState.getText();
            strZip = txtZip.getText();
            //Move variables down
            strOutputLine = strName + ("\n") + strLast + ("\n") + strAdd + ("\n") + strCity + ("\n") + strState + ("\n") + strZip + ("\n") + ("\n") ;
            //Append
            txaAdd.append(strOutputLine);
            //Clear Text Fields
            txtName.setText("");
            txtLast.setText("");
            txtAdd.setText("");
            txtCity.setText("");
            txtState.setText("");
            txtZip.setText("");
            //set focus back to Lastname
            txtName.requestFocus();
        public void mouseEntered(MouseEvent e) {
            // Changing of Button colors
            setForeground(Color.red);
            btnAdd.setForeground(Color.magenta);
            btnAdd.setBackground(Color.green);
            //Status bar text
            showStatus("Format Address into Text Area");
        public void mouseExited(MouseEvent e){
            //Colors Back
            setForeground(Color.blue);
            btnAdd.setForeground(Color.red);
            btnAdd.setBackground(Color.yellow);
            //Clear Status bar
            showStatus("");
        public void mouseClicked(MouseEvent e) {
            //empty Method
        public void mousePressed(MouseEvent e){
            //empty method
        public void mouseReleased(MouseEvent e){
            //empty method
    }(Dhananjay Singh)

  • How do I change the color of a JSCrollBar

    Hi all,
    How do I change the color of a JScrollBar. I was able to change the color of the background, but not the scrollbar itself.
    Can anyone help?
    Thanks,
    R.

    Hi,
    Thanks for all your help. I actually found the sun bug report about this problem. The fix is to create a class for the JScrollBar extending JComponent and then override the setUI method.
    Here is the code for anyone who needs it:
    /* class custom JScrollBar **/
    class myScrollBar extends JScrollBar
    public myScrollBar(int orientation){
    super(orientation);
    public void setUI(BasicScrollBarUI ui) {
    super.setUI(ui);
    /* class MyUI**/
    class MyUI extends BasicScrollBarUI
    Color barColor = new Color(51,172,49);
    Color bgColor = new Color(245,245,245);
    protected JButton createDecreaseButton(int orientation) {
    return new ArrowButton(orientation);
    protected JButton createIncreaseButton(int orientation){
    return new ArrowButton(orientation);
    JButton up_button = (JButton)createIncreaseButton(SwingConstants.NORTH);
    JButton down_button = (JButton)createDecreaseButton(SwingConstants.SOUTH);
    JButton left_button = (JButton)createDecreaseButton(SwingConstants.WEST);
    JButton right_button = (JButton)createIncreaseButton(SwingConstants.EAST);
    protected void paintThumb(Graphics g,JComponent c,Rectangle thumbBounds)
    g.setColor(barColor);
    g.fill3DRect((int)thumbBounds.getX(),(int)thumbBounds.getY(),
    (int)thumbBounds.getWidth(),(int)thumbBounds.getHeight(),true);
    protected void paintTrack(Graphics g,JComponent c,Rectangle trackBounds)
    g.setColor(bgColor);
    g.fillRect((int)trackBounds.getX(),(int)trackBounds.getY(),
    (int)trackBounds.getWidth(),(int)trackBounds.getHeight());
    * ArrowButton is used for the buttons to position the
    * document up/down. It differs from BasicArrowButton in that the
    * preferred size is always a square.
    private class ArrowButton extends BasicArrowButton {
    public ArrowButton(int direction) {
    super(direction);
    public void paint(Graphics g) {
    System.out.println("i am inside the button paint");
    g.setColor(new Color(51,172,49));
    g.fill3DRect(0, 0, this.getSize().width, this.getSize().height, true);
    int w = this.getSize().width;
    int h = this.getSize().height;
    int size = Math.min((h - 4) / 3, (w - 4) / 3);
    size = Math.max(size, 2);
    g.setColor((new Color(0,0,0,0)).darker());
    paintTriangle(g,(w - size) / 2,(h - size) / 2,size+1,this.direction,true);
    public void paintTriangle(Graphics g,int x,int y,int size,int direction,boolean isEnabled){
    g.setColor((new Color(0,0,0,0)).darker());
    super.paintTriangle(g,x,y,size,direction,isEnabled);
    public Dimension getPreferredSize() {
    int size = 16;
    if (scrollbar != null) {
    switch (scrollbar.getOrientation()) {
    case JScrollBar.VERTICAL:
    size = scrollbar.getWidth();
    break;
    case JScrollBar.HORIZONTAL:
    size = scrollbar.getHeight();
    break;
    size = Math.max(size, 5);
    return new Dimension(size, size);
    in init():
    //setting the scrollbars
    MyScrollBar vertical = new MyScrollBar(JScrollBar.VERTICAL);
    MyScrollBar horizontal = new myScrollBar(JScrollBar.HORIZONTAL);
    horizontal.addAdjustmentListener(new ScrollHandler());
    vertical.addAdjustmentListener(new ScrollHandler());
    vertical.setUI(new MyUI());
    horizontal.setUI(new MyUI());
    vertical.setBorder(BorderFactory.createLineBorder(grayColor));
    horizontal.setBorder(BorderFactory.createLineBorder(grayColor));
    scrollPane.setHorizontalScrollBar(horizontal);
    scrollPane.setVerticalScrollBar(vertical);
    I hope it helps others.
    R.

Maybe you are looking for

  • Add new column in RFUMSV00 program

    Hi, I am new in abap. I have requirment to add new column in VAT report. I have copy RFUMSV00 program to  'Z'  program and want to add new column in 'Z' program. The column is BSEG-ZNUOR(Assignment).How can i add a column in report and how to retrive

  • The RFUMSV50 program does not generate transfer lines of deferred VAT

    Hello; The RFUMSV50 program does not generate transfer lines of deferred VAT , The context is the following one: Code VAT Created with code target VAT, general account of VAT also created, Rule of deferred VAT created and activated for the company co

  • How to Stop and restart the midtier?

    Hello All, I have installed Oracle AS (Infraturcture & middle tier , BI & Forms) on same Linux box.i.e: Oracle As 10.1.2.0.2 (Rel 2, x86 for Linux), SLES 9 Here is my question: How to Stop and restart the midtier? Regards, DN

  • Change Documents for Material Class

    Hi, I activated the change logging for a specific Material Class. However, when I check the change log, there is a material class which will show the characteristic change in the following format. For example I modified characteristic ABCDEF from 1 t

  • How do I add third party apps to launchpad?

    I have a number of third-party apps that I use infrequently, so I don't want them on the dock, but would like them in Launchpad, rather than having to search for them.  How can I add them to Launchpad?