Setting the colour

Hi,
I'm using the following method to set the colour for lines and shapes that I draw to the screen -
g.setColor(Color.lightGray);
However, if I want to set the colour to something specific such as -
RGB - 204 204 204 or #cccccc
Is this achievable using the setColor method?
Thanks for any help offered (new to Java!)
David

Hi annie,
Thanks for your help. However, I get the following error message when I use that -
cannot resolve symbol
symbol : method newColor (int,java.awt.Graphics,int)
location: class Erase
g.setColor(newColor(r,g,b));
^
1 error
I have imported java.awt and javax.swing so I'm not sure why I get the error? Any ideas?
Thanks again,
David

Similar Messages

  • Setting the colour of the search box text on a public website

    I am using the search box snippet in the header of my public website.
    The background of the header is a dark blue.  The search box background is transparent so the default colour of the text (#444) on the dark blue background is barely visible.
    The text colour appears to be set by the following entry in corev15.css:
    input[type=password],
    input[type=text],
    input[type=file],
    select,
    textarea,
    .sp-peoplepicker-topLevel,
    .sp-peoplepicker-topLevelDisabled,
    .sp-peoplepicker-autoFillContainer,
    .ms-inputBox
    border:1px solid #B0B0B0;
    background-color:#fff;
    background-color:rgba(255, 255, 255, 0.85);
    color:#FFFFFF;
    I changed the colour from #444 to #FFFFFF.
    Now I want to create a new post in the Blog.  The new post's Title and Body fields use the same entry in corev15.css to set the colour of the text.  As the background of the new post is white the text is invisible!
    Using the F12 development function in IE, setting the colour of the Search box text with an inline function works, but when I add style="color:white" to the <input> of the Search box snippet it seems to be ignored.
    What am I doing wrong?  Is there another way around the problem (I don't want to change the background colour of the header nor the background of the post page and there is no colour that will display the text well enough against both backgrounds).
    Your help would be much appreciated.
    Thanking you in anticipation.
    Roger
    rogerwithnell

    Thanks for your help, Patrick.
    Adding color: white !important; inline in the <input tag of the Search box snippet is still ignored, however.  When I look at the HTML and CSS with F12 in IE, the inline mark-up is not set.  I guess this something to do with how the Search Box
    snippet works?
    I've made some progress, though.  All the pages of the site (except the Blog NewPost page) use the corev15.css file. So I've set the colour here to white.  The css entry is:
    input[type=password],
    input[type=text],
    input[type=file],
    select,
    textarea,
    .sp-peoplepicker-topLevel,
    .sp-peoplepicker-topLevelDisabled,
    .sp-peoplepicker-autoFillContainer,
    .ms-inputBox
    border:1px solid #B0B0B0;
    background-color:#fff;
    background-color:rgba(255, 255, 255, 0.85);
    color:#FFFFFF;
    The Blog NewPost page uses \_catalog\theme\themed\CDD8DBA6/COREV15-51C31438.themedcss. I've changed the same CSS entry as follows:
    input[type=password],
    input[type=text],
    input[type=file],
    select,
    textarea,
    .sp-peoplepicker-topLevel,
    .sp-peoplepicker-topLevelDisabled,
    .sp-peoplepicker-autoFillContainer,
    .ms-inputBox
    border:1px solid #B0B0B0;
    background-color:#fff;
    background-color:rgba(255, 255, 255, 0.85);
    color:#444 !important;
    Now this page sets the colour to #444.  This means that the text in the Title and Body fields is visible but the text in the Search Box (with its dark blue background) is not.
    The Search Box on Blog NewPost is not vital but I'd like to fix it.  How can I do this?
    Roger
    rogerwithnell

  • Can I use a colour palette control to set the colour of an LED on front panel?

    Hi,
    I want to allow the user of my LabView program to be able to set the colour of an enlarged LED on the front panel using a colour palette control also on the front panel. Is this possible or can the LED only be the colour it is set to in its properties dialogue box?
    Thanks,
    Dave.

    The question is of course: "Does it really need to be a boolean LED that has a True/False and all the boolean logic???
    If you just want an LED lookalike where the color can be easily controlled programmatically I would recommend a color box indicator instead. You can even customized it to look like an LED! The attached example (LabVIEW 7.1) shows both methods, but the color box option is programmatically much less messy (no bundling, no array building, no property nodes!).
    (To make the LED color box indicator, I customized a plain color box and simply imported the graphic elements from the regular LED indicator.)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ColorBoxLED.vi ‏22 KB

  • How to set the colour in iphoto for ibooks?

    i just got a few books back and the colour is off-too red, magenta hues in the black and white images.
    What is the best way to get pics ready for books?
    All my images are in iphoto-do I need to take the into Photoshop?
    I created an album and then selected a book and have been adjusting exposures and contrast in the ibook format.
    Is there a better, easier way to get great results?

    Paola
    Welcome to the Apple user discussion forums
    check the color profile for your photos - is it sRGB - for best results it should be (that is the normal color profile for digital cameras
    From your description it sounds like your photos might be in adobe RGB which is a wider color space and does not reproduce well using the Apple printer (and most digital printing) which uses sRGB
    LN

  • Setting the colour red for an input field or a text-field in a table

    Hy,
    I am using an input-field or text-field within a table-cell. For some rows in the table the text in the input-field / text-field should be red. How can I do this ?
    Florian Hroch

    Create a new attribute "TextColor" of type "com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor" (local DDIC types), under the table's data source node.
    Bind the "TextView.semanticColor" property of the table cell editor to this attribute.
    If you cannot add new attributes under the data source node (this is the case if there is a structure binding), add a value node "TableProperties" (cardinality 1:1, selection 1:1) under the data source node and add the attribute there.
    Then you can control the color of the TextView in table row at index i by setting the "TextColor" value for node element at index i.
    For an input field, you cannot set the text color, a workaround might be adding an icon in an extra column.
    Armin

  • When I use the function of "finding keyword", the word would be shown in green. Can I set the colour by myself?

    When I use the function of "finding keyword"(ctrl+f), the keyword would be shown in green. I want to change the highlighted colour to be blue. Is there any function to change the colour?

    See '''''cor-el's''''' answer in this thread: https://support.mozilla.com/en-US/questions/900541
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You may need to update some plug-ins. Check your plug-ins and update as necessary:
    *Plug-in check --> http://www.mozilla.org/en-US/plugincheck/
    *Adobe Shockwave for Director Netscape plug-in: [https://support.mozilla.com/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *Adobe PDF Plug-In For Firefox and Netscape: [https://support.mozilla.com/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *'''''Shockwave Flash''''' (Adobe Flash or Flash): [https://support.mozilla.com/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]
    *Next Generation Java Plug-in for Mozilla browsers: [https://support.mozilla.com/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • How to set the default component color

    Hi
    I have a JFormattedTextField which is part of a form. Based on user input, if there's something wrong in it, then I colour it pink. I also make it editable(true) or editable(false) based on the mode that I am.
    Problem I have is that once I set the color of it once (to pink), then it won't change the colour of the Textfield based on mode when I call setEditable(true/false) anymore. I want it to "unset" the colour that I did and not have to colour it everytime. I don't want to have to manually change the colour after I set the colour once.
    Can anyone help me with this?
    Thanks!

    Thanks camickr !
    That's exactly what I was looking for. (let the UIManager take care of colors of the textfield whether it's editable or not)
    as for 2nd reply my code is in several files. IF i have to shorten it, it would be:
    it's just a pseudo code and incomplete but it gets the idea across
    * this function automatically changes colors of textfield based on mode which can change any time
    if(mode == NEW_MODE)
    textField.setEditable(true);
    else
    textField.setEditable(false);
    * This function sets the color during save time
    public void save()
    clear();
    if(textField.getText() == null)
    textField.setBackGround(Color.PINK);
    public void clear()
    //reset the color if it's pink or to the original color
    //the color must update once we change mode which is independent of this
    public void open(Patient p)
           clear();
           displayPatient(p);
    }

  • Setting the color temperature control to 6500 on a W510

    I've just bought a datacolor Spyder 4 so I can see color casts on my photos. When using it for the first time today It asks me to set the colour temprature to 6500. Try as I might I can't find where to do this. I've been through windows and tried to find the settings also tried  the NVidia settings - these were set to 'other application' anyway.
    Can anybody help. It is tiresome doing some corrections everytime I use my home PC after thinging the color was correct on my w510.
    thanks

    Maybe this helps:
    http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
    Kurta

  • How can I programmatically change the colour of tab pages? If not, when?

    I have found that in LabVIEW 6.0.2 the "Dialog" tab control cannot be coloured, but the other type of tab control one can be coloured by the paintbrush tool. I cannot find any property node to programmtically set the colour of the enitre tab control or individual pages. When will these properties be available in LabVIEW?

    The dialog controls and indicators are designed
    specifically for use in dialog boxes. These controls inherit their color from the colors you set in Control Panel >> Display. Because of this you will not be able to programmatically change their color.
    Chris_Mitchell
    Product Development Engineer
    Certified LabVIEW Architect

  • Why does the colour change from web browsers to CS5?

    Hi there
    I´m running OSX 10.6.4 on a MacPro 2009, 2x2.26, 16 gb RAM.
    Photoshop CS5 12.0.1.
    When I import photos from the web (Safari or Firefox) to Photoshop, the colour changes drastically.
    The only time the colours stay the same, is if I set the colour management to North American General Purpose 2, but this is a setting
    I can´t use. I need to use my Spyder 3-calibrated RGB profile as RGB work space, and I use Fogra 27 or a specific cover art profile
    for CMYK use.
    I enclose a screenshot of my settings and the problems that occur.
    Can someone help?
    All the best!
    Hakon, Norway

    When I import photos from the web (Safari or Firefox) to Photoshop, the colour changes drastically.
    Most of the photos on the Web will be un-tagged sRGB (if they have a tag, an embedded profile, Photoshop (and color-managed browsers) will pick up the profile and display it properly...).
    The short answer is to open the un-tagged file in in Photoshop> Edit> Assign Profile: sRGB
    You may know, the Mac OS applies its default Monitor profile to untagged color, whereas, Photoshop will apply its default Working RGB if you tell it not to manage the document...if you have a wide-gamut monitor and Assign MonitorRGB to an sRGB file, you get an intense saturation boost especially in the reds (is a clue).
    YOU MAY BE WISE to set something like sRGB as your Photoshop Working RGB with these Color Management Policies (to try and figure out what's going on)...
    MonitorRGB equals Photoshop WorkingRGB (as you are set up there) is a disaster for any number of reasons — Photoshop already displays through the monitor profile so setting its Working Space to your monitor profile is BAD workflow for 99.99 percent of the users who setup that workflow...

  • HT2513 Why does Calendar (iCloud) always change the colour of my Work calendar?

    Calendar allows me to set the colour, but next time I am back to check my calendar, the colour has changed.  This happens on both my Mac and iCloud calendars.  I also susbcribe to a Google set of calendars.  Thanks.

    Hello;
    To be honest with you, I've never heard of such thing.
    Since the board you are using is an analog output board, it contaims only output channels, therefore, only analog output program samples will work with it.
    You shouldn't have to worry about any extra configuration of the DACs.
    Regards
    Filipe A.
    Applications Engineer
    National Instruments

  • Can i set the label to be a different colour in an applet?

    Hi,
    i have written an applet, and am now adding a panel so that i can
    give a guide to what the components on the applet are. i am using gridlayout as a layout manager for the panel, (0,2) (it is a 2 row layout). i have two labels in each of the columms but in the second column i want to change the colour of the text. can i do this with a label or do i have to use something else?
    thanx for any help in advance
    regards
    vanessa

    its still not working.
    i have the following:
    panelColorCode.setForeground(Color.black);
    panelColorCode.setLayout(new Gridlayout(0, 2));
    panelColorCode.setBackground(Color.white);
    ....add(new Label("Colour code"));
    ....add(new Label.. these are both white backgrounds
    ....add(new Label... ditto
    panelColorCode.setBackground(Color.gray);
    ....add(new Label....
    this last line sets the whole panel to gray, but i just want the last label to be greyed out. is this possible, am i being dim?
    thanks again for help

  • TDMS : How to set the background colour programatically for .tdms file

    Hello every one 
    is there any method to set the background colour of .tdms file programatically
    Thank you
    Raja

    Hi Raja,
    "TDMS" is a file on your harddisc. How should a file have a background color?
    Or the other way around:
    How do you set the background color of a simple text file?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Hey guys, I'm having trouble matching the colour of the image back ground (white) with the pre-set colour selection. is there a tool that can help me? thanks

    hey guys, I'm having trouble matching the colour of the image back ground (white) with the pre-set colour selection. is there a tool that can help me? thanks

    Your description of the problem is not quite clear so I made certain assumptions. I hope I am rigtht. I believe you have a color patch such as this:
    that you would like to place in an image area that has modeling in its white background. You do not want to lay in a flat color but rather to add a color and not lose the modeling or other background tone. The problem is, after making the selection, if you use Edit > Fill and set the Blending mode to Color, the white background remains white. The only colored background area may be an object's shadow or some similar area that is not pure white. (Image 2) It is an unsatisfactory result.
    If that is an accurate description of the problem, consider this:
    Image 1: The original image
    Image 2: Edit > Fill with the Blending mode set to Color. White remains white
    Image 3: Mode changed to Lab Color. Edit > Fill with the Blending Mode set to Color. Then return to RGB.
    (I would not normally use this green as a replacement color but since it is a Tiffany clock, I chose a light version of Tiffany's trademark color.)

  • I set the Link Colours, (so I can easily see what URL's I have visited after Google search" but it doesn't respond.

    After a google (etc) search, instead of the colours I set (in tools\options\content\colours) do not show. If I set a visited website to show yellow (e.g.), it just shows the regular blue (no different from the "unvisited" sites.
    There was a time when, regardless of my settings, the visited sites would show a slightly different colour blue - not so now.
    I have Windows XP Pro SP2

    * Make sure that you do not use [[Clear Recent History]] to clear the Browsing History.
    * Make sure that the History is set to at least 1 day: Tools > Options > Privacy > History: "Remember visited pages for at least"
    * Make sure that you do not start Firefox in Private Browsing mode (Tools > Stop Private Browsing is grayed, see [[Private Browsing]])
    * To see History and Cookie settings in Tools > Options > Privacy, choose the setting "Firefox will: Use custom settings for history"
    You can look at these prefs on the about:config page.
    *http://kb.mozillazine.org/browser.history_expire_days (180) (also affects saved form data)
    *http://kb.mozillazine.org/browser.history_expire_days_min (90)

Maybe you are looking for