Want to use Timer class!!!

I want to make a digital clock using Timer class of swing package to call method repaint() after every 1000 miliseconds which is capable to calling method actionPerformed of Interface ActionListener.
What changes need to do in my given code for that task?
import java.util.Calendar;
import java.awt.*;
import javax.swing.*;
public class DClock extends JFrame{
public DClock()
super("DIGITAL CLOCK");
getContentPane().setBackground(Color.WHITE);
setSize(300,150);
setVisible(true);
public void paint(Graphics g)
super.paint(g);
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
int second = calendar.get(Calendar.SECOND);
g.setFont(new Font("Serif",Font.BOLD,36));
g.setColor(Color.BLUE);
g.drawString(hour + ":" + minute / 10 + minute % 10 +
":" + second / 10 + second % 10, 85, 60);
repaint();
public static void main(String[] args) {
DClock application=new DClock();
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

dont know is any body see this but he is using
recursion. (i think) repaint tell the ui that is must
call the pain method. It's easy to find out if you're unsure. Just have a look.
    public void repaint() {
     repaint(0, 0, 0, width, height);
public void repaint(long tm, int x, int y, int width, int height) {
     if (this.peer instanceof LightweightPeer) {
         // Needs to be translated to parent coordinates since
         // a parent native container provides the actual repaint
         // services.  Additionally, the request is restricted to
         // the bounds of the component.
       if (parent != null) {
         int px = this.x + ((x < 0) ? 0 : x);
         int py = this.y + ((y < 0) ? 0 : y);
         int pwidth = (width > this.width) ? this.width : width;
         int pheight = (height > this.height) ? this.height : height;
         parent.repaint(tm, px, py, pwidth, pheight);
     } else {
         if (isVisible() && (this.peer != null) &&
          (width > 0) && (height > 0)) {
          PaintEvent e = new PaintEvent(this, PaintEvent.UPDATE,
                      new Rectangle(x, y, width, height));
          Toolkit.getEventQueue().postEvent(e);          
    }So no, it seems like it doesn't. It rather seems to call update.

Similar Messages

  • HT201250 I want to use Time Machine to back up my pictures because my hard drive is full but I'm wondering if once I back up the pictures then delete them will time machine delete them off the back up too?

    I want to use Time Machine to back up my pictures because my hard drive is full but I'm wondering if once I back up the pictures then delete them will time machine delete them off the back up too?

    Evetually yes.
    If your pictures have been in the same location (same folder, same subfolder, ...) for more than a week, then copies if them will remain in your TM backups until it fills up. They are then vulnerable to being deleted.
    If they've been there for less than a week, TM could delete them as early as a month from now. If they've been there for only a few hours, chances are TM will delete them tomorrow.
    This is why TM is not the best tool to use to archive data that you will be deleting from your main hard drive. Copy them to a dedicated external drive, or burn DVDs.

  • Just want to use Time Capsule as a wireless hard drive?

    I thought I was computer savvy until now.
    I just want to use Time Capsule as a wireless hard drive. I do not want to connect my Internet to it whatsoever. I realize this would involve disconnecting from Time Capsule and reconnecting to my Internet every time.
    The settings for Time Capsule are just mind-boggling.
    Is there any easy way to set it up as a password-protected wireless hard drive?
    I am so lost with all the settings.
    Please help! I will provide points!

    First, you don't need to use Time Capsule with Time Machine. It can be used as a manual file storage or file exchange drive.
    Where do you have the Ethernet cable placed on the Time Capsule. Is it the WAN port or one of the network ports?
    If you are attempting to set-up the Time Capsule as your wireless router, it will need to be connected to the wired modem from your service provider through the WAN port for configuration. The Time capsule should then appear as a configurable Airport device.
    To start, turn off your cable or DSL modem and the Time Capsule. Turn them both back on with the Time capsule connected to the wired modem via of the WAN port so the modem can grab the TC's MAC address.

  • So I can't use NAV if I want to use Time Machine?

    I just want to make sure I comprehend what I am reading on here and the internet in general: If I want to use Time Machine without lags, I need to disable Norton Auto Protect. So does that mean I can't have virus protection if I have TM in the "ON" setting?

    If you want to use NAV, disable Auto-Protect during the initial Time Machine backup to speed things up for that initial backup. After that, turn Auto Protect back on if you'd like. You can judge for yourself, but I doubt you will notice any significant slowdown compared to when you had Auto-Protect turned on prior to using Time Machine.

  • Want to use Time Capsule as a back up AND external storage device-help!

    I know there's been a few variations on this question but I can't seem to find the answer that relates to me so probably being dumb but help would be greatly appreciated.
    I bought a 500gb Time Capsule yesterday and finally got it set up through AirPort Utility. I think I've done it right-there's a green light and it's going through the motions of backing up although VERY slowly. It's taken 10 hours to back up 20GB. I've used Time Machine before with an external Seagate drive so I know how to access/check those back ups.
    I have a dish on the side of my house (on side of a mountain!) that brings the internet signal into a wireless router and then my MacBook accesses through that WIFI network. I plugged the ethernet cable from one of the standard ports out the back of the router into the WAN port on the Time Capsule as part of the setup and that seems to be right in that I can see the TC and surf the net.
    So, now I just want to see the Time capsule as a normal external drive on my desktop and move other files to it so they can come off my Macbook completely but the only way icon I can see if the white one that says 'Backup of...' I've copied stuff onto this but I suspect that was the wrong thing to do.
    Finally, I only want to TM to use the TC up to a certain max storage so I always have space free on it but can't find settings to allow me to do that.
    I'd be really grateful if someone could tell me how to set this up properly!

    Paretola wrote:
    So, now I just want to see the Time capsule as a normal external drive on my desktop and move other files to it so they can come off my Macbook completely but the only way icon I can see if the white one that says 'Backup of...' I've copied stuff onto this but I suspect that was the wrong thing to do.
    No. Don't transfer anything into the Back of... sparsebundle. That is your Time Machine backup.
    Under Finder -> Shared -> Time Capsule -> Time Capsule Disk. This is where you can create a new folder to store your files. If you want to see this on your Desktop, via Finder, click Preferences. Under General, make sure +Connected servers+ is ticked.
    Finally, I only want to TM to use the TC up to a certain max storage so I always have space free on it but can't find settings to allow me to do that.
    Since the TC HDD isn't partitionable, you can't really do that. Best thing is to get another HDD for storage as TM works best if you give it enough room to grow.
    I'd be really grateful if someone could tell me how to set this up properly!

  • I want to use Time Capsule simply as a backup harddrive, no wi-fi

    My wife and I were talked into buying the Time Capsule. We only wanted an external HD to use Time Machine with (we are new to Leopard). No interest in using any wireless features. We were told to get a TC because it would work straight out of the box. Neither the SetUp Guide nor the Support website describe how to do this, so I just followed the directions in the SetUp Guide as best I could. I installed the disk. I went into Airport Utilities (all along, wondering why, but OK), and indicated that I would connect only with Ethernet cable. I went and bought an Ethernet cable ($$$). Did everything I was supposed to, short of setting up the internet connection, etc (again, I don't want the wireless stuff). Went into Time Machine, chose Set Up Time Machine. Tried repeatedly clicking on "Change Disk". The computer (MacBook) seems not to see the TC at all. TC is plugged in, and connected to MacBook with the Ethernet cord. Infuriating! I am starting to wonder if all I need to do is connect the two with a USB cable instead. I'd need to go get one of those. If this is it, why wouldn't they just say this somewhere in the SetUp Guide?????! Thank you to anyone who can help.

    No, you do not use the USB port to connect to your Mac. That is only for connected a USB HDD or printer. Try opening AirPort Utility and ensure that under Disks you have File Sharing Enabled with Time Capsule password and restart TC.

  • I want to use Time Machine to restore from one IMAC to a different IMAC. How do I do that?

    I use Time Capsule to back up two different IMACs. I want to use the back up from machine A to restore machine B. 
    When I am on machine B I can't see the back up on machine A.  How do I do this?

    Look at Q16.
    The whole 14-17 is good to read so you understand what you are doing.
    http://pondini.org/TM/FAQ.html

  • Binned BT and want to use Time Capsule instead of BT Home Hub

    This is my first question so please be gentle with me and forgive any errors!
    After a truly horrendous experience with BT (22 calls to them in two weeks to resolve broadband speed of 0.4 mbps and no that's not a typo) I've changed ISP.
    I already had a Time Capsule which previously I've used only as back up facility. Now I have a separate cable modem and want to use the Time Capsule as a router. The cable modem is plugged in to the phone line (with a filter) and there's an ethernet cable connecting it to the Time Capsule.
    I thought I could bin my hated BT Home Hub, but the minute I unplug it, the set up doesn't work.
    So it would seem that my Mac is talking to the Home Hub, that's talking to the TC and that's how I'm getting onto the net. I'm at a loss what I need to do to be able to throw the Home Hub in a skip.
    Would greatly appreciate any advice as this is frying my tiny brain!
    Thanks in advance.
    Macbook Pro, iPad 2, iPhone 4, Time Capsule

    There are some issues here.. if your modem is plugged into the phone line it is adsl not cable modem..
    The TC is not a modem.. it is a router.. you still need a modem to provide connection. Ask your new ISP for what their preferred modem is.. In the UK most ISP use PPPoA method of authenticaiton.. The TC cannot handle that.. they only offer dhcp to an existing router or PPPoE. That means the TC needs to be bridged. If the BT home hub is now running fast though, a new modem is not going to make the connection go faster.

  • I want to use Time Capsule and/or Time Machine to Mirror Two Macs

    I have a MacBook and a MacBook Pro. The MBP is work-related, but I have many creative projects that I have to do on both machines. I want to have both the MB and the MBP showing exactly the same files, and updating exactly the same files, in the same fashion, even when I am working primarily on just one of the two machines.
    How can I use Time Machine or Time Capsule (or both together) to synchronize my two MacBooks, so neither one is showing outdated file/folder contents?

    time machine is a backup tool and time capsule is the backup destination of choice for some users. you will not be able to mirror your two Macs using TM.
    you will find a wealth of information on TM on [this_|http://web.me.com/pondini/TimeMachine/Home.html] site.
    another good source: _*Time Machine 101*_
    an suitable alternative to TM might be ChronoSync.
    happy holidays !
    JGG

  • HOW TO USE TIMER CLASS

    Hi All,
    m a beginer to Webdynpro, i want to use the timedtrigger, will any one help with an example
    Thanks in advance
    Siva Sankar N

    Hi
    See this Thread
    delay timer webdynpro java
    Kind Regards
    Mukesh

  • Want to use Time Machine as wireless back up only - no internet

    Im searching everywhere and unable to locate how to set up my TM as a wireless back up only. Im already hooked up to the internet and only want to use the backup feature in TM. Can someone give me directions or point me to the thread? thanks

    Welcome to the discussion area!
    By TM, I take it that you mean Time Capsule, correct?
    If you want to backup using wireless only to the Time Capsule, you have two basic configuration choices to consider:
    1) Connect the Time Capsule to your existing wireless router using an ethernet connection, and turn off the wireless on the Time Capsule. Backups will occur over your current wireless network. For most users, this is the easiest and most reliable way to configure a Time Capsule for back ups.
    2) Configure the Time Capsule to "join a wireless network". In this configuration, the Time Capsule can be located virtually anywhere that it can receive a good wireless signal because it becomes in effect, only a wireless backup device.
    Configuring the Time Capsule to "join" a wireless network can be quite tricky, even for experienced users because you must know the exact type of security the wireless network is using. It sounds simple, but different manufacturers use different names for the same thing, and it can be a challenge to get the device configured correctly without multiple tries. If you already have an Apple main router, this will be much easier to configure.
    Post back for more details.
    Message was edited by: Bob Timmons

  • Just got ext HD and want to use Time Machine; questions first

    I finally purchased an ext. HD with enough capacity to actually start using TM. My question is, the main reason for getting it was to back up media, mainly videos and such, things that I'd have quick access to. So, my question is, is okay to partition the drive? And if so, about how much should I allot to it? The drive is an Iomega ego and is 320GB. My iMac is a 250 GB HD with only about 100 GB's used.
    Also, when I first plugged in the Iomega, it automatically took me to a Time Machine screen asking me if I wanted to use this drive for TM. I guess it's formatted for mac right out of the box. Should I click yes on this? Will it allow me to format after the fact? OR, do I need to hit "cancel" and then go into Disk Utility and set up my partition?
    Many thanks. I know this is probably pretty rudimentary, but it's my first time using Time Machine.

    Yes it's OK to partition a backup drive in order to use part of it for storage and the other part for TM backups. But your external drive is not large enough for both. A TM backup volume should be at least twice the capacity of the drive it backs up. In your case that means the TM volume should be at least 500 GBs to back up a 250 GB drive (it's really less important how much space is currently used then how much space could eventually be used.)
    If I were you I would get a second larger external drive for TM backups. Or adopt a different backup strategy that does not involve using TM such as a simple cloned backup that you update periodically with backup software. This would only require a 250 GB volume on your external drive leaving about 70 GBs of a storage partition.
    For backups you could use one of the following:
    Backup Software Recommendations
    1. Retrospect Desktop (Commercial)
    2. Synchronize! Pro X (Commercial)
    3. Synk (Backup, Standard, or Pro)
    4. Deja Vu (Shareware)
    5. Carbon Copy Cloner (Donationware)
    6. SuperDuper! (Commercial)
    7. Intego Personal Backup (Commercial)
    8. Data Backup (Commercial)
    9. SilverKeeper 2.0 (Freeware)
    10. MimMac (Commercial)
    11. Tri-Backup (Commercial)
    Visit The XLab FAQs and read the FAQ on backup and restore. Also read How to Back Up and Restore Your Files.

  • I want to use time machine on a network drive

    i know in the past Apple holds us hostage to buy their time capsule.  With Lion now launched, is there a work around to allow families to buy there own hard drive and use it for multiple macs for time machine?
    Im fairly new to Mac, convinced my wife to switch, now here we are held captive to buy a TC when we already have a fantastic 2TB drive we purchased for a fraction of the price of a TC.  I dont care about wifi, I just want to save our Mini time machine to our MBP networked drive (or vice versa).
    I currently have Lion on the MBP, and Leopard on the Mini.  After installing and hating Lion on my MBP, i have not "upgraded" the mini.  (although I am currently following the "upgrade back to Leopard" threads)
    Thanks for any help or ideas.

    In the past Apple was not holding you hostage by requiring you to use a Time Capsule for network Time Machine backups. Search on Google for Time machine NAS OS X (or something like that) You will find a number of drives that were working with SL.
    Now, they did change the file protocol in Lion, so some of the NAS servers won't work with Lion, at the moment. So long as it is a decent company that makes the NAS they should be releasing a firmware update to get their NAS working with Lion.
    One of the companies that put out a press release was Western Digital. They said they would be working on an updated firmware so that you could use it as a Time Machine drive.
    Just look around the interwebs and I am sure you will find several that will work.

  • I want to use time machine to backup two 4 TB drives, one USB and the other thunder bolt  to 2 4TB USB drives

    I have a 2012 iMac running Mavericks, booting off of a external 4TB thunderbolt drive and using a separate 4TB USB drive for my pictures. I want to back up each of the drives to two USB 4TB  drives with Time Machine. I cannot seem to figure out how to have multiple sources with multiple destinations.

    Hello Randy,
    Try excluding the drive in Time Machine settings. Take a look at the article below to go through and remove the exclusion of the external drive so that can be backed up as well. 
    OS X Mavericks: Exclude items from a Time Machine backup
    http://support.apple.com/kb/PH14182
    Regards,
    -Norm G. 

  • Want to use Time Machine but my external HDD is NTFS formatted

    Discussions suggest install NTFS ng but download failed (I'm on satellite broadband)...I need to backup my Macbook before installing Bootcamp and then I can use Windows on my Mac. I'm a new mac user and have just switch platforms. I don't want to loose the data on my Mac OR format the external HDD which is the backup of my previous WIN machine.
    What is best plan.. <?> get a new HDD to exclusively Time machine to OR install Bootcamp and hope for the best...?

    Lancer 10 wrote:
    Discussions suggest install NTFS ng but download failed (I'm on satellite broadband)...
    It's only 4 MB. Perhaps you should try again. If your satellite broadband can't handle that, perhaps you need something better, like 3G or dialup.
    What is best plan.. <?> get a new HDD to exclusively Time machine to OR install Bootcamp and hope for the best...?
    Time Machine requires HFS+ to work. It will create an HFS+ disk image when used with a server. For an external hard drive, I suggest you partition it into 2 volumes, one being HFS+ and the other NTFS.

Maybe you are looking for

  • Scheduled function module in background job

    HI all, I have created a function module(RFC) & Now I need to schedule it in background job, i have used fm job_open ,job_close  But through there i can only scheduled Reports  so pls gide me how to scheduled fm . regards, Anuj

  • How to change a 1:1 to a N+1 cluster

    Hi all, My customer has a 1:1 cluster, now I want to change the setup for OEAP600, this means I have to set the NAT Address on the Management Interface.This seems not be possible in a 1:1 Cluster. -> I have to break the cluster, set the NAT Address a

  • I can't add my songs to the new iTunes 11.0 I want the old iTunes back

    I have been trying to add my MP3 music from my laptop to the iTunes library and it will not allow me to add the songs to the lists. I have tried all options given on the support page as well as any other guidance found on the internet and it will not

  • StringIndexOutOfBoundException In UDF in mapping

    Hi , I have a UDF via which I am taking the input string and for every 132 characters of input string I split in show it in a different line of an idoc. It is working fine for 2 lines .However when I get 3 lines  i.e. anything more then 395 character

  • Wireless security camera

    Is there a wireless security camera that requires no PC, just works directly with my Mac & new Airbase ?