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.

Similar Messages

  • How to remove or change the color of hair in a beard? [was:does anyone know]

    how to remove or change the color of hair in a beard

    There are many ways to do that and there are many free tutorials on the web for doing that in Photoshop.

  • How to remove and change the color of Java cup and border

    Hi to all,
    How to remove and change the color of Java cup and border.
    Thanks in advance
    khiz_eng

    This is just an Image. You would need to create your own image and call setIconImage(Image) on your JFrame.

  • How can I always change the color of certain letters?

    I know that sounds weird. But hear me out.
    I was reading an article about synaesthesia, and it seems that reading with certain letters always displaying in a certain color can do interesting things.
    I'm not trying to do anything too crazy, just a little experiment on myself.
    So I'm wondering if anybody knows how I may change the color of certain letters on my Mac? I realize that'll make some interfaces look screwy, and in some instances it may not be possible - but is there a way?
    Thanks!

    Kliegs wrote:
    I've never heard of anything like this, so I'm just curious if it exists.
    You and me both, let's wait and see what other say.  My guess would be that modifications of that type aren't possible w/o some serious "modifications" i.e. hacks, if even via that method, specifically regarding the operating system.

  • I'm a new MacBook owner, struggling!  Why can't I change the color of the font on emails I'm sending, can't change the Contact list to last name first.  HELP!

    How do I permanently change the color of the font for the emails I send?  How do list Contacts by LAST name, not first?  How do I put this little emoticon button on my tool bar?  THANK YOU.  saljack

    saljack wrote:
    How do I permanently change the color of the font for the emails I send?  How do list Contacts by LAST name, not first?  How do I put this little emoticon button on my tool bar?  THANK YOU.  saljack
    Order of contacts=Open contacts. Click on menu bar>preferences>general.
    What little emoticon?
    Color permanently=as far as I know, you cannot change it.
    Barry

  • Changing the color of a shape as it moves and scales?

    I have a symbol of a shape with a gradient drawn in Illustrator that I copied-and-pasted into Flash CS5. I created a simple motion tween by making the symbol move around the stage and scale. How do I now change the color of the symbol as it is moving on stage?
    Thanks.

    the advice given so far is sound, but by adding adjust color filter or the color effect > tint, you will be changing your gradient to a solid color, not another gradient.
    so for instance if your gradient is a black to red linear grandient and you want it to tween to a black to blue gradient, you have to break apart your symbol, remove the existing tween and perform a shape tween.
    a shape tween can tween the gradient that fills the shape as well as the shapes position and scale.

  • Can I change the colors for my calendars on the iPhone?

    Does anyone know how to edit or change the color of the calendars on the iPhone. I have an iPhone 3G 16gb model. I have 2 calendars from my work exchange server, plus 4 calendars I have subscribed to. After the update all the colors are different, and I would like to know how to change them or to pick a color to belong to a particular calendar. Anyone who knows please post here or email me directly.
    Joseph DeLuca

    The colors are set by the phone in the order they are added. At this time you cannot really "pick" their color, but removing them and adding them in a different order will set their color differently. Hopefully Apple will let us color-code our calendars in the future like GoogleCalendars... But until then, we'll just have to re-add them in a different order, or live with it
    Sorry.

  • How to change the color of the item in the tree.

    Hi
    I am using TREE for navigation and it has nodes. I would like to change the color of the node if it is clicked.
    Any ideas?

    Hi Denes,
    I had same query like I was looking for, how to highlight node
    which user has clicked ! I followed your stesp like :-
    select "emp" id,
    "mgr" pid,
    CASE
    WHEN PROJECT_NAME = :F200_USER_SELECTED
    THEN '<span class="HighlitTreeNode">'
    || PROJECT_NAME
    || ' '
    || '</span>'
    ELSE PROJECT_NAME
    END name,
    'f?p=&APP_ID.:16:&SESSION.::NO::F200_USER_SELECTED,F200_USER_SELECTED_TABLE_ID,F200_USER_SELECTED_TABLE_NAME:'||"LOB" ||','||"ID"||','||"TABLE_NAME" link,
    null a1,
    null a2
    from TREE_PROJECTS
    and set Stylesheet to :-
    <style>
    a {text-decoration:none;font-weight:bold;}
    a:hover {text-decoration: underline; color: darkred;
    font-weight:bold;}
    .HighlitTreeNode {font-size:12px;font-weight:bold;color: darkred;
    margin-left:20px;white-space:nowrap;}
    </style>
    ====================
    This has solved my query completely.
    Thanks a ton for such a nice tip !
    Regards,
    -DVS

  • 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.

  • How to change the color of same coloured sections of an image according to the colorpicker..?

    Hi.. How r u all..?
    I'm doing a small program to change the color of those sections of an image which are having the same color, according to the color selected from the colorpicker..
    Say we have selected a color from the colorpicker, and then the mouseclick event on the image changes the color of those parts in the image which are having the same color as the clicked portion (or pixel) to the selected color.. If we've selected FF0000 from the colorpicker, then clicked on 3300CC coloured pixel in the image. This should change the color of all the 3300CC coloured pixels in the image..
    I've a colorpicker [colpickr] and a movieclip [mc] of the image on the stage. I created a bitmap of that same same image (imag1) using code. Selecting the color from the colorpicker and a mouse click on the movieclip (here I used getPixel) will change that color in the bitmap to the selected color (with setPixel). So here I've two images; one is a movieclip (inorder to add listener for click event) and one is a bitmap (inorder to set the property setPixel). But I need only a single image.
    Please help me regarding this.. Given below is my (horrible) code..
    import flash.events.MouseEvent;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.net.URLRequest;
    import flash.display.Loader;
    var c = 0;
    var myBitmapData:BitmapData;
    var bm:Bitmap;
    colpickr.selectedColor = 0xffffff;
    var preLoader;
    var urlReq;
    var preloader_img:MovieClip;
    preLoader =new Loader();
    preLoader.unloadAndStop();
    urlReq = new URLRequest("imag1.jpg"); // i've selected the same image as that of movieclip mc
    preLoader.load(urlReq);
    preLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,preLoaderComplete);
    //creates a bitmap image of mc..
    function preLoaderComplete(loadEvent:Event) {
        myBitmapData = new BitmapData(mc.width,mc.height);
        myBitmapData.draw(mc);
        bm = new Bitmap(myBitmapData);
        addChild(bm);
        bm.width = mc.width;
        bm.height = mc.height;
    mc.addEventListener(MouseEvent.CLICK, _onMouseClick);
    //gets the color of mc and sets the color to bitmap
    function _onMouseClick(event:MouseEvent):void {
        var myColor:uint = myBitmapData.getPixel(mc.mouseX,mc.mouseY);
        c = myColor.toString(16);
        for (var i=0; i<bm.width; i++) {
            for (var j=0; j<bm.height; j++) {
                if (myBitmapData.getPixel(i,j).toString(16) == c) {
                    myBitmapData.setPixel(i,j,colpickr.selectedColor);

    try this:
    import flash.events.MouseEvent;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.net.URLRequest;
    import flash.display.Loader;
    var c=0;
    var myBitmapData:BitmapData;
    var bm:Bitmap;
    colpickr.selectedColor=0xffffff;
    var preLoader;
    var urlReq;
    var preloader_img:MovieClip;
    preLoader =new Loader();
    preLoader.unloadAndStop();
    urlReq=new URLRequest("z_bitmaps/image1.jpg");// i've selected the same image as that of movieclip mc
    preLoader.load(urlReq);
    preLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,preLoaderComplete);
    //creates a bitmap image of mc..;
    function preLoaderComplete(loadEvent:Event) {
        bm = Bitmap(loadEvent.target.loader.content);
        addChild(bm);
    stage.addEventListener(MouseEvent.CLICK, f);
    function f(e:MouseEvent):void{
        if(bm.hitTestPoint(mouseX,mouseY) && !colpickr.hitTestPoint(mouseX,mouseY)){
            _onMouseClick(e);
    //gets the color of mc and sets the color to bitmap
    function _onMouseClick(event:MouseEvent):void {
        c=bm.bitmapData.getPixel(bm.mouseX,bm.mouseY);
        for (var i=0; i<bm.width; i++) {
            for (var j=0; j<bm.height; j++) {
                if (bm.bitmapData.getPixel(i,j)==c) {
                    bm.bitmapData.setPixel(i,j,colpickr.selectedColor);

  • How do I change the color of a Photo Box?

    I'm new to Aperture, but I'm impressed with the customization abilities of the Photo Book compared to iPhoto. I want to be able to do a couple things: change the color of the Photo Box, and possibly change the Photo Box style (one book layout in particular makes the Photo Boxes look like a photo on the page, complete with shadow).
    Can anyone help with one, or both issues?

    Some quick help would be really appreciated...
    Who knows how to change the color of the Photo Box?
    Anyone here know how to bring a different style (i.e., the Snapshots style) to a different themed book?

  • How to change the color of Menu links in obiee

    Does anyone knows how to change the colors of Menu links in obiee. With menu I mean the menu links default right top (Search, homepage, Catalogus, Dashboards, new, Open). This should be set in skin and style files, not? I searched a lot. I could not find It. It is now Oracle blue, we want to change this.
    obiee 11.1.1.5.
    Thanks

    You have to customize portal banner and portal content CSS files as needed in OBIEE server.
    below links will guide u but will will not tell you exactly but your req can be done by customizing portal content and portal banner CSS files. try to identify the exact code using firebug in mozilla.
    http://www.rittmanmead.com/2009/04/customizing-obiee-dashboard-banners/
    Customization of login page, banner,logo in obiee11g
    Thanks
    Jay.

  • How can I change the color of subscribed calendar?

    Hello!
    I have subscribed two calendars from the internet at my ipad. They automatically got the colors green and red. Now I wanted to change these colors. So I did it and changed them in the calendar-app of the iPad to blue and yellow. At first it worked. But after a few minutes, the colors automatically changed back to green and red. And that happens all the time. Whenever I change the colors of my subscribed calendars, they automatically change back a few moments later.
    Why does it happen? And how can I make my iPad keep the new color settings?
    I am using iOS 5.0.1

    I figured out a solution for changing the other calendars but not the birthday calendar. Although it's not the most direct fix, it worked for me. Apparently Apple didn't think to give us the ability to choose the calendar color. I use Entourage and sync over the air. When I upgraded to iOS 4 my calendar turned bright red and the birthday calendar was blue. I don't use the birthday calendar so it isn't even enabled in my case. What finally worked was to go through the calendar colors one at a time by disabling and re-enabling the calendar in my mail account settings. I would double click the home button to quickly switch between settings and calendar to check the color each time I enabled the calendar. I had to do this 4 or 5 times to cycle through until blue came back up.

  • How can i change the color of the text on a button in Roll Over or Click state (Cs5.5)

    Hello,
    Here is the problematic:
    1° How can i change the color of the text on a button in Roll Over or Click state (Cs5.5)
    - I've many button in a doc im creating
    - the color of the buttons is white with black stoke & black text
    - in roll over state i want them to inverse the color coding (the text white & bottom black)
    - currently the text becomes invisible as black on black cant be seen (ive stroked it white but that looks ugly)
    - i would just like to know if there is a function made for this?
    My other questions:
    2° Ive a presentation on which Ive created buttons which tigger pop-up animations
    - i have 5 buttons which trigger animations
    - the viewer can chose to Click on any of the buttons randomly
    - the problem is once the animation is open how can it be close... either:
    a) by it self after "40" seconds
    b) when ther viewer clicks another button
    3° Ive created buttons linking pages..
    - "go to page xxx"
    - when i do a preview and click on the buttons the links dont take me to the right pages
    - is that normal? (maybe in preview its suppose to be like that)
    4° I would like to intergrate YouTube videos in the presentation so they play inside the docment.. when i tried.. it said the 'link isnt a flash video'
    - what should i do?
    5° Once i export it into Swf. how how can i visualize it? or put it online?
    Thank you for your time.

    stlbbl4u wrote:
    Hello,
    Here is the problematic:
    1° How can i change the color of the text on a button in Roll Over or Click state (Cs5.5)
    - I've many button in a doc im creating
    - the color of the buttons is white with black stoke & black text
    - in roll over state i want them to inverse the color coding (the text white & bottom black)
    - currently the text becomes invisible as black on black cant be seen (ive stroked it white but that looks ugly)
    - i would just like to know if there is a function made for this?
    You should setup Object Styles - these can also include Paragarph Styles that can be triggered when the Style is selected.
    http://help.adobe.com/en_US/indesign/cs/using/WS5CEDB81A-0011-4dc9-9DE8-AC7AD4C80076a.html
    My other questions:
    2° Ive a presentation on which Ive created buttons which tigger pop-up animations
    - i have 5 buttons which trigger animations
    - the viewer can chose to Click on any of the buttons randomly
    - the problem is once the animation is open how can it be close... either:
    a) by it self after "40" seconds
    b) when ther viewer clicks another button
    I'm not sure what you mean - I don't do files with Animations
    3° Ive created buttons linking pages..- "go to page xxx"
    - when i do a preview and click on the buttons the links dont take me to the right pages
    - is that normal? (maybe in preview its suppose to be like that)
    Does it work properly when you export it to the finished file?
    4° I would like to intergrate YouTube videos in the presentation so they play inside the docment.. when i tried.. it said the 'link isnt a flash video'- what should i do?
    InDesign won't link directly to youtube videos. I think your best bet would be to use Downloader to download the video and embed them directly in Indesign.
    5° Once i export it into Swf. how how can i visualize it? or put it online? 
    Thank you for your time.
    You can look up how to embed a SWF file into your HTML - but it depends what you mean by "online" there's a dozen ways to get a file "online".

  • How to change the Color of a string using swings/awt concept.

    Hi friends,
    How can i change the Color of a string.
    For ex:
    If i have a string "Welcome to the Java World",I want one particular Color for the string "Welcome to the" and a different Color to the "Java World" string.
    So please kindly help me out to resolve this issue.
    Thanking u in advance.

    "Text Component Features"
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html

Maybe you are looking for

  • Using Anchors and Count in Report

    Hello, In a report I am using two rows and a count variable if data in 1st row is null then the 2nd row must move up when we anchor but it's not happening can any body help me. Thanks & Regards, Dinesh .M

  • Problem: IPv6 w/ PPPoE on Cisco 2901

    Folks: I have this Cisco 2901 configured with PPPoE and IPv6 and connect it through a CO (DSLAM) to an Actiontec xDSL router. PPPoE connections are on FE0/0/0, through virtual template. The Actiontec router gets NA and PD addresses succesfully and LA

  • DRQ: Allow choosing correct Business Partner bank account in Payment Wizard

    Hello, This is a DRQ about the Payment process. It concerns the "Payment Wizard" functionality (Menu "Banking --> Payment Wizard") and the "manual outgoing payments" creation (Menu "Banking --> Outgoing Payment --> Outgoing payment"). Version : 2007A

  • Checking the initiality of the fields while creating  entries for a table

    While creating entries using table maintenance generator(TMG) i need to check the initiality of the fields.Are there any such events? I know i can go and change in the screen by making it mandatory or by writing a module in the PAI of the screen of t

  • Create a link to a specific page, on the disc

    Ok. I am creating a PDF that will need buttons to link to specific pages in other PDFs. I know how to do this if the PDFs are online but the boss needs a 'dvd delivered' SOOOooooo... -Root   Main PDF (with button)    -subfolder     Target PDF (page 3