Displaying multiple colors in a shape?

Hi i have made a game where users click on the screen and a red triangle appears correspinding to where they clicked. How do make the game act so that when i/user clicks on the screen the user would see for example the colours red, blue, green, yellow in that order in each triangle. Would i need to use the Cardlayout functionality ? if not, how?
The code for it to be red is as follows;
if(m_bMouse)
               gc.setColor(Color.RED);
                    for( int i = 0; i < m_nTrianglesDrawn; i++)
                         gc.fillPolygon( m_polyTriangleArr);
                         m_bMouse = false;

Suggestion:
1. Start small. Create a subclass of JComponent with a shape on it that cycles through a sequence of colors, driven by a javax.swing.Timer. You can either have the timer never stop, or have the timer stop itself at the end of the color sequence.
2. Have the component start out empty and add the shape when the mouse is clicked on the component. That click starts the timer.
3. Allow for many shapes on the component rather that at most one.
Do one step at a time, so that you can debug and test as you go along.

Similar Messages

  • How to display multiple colors in a lineseries?

    Hi,
    I want to display different colors in a line series based on some condition. As per my observation we can use fillFunction on columnseries to get different colored chart items, but it does not have any effect on lineseries. Is there any way by which we can get multi colored line series?

    It looks like you would have to create a custom line series component.
    You can create an ItemRenderer and add the data value as text to the points on the line series.  When you do that, you could adjust the style color of the Label text to correspond with conditions.

  • T420s: External Monitor displays flashing Multiple Colors (a la Kanye West video) then shuts down

    Has anyone seen this? I've had it happen to several T420s models. While connected to a docking station with the lid closed, the external monitors will just display flashing colors really quickly like in Kanye West's "All of The Lights" music video. Once the display is done, the laptop shuts off. When I first experienced it, it was on my personal laptop. I switched shells and popped my hdd into another one. It ended up happening again sometime down the line. It then happened to my boss' as well. Most recently I've had a colleague report the same issue. Does anyone have an idea as to what could be the issue?

    I have the same problem too. I am not using any docking station. It occurs very rarely and I notice it happening when I connect to an external monitor or when in video calls. Happens both in Windows and Ubuntu. I tried switching to a different T420s laptop and I see the same behavior there too (but not as frequently as the other one).
    M_Wilson's description of the issue is spot on. The screen flickers colorfully for about 15-20 seconds and then the laptop shuts off completely.
    I also noticed sometimes that the laptop gets hot under the part where the display card is present (near the fan outlet vent on the left side). The laptop fan is running at full speed at that time.

  • Video displays weird colors with normal sound

    I recently downloaded the newest version of quicktime (itunes said it was required) and also service pack 2 because that was required for the newest quicktime, but now when I play videos, they are playing (I can hear the sound), but the video is just a weird display of colors and shapes.

    Open the QuickTime Control Panel / Advanced tab and check the box for "Safe mode".
    Quit and relaunch QuickTime Player and try the files again.

  • Leave Multiple Colors in AE CS5

    Hey everyone! I've been hired to shoot a web video for a yogurt shop and they want to do a similar "Leave Colors" effect that they used in their still photographs on their website. Obviously doing this in still form is easier than motion video, but I told them I knew there was a way to do this and I'd figure it out. However there doesn't seem to be many sufficient explanations of how to achieve this effect in CS5.
    Where do I begin? I know I can help myself a lot by directing my subjects not to wear similar colors to the yogurt, but that will be somewhat of a challenge with multiple-colored yogurt. Is After Effects CS5 even the best program to use to accomplish this? Thank you so much, everyone!

    duplicate your layer, desaturate the bottom one and roto the yogurt and parrot from the top layer, mask the yogurt container since it has pretty simple shape. From the look of the photos, this should be a breeze with roto brush.
    Anything like keying, leave color, change to color etc will get you unpredicable results and/or hard to handle.

  • How do i set a multiple colors for a panel

    hi all,
    how do i set a multiple colors for a panel .pl desperately need a solution.
    regards
    bhaskar

    Iam contradicting self !
    Hope this helps !
    java.lang.Object
    |
    --java.awt.Component
    has the paint method ! Take the Graphics Object and call Graphics.setColor( Color.red ) .. and u can draw regular shapes like fillRoundRect. blah blah.. u need t count on the pixels .. I guess..
    An easier choice could be adding labels or panels with a layout of ur choice ..
    venu

  • Are multiple colors possible on a published calendar?

    Hi, on my desktop I easily see multiple colors, with each on for a different calendar. we have a published calendar for a group, that would be great if it were possible either to publish both with the same URL, or at least allow color changes for some of the items on the calendar again with just one url. Is this possible in iCal?
    Thanks.
    -wayne

    Wayne,
    Unfortunately, published calendars are not capable of displaying individual calendar colors.
    Consider providing iCal Feedback.
    ;~)

  • Display multiple spreadsheet on one XY Graph

    Hello 
    How can i display multiple spreadseet on one XY Graph ?
    i'm using this method for single file :

    This is what i have done 
    it's really intresting that The color of the plots automatically got changed 
    as you see here address is constant and number of file too.
    now i'm working on user just select the folder and the code automatically display all file in the folder .
     

  • I want to connect my IMAC to TV with HDMI cable. I did it before going to Dispaly and Arrangments and then mirror. Now when I go to display I dont have to option of arrangements. Olny {Display and Color} pops up. Any ideas what happend to arrengements?

    I want to connect my IMAC to TV with HDMI cable. I did it before going to Dispaly and Arrangments and then mirror. Now when I go to display I dont have to option of arrangements. Olny {Display and Color} pops up. Any ideas what happend to arrengements?

    For the "Arangements" option to appear, the external display must be turned on with the correct input selected and connected to the computer.  Then close system prefs, reopen, go to "Display" and "Arrangement" will be along the top. 

  • Crystal report -How to display multiple lines in line chart?

    Hi,
    M struggling to display multiple lines in line chart. All the values m fetching it from database into data table in below format & data type
    Category(String).....year(Int).....graph_values(Int).....table_value(String)
    Test.........................2006.......... -100............................(100)
    Avg..........................2006..........20................................20
    Median......................2006...........5................................5
    Test..........................2007...........500.............................500
    Avg...........................2007............90..............................90
    Median.......................2007............45..............................45
    M using cross tab to display data and chart to plot line. Following fields I used in Cross tab Expert & Chart expert
    Cross tab expert-
    Rows u2013 category
    Columns u2013 year
    Summarized fields u2013 Min of table_value
    In Chart Expert u2013
    On Change of - Year
    Show values - graph values
    In cross tab m able to see the data properly but not in graph.I have three categories. Hence it should plot three lines in line chart but m able to see only one line for test category.
    FYI u2013 using VS 2008 and crystal report assembly version 10.5
    Urgent. Please reply soon.
    Thanks
    ThakurS

    I got the solution.
    In Chart Expert - I should use
    On Change of -- Year, Category
    Show values -- graph values
    Thanks,
    ThakurS

  • Display specific row to display multiple time in jsf table 11.1.1.2.0 with

    HI ALL,
    I'm using jdeveloper 11.1.1.2.0 with ADF 11g.
    I have to display the values in jsf frm table where i'm using DislayCertDetailVO . In dis VO i'm having a column no.of certificaties .taking dis column value when i navigate to other page jsf by selecting a specific row. here i have to display the selected row in multiple times based on the no.of.certificates column value.
    I want to display specific row to display multiple time to repeat same row in a table in jsf based on the value from bean or table in database.
    Edited by: user9010551 on Apr 28, 2010 6:14 AM
    Edited by: user9010551 on Apr 28, 2010 10:33 PM

    Hi, Trying it once more to give more clarity of my scenario.
    I have to navigate from 1 screen to the other by picking a given table record/row from the 1st screen. While displaying the record on the 2nd screen the catch is that, I have to display it as many times as the value in a cell of the selected record.
    eg.
    screen 1
    col1   col2     col3
    2 order1 item1
    [next]
    On clicking next it should look like
    screen2
    col1           col2            col3           col4
    order1 item1
    order1 item1
    where col3 and col4 will be editable by the user and col1 is the value depends how many times i have repeat the row/record
    Hope this give more clarity.

  • How to Display multiple records in Table in VC without using BAPI.

    Hi All,
    I am working on Visual composer (NW2004s SP10). I am trying to display Poitems from BAPI_PO_GETDETAIL. I am creating my front end using VC. I have created one form and one Table where I want to display POItems. I am writing my logic of retrieving data from BAPI in CAF.I am connecting them in Guided procedures.When I run my process in Guided Procedures I am getting single row displayed in table. Can Anyone help me how to display multiple rows in table.
    Regards,
    Sheetal

    Hi Sheetal,
    if the BAPI returns a table, then you get multiple rows. From which system is the BAPI, so that I can check the BAPI to give you further information.
    Best Regards,
    marcel

  • Is there a way to transform multiple colors?

    I have a project where I've been asked to allow a user to choose between multple color themes of a character.  This object  is complex in that it has multiple colors and that each color needs to change differently based on the theme's color scheme.
    Is there a way to take a movieclip with multiple colors and apply process to it that will detect different colors and transform them accordingly without taking each individual color, making a movie clip from it, then modifying the movieclip's colors?  Each character has a pretty limited color pallette, so this process would only have to find and then change maybe 3 or 4 colors.  But the character in question is hand animated and has a LOT of frames, so I'm hoping there's a chance that I can handle this programmatically rather than doing it all by hand with a few hundred extra movieclips to make color changes to.  Any help is greatly appreciated!

    Hi, and thanks for the help.
    This is the 1st time I've looked at the palletteMap method.  I see in the documentation:
    paletteMap(sourceBitmapData:BitmapData, sourceRect:Rectangle, destPoint:Point, redArray:Array = null, greenArray:Array = null, blueArray:Array = null, alphaArray:Array = null):void
    Parameters: 
    sourceBitmapData:BitmapData — The input bitmap image to use. The source image can be a different BitmapData object, or it can refer to the current BitmapData instance.
    sourceRect:Rectangle — A rectangle that defines the area of the source image to use as input.
    destPoint:Point — The point within the destination image (the current BitmapData object) that corresponds to the upper-left corner of the source rectangle.
    redArray:Array (default = null) — If redArray is not null, red = redArray[source red value] else red = source rect value.
    greenArray:Array (default = null) — If greenArray is not null, green = greenArray[source green value] else green = source green value.
    blueArray:Array (default = null) — If blueArray is not null, blue = blueArray[source blue value] else blue = source blue value.
    alphaArray:Array (default = null) — If alphaArray is not null, alpha = alphaArray[source alpha value] else alpha = source alpha value.
    I comprehend the 1st 4 parameters, but the color and alpha arrays have got me confused.  How would I use these to, for instance find all the pure blue pixels in a bitmap (0x000000FF) and then change those pixels' colors to some other color, then find all the pure red pixels (0x00FF0000) and change them to yet another color?  Fortunately I don't have to deal with alpha with this current delimma . . .
    One other question before I look into this method as a solution, is it possible to programmatically convert vector-based artwork into a bitmap to use this colorMatrix feature?  All the artwork I need to change colors on is hand drawn animation using the native Flash drawing tools.  Thanks again for any additional help!

  • How to display multiple reports at the same time

    Hi,
    I'm trying to display multiple reports at the same time, each one in separates tabs or windows using Forms 11g 11.1.1.6
    I have a button which has a call to a procedure which makes use of rp2rro library to show the specific reports, for example:
    call_report('report1');
    call_report('report2');
    call_report('report3');
    call_report('report4');
    The main problem is that, just the last report is been displayed.
    Is there some way to display report1, report2 etc in separate tabs or windows ??
    Regards
    Carlos

    You shouldn't have a problem calling different reports at once. As long as you're using Forms 11g they show up in different windows.
    The question is how you are calling the report.
    Here is how I manipulate it.
    After I pass parameters with the ADD_PARAMETER built-in I set some key values (destype, desformat, desname) with the RP2RRO's procedures.
    Finally calling RP2RRO.RP2RRO_RUN_PRODUCT and then WEB.SHOW_DOCUMENT passing the correct procedure parameters the report comes up in a window. If you repeat the above changing the appropriate variables (the report_name in the RP2RRO_RUN_PRODUCT and so on) you can get multiple reports in different windows.

  • How to integrate bing map for including or displaying multiple locations at the same time

    how to integrate bing map for including or displaying multiple locations at the same time

    Have you aware of the geolocation field that's been introduced with SharePoint 2013?  You can store location data within a list and then integrate this within Bing.  The second tutorial on this Bing team blog will show it well.
    https://www.bing.com/blogs/site_blogs/b/maps/archive/2013/03/26/connecting-a-sharepoint-list-to-bing-maps.aspx
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

Maybe you are looking for

  • Error on startup, Any of you experts want to help?

    Hey guys, Ive had itunes on my computer for a few monthes now and its been working fine, but yesterday i decided to upgrade to the latest version. Now, Im getting an error when I start iTunes that says itunes has encountered a problem and needs to cl

  • Retreive Next Source File in MDM Import Manager

    Hi all, I am curious about the above feature in the MDM Import Manager. It can be found under File menu but I found that it is always greyed out even if I have selected multiple files. When I select multiple files, the system is clever enough to take

  • Steps to create webdynpro

    hi all,        i'm new to webdynpro.. Can you send me the step by step procedure to create webdynpro objects Regards Suprith

  • HELP! Firewire Drives Unmounting by themselves.

    I have a small workgroup with a G4/800 server with two FireWire drives connected. One of the drives contains ALL of the organizations files and is shared over the network using the SharePoints software. The other Firewire drive is just a backup drive

  • Delete my iCloud account because I no longer have that e-mail address.

    How do I delete my iCloud account without a password? I set-up iCloud with my last jobs email and now I can't delete the account. The password I am using is wrong and I can't reset the password because it tells me my birthdate is incorrect.