A program that needs a code. How do i code this?

Write a ColoredPoint class. It�s purpose will be to display a colored point within a window. One simple way to draw a point is to draw a line (which I would call a �pointline�) that begins and ends at the same point. The java.awt.Graphics class includes a member method drawLine(int,int,int,int).
Put your ColoredPoint class to use by writing a RandomPoints class that will draw points at random locations within a window. Allow a new random point to be drawn again and again indefinitely until the window is closed. A simple way to accomplish this is to generate and plot a random point within an infinite loop.
Notes
You may find the following classes to be helpful. When you import them, please import by full class name. Do not import an entire package by using the wild card symbol *. For example, use:
     The useful classes are:
     javax.swing.Jframe
     java.awt.Color
     java.awt.Graphics
     java.util.Random
How do i code this?

You should do your assignments on your own.
anyway here a code(U will have to modofy it a bit to make it worj the way u want, this code will give u a basic idea:
import java.awt.*;
import javax.swing.JFrame;
class MyFrame extends JFrame implements Runnable
int width = 500;
int height = 500;
int x,y;
int r, g, b ;
MyFrame ()
     setSize(width, height);
     setVisible(true);
     new Thread(this).start();
public void run()
    while(true)
        try
            if(isVisible())
             x= (int)(Math.random()*width);
             y= (int)(Math.random()*height);
             r = (int)(Math.random()*255); g = (int)(Math.random()*255); b = (int)(Math.random()*255);
             repaint();
            Thread.sleep(200);
        catch (InterruptedException e)
            e.printStackTrace();
public void update(Graphics graphics)
  graphics.setColor(new Color(r,g,b));
  graphics.drawLine( x,y,x,y);
public static void main(String[] args)
    new MyFrame();
}Tanveer

Similar Messages

  • My iPad mini won't allow me to update any apps that need it. How do I fix this?

    My iPad mini will not allow my to update apps when needed. Can you help me correct this?

    Couple things to try:
    check restrictions settings>General>restrictions. Make sure installing apps is not restricted, also verify age restrictions are not set below what the app shows
    reset iPad: hold home and power buttons down simultaneously for 15-20 seconds until the apple logo appears, try updating again.
    if still fails, you could try restarting your router but that is a long shot.

  • I am trying to use an education program that needs Java applets to install and use and it will not use Safari. When I download IE from the web it will not install. How can I get a browser that will work on my MacAir for travel use of this program?

    I am trying to use and education program that needs Java applets and it will not run on Safari. IE will not install from the web. How do I get a browser that will work to install so I can use this program when I travel.

    Try using FireFox. IE will only run on a Mac if you run Windows on the Mac.
    Windows on Intel Macs
    There are presently several alternatives for running Windows on Intel Macs.
    Install the Apple Boot Camp software.  Purchase Windows 7 or Windows 8.  Follow instructions in the Boot Camp documentation on installation of Boot Camp, creating Driver CD, and installing Windows.  Boot Camp enables you to boot the computer into OS X or Windows.
    Parallels Desktop for Mac and Windows XP, Vista Business, Vista Ultimate, or Windows 7.  Parallels is software virtualization that enables running Windows concurrently with OS X.
    VM Fusion and Windows XP, Vista Business, Vista Ultimate, or Windows 7.  VM Fusion is software virtualization that enables running Windows concurrently with OS X.
    CrossOver which enables running many Windows applications without having to install Windows.  The Windows applications can run concurrently with OS X.
    VirtualBox is a new Open Source freeware virtual machine such as VM Fusion and Parallels that was developed by Solaris.  It is not as fully developed for the Mac as Parallels and VM Fusion.
    Note that Parallels and VM Fusion can also run other operating systems such as Linux, Unix, OS/2, Solaris, etc.  There are performance differences between dual-boot systems and virtualization.  The latter tend to be a little slower (not much) and do not provide the video performance of the dual-boot system. See MacTech.com's Virtualization Benchmarking for comparisons of Boot Camp, Parallels, and VM Fusion. A more recent comparison of Parallels, VM Fusion, and Virtual Box is found at Virtualization Benchmarks- Parallels 10 vs. Fusion 7 vs. VirtualBox. Boot Camp is only available with Leopard and later. Except for Crossover and a couple of similar alternatives like DarWine you must have a valid installer disc for Windows.
    You must also have an internal optical drive for installing Windows. Windows cannot be installed from an external optical drive.

  • The credit card info on the account has changed but for some reason there is no option for me to make the changes.  In addition, cloud has stopped working and all other programs that need to be updated cannot be.

    the credit card info on the account has changed but for some reason there is no option for me to make the changes.  In addition, cloud has stopped working and all other programs that need to be updated cannot be??

    Make sure that EVERY DETAIL is the same in every place you enter your information
    -right down to how you spell and punctuate the parts of your name and address
    Change/Verify Account https://forums.adobe.com/thread/1465499 may help
    -Credit card https://helpx.adobe.com/utilities/credit-card.html
    -email address https://forums.adobe.com/thread/1446019
    -http://helpx.adobe.com/x-productkb/global/didn-t-receive-expected-email.html

  • I installed Elements 12 because my version of Photoshop (CS5.1) is not compatible with Yosemite. Now the Adobe Application Manager will not search for updates for any of the programs in CS5.5 that I have. How do I fix this?

    I installed Elements 12 because my version of Photoshop (CS5.1) is not compatible with Yosemite. Now the Adobe Application Manager will not search for updates for any of the programs in CS5.5 that I have. How do I fix this?

    '''Except 8.0.x version also supported version is 3.6.24 '''you can find it here:
    http://www.mozilla.org/en-US/firefox/all-older.html
    check the system requirements:
    http://www.mozilla.org/en-US/firefox/3.6.24/system-requirements/
    see also:
    [https://support.mozilla.com/en-US/kb/Installing%20a%20previous%20version%20of%20Firefox Installing a previous version of Firefox]
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

  • I purchased a powermac pro and it came with logic Pro 9 (but with out the additional suite of programs that comes with). How can I reregister or reinstall Logic Pro 9 to get those features?

    I could really use some insight into this please also how many gigs of RAM should my power mac have it only has two right now and logic tends to glitch up majorly.

    My original question :
    I purchased a powermac pro and it came with logic Pro 9 (but with out the additional suite of programs that comes with). How can I reregister or reinstall Logic Pro 9 to get those features?

  • HT4623 I want to use a program that needs Adobe Flash and I'M then told this device, iPad, can't use Adobe.  What does it use instead?

    I want to use a program that needs Adobe Flash and I'm then told Adobe Flash cannot be used with my iPad.
    What do,I use instead go Adobe Flash?

    Adobe has not made a version of Flash for the iPad.
    Kappy explains why. https://discussions.apple.com/message/19446567#19446567
    5 Flash Player Alternatives http://www.techshout.com/features/2011/01/flash-player-for-ipad-apps/
    Top 4 browsers supports flash player on iPad and iPhone
    http://mashtips.com/flash-player-ios/
     Cheers, Tom

  • I HAVE OS X 10.6.4, BUT NEED TO RUN SOFTWARE THAT REQUIRES POWERPC.  HOW CAN I DO THIS WITH LION?

    I HAVE OS X 10.7.4 (Lion), BUT I NEED TO RUN SOFTWARE THAT REQUIRES POWERPC.  HOW CAN I DO THIS WITH LION?

    If you are running Lion then you cannot run PPC software. Your computer would have to be capable of being booted by Snow Leopard in order to run PPC software. Or consider upgrading your PPC software or buying replacement software that works with Lion.
    What specific Mac model do you have?

  • I'm unable to install I Tunes. I get a message "the feature you are trying to use is on a network resource that is unavailble". How do I solve this?

    I'm unable to install I Tunes. I get a message "the feature you are trying to use is on a network resource that is unavailble". How do I solve this? Thanks.

    I am having the same issue for itunes.msi (iPhone 4S and Windows XP)
    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • I have a new Mac Mini. When I start it, the message and mail program's open automatically. How do I change this?

    When I boot up my Mac Mini, the mail and message program's open automatically. How do I stop this?
    I heard that all program's that are open when shutting down, will open again on booting up. I always close all program's before shutting down!

    Go to preferences and General and be sure the box is checked that states to close all programs on exit.  Also, right clcik your mail icon in the dock and under options be sure the open at login is not checked.

  • HT2542 Hi, I created a new user on mac, Admin but i can't use adobe CS6 while the original user is admin too and all programs are running normal. How can i solve this problem?

    Hi, I created a new user on mac, Admin but I can't use adobe CS6 while the original user is admin too and all programs are running normal. How can I solve this problem?

    Hi Amanda,
    Software applications are usually installed in the Applications folder on the Macintosh HD and are accessible to all users.
    I would advise you to check the Applications folder and see if your software is in there.
    Next step would be to Control Click or Right Click on the application and choose "Get Info" and make sure the permissions are set to "Read & Write" for all users. The article below provides more details:
    Troubleshooting permissions issues in Mac OS X
    http://support.apple.com/kb/ht2963
    You may need to contact Adobe Support if this does not resolve your issue:
    http://helpx.adobe.com/photoshop.html
    Hope this information helps!
    - Judy

  • When Firefox is opened, nothing shows up but a black screen and the program is not responding. How can I repair this?

    When Firefox is opened, nothing shows up but a black screen and the program is not responding. How can I repair this?
    == User Agent ==
    Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4

    That issue can be caused by an extension that isn't working properly.
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode

  • I get an error message saying "The iTunes Library.itl file cannot be found or created" when I try to open iTunes on my computer and the program fails to open.   How can I fix this?

    When I try ot open iTunes on my computer I get an error message stating "The iTunes Library.itl file cannot be found or created" and the program fails to open.  How can I fix this issue?

    Hi pgarard1,
    If you are having issues with launching iTunes after an update, you may want to take a look at the troubleshooting in the following article:
    iTunes for Windows: Doesn't open after upgrading in Windows Vista or Windows 7
    http://support.apple.com/kb/TS2363
    Regards,
    - Brenden

  • TS1702 After installing the new software to my iPhone 4S , my dream zoo either will not start or when it does it has a blank screen that has a few icons on it that wont work. How can I fix this is it possible to go back and reinstall the older software ?

    After installing the new software to my iPhone 4S , my dream zoo either will not start or when it does it has a blank screen that has a few icons on it that wont work. How can I fix this is it possible to go back and reinstall the older software ?

    Unfortunately I tried that and it didn't work. Thanks for the help though. I tried to uninstall and it said I couldn't because the file is corrupt or something, but I think I finally got it uninstalled and/or deleted or whatever, but now I try to reinstall/download it again from the beginning and I can't. No matter what I do I can not get Firefox working again. No matter how many times I try to redownload it. Any other suggestions?

  • Wanted to update the software now available, but it is asking for a pass code. As far as I remember in didn't put in any pass code , how do I settle this issue . Earlier updates were asking Apple ID but pass code for updating the new soft ware not known.

    Wanted to update the software now available, but it is asking for a pass code. As far as I remember in didn't put in any pass code , how do I settle this issue . Earlier updates were asking Apple ID but pass code for updating the new soft ware not known.

    Hello Kewal,
    Thank you for the details of the issue you are experiencing when trying to perform an update.  I recommend trying to update using iTunes, and as always, it is a good idea to make a backup first. 
    iOS: Back up and restore your iOS device with iCloud or iTunes
    http://support.apple.com/kb/ht1766
    Update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/ht4623
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • My Macbook Pro always ejects any CDs, DVDs that I insert. How do I remedy this?

    My Macbook Pro always ejects any CDs, DVDs that I insert. How do I remedy this?

    Before taking it for repair, try a drive cleaning disk. They are US$5-15 at most computer, electronics, and office supply stores. Slot-loading drives get dirty and the inexpensive cleaning disk is the logical step before spending a lot of mony.
    Case in point: A friend has an older MacBook Pro and its optical drive had not worked in years. When he took the computer to an AASP for servicing another issue, he asked about replacing the optical drive. The Service Provider said it woul cost US$140 paarts + labor to install a new one--something my friend could not afford at the time.
    I loaned my friend my drive cleaning disk and now his original drive works like it did when new.

Maybe you are looking for

  • Can I use iTV to connect ibooks to a TV/projector?

    My title is very visual, and would lend itself to large TV Monitor/projector/display. Thanks

  • H67MA-E45 Updated to latest BIOS now won't load BIOS?

    Hi, I ran the latest BIOS update 7678v32, all seemed to go fine and it said BIOS update completed will now restart. Now the LED and fan starts for 1-2 secs then goes off straight away, this repeats every 10secs or so. I've tried clearing CMOS but sti

  • Business Objects Web Service Interface for Scheduling (without Java SDK)

    Task: > use BO web service interface to schedule report generation and fetch job with generated PDF object without having to use Java (Webservice) SDK Detailed requirements: > get session ID : ok, session WSDL, <BO server alias>/dswsbobje/services/Se

  • Help - cant type in url adress in address bar

    im a new apple convert after 20 years of window/pc use i am having BIG BIG trouble i cant seem to type in URL web address on my toolbar also i would rather display multiple web pages open at the bottom or top of my screen, rather or in addition to th

  • Quicktime rendering error

    Hi, whenever I render footage with speedgrade, using the H.264 Quicktime setting, the Quicktime player can not open the file up. It always says: 'Error -2048: Couldn't open the file .MOV because it is not a file that Quicktime understands. I don't ge