Results 1 to 5 of 5
  1. #1
    kdiswired is offline Member
    Join Date
    Apr 2012
    Posts
    7
    Rep Power
    0

    Default Unable to get control of CMD after running applets

    I wrote the below program and compiled and interpreted it. I got the output but was not able to get back the control of command prompt. Therefore, I had to close command prompt.

    import java.awt.*;
    Java Code:
    class myApp
    {
    	public static void main(String a[])
    	{
    		Frame f=new Frame("My Form");
    		Panel p=new Panel();
    		Button bs=new Button("Submit");
    		Button bc=new Button("Cancel");
    		
    		f.add(p);
    		p.add(bs);
    		p.add(bc);
    		f.setSize(1024,768);	
    		f.setVisible(true);
    	}
    }

    can anyone please tell me how to get back the access to command prompt???

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,048
    Blog Entries
    7
    Rep Power
    23

    Default Re: Unable to get control of CMD after running applets

    Read the API documentation for the JFrame class and see what the setDefaultCloseOperation( ... ) method is for.

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,937
    Rep Power
    20

    Default Re: Unable to get control of CMD after running applets

    Your topic title is misleading; the question has nothing whatsoever to do with Applets.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    kdiswired is offline Member
    Join Date
    Apr 2012
    Posts
    7
    Rep Power
    0

    Default Re: Unable to get control of CMD after running applets

    I got it........I need to use the below

    setDefaultCloseOperation(EXIT_ON_CLOSE);

    Thank you :)

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,048
    Blog Entries
    7
    Rep Power
    23

    Default Re: Unable to get control of CMD after running applets

    Quote Originally Posted by kdiswired View Post
    I got it........I need to use the below

    setDefaultCloseOperation(EXIT_ON_CLOSE);

    Thank you :)
    Yep, that's it (for now). If closing a JFrame exits the entire application (with unsaved work in it?) it can be considered rude by the user. For now this behaviour is fine ...

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. iam unable to run applets in jedit in mac......
    By apple1992 in forum Java Applets
    Replies: 4
    Last Post: 03-13-2012, 02:27 PM
  2. Replies: 4
    Last Post: 03-06-2012, 04:33 PM
  3. running Applets w/o HTML page.
    By angryboy in forum Java Tip
    Replies: 0
    Last Post: 01-30-2009, 10:41 PM
  4. access control exception,while running rmi
    By megha in forum Advanced Java
    Replies: 3
    Last Post: 10-26-2008, 05:10 PM
  5. Unable to view applets on a web browser
    By thejdev in forum Java Applets
    Replies: 2
    Last Post: 03-04-2008, 07:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •