Digital clock which randomly selects different colors from Applet

Hi,
I relatively new to java, what I'm trying to do is list about five colours in my Applet and pass the colours into my java code, and maybe the font.....
I want to be able to Display a digital clock which randomly selects different colours which were passed from my Applet
Thanks for any help
Zip
Clock Code:
import java.awt.*;
import java.applet.*;
import java.util.*;
import java.text.*;
public class dclock extends Applet implements Runnable{
Thread animThread = null;
int delay = 1000;
public void init(){}
public void paint (Graphics g){
// get the time
Calendar cal = Calendar.getInstance();
Date date = cal.getTime();
// format it and display it
DateFormat dateFormatter =DateFormat.getTimeInstance();
g.drawString(dateFormatter.format(date), 5, 10);
public void start(){
if(animThread == null){
animThread = new Thread(this,"Animation");
animThread.start();
public void stop(){animThread = null;}
public void run(){
while(animThread !=null){
try{ Thread.sleep(delay);}
catch(InterruptedException e){};
repaint();
//sec++;
}

Why doesn't the clock just decide what colour it is going to be? If you need to pass the colour choices in, just let the clock accept a collection of colours in its constructor or something. I don't understand what bit of this you are having problems with as you haven't really explained. Please also use code tags.

Similar Messages

  • TFS Workitems:Bugs : I want ot select different lists, from the global list, for fields basd upon user group

    Hi,
    I am customizing the bug workitem workflow.
     I want ot select different lists, from the gllobal list, for fields basd upon user group
    I am aware that I can use "when" clauses in the allowed/suggested values of the field.
    My question is : how do I get the group(s) that the current user is in and how do use this to select different lists?

    Hi!
    You can not do this through standard way. You must to create the custom work item control:
    http://witcustomcontrols.codeplex.com/
    And get the user group through IIdentityManagementService.
    IIdentityManagementService IdentityService = _workItem.Store.TeamProjectCollection.GetService<IIdentityManagementService>();
    TeamFoundationIdentity _curid = null;
    _workItem.Store.TeamProjectCollection.GetAuthenticatedIdentity(out _curid);
    string _group = "Admin";
    var _gr = IdentityService.ReadIdentity(IdentitySearchFactor.AccountName, _group, MembershipQuery.Direct, ReadIdentityOptions.None);
    if (_gr.Members.Where(s => s.Identifier == _curid.Descriptor.Identifier).Count() > 0) return true;

  • Is there an easy way to select complimentary colors from within Photoshop?

    Is there an easy way to select complimentary colors from within Photoshop?
    Is there a tool like Kuler for Photoshop?
    Kind regards,
    Michael
    Learn how to do meditation

    See attached image... I have PS CS5.
    Is there a way from the color picker or using color libraries to pick shades, complimentary, tetradic or triadic colors?

  • Randomly selecting some rows from the database table

    Hi can some one help me in selecting some rows from a database table which has around 90,000 rows.
    Thanks.

    One thing you might try is the "sample" clause if you have 8i which is supposed to return a random percentage of the table. Say for example, you have a sequence number on your table as the pkey. Then you might try:
    select * from <table_name> where pkey in(select pkey from <table_name> sample(10));
    This should give you a random 10 percent of the rows in the table but I tried this once and the results seemed unpredictable. For example it returned a different number of rows each time even though the number of rows in the table didn't change.
    Hope this works for you.

  • Random selection of rows from a 2D array then subset both the rows that were selected and those that were not. Please see message below.

    For example, I have a 2D array with 46 rows and 400 columns. I would like to randomly select 46 data rows from the 2D array. By doing the random selection it means that not all individual 46 rows will be selected some rows may appear more than once as there may be some duplicates or triplicates in the random selection. The importan thing is that we will have randomly selected 46 rows of data (no matter that some rows appear more than once). Then I would like to subset these randomly selected 46 data rows (some which will be duplicated, or triplicated, etc.) and then also find and subset the rows that were not selected. Does this make sense? Then i would like to do this say 10 times for this data set. So that then I will have 2 by 10 data sets: the first 10 each with 46 rows and the other 10 with n rows depending on how many WERE NOT randomly selected. i hope that my explanation is clear. I am relatively new to Labview. It is really great so I am getting better! If anyone can help me with this problems it will be great. RVR

    Start by generating randon #s between 0 and 45. Run a for loop X times and in it use the random function, multiply the result by X and round down (-infinity). You can make this into a subVI, which you can reuse later. In the same loop, or in a different one, use Index Array to extract the rows which were selected (wiring the result out of the loop with auto indexing causes it to be rebuilt into a 2D array).
    One possible solution for the second part would be to go over the array of randomly generated numbers in a for loop and use Search 1D Array to find each of the numbers (i). If you get -1, it means the row wasn't selected and you can extract it.
    I hope this puts you on the right path. If not, don't be afraid to ask more.
    To learn more about LV, I suggest you read the LabVIEW user manual. Also, try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide.
    Try to take over the world!

  • Selecting different pageitems from viewer

    I'm trying to run a report from viewer and i've say, 4 page items
    how do i run the report by selecting different page items in one shot instead of running it for each change in the page item...?

    Hi
    It's NOT re-running the query, I already said that in my previous posting. ALL items get queries whenever you use page items and Discoverer creates placeholders in memory for all of the permutations.
    All it's doing is pulling the results in from the placeholders in the memory cache. Now, if your query is a big query with lots of items being pulled back then it is quite possible that you are exceeding the available memory and so the query WILL re-run in this case. If you are out of memory then there is nothing you can do except increase it.
    User machines that are running Plus need to have at least 1Gb of memory. If you have less than that you will definitely have issues. Also, the server needs to be capable of allotting 85Mb per user session, in addition to which you will need approximately 1.3Gb of available memory just to load the operating system and enable the application server.
    Does this help?
    Best wishes
    Michael

  • Selecting different homes from command prompt

    Hi Gurus,
    Oracle client-9201
    Oracle client-10201
    Win XP SP2
    We have two oracle homes. We want to switch it from one to another. We have restriction that this should be done from command prompt only. Although I can change homes launching latest OUI and going to "INSTALLED PRODUCTS" tab where we find ENVIRONMENT tab. There it is possible to change home and apply. But this thing I want to do from command prompt.
    Any help will be highly appreciated.
    Regards.
    Virendra

    No, you don't want it to be from a command prompt and from OUI. What you want is to be able to do this without the need to visit all 400 client boxes. The method is irrelevant, as long as it efficiently achieves your real goal.That is true.
    You keep saying "command prompt" and "OUI", but can't visit all the necessary machines. So what were you envisioning? Creating some batch file you could distribute to all affected users over the network, and ask them to execute said batch file? That may (or may not) be valid, but to find the best solution we have to clearly define the real requirements and separate that from any pre-concieved solution.You can say it is my pre-concieved assumption that I will go with Command Prompt/OUI. But the real problem is I don't want to visit all machines. It can be a batch file distributed to all machines or our network people may execute it sitting on domain controller machine from which he can run programs in background of any machine in network.
    From the other things discussed on this thread, I suspect you are going to have to blow in some registry hack, by one of several possible means. But first we have to know what your real constraints are and all of the options open to you.Real constraint is, We don't want (rather can't) visit all 400 terminals.
    Do you have the ability to push registry settings at client logon?Yes, We can.
    Can you guarantee the consistency of configuration of all 400 clients?Home name and Location may be different on different machines.
    Do you have the ability to force the automatic execution of a command file from a file server and client log-on time?Yes, it is possible.
    Are you working with your network people to explore what help they might be able to provide on the above points?They may help us depending upon the requirement.
    Regards
    Virendra

  • Different colors from original footage

    Hello,
    i got footage from a HMC151 Panasonic. I edit in prores 422 and then export in quicktime self contained, and then compressor to obtain a standard dvd. I notice that the colors are quite different from original footage, they seems like colds. There's a way to retain original colors. Is up to compressor the difference?
    Thanx
    Fran

    I don't believe you want to over do this adjustment.The preview window will show a true compressed frame, as in what you'll get in the end when you submit the job... so if you make this too dark or whatever, you'll also do this to the resulting files. i.e, this preview should match the resulting file as it is actually applying the change in the preview window. What you see there before you compress should be what you see with the compressed files.
    Jerry

  • Different colors from RAW+JPEG mode of my camera

    The same issue of always... color profile.
    I shot my entire trip thru Europe using RAW + JPEG Basic mode of my Nikon D40 digital camera. Oddly, the JPEG files are looking MUCH MUCH better, because iPhoto assigned the correct color profile to the files, instead of signing all RAW files as Adobe RGB. (I have Adobe RGB option on my camera, but I shot as sRGB).
    I tried installing Aperture trial to reprocess all RAW files and no success. Looking RAW and JPEG side by side makes me sad.
    What should I do to make iPhoto recognize my RAW files as sRGB?
    Sorry for posting this again... I read more than 20 threads about color issues and I didnt managed how to fix my problem.

    Hi Dave,
    yes, thats generally what i want to do.
    I have the PEF-Files out of my camera and i convert them with the Adobe DNG converter to the DNG format. The old Pentax K100D is using uncompressed PEF, thats why the pictures are twice the size than the converted DNG
    If i import these files for further processing into Lightroom, they are looking similar to the originals viewed with another application (e.g. the pentax development tool) for a second, after that Lightroom is changing the preview to the settings of the Adobe Profile. Colors are much more colder and less colorful. If i try to change the profile in the developement tab, there are no visible changes to the picture.
    I've downloaded the DNG Converter and Camera RAW. There are several profiles included, but i don't know how to use them with Lightroom or Photoshop CS4 (with installed ACR).
    I've created a screenshot of the differencies so you know what i mean.
    Screenshot
    On the left side you can see the developed JPEG via PEF out of the Pentax-Software (Silkypix), on the right is the developed JPEG out of the DNG via Lightroom. Both files are without any further changes to the development process.
    The left picture corresponds to the original conditions.

  • Cannot select different values from a table in a view object

    Hi everyone,
    I have two tables, Employee : ID, NAME, SALARY, NO_ROLE and role : ROLE_ID, ROLE_EMP. I join them with NO_ROLE and ROLE_ID. I created a view object with these two tables in JDeveloper, I made a LOV with ROLE_EMP and I want to be ale to create an employee with his ID, NAME, SALARY and by choosing a value in the ROLE_EMP list. The problem is that when I choose a ROLE_EMP, I cannot commit because the link between ROLE_EMP and ROLE_ID is not made correctly in ADF.
    In SQL, that's what I'm trying to do: INSERT INTO Employee VALUES (ID, NAME, SALARY, NO_ROLE) WHERE NO_ROLE = ROLE_ID of the ROLE_EMP I have selected.
    Thanks for your help ;)
    PS: I followed this tutorial to do this, but it is not exactly what I want to do: http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_55/jdtut_11r2_55_2.html

    To be more generic, when I create an employee and select his role_emp (the name of the role) I want that the role_id of the role_emp to commit.

  • Problems with color from Photoshop to InDesign CS2?

    Hi all,
    Couple of questions:
    When I select "Proof Colors" from "View", the color changes a little bit. Is this normal?
    Also, on "View", "Proof Setup", which one should I select "Document CMYK" or "Working CMYK" or some other "Custom"
    thanks for all your help,
    Alex

    >When I select "Proof Colors" from "View", the color changes a little bit. Is this normal?
    It's not abnormal, but it will depend on what color spaces the objects are in and the color space that you choose to proof.
    >Also, on "View", "Proof Setup", which one should I select "Document CMYK" or "Working CMYK" or some other "Custom"
    You have a lot of choices for how to set up color management. I usually leave my settings set up for my most common situation, US Sheetfed coated and Adobe RGB, but if I have a special job I can reassign the document color space (notice I said Assign, not convert, in order to preserve the native object color numbers). You can proof the color in either the Working CMYK (the one in the color settings) the Document CMYK (if that's different) or something else entirely if you are repurposing an existing document for a new output method.
    When you proof colors, InDesign calculates the conversions on the fly and displays the results. RGB objects will almost always show some shifting due to gamut differences, but the type and degree will depend on the rendering intent you specify. CMYK objects tend not to show as much shifting because the gamuts are likely to be closer, but again it will depend on the exact profiles and intents. Objects that are already in the chosen proofing space should not show any shift at all.
    There is a caveat here regarding working in one space and outputting in another: If you want the colors to be as close as possible you will be converting to the new profile, which will by necessity change some color numbers to match the appearance. This is not usually a problem with things like photographs, but other things, like type, which is created as 100% K can be converted to a four-color mix which is not good. If you know the output conditions, I always recommend setting the document CMYK to that space when you start.
    Peter

  • Different color text in one cell

    How do I set a color for a group of words within a cell leaving the rest of the words black?
    I can make all the text within a cell the same color but when I select the words I want to be a different color the color selector in the toolbar goes away and only fx, Cancel and Accept buttons are available.

    If it is simple text, not the result of a formula, select the words you want to change and select another color from the toolbar or the color panel. That is, unless I didn't understand your request. I don't know where you are seeing Accept, Cancel and Fx.

  • HOW CAN I Publish ALL the Original Different Colors in iCal

    I am trying to publish a grouped calendar which includes several differently colored events. I am testing it by subscribing to it from an iCal that has no calendars created at all....and it still will not publish the different colors of the original calendar. All the events appear as one color.
    How can I publish/share my calendar and have ALL the different colors show?
    -I am publishing using a .Mac account.
    THANKS VERY MUCH for any help anyone can give! It will be hugely appreciated.

    I am having this same trouble - I publish
    webcal://ical.mac.com/neyt/neyt.ics
    as a grouped calendar. I tried resetting my sync data fromthe computer that this calendar lives on ( OSX 10.4 because I realized earlier versions have Ical that doesn't even group..)
    Now when I have a subscriber pull down the .ics file, it doesn't show up as grouped, nor do the groups live onthe website version.
    why don't these groups just show up? if I send people the .ics file - it all works just fine...
    I know that some colors might be in use on other computers, I'm sure that other colors will be assigned s individuals need them in their calendars, but the groupings should sync...
    help!!
    flipster for G.Stockman

  • How to differentiate PO's in different colors in abap editor

    Dear sir,
              I had created five Purchse request using ME51N Transaction.  I would like to write each PO in each color using ABAP editor.
    With Regards,
    Baskaran

    Hi,
    You can try the following,
    Get the PR's you have created into a internal table, by writing a select query.
    Before writing out the internal table fields, do the following
    loop at itab.
    if sy-tabix = 1.
    format color 1  intensified on.
              skip.
              write:/1 'field1',18 '-' , 20 itab-field .
              format color off.
    endif.
    if sy-tabix = 2.
    format color 2  intensified on.
              skip.
              write:/1 'field2',18 '-' , 20 itab-field .
              format color off.
    endif
    endloop.
    You can use up to 7 different colors  from 1 to 7.
    Regards,
    Vik

  • I installed the new update of OS X and now find the iMessages are different colors or shades of gray.  Why?

    Why are iMessages coming thru in different colors from different people?  I haven't assigned color tags to these people.  How did this happen and how can i change it?

    http://www.apple.com/osx/whats-new/

Maybe you are looking for

  • How can i show images from different folders  in image gallery

    Hi All,          i have downloaded and executed photo viewer image gallery application.           in that we r showing images sequentially what we have defined in xml file.          but i want show images randomly or i want show images from different

  • HU assignment to Outbound Delivery

    Hi Experts, I am facing a problem with the assignment of HU to Outbound Deliveries. I'm working with WM module. When my HU get to my shipping area (standard 916 with dynamic storage bin), it is assigned to the Outbound Delivery. In my process, I dele

  • Sending of OUTBOUND IDOC

    We are sending out idocs for schedule lines, Some idocs get stuck at 03 status (successfully processed), but these idocs or not received by the recepiant systems which does ot acknoledge receipt. hence thou these idocs are successful they are not sen

  • Can 15" LCD TFT studio monitor be used with my G4?

    I've acquired a nice 15" Apple LCD TFT studio monitor and would like to use it with my G4 but have found that the connections are incompatible. Are there any adaptors i could get to resolve this issue?

  • Out of sync export...

    hallo, i was working with FCP 2 and exported a audio track to soundtrack pro 2...i was familier to soundtrack pro, and used it for very simple modifications...but this was my first run in with soundtrack pro 2...anyway, i exported to soundtrack with