Problems with applet - no text in the window

Hi!
I'm trying to learn some java, and I've just done my first applet. The code looks like this:
import java.awt.*;
import java.applet.*;
public class MittNamnApplet extends Applet {
Font f;
public void init() {
f = new Font("SansSerif", Font.BOLD, 24);
setBackground(Color.pink);
public void pain (Graphics g) {
g.setFont(f);
//g.setColor(Color.blue);
// g.drawString("Habibi", 45,100);
And then I made an html code that looks like this:
<html>
<applet code="MittNamnApplet.class" height=200 width=320>
</applet>
</html>
When I run it with appletviewer in Command prompt there is only a pink squre coming up, where is the text??? Why? Can someone please help a dummie?
Thanks ;-)

The method name should be "paint", not "pain".
And you have commented out the g.drawstring statement, so it doesn't draw your name.

Similar Messages

  • Problems with running DVDs/CDs on the Windows side

    Hey there,
    I've been having some problems running some DVDs and CDs on my drive on the Windows side. It works fine on the Mac side. The only thing that run properly is the Mac Installation CD. When I pop in a DVD movie, it functions 90% fine. But when I pop in a blank CD/DVD to burn something or run a CD of Data, it won't work.
    Does anyone know why? And how to have it work?

    See if this works for you.
    http://discussions.apple.com/thread.jspa?threadID=1997372&tstart=0
    Let me know if it works,
    Kevin

  • Problem with pages when it restores the windows

    hi,
    my problem is that when I open Pages', it says :
    "application "Pages" has unexpectedly quit during the restoration of its windows. Would you like to try again to restore its windows?"
    and after that it goes down. So I cant't use it.
    I'm sorry if my English is not very good but the reason is that I'm french.
    Looking for your answer , thank you for paying attention to my problem.
    nicolas

    Hello happy English users, I'm glad to meet a French asker.
    So, I apologize but I will speak French.
    Bonjour
    Nicolas.
    Nos hôtes américains sont habitués à ce que je répondes en Français aux questions posées par des francophones.
    Quel est le système d'exploitation que vous utilisez et quelle est la version de Pages en service.
    Donnez également le message exact en Français.
    À plus.
    Yvan KOENIG (VALLAURIS, France)  dimanche 11 décembre 2011 14:52:18
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • I can't text a contact but can voice phone them. I don't have the problem with any other contact and the contact is not blocked. I have an iphone5.0 OS 8.1.3

    I can't text a contact but can voice phone them. I don't have the problem with any other contact and the contact is not blocked. I have an iphone5.0 OS 8.1.3. I used to be able to text them with no problem. The only difference I can think is that this problem may have started since I downloaded the OS I am using now
    cycleluke

    Wasn't responding to you. Please show me links where this helped.
    Apple isn't showing any system problems: https://www.apple.com/support/systemstatus/

  • Is anyone experiencing problems with opening mission control from the desktop.  Running mountain lion with parallels 7 and windows 7

    is anyone experiencing problems with opening mission control from the desktop.  Running mountain lion with parallels 7 and windows 7

    I had been having a similar problem on Lion with Safari pdf files despite downloading the latest Adobe Reader XI.
    I would constantly get the same messages - There was an error opening this document. The file is damaged and could not be repaired. And I would get a blank page when I tried to print the pdf if I tried printing from the Safari web page using File - Print from the top toolbar on my laptop.
    Then I came across the grey Safari lozenge with action icons.
    This allowed me, without downloading the pdf, to print the pdf file direct from the Safari page by using the Print icon on the grey lozenge that appears centrally three quarters down the screen.
    Then I discovered that if I save the pdf using the Save icon from this same grey lozenge on the Safari page I can open and print this pdf version from my desktop.
    I've tested it with a couple of different pdf files and these methods work using the grey lozenge icons but the same pdfs files don't work using File - Save As on the Tool Bar.

  • Problem with two monitors while using Photoshop, windows move from 2nd screen to 1st screen.

    Problem with two monitors while using Photoshop, windows move from 2nd screen to 1st screen.
    I saved a new workspace and it did not help.
    No problem before I went to Maverick.

    I found the fix, go to System Preferences and open Mission Control and uncheck the box to keep monitors as they were (When switching to an application...........)

  • Sync Problem - "There is a problem with this drive. Scan the drive now and fix it".

    Have new desktop computer with Windows 8.When I connect my iPod to my computer to sync, I get the message – “There is a problem with this drive. Scan the drive now and fix it”. It is identifying the drive on the iPod as the problem. iPod works fine on my laptop computer and older desktop (both with Windows Vista). iTunes seems to momentarily recognize my iPod then it doesn't.  Any thoughts about a fix?

    bump, I have same issue. thanks, MM

  • [svn:fx-trunk] 8452: - Fix flicker problem with constraint bound text that is being autoSized.

    Revision: 8452
    Author:   [email protected]
    Date:     2009-07-08 08:38:32 -0700 (Wed, 08 Jul 2009)
    Log Message:
    - Fix flicker problem with constraint bound text that is being autoSized.  If the remeasure is done in a 2nd pass you will see a flicker as all the objects are moved to accommodate the reflowed text.
    - Fix data binding issue with text setter.
    - Rework measure() to accommodate implicit autoSize.
    If explicitWidth or widthInChars specified and explicitHeight or heightInLines specified, or for now, blockProgression != "tb", the text has fixed dimensions and is not auto-sized.
    If no text and width specified, but no height, start at specified width and one line high and grow taller.
    If no text and height specified, start at 1 char wide with the specified height and grow wider.
    If neither width nor height specified, and toFit lineBreaks, start at explicitMaxWidth, or default maxWidth of 160, and grow taller.
    If neither width nor height specified, and explicit lineBreaks width is unlimited and can grow taller.
    These are further constrained by min/max Width and Height except in the case that explicitWidth or explicitHeight are specified.
    - Change default maxWidth for RichText and SimpleText to 160 to match RET.  Previously it was 10000.  This is used for
    text with toFit lineBreaks if a width isn't specified.
    QA Notes: 12 or so TextGraphic tests fail because of the new default maxWidth.
    Doc Notes:SDK-22014, SDK-21837
    Reviewers: Gordon
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22014
        http://bugs.adobe.com/jira/browse/SDK-21837
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/RichEditableText.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/GraphicEleme nt.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/RichEditable TextContainerManager.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/TextGraphicE lement.as
    Added Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/RichEditable TextEditManager.as

    You have used elements like header, footer, footer1 and nav without using the correct DOCTYPE declaration. Replace the first line of your code with
    <!doctype html>
    Also have a look here for other problems http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fhome.surewest.net%2Fstorytales%2F test%2Fforposting.html
    After the above has been fixed, please come back here to fix the remaining problem(s)
    Gramps

  • I have a problem with my iPad 1 st. the problem is that I unable to locate even when connected to a WiFi network and the location is activated and restore and same thing happens .. may be I need help!  Thank you ...!

    I have a problem with my iPad 1 st. the problem is that I unable to locate even when connected to a WiFi network and the location is activated and restore and same thing happens .. may be I need help!
    Thank you ...!

    Hi there beni_m,
    You may find the troubleshooting steps in the articles below helpful.
    iOS: Not responding or does not turn on
    http://support.apple.com/kb/ts3281
    iOS: Device not recognized in iTunes for Mac OS X
    http://support.apple.com/kb/ts1591
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/ts1538
    -Griff W. 

  • I am having problem with me Iphone4, looks like the mic of my phone is not working. no one can hear me if I make a call to them

    Can any one please help me I am having problem with me Iphone4, looks like the mic of my phone is not working. no one can hear me if I make a call to them. I have tried all restoring options but no use. please help me

    The mic on my iPhone4 has just quit also. Similar symptoms to yours in that people I'm talking to hear only static or my voice very faintly. The voice/memo recorder also only really records static.
    It happened suddenly and seemed to get better after a day or two but then went completely after another day.
    I'm returning it to Vodafone New Zealand shortly but will have to wait 5-10 days for a replacement. There are NO Apple accredited means to speed this procedure up in NZ.
    We don't even have a single physical Apple Store where you could walk in and talk to a Genius.

  • Hello I have a problem with my ipod touch 1G the problem is that see me key to the floor! And when recogi not prendia after 5 minutes prendio but it gave to me the surprise of which the battery had finished completely! What I did was to set it to load wit

    Hello I have a problem with my ipod touch 1G the problem is that see me key to the floor! And when recogi not prendia after 5 minutes prendio but it gave to me the surprise of which the battery had finished completely! What I did was to set it to load with the USB but do not load the battery me the icon of the battery appear and below of her the beam that indicates that this being loaded but this way I have left it the whole yesterday and what goes of today and continues without loading anything! They can help me porfavor I am grateful for them to him very much!   And my PC does not detect it not itunes

    Try the not-charging topic of:
    iPod touch: Hardware troubleshooting
    It could be that the battery is dead.

  • I have a problem with itunes when I sync the saved music and want to sync my iphone 5 ios 7.0.6 no longer passes the music thing is that just stays on "waiting for sync" and not worry please help are more than 400 songs that do not want to hear who are wi

    I have a problem with itunes when I sync the saved music and want to sync my iphone 5 ios 7.0.6 no longer passes the music thing is that just stays on "waiting for sync" and not worry please help are more than 400 songs that do not want to hear who are wi

    Plawexki wrote:
    ...  do you know if the contacts, photos, messages etc will be wiped?
    Yes... Everything will be Wiped and Replaced with what is currently on Your Mac.
    SYNCING with iTunes
    See here  >  http://support.apple.com/kb/HT1386
    From Here  >  http://www.apple.com/support/iphone/syncing/
    You may find this information of interest...
    Have a read here...
    https://discussions.apple.com/message/18409815?ac_cid=ha
    And See Here...
    How to Use Multiple iDevices with One Computer

  • I have a problem with my MacBook Pro is the almost of my app not working at all like a app store and terminal and other important apps please if u can help me as fast as you can cuz i don't wanna format it that's why am on Mac now not win ?

    i have a problem with my MacBook Pro is the almost of my app not working at all like a app store and terminal and other important apps please if u can help me as fast as you can cuz i don't wanna format it that's why am on Mac now not win ?

    Abdussalam.A,
    you mentioned that Terminal does not work at all for your MacBook Pro. What currently happens when you run Terminal? In what way does it not work?

  • Hiya, I've got a weird problem with my iPhone4. On the 'home page' of my iPhone the mail symbol tells me there's a new mail waiting for me. However, there's no new mail to be found. Does anyone know what the problem is? Thanks

    Hiya, I've got a weird problem with my iPhone4. On the 'home page' of my iPhone the mail symbol tells me there's a new mail waiting for me. However, there's no new mail to be found. Does anyone know what the problem is? Thanks

    This response is a little late as I just read about your problem. I have a 2012 Dodge Charger and a 2012 Chrysler Town and Country and both worked flawlessly with the iPhone 5s my wife and I had. However, we just upgraded to the iPhone 6 and Uconnect will receive calls but you cannot answer them. You can callout successfully, however. the annoyance being the inability to answer incoming calls in the HandsFree mode.

  • When I connect my nano to my computer I receive the following message: There is a problem with this drive. Scan the drive now and fix it. My computer recognizes the ipod but the play lists saved in my itunes library are not the playlists that are on my na

    When I connect my nano to my computer I receive the following message: There is a problem with this drive. Scan the drive now and fix it.
    In addition, when I connect my nano, my computer does recognize but the library and playlists in my Itunes is not the same as the library/playlists on my ipod (on this ipod). If I purchase new songs from itunes, they go to the library on the computer but I cant get them to the ipod playlist.

    bump, I have same issue. thanks, MM

Maybe you are looking for

  • Mount SFTP in OS X

    Hello Everyone, Is there any possible way to mount SFTP shares in OS X (to show up as a drive on the desktop)? I know there's no support built-in, but I was hoping maybe somebody knows of a third party utility (preferably free) that exists to assist

  • Scans with image capture don't show up in destination folders

    When I tell Image Capture to save a scan in a particular folder, it doesn't show up there in the Finder.  This is a fairly new trick.  Sometimes after considerable fiddling, they will suddenly be there.  I have no idea what it was that I did to get t

  • Emailing Top SQL report metrics

    I have performance monitoring configured on a database using 10g Em grid control. Is there a mechanism through which I could email the 'Top SQL' page that we get to see using EM? Ideally I would like to come up with the sql that EM uses to get the to

  • External Hard Drive Utility Won't Stop Mounting!

    I just bought a 1 TB Buffalo Drive Station to use as my Time Machine Backup drive. Plugging it in it came right up as a new volume, but so a second volume also mounted called "Utility_HD-CXU2", which contains Mac and Windows utilities. No problem I t

  • ITunes will not open on Windows using XP pro.

    ITunes 9.0.2 downloaded on a Sony Viao using Windows XP Pro. When trying to open iTunes, the following message is received. 'The folder iTunes cannot be found or created and is required. The default location for this folder is inside the My Music fol