Can been JOptionPane.showMessage used in applet?

I am a newer in java programming. i have written a java applet programm. But when i run it, there is something wrong. Can someone tell me where is the problem. Here is the programm.
import javax.swing.*;
import java.awt.*;
import java.applet.*;
public class ChenTest extends JApplet{
String input;
     int output;
int x=0;
     int y=0;//����init��
public void init(){
public void paint(Graphics g){
output = question();
     input =JOptionPane.showInputDialog("enter the result ");
System.out.println("init"+y);
x = Integer.parseInt(input);
     while(x !=output){
     g.drawString("no",25,25);
          input =JOptionPane.showInputDialog("try again ");
          x = Integer.parseInt(input);
          System.out.println(x);
     g.drawString("yes",50,50);
     y++;
public int question()
     int number1,number2,result;
number1 = 1+(int)(Math.random()*9);
number2 =1+(int)(Math.random()*9);
// System.out.println("how "+number1 +"*"+number2);
     System.out.println("chen"+number1+"*"+number2);
     JOptionPane.showMessageDialog(null,"how much is "+number1 +"* "+number2);
return result = number1 * number2;
}

"there is something wrong" does not compute ...
hint: if you use swing in your applet, you need to have at least Java2 plugin running with your browser.

Similar Messages

  • A function can not be used in Applet.what's wrong?

    Here is a function.
    private String LoadFile() {
    String input;
    String output="sssssdsdsddf";
    try{
    FileReader f=new FileReader("shu.txt");
    BufferedReader in = new BufferedReader(f);
    while ((input = in.readLine())!= null){output=output+input;}
    in.close();
    }catch(IOException e) {
    System.err.println("Exception caught: " + e.getMessage());
    return output;
    It can be used in Java Application,and work well.but can not be used in Applet,it does not work.what's wrong?

    http://www.javaworld.com/javaworld/jw-12-2000/jw-1215-security.html#sidebar1

  • A function can not be used in Applet.what' wrong?

    Here is a function.
              private String LoadFile() {
    String input;
              String output="sssssdsdsddf";
              try{
              FileReader f=new FileReader("shu.txt");
    BufferedReader in = new BufferedReader(f);
    while ((input = in.readLine())!= null){output=output+input;}
              in.close();
              }catch(IOException e) {   
                   System.err.println("Exception caught: " + e.getMessage());
    return output;
    It can be used in Java Application,and work well.but can not be used in Applet,it does not work.what's wrong?

    Don't you think it would be a bit of a security risk if any applet you downloaded from the web (unknowingly) could read/write to your file system....
    Applets have strict security applied to them, and file i/o is one of the restrictions. There are ways around it, but for the moment I'd suggest you build a bridge and get over it.
    Cheers,
    Radish21

  • How can I display some OrdImages using a Applet in html or Jsp?

    hi
    I want to use a applet to display some images retrieved from intermedia OrdImage Object.
    Now ,I know that a applet can display some image objects or some images with their own filepaths. But we can get ordimag objects from Oracle database.And we can image data or image properties by ordimage java mathod. It is in html/Jsp environment. So how can I transform from ordimage to applet?? I appreciate someone who can help me!
    Bill

    Do you mean applet or Servlet?
    An Applet is java code that is downloaded over the web and runs in a web browser environment. Is this what you are doing?
    I suspect you are really talking about servlet/JSP environments, and the ability to include images from the database in a web page.
    In either case (applet or servlet), you want to be able to access images via a URL. For a Servlet/JSP/web page, this URL will be specified in a HTML <IMG> tag with a key as a parameter to the image you wish to view. Images are not in-line downloaded in a web page. They are access after the HTML is loaded, and are accessed with URLs, sometimes relative URLs rather than fully specified URLs.
    To deliver images to the web from the database using the PL/SQL gateway and iAS, where the procedures are generated by a wizard, see:
    http://otn.oracle.com/software/products/intermedia/htdocs/descriptions/imedia_code_wizard.html
    You can create a simple servlet (JSPs can not deliver binary data) that delivers database images using java classes. See:
    http://otn.oracle.com/software/products/intermedia/htdocs/descriptions/servlets_jsp.html
    http://otn.oracle.com/sample_code/products/intermedia/htdocs/intermedia_servlet_jsp_samples/imedia_servlet_jsp_readme.htm
    for a sample.

  • I'm trying to access an uncompleted app. on a gov't website using Safari 5.1. I receive a message saying the browser is incompatible with the website. It has been suggested that use Safari 5.0 instead. Must I delete 5.1 first, or can I have both browsers

    I'm trying to access an uncompleted app. on a gov't website using Safari5.1 I receive a message saying the browser is incompatible. I have been advised to use Safari 5.0. Must I delete 5.1 or can I use both browsers on my Mac.

    As above, there is more to Safari than just the App, however I dont like the changes in 5.1, so restored the 5.0 version of just the App and it functions just like it used to
    It might not work for you, and it can just be deleted if it doesn't, not sure how easy it is without time machine
    go into Finder and Applications folder
    enter time machine (it will default to app folder)
    find a date that you had 5.0
    click to restore it (Do Not restore into original location, restore it to desktop to test it)
    When this has been done, run Safari from your desktop and see if it fixes your issue
    I have been using this version done like this for a couple of weeks and it is fine, I did copy it to the Application\Utitlities folder along with some other older software I have, then made this one the version on my dock
    If it doesn't make any difference just delete Safari.app from your desktop

  • Your Voucher has been suspended and can no longer be used !!?

    Hi guys,
    I have purshased 2 vouchers for 2 Java exams it's been a while, they have both expiration date at 31-AUG-2013 , lately when I tried to apply them for my exam at PearsonVue a message appears and tells me that "the voucher is SUSPENDED and can no longer be used"
    I don't understand what is going on and they dont even tell why it is suspended
    is there something I can do about it? thanks in advance
    - Kacem

    I'm pretty sure that for this situation, you'll need to contact Oracle Certification Support Oracle University - Support Form. If it is the issue that I suspect, Oracle Certification Support will need to assist. Please provide the voucher numbers when you contact Oracle, they will need to know the voucher numbers and any purchase info you have - where did you purchase, how did you pay, can you provide a receipt?
    Regards,
    Brandye Barrington
    Certification Forum Moderator

  • I downloaded Firefox 4.0.1 and have not been able to use my DigitalPersona fingerprint login since. Will this be added on or can you tell me how to go back to using the older version of Firefox so I can use my fingerprint login again? Thanks

    I have not been able to use my digitalPersona v4.11.3826 (fingerprint login) since I downloaded firefox 4.0.1. Will this be incorporated to the add-ons or if not, can you tell me what the easiest way is to go back to using the older version of Firefox?

    EgisTec, who now provide the HP Simplepass application, have made an update of the scanner software for Firefox 4, for details see https://support.mozilla.com/questions/814397

  • CS6 Camera Raw - I can now only crop using aspect ratio in the custom crop setting rather than being able to set the dims in cm and inches? anyone know how to revert? ever since installing new mac operating system things have been strange!

    CS6 Camera Raw - I can now only crop using aspect ratio in the custom crop setting rather than being able to set the dims in cm and inches? anyone know how to revert? ever since installing new mac operating system things have been strange!

    Hi Kglad.
    I have looked at all of my settings both in Bridge and CS6 Photoshop regarding Camera Raw. I am at a loss how to set the crop tool in cm or inches as I once did - now the only option is to crop using ratios of 1:1 etc etc - This is infuriating as lots of my square crops I could set at 10" x 10'' specifically to print one to one to fit frame and mount size -
    Now if cropping using bloody aspect ratio of 1:1 (square) the actual dims of the crop are roughly 4.25 inches x 4.25 inches. this means I then have to open the whole image in photoshop in order to crop at the dims I have set! It was so much quicker in terms of batch cropping in camera raw being able to set dims in centimetres and inches but they have gone and mucked around with it, with the new bloody update! Unless you are an absolute genius and know how I can go back to having an option of CM, Inches and aspect ratio within the custom crop settings? (Please say you do)
    here is the new tutorial for CC -  my guess is they have scrapped the control we had over the custom crop settings
    Cropping Images In Adobe Camera Raw 8

  • I have always been able to zoom in on my photo by holding the cmd and space bar, that changed and now it creates a box and zooms in on that area and I can't zoom out using cmd   space bar. How do I change it back to the  original way of zooming?

    i have always been able to zoom in on my photo by holding the cmd and space bar, that changed and now it creates a box and zooms in on that area and I can't zoom out using cmd   space bar. How do I change it back to the  original way of zooming?

    Select the Zoom Tool in the tool box and see if Scrubby Zoom is unchecked or greyed out in the tool options bar.
    (you want Scrubby Zoom checked)

  • I upgraded to 20gb iCloud but it isn't enough to back up. I get constant error messages saying there is no backup space and I've not been able to use the upgrade. Apple promised to refund then didn't. Please help is there anyway I can use this space?

    Please see the subject line thanks
    I upgraded to 20gb iCloud but it isn't enough to back up. I get constant error messages saying there is no backup space and I've not been able to use the upgrade. Apple promised to refund then didn't. Please help is there anyway I can use this space?

    If you were told they would refund the price for the iCloud storage - Contact AppleCare and ask to speak with a senior advisor.  Have the case number for the promised refund available.
    If you are trying to update your device, but you don't have sufficient space to download and install the update, you need to delete content from your device.  Buying storage in iCloud does not add space to the device which is what you need.
    You can always update using a computer with iTunes installed - this method is faster, and will allow you to make a backup on the local computer (Local backups restore faster than iCloud backups).
    HTH

  • Can you please tell me how can i change the parameter of Applet using Aspec

    Respect Members
    Can we apply Aspectwerkz on Applet? In our project we have to
    change the method parameters before its execution(Around Advice) , can we do this in applet using Aspectwerkz?
    Can you please tell me how can i change the parameter of Applet using Aspectwerkz or AspectJ ?
    I did it by for Java Application using the AspectJ And Aspectwerkz But not able to do for Applet.
    For Applet I Am setting the parameter in JAVA plug in for Aspectwerkz e.g. -Xdebug -Xrunaspectwerkz -Xbootclasspath & path for xml file in which pointcut is defined.
    If you any Friend working on it or any author who might be helpfull for me please Forward this mail to him/her
    THANKs in Advance
    [email protected]

    hello rodale, what you're seeing is probably a side effect of firefox not being able to save certain preferences into its profile folder.
    go to ''firefox > help > troubleshooting information'', click on ''profile folder/show folder'' and close all firefox windows afterwards. a windows explorer window should open up - in there delete the file named '''user.js'''.
    in case this didn't solve the issue yet please also refer to [[How to fix preferences that won't save]].

  • How can I use a applet in a JSP file?

    hi
    I failed to use applet in a jsp file.My workspace is a BC4J type. I put the applet's source file in business component project.the jsp is in JSP project.
    The jsp file calls applet by <jsp:plugin></jsp:plugin> style.
    The error is can't find the applet class.
    why? Thank someone for give me help.

    Actually using jsp applet tags does not mean that it is taking care of that the classes are available. It simply renders the Applet tag tothe JSP page. If e.g. teh codebase is specified as /java/, then there should be a mapping to the Java class location with thename of /java/. If codebase is not provided, then the Java class must be in the classpath of the JSp servlet.
    Frank

  • Trying to find a Passive Voice counter or detector for my daughters in school - they've been told to use MS Word - hoping I can identify same in Pages.  Any insight is greatly appreciated.

    Trying to find a Passive Voice counter or detector for my daughters in school … they've been told to use MS Word … hoping I can identify same in Pages.  Any insight is greatly appreciated.

    I take it you are objecting to the lack of passivity in my statements.
    I assumed nothing.
    My statement stands. Healthy humans are making themselves educational cripples by clutching at "smart solutions", which aren't.
    Ms Word manages to mark down the Gettysburg Address and Martin Luther King's "I have a Dream" Speech.
    It is no wonder people can no longer spell, find their way around, know where, or what anything is, let alone think for themselves, and get diabetes in their teens. All because they jump on cue when anyone says "Buy".
    Peter

  • HT1937 How can I get to use my phone?  Much of it appears to be set up but when I try and make a call it tells me I have not been given access to this service

    How can I get to use my phone?  When I try and dial out it says:  'You have not been given access to this service'

    Have you chacked with your carrier.  The message you are getting seems to relate to a carrier issue and not something to do with the phone itself

  • Popup Applet: Can we used popup applet to list records from other BC

    I have created a popup applet based on contact BC and called it from one control(ex. Add button) in my newly added applet.I am not able to see any records there in popup applet.
    Can you please suggest what is the issue or can we use popup applet to show records and select it from it.

    Hi,
    This is Siebel debugging 101.
    Have you looked at your log file to see the SQL that executed?
    Robert Ponder
    [email protected]
    770.490.2767
    www.ponderproserve.com
    Ponder Pro Serve is the recognized leader in Siebel upgrades and Siebel performance on Oracle 11g
    Edited by: Robert Ponder on Oct 21, 2010 2:01 PM

Maybe you are looking for

  • Calling Reporting Services Web Service with jQuery possible?

    Hi, is it possible to call the Reporting Services Web Service with jQuery? If yes, can someone post me a small example? Background: My plan is to create a html with a form which is also uploaded then into the reportserver. I open this html later by c

  • BPM Message Flow Question

    My scenario involves a BPM, the BPM retrieves via Receiver JDBC(Sync Call) some data using two fields of the initial message, the response message from JDBC have one field I want to map that field to the initial message in order to keep in one messag

  • Import problem with LOBs

    Hi, Oracle 9.2.0.4 Solaris 9 I have just tried to import a schema with LOBs (mainly CLOBs, I think). The export was from a schema residing in a tablespace 'LUM' and going to an instance with a tablespace 'LUMTEST'. The documentation and experience sa

  • Problem with CE 4.0

    Hi, I want to set up CE 4.0 within Win 2008 server and have got this If a later version of it already exists on the server, then how to connect to the existing CE DB, by SS management studio? Many Thanks & Best Regards, Hua Min

  • Satellite U505-S2970 has been installing an update for 2 hours.

    I just got my Satellite laptop yesterday and it has been working fine. Today I went to shut it down and it said it had to install updates. So I shut it down and when it got to the 13th update it just stayed there. That happened 2 hours ago and it sti