JLabel doesn't show up in the Applet

Hi, all,
Could you please help me to see my code and tell me why the JLabel component doesn't show up in my applet?
Thank you. It seems the applet's paint() overlaps the JLabel.
I would like to create a JLabel on my applet, so that I can update the time on it rather than repainting the whole applet.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
    This class tests the ChessBoard class and provides
    two methods for the users to play a chess game.
public class ChessGame extends JApplet
        Represents the listener for the mouse.
   class MyMouse implements MouseListener
            Gets clicked position on the chess board
            and moves chesses.
            @param event the event that makes this action perform
        public void mousePressed(MouseEvent event)
                               // Do something.
        // Do nothing methods.
      public void mouseReleased(MouseEvent event){ }
        public void mouseClicked(MouseEvent event){ }
        public void mouseEntered(MouseEvent event){ }
        public void mouseExited(MouseEvent event){ }       
        Constructs a chess game on an applet.
   public void init()
        setBackground(Color.white);
        myGame = new ChessBoard();
      whiteTurn = 0;
      whoseTurn = "White's Move:";
      isFirstClick = true;
      MyMouse mouse = new MyMouse();
        addMouseListener(mouse);
        JPanel panel = new JPanel();
        gameTime = new JLabel("My Time");
        panel.add(gameTime);
    public void paint(Graphics g)
        Graphics2D g2 = (Graphics2D) g;
        // Clear backgroung
        g.setColor(getBackground());
        g.fillRect(0, 0, getWidth(), getHeight());
      // Sets color for message        
        g.setColor(Color.BLACK);
        // Displays last moved action.
      if(lastMoved != null)
         g.drawString("Last Moved: ", 45, 440);
            if(whiteTurn == 1)
            g.drawString("White Moved: " + lastMoved, 45, 460);
         else
            g.drawString("Black Moved: " + lastMoved, 45, 460);
        // Displays whose turn for the user.
      g.drawString(whoseTurn, 45, 20);
        // Draw the chess board and its pieces.
        myGame.paint(g2);
    private ChessBoard myGame;
    private int whiteTurn;   
   private String whoseTurn;
    private String lastMoved;
   private int oldRow, oldColumn, newRow, newColumn;
   private boolean isFirstClick;
    private JPanel panel;
    private JLabel gameTime;
}

You never add the panel containing the label to the applet. Try something like this:
        Constructs a chess game on an applet.
   public void init()
        setBackground(Color.white);
        myGame = new ChessBoard();
      whiteTurn = 0;
      whoseTurn = "White's Move:";
      isFirstClick = true;
      MyMouse mouse = new MyMouse();
        addMouseListener(mouse);
        JPanel panel = new JPanel();
        gameTime = new JLabel("My Time");
        panel.add(gameTime);
        // add new panel containing JLabel to applet
        this.getContentPane().add(panel);
    }

Similar Messages

  • I just purchased a new computer and downloaded I tunes but when I go to sync my iphone and ipad touch my library from my old computer doesn't show up on the new one. Only the purchased itumr dongs come up. How do I get my original itunes library?

    I just purchased a new computer and downloaded I tunes but when I go to sync my iphone and ipad touch my library from my old computer doesn't show up on the new one. Only the purchased itune songs come up. How do I get my original itunes library?

    Have you copied your content over from your old computer and onto the new on ? If not, and you still have your old computer, then there a number of methods described on this page which you can use to copy your library over : http://support.apple.com/kb/HT4527 . If you no longer have your old computer then have you got a backup of your content that you can copy onto the new computer and add into iTunes ?

  • MSI GT 70 ONC: Stereoscopic 3D option doesn't show up in the NVidiaControl panel

    Hi,
    I have MSI GT 70 ONC Laptop with NVidia 670M (2GB) graphics card. I also have Sony Bravia 3D TV.
    I can play 3d movies on laptop and can watch them on my 3d TV using HDMI cable fine although my laptop doesn't have 3d display.
    I am trying to use my laptop which doesn't have 3D display but has Graphics card which supports 3D to play 3d games and see them on my 3D TV.
    I checked online and found out that I need to change "Stereoscopic 3D" settings in NVidia control panel but Stereoscopic 3D option doesn't show up in the control panel. Very few options are there. I have updated drivers to the latest level but still can't see "Stereoscopic 3D" option in NVidia control panel. So will you be able to help me out what I can do to see the option? Thanks in advance.

    I have got an gs70. Exactly the same problem. Unfortunately this hdmi outputs are connected for the intel graphics cards. And intel does not support 3d.
    I was actually very angry with MSI. Because they do not mention in the description. They promot just the gtx card. And forgot to mention about the hdmi connection.
     Forget the 3d tv. Or you can buy an external mini pci-e graphics card adaptor.
    search in google for : EXP GDC Beast Laptop External Independent Video Card Dock

  • TS4057 I did this and now my videos are not working. They show the pictures aren't there on some and on others it shows they are there, but doesn't show them in the player. When I try to Share anything it just says Waiting for Processing for hours. What d

    I did this and now my videos are not working. They show the pictures aren't there on some and on others it shows they are there, but doesn't show them in the player. When I try to Share anything it just says Waiting for Processing for hours. What do I do?
    I also got Motion and can't figure out how to use it with Final Cut Pro X. Any help woud be great. Thanks

    I have no idea what may have caused your MacBook to stop working, but from your description it kind of sounds like it may have started before you ran Software Update and installed the new Apps. Just the general slow feeling and bugginess is what tips me off. You said that you weren't sure if you had closed all open windows, that doesn't matter if the computer restarts itself. It automatically closes all other open applications when restarting.
    As to your data being retrievable, if when you take it in they do a fresh install of the OS, then no, it will not be unless you want to pay several thousand dollars to a software retrieval company.
    I am glad to hear that you have taken into the Apple Store to get it fixed, and that you have all of your purchased music backed up to your iPod. You should be able to just transfer it all back to iTunes once you get your computer back should it be necessary.
    As a side note, the proper place for this topic would probably in the MacBook forums, not iTunes since there is no evidence that iTunes started the issue.

  • Preview doesn't show up in the capture window

    When trying to capture, the video preview doesn't show up in the capture window, only the color bars. I am able to run my transport with the buttons and the key commands, so I know the Canon ZR500 is really communicating (easy setup: DV-NTSC), via firewire. My scratch disk is a G-Raid hooked up through the firwire 800 input. The crazy thing is, it worked only one time. I've wasted one whole day and this morning, restarting, rebooting, unplugging, different tapes, etc. Next step is takew my entire setup to the so-called Genius Bart and see if Apple's Geniuses know anything about Apple software. Frustrating as ****. I will never buy Apple again.

    Careful about editorializing. There are lots & lots of Mac users who are successfully capturing from Canon camcorders. I am one of them, and have never had a problem. So there is something in your setup that needs to be uncovered, it's not FCE or Canon per se.
    One observation, you have a small hard drive (100GB) and even though you appear to have 59GB free, that's actually not a lot of space. One hour of DV consumes about 13GB and during capture the Mac temporarily needs nearly 2x that space, which means your system is using the 'inner' cylinders of the hard drive, where performance slows down; this could explain your dropped frames problem. Can you move some stuff off your system HD onto your G-RAID (say, your iPhoto and iTunes libraries if you are using those apps, they often take a lot of disk space)?

  • Mobile me gallery doesn't show up in the widget

    I posted some albums to mobile me through iPhoto.  When I tried to put them on the website through iWeb, there were no galleries in the widget menu.  Why?  Is it because my site is an independent ".com" site versus being a "me.com" site??  Help!

    klcwebdesign wrote:
    ...it still doesn't show up in the widget menu
    I dunno what more to suggest, except to say that MobileMe live chat support is now 24/7 — see this announcement:
    http://www.apple.com/mobileme/news/2009/04/live-chat-support-247.html
    And to answer your previous question, you can simply change the settings and republish. See this iPhoto Help page:

  • IBook doesn't show up in the Textbook section

    Hi Folks,
         I recently had my iTextbook approved through the iBookStore (Physics: Fundamentals and Problem Solving), but noticed that it doesn't show up under the Textbook --> Science and Nature section, even when I choose "See All."  Does anyone know how to get this moved to the correct section?  Thanks much!
    Dan

    So I've been waiting 10 days now for my iBooks Author textbook to appear. The upload went fine, but as of today, nothing appears on title search.
    I've noticed some folks mentioning they were approved through the iBookstore. Does that approval come in an emai? I see no status indicators in iTunes Connect to check on progress of releasing the title.
    Can anyone shove me in the right direction?

  • Trying to install airport 5.6 to configure old UFO airport but doesn't show up in the app utility folder. How do you configure older Airports in OS X 10.7.5??

    trying to install airport 5.6 to configure old UFO airport but doesn't show up in the app utility folder. How do you configure older Airports in OS X 10.7.5??

    David Why? wrote:
    ... How do you configure older Airports in OS X 10.7.5??
    Use the technique described in this thread: I can't install airport utility 5.6
    Though it discusses Mountain Lion, you need to follow the exact same steps for OS X 10.7.5.
    I no longer have any original AEBSs to test. You may need an even earlier version of AirPort Utility. If AirPort Utility 5.6 cannot configure yours, let me know and I will attempt to find the correct version for you. You will need to use the same "extraction" technique described above.
    Edit: If 5.6 does not work try this one: AirPort Utility 5.5.3
    Important: If you elect to drag that version to your Utilities folder, be sure to give it a unique name. I suggest "AirPort Utility 5.5.3" This is not necessary for AirPort Utility 5.6, which will retain that name on its own.

  • When i copy songs with home sharing it shows it copying but doesn't show up in the library

    When I copy songs with home sharing it shows it copying but doesn't show up in the library. What should I do ?

    Hi adtsalmon,
    You can only watch the movie on the device you rented it on. Here's a snippet from the Apple Support site (italics mine):
    If you download a rented movie on your computer: You can transfer it to a device such as your Apple TV (1st generation), iPhone, iPad, or iPod if it’s a standard-definition film (movies in HD can only be watched on your computer, iPad, iPhone 4 or later, iPod touch (4th generation or later), or Apple TV). Once you move the movie from your computer to a device, the movie will disappear from your computer's iTunes library. You can move the movie between devices as many times as you wish during the rental period, but the movie can only exist on one device at a time.
    If you download a rented movie on your iPhone 4 or later, iPad, iPod touch (4th generation or later), or Apple TV: It is not transferable to any other device or computer.
    Here's the link to the Movie Rentals FAQs site FYI:
    http://support.apple.com/kb/HT1657
    Hope this helps!
    Cheers,
    GB

  • I purchased a game name Einstein and I can't see it , it doesn't show up in the menu!?

    I purchased a game name Einstein and I can't see it , it doesn't show up in the menu!?

    This may be related to the "feature" that displays all Greatest Hits albums as one album, or it may be that the tracks are marked as compilations. Find one of the missing artists in iTunes and select the tracks from the album. Make sure the Compilations flag is set to No. Change the album title to something unique, e.g. if it's called *Greatest Hits*, rename it to *Greatest Hits, Artist*. Resync your iPod and see if it helps. If so, repeat the treatment.
    tt2

  • When i click on a photo to edit, the photo doesn't show up and the area where the photo should show up is black.  Why?

    When i click on a photo to edit, the photo doesn't show up and the area where the photo should show up is black.  Why?  I can edit some photos, whereas others I can not.

    There are several possible causes for the Black Screen issue
    1. Permissions in the Library: Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Include the option to check and repair permissions.
    2. Minor Database corruption: Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild.
    3. A Damaged Photo: Select one of the affected photos in the iPhoto Window and right click on it. From the resulting menu select 'Show File (or 'Show Original File' if that's available). (On iPhoto 11 this option is under the File -> Reveal in Finder.) Will the file open in Preview? If not then the file is damaged. Time to restore from your back up.
    4. A corrupted iPhoto Cache: Trash the com.apple.iPhoto folder from HD/Users/Your Name/Library/ Caches...
    5. A corrupted preference file: Trash the com.apple.iPhoto.plist file from the HD/Users/ Your Name / library / preferences folder. (Remember you'll need to reset your User options afterwards. These include minor settings like the window colour and so on. Note: If you've moved your library you'll need to point iPhoto at it again.)
    If none of these help:
    As a Test:
    Hold down the option (or alt) key key and launch iPhoto. From the resulting menu select 'Create Library'
    Import a few pics into this new, blank library. Is the Problem repeated there?

  • I was using iMovie yesterday and it was working. But today when it started it doesn't show anything in the window on the left. No events, no projects, nothing. It's blank and so is the rest of the screen. Does anyone know what my problem might be?

    I was using iMovie yesterday and it was working perfectly. But today when it started it doesn't show anything in the window on the left. No events, no projects, nothing. It's blank and so is the rest of the screen. Does anyone know what my problem might be?
    Where does the imovie.library reside? where do the events and projects reside?

    Hi winkydb,
    Thanks for visiting Apple Support Communities.
    If you do not see the events or clips you were working with previously, first see if you can switch back to the library you were using with this method:
    Show or hide the Libraries list
    You select libraries and events in the Libraries list.
    To show the Libraries list: Click the Show button on the left side of the toolbar.
    The default location for iMovie libraries is the Movies folder in your home folder.
    You can find this information here:
    iMovie (2013): Work with multiple libraries
    http://support.apple.com/kb/PH14745
    Best Regards,
    Jeremy

  • Ipad is connected to the computer however doesn't show up in the menu, I'm trying to restore it but am concerned that it will restore the iphone and not the ipad. any suggestions?

    ipad is connected to the computer however doesn't show up in the menu, I'm trying to restore it but am concerned that it will restore the iphone and not the ipad. any suggestions?

    Hi vanover7,
    It sounds as if when you connect your iPad to your computer it does not show up in iTunes, is that correct? 
    Please use the steps in this article to troubleshoot the issue -
    iPhone, iPad, or iPod touch not recognized in iTunes for Windows - Apple Support
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • When I connect my ipod to my mac air it doesn't seem to recognize it- it doesn't show up on the screen. What can I do ?

    When I connect my ipod to my mac air it doesn't seem to recognize it- it doesn't show up on the screen. What can I do ?

    Try using RecBoot to kick it out of recovery mode. If that does not work, try a manual install, as outlined in link below. If it STILL keeps entering recovery mode, you most likely need a new logic board.
    Basic troubleshooting steps  
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 
    Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101

  • My scanner doesn't show up in the"please select a device list" windows 7 - HP7300 all-in-one

    In acrobat X-my scanner doesn't show up in the "please select a device list" how do I get it to see my scanner? - windows 7 - HP 7300 all-in-one

    In case anyone else finds this thread I did end up getting mine to work (after abut 48 hours of pulling my hair out). The "solution" was simple in my case, but it might have been a coincidence. I turned the wireless off on my phone for a different reason - then I when I turned it back on the device instantly appeared in spotify-desktop! I had already factory reset my phone, so I know that establishing a connection to the wireless was not the problem in the first place. Also, I was able to play music on my phone, so I know that it was hooked up to the wireless (I turned off 3g just to be sure).
    But for some reason when I toggled the wireless off then on again - it worked. Go figure.

Maybe you are looking for

  • Problem with international file names on FAT volumes

    I believe I've found a bug in QuickTime for Windows. I have a FAT32 volume on my Windows XP system where some folders containing QuickTime movies have Russian names. The QuickTime player fails to open these files, either from the Explorer shell or us

  • 55G310 Toshiba LCD TV Has no audio through HDMI 1 input

    I bought this TV last october new from Best Buy, and Have so far only had 1 HDMI device going in to the TV.  Today I went to plug in a second device, and I plugged it in through the HDMI 1 input.  I get picture, but no sound. I tried other hdmi cable

  • I have a Mac with photoshop CS6 regularly updated. I am unable to read RAW images CANON Power shot G16 /ADOBE LISTING WAS of NO HELP

    Is there any one who could let me know how to read Raw images Canon power shot g16? I tried all I could and followed the suggestions given by ADOBE but noting works. I see the images with other program but I cannot work on them.

  • Simple pass not working with Chrome

    I've seen this posted numerous times (some posts going back to 2012) and I have yet to see an answer that works. I just bought a windows 7 machine with simple pass.  Simple pass simply does not work with chrome. The only time it works is when I log o

  • Error when deploy packages on DP

    Hi when I try to deploy a package on the new distribution point I receive this error: Failed to create virtual directory on the defined share or volume on distribution point Possible cause: Distribution Manager requires that IIS base components be in