How would I set these two polygons different colors?

I am trying to replicate the flag in this URL: http://www.cia.gov/cia/publications/factbook/flags/pm-flag.html
I can get the two stars to be the same color, but how would I make them be the correct different colors?
I have two classes each posted here:
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.*;
public class PanamaFrame extends JFrame
{   PanamaFrame()
    {   setTitle("Panama Flag");
        setSize(450, 325);
        setLayout(new GridLayout(2,2));
        JPanel top = new JPanel();
        JPanel bottom = new JPanel();
        //StarPanel topleft = new StarPanel();
       // StarPanel bottomright = new StarPanel();
        top.setBackground(Color.red); //990000
        bottom.setBackground(Color.blue); //6633CC
        add(new StarPanel());
        add(top);
        add(bottom);
        add(new StarPanel());
        setVisible(true);    
}and
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.*;
public class StarPanel extends JPanel
{   public void paintComponent (Graphics g)
    {   super.paintComponent(g);
        setBackground(Color.white);
        int[] x={110,119,146,125,133,111,89,96,84,75,102,110};
        int[] y={42,68,68,83,110,94,110,84,75,68,67,42};
        int n=11;
        g.setColor(Color.red);
        g.fillPolygon(x,y,n);
} Thanks
Brandon

I'm new to all this graphica stuff as of this
week.... so I dont' really know what you mean by
that? CAn you explain? I need to set the two stars
to different colors... Is there something that I can
do? Or will it require much change in the code?You're already using g.setColor(Color.red) to change the color it's painted in. So, make that a private member of your class called starColor and then change that line of code to g.setColor(starColor). Then add a constructor that accepts a Color for an argument and when you create it pass it the Color you want it to be.

Similar Messages

  • How do you set up two different ipads on one computer ?

    I purchased a new ipad for my wife and want to get her started but we both use one imac as our desktop system.  How do you set up two different uses on one computer.
    Thanks,
    Dave

    Other options not covered in the article:
    1) You can plug both in under the same computer username and same iTunes Apple ID and give each device it's own name. You should be able to manage them as separate devices with different media, apps and screen layouts. All of your media would be in a common pool, though.
    2) Under one computer username, you can login and logout of two different iTunes Apple IDs. This option is cleaner with two computer usernames but it can be done with one.

  • How can I set up two iPhones with the same contact, photos, music etc... but a different sim card and phone number. They will both be my phones, but one will be for use in other countries.

    How can I set up two iPhones with the same contact, photos, music etc... but a different sim card and phone number. They will both be my phones, but one will be for use in other countries.

    Phone A = phone with information you want duplicated
    Phone B = phone that you want to copy from A
    Backup Phone A.
    Wipe Phone B using these instructions. What to do before selling or giving away your iPhone, iPad, or iPod touch - Apple Support
    Phone B should be on the 'Hello' screen. Do not swipe it. Launch iTunes. Plug in Phone B.
    When iTunes asks if you want to set up as new phone or restore from backup, choose restore from backup of Phone A.
    After this setup, any changes to one phone (i.e. adding a contact, downloading an app) will have to be manually duplicated on the second phone, if that is your desire). Making changes to one phone will not affect the other after setup.

  • How to set up two iPads, different locations, one account.

    How do I set up two iPads in two different States with one account.  My 89 year old father can not do the details of setting up an account but I want him to have apps and have even gifted him a bird guide.  Now it sits in his in box because we don't know how to download it without an account.  

    Obviously your father will not be able to sync with iTunes, but somehow I don't think that is going to be an issue.
    You can set up the account on your iPad, or computer, whatever, and then have your father sign into your Apple ID on his iPad. Settings>Store>Sign in. He will need your ID and password in order to download apps or other paid content.
    However, he does not - nor do you need to set up the account on his iPad. He just needs to sign in to the account.
    This is not really ideal - separate ID's would be the way to go, but if you are essentially maintaining the device and springing for the apps - it will work - if you want to share an ID.

  • How does one set up two different iTunes accounts on the same computer so that they do not merge into one?

    How does one set up two different iTunes accounts on the same computer so that they do not merge into one?

    mparker402 wrote:
    So, when the other iTunes account needs to be used, I should log out of Windows and have the other user log in under a different Windows account, correct?  
    M Parker, 
    Yes, since you are trying to keep things separate, that is exactly what you would do.

  • How can I get these two results in two different columns?

    SELECT COUNT(attr_id)
    FROM pv_attribute
    WHERE port_id = 322;
    SELECT COUNT(attr_id)
    FROM pv_attribute
    WHERE port_id = 323;
    How can I get these two results in two different columns?
    Thanks

    So Jens made a tiny mistake with the column name... shame you couldn't be bothered to research Pivoting so you could have corrected the mistake (possibly it was deliberate *{:-) ) and learnt something.
    with pv_attribute as (select 16123 attr_id, 322 port_id from dual union all
                          select 16123 attr_id, 322 port_id from dual union all
                          select 19223 attr_id, 322 port_id from dual union all
                          select 11193 attr_id, 323 port_id from dual union all
                          select 13163 attr_id, 323 port_id from dual)
    -- end of test data setup
    select sum(decode(port_id, 322, 1, 0)) cnt_322,
           sum(decode(port_id, 323, 1, 0)) cnt_323
    from   pv_attribute
    where  port_id in (322, 323)

  • How do you set up two different icloud accounts on the same itunes account?

    How do you set up two different icloud accounts on the same itunes account?

    Don't know what you mean.
    Please explain.

  • How do I set up two separate iTunes accounts on one MacBook Pro in order to manage the wife's iPhone and my iPhone? Can this be done?

    How do I set up two separate iTunes accounts on one MacBook Pro in order to manage the wife's iPhone and my iPhone (with separate info on each of course) ? Can this be done? A little step by step would be greatly appreciated; just short step by step though, I can follow fairly well.
    Kindest Regards,
    Phil T.

    You would each need to use your own user account on the Mac, you can do this at system preferences > users & groups.

  • How do I set up two profiles on my computer but still utilize all programs and files?

    How do I set up two profiles on my computer but still utilize all programs and files?  I want to set up two profiles so my wife and I can utilize two iTunes accounts and different internet settings, but when I set up an administrator profile for her and log in. I don't see all of the stuff that is on the administrator profile (mine) that was created first

    A second user account is separate; with separate preferences and data,  but can share the same apps as long as they're in the top-level Applications folder, not an Applications folder inside another user's home folder.
    Sharing files is a bit different; you can put them in the special Shared user folder, or grant permission to specific files/folders in one account to a different user.

  • How can I combine these two DAQ tasks???

    I am using LabVIEW 11, Windows XP, cDAQ-9174 chassis, two NI-9205 modules.
    Please see my code for reference. I am very new so i will accept all suggestions.
    I am acquiring 12 volatage signals in a producer/consumer structure giving me a queue of 1-d array of waveform(dbl). Then I am acquiring 12 voltage signals in another loop giving me 2-d array of waveform(dbl).
    There is an issue creating the channels. How can I combine these two tasks?
    Thanks,
    ~Chris
    Attachments:
    WaveTest_6.2.vi ‏558 KB

    Hello chrisbe723,
    When you say that there is an issue creating the channels, are you getting a specific error message when running your code? Also are you referencing the same set of channels for the two DAQ task you are configuring?
    Paul-B
    Applications Engineer
    National Instruments

  • HT5620 How can I set up two separate accounts on one iPad?

    How can I set up two separate accounts on one shared iPad?

    The iPad is meant to be a single user device.
    It is possible to use multiple ID's on an iOS device, but when you switch ID's and download content with another ID, you associate the device with that ID for 90 days and lock yourself out of the other ID for that 90 day period.
    So while it is possible, it's not advisable.

  • How do I set up two libraries on one pc so that we have two separate libraries for each iPhone?

    How do I set up two libraries on one pc so that we have two separate libraries for each iPhone?

    Launch it with the Shift key held down, or create a second Windows user account.
    (60390)

  • How do I set up two iPads on one apple tv?

    How do I set up two iPads on the same apple tv?

    Launch it with the Shift key held down, or create a second Windows user account.
    (60390)

  • How would YOU retype these old XM08 types for use in an ABAP OO method?

    The XM08 function group has the following type declarations:
    TYPES: BEGIN OF mmcr_drseg_co.
            INCLUDE STRUCTURE cobl_mrm_d.
    TYPES: cr LIKE drseg_cr    OCCURS 0,
           unpl_refwr TYPE refwr,
           END OF mmcr_drseg_co.
    TYPES: mmcr_tdrseg TYPE mmcr_drseg OCCURS 0,
    TYPES: BEGIN OF mmcr_drseg.
            INCLUDE STRUCTURE drseg.
    TYPES: cr LIKE drseg_cr OCCURS 0,
           co TYPE mmcr_drseg_co OCCURS 0,
           sm LIKE drseg_sm OCCURS 0,
           charact TYPE rbcharact_instance OCCURS 3,
                                           "instances of characteristics
           uebgmat  TYPE matnr,
           uebrblgp TYPE rblgp,
           selkz_db TYPE selkz,
           rblgp_old TYPE rblgp,           "rblgp before aggregation
           END OF mmcr_drseg.
    How would YOU redeclare these types so that they work in an ABAP Objects class?  
    Some of the "fixes" are easy, like replacing "LIKE" with "TYPE:".
    But what about the "INCLUDE STRUCTURE" and the "occurs 0" specifications?
    The reason I'm asking this is that I have to call a method from ZXM08U16 and I'd like to be able to pass this method exactly what XXM08U16 gets from SAP, i.e. the table E_TDRSEG of type  MMCR_TDRSEG

    David,
    I wonder it can be directly in ABAP (I would like to hear opinions from others as well!), I needed to use Data Dictionary as well:
    TYPES: BEGIN OF mmcr_drseg_co.
            INCLUDE STRUCTURE cobl_mrm_d.
    TYPES: cr TYPE z_tt_drseg_cr,
           unpl_refwr TYPE refwr,
           END OF mmcr_drseg_co.
    z_tt_drseg_cr is a table type created in SE11, based on structure drseg_cr.
    the way to create internal table and work area, based on the above:
    DATA : gt_... TYPE TABLE OF mmcr_drseg_co.
    DATA : gw_... TYPE mmcr_drseg_co.
    hope this helps some
    ec
    UPDATE : Rich is right, it is possible to do it only in ABAP with the DEFAULT KEY addition.

  • How would I set up macbook gestures in about:config to open up a new tab(cmd+t) and word search (cmd+f)?

    I'm trying to re-setup my multitouch gestures on my mac. what values in about:config would i need in to put in to [1] open up a new tab (command+T) for '''browser.gesture.twist.right''' and [2] how would i set up a page search (command+F) for '''browser.gesture.swipe.down'''
    Thanks

    Try <b>cmd_newNavigatorTab</b> and <b>cmd_find</b>

Maybe you are looking for

  • Cant add Apps to login items with profile manager

    I can set up profile manager successfully, and set certain settings like the Dock, the login window, etc. But when I click on Login Items, and try to add an Application, the list of applications is blank. Tried it from my server, tried it logged in r

  • Backup files

    What iPad / iPhone backup files are retained by iTunes? My iPad gets synced perhaps 2-3 times a month, usually wirelessly. The sync operation always begins with a message bar in iTunes saying "backing up files." But recently, I had a need to retrieve

  • SKF for Progress Analysis

    Hi, I have successfully run progress analysis using Estimate method .  As my understanding after I run CNE1, system will record POC that I maintained in Estimate table into SKF.   Which report I can use to see this SKF value ? I have checked all SKF

  • Printing labels with partner

    Hi there, Is it possible to print labels through address book that include the partner information? For example if my address card reads: Joe Blogs Partner: Jane Doe 9 Street Name Suburb, State, Postcode Can I get a label to print: Joe Blogs and Jane

  • Media manger for ipad 2

    When I access a flexview movie from my ipad I only have two options available, bookmark and preview.  How do I get to a point where I can view a movie from my ipad.  Do I need to buy it first using my PC or set top box?  I guess I need some instructi