set rgb color (Java)

Discussion in 'Java' started by Eitan M, Aug 9, 2007.

  1. Eitan M

    Eitan M Guest

    Hello.
    How can I in Java :
    set the rgb color (background color - what command) of JTextArea, i.e.
    (I want light-yellow, i.e).

    Thanks :)
     
    Eitan M, Aug 9, 2007
    #1
    1. Advertising

  2. Eitan M

    kcwong Guest

    Re: set rgb color (Java)

    On Aug 9, 11:34 pm, "Eitan M" <nospam@nospam_please.com> wrote:
    > Hello.
    > How can I in Java :
    > set the rgb color (background color - what command) of JTextArea, i.e.
    > (I want light-yellow, i.e).
    >
    > Thanks :)


    The Java API documentation would be a nice place to start looking.

    http://java.sun.com/javase/6/docs/api/javax/swing/JTextArea.html

    Load the page, then bring up the search function of your browser, and
    search for the text "background".
     
    kcwong, Aug 9, 2007
    #2
    1. Advertising

  3. Eitan M

    Roedy Green Guest

    Roedy Green, Aug 9, 2007
    #3
  4. Eitan M

    Roedy Green Guest

    Re: set rgb color (Java)

    >but I am looking for the function which does the conversion of RGB -> color.
    setBackground wants a Color object. See the docs on the Color class
    for the various ways to create one. See
    http://mindprod.com/jgloss/colour.html
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Aug 9, 2007
    #4
  5. Eitan M

    Eitan M Guest

    Re: set rgb color (Java)

    there is setBackground - that's I know,
    but I am looking for the function which does the conversion of RGB -> color.

    Thanks :)

    "kcwong" <> wrote in message
    news:...
    > On Aug 9, 11:34 pm, "Eitan M" <nospam@nospam_please.com> wrote:
    >> Hello.
    >> How can I in Java :
    >> set the rgb color (background color - what command) of JTextArea, i.e.
    >> (I want light-yellow, i.e).
    >>
    >> Thanks :)

    >
    > The Java API documentation would be a nice place to start looking.
    >
    > http://java.sun.com/javase/6/docs/api/javax/swing/JTextArea.html
    >
    > Load the page, then bring up the search function of your browser, and
    > search for the text "background".
    >
     
    Eitan M, Aug 9, 2007
    #5
  6. Re: set rgb color (Java)

    Eitan M wrote:
    > there is setBackground - that's I know,
    > but I am looking for the function which does the conversion of RGB -> color.

    The Color constructors do this conversion, for example:
    Color background = new Color(255, 255, 128);
    yourTextArea.setBackground(background);

    --
    Thomas
     
    Thomas Fritsch, Aug 9, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    10
    Views:
    15,056
    tshad
    Jan 12, 2005
  2. =?Utf-8?B?a3N0cml5aG9u?=

    RGB color in c# help

    =?Utf-8?B?a3N0cml5aG9u?=, Sep 30, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    5,970
    =?Utf-8?B?a3N0cml5aG9u?=
    Sep 30, 2005
  3. Johan Holst Nielsen

    Regarding color conversion (RGB->CMYK)

    Johan Holst Nielsen, Nov 12, 2004, in forum: Python
    Replies:
    4
    Views:
    1,897
    Robert Kern
    Nov 13, 2004
  4. xeroxero

    Color Picker Post RGB Values?

    xeroxero, Sep 19, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    392
    Walter Wang [MSFT]
    Sep 22, 2006
  5. John Salerno

    OT: Question about RGB color method

    John Salerno, Apr 10, 2007, in forum: Python
    Replies:
    8
    Views:
    523
    John Salerno
    Apr 12, 2007
Loading...

Share This Page