Page 1 of 2 12 LastLast
Results 1 to 20 of 22
  1. #1
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Question finish a running swing through cmd, help plz i need to clear the doubt for my project

    hi,
    When i start an applet, and then close it, the command prompt doesn't come to editing mode. Rather I have to press Ctrl+C to exit the executing mode.
    Is there a syntax which we can insert into the class , so it exits automatically..
    regards

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    When i start an applet, and then close it,
    Please explain what you mean by an applet? Applets are normally part of an HTML page and execute in a browser. There is no way to "close" an applet. It's part of what a browser displays on a page.

    What are you executing, where is it being executed and on what OS?

    What is command prompt editing mode?

  3. #3
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    Quote Originally Posted by Norm View Post
    Please explain what you mean by an applet? Applets are normally part of an HTML page and execute in a browser. There is no way to "close" an applet. It's part of what a browser displays on a page.

    What are you executing, where is it being executed and on what OS?

    What is command prompt editing mode?
    oh im sorry
    replace the word 'applet' by 'swing'
    I was speaking about swing
    when i run a swing (example, JFrame), and when i exit, the command prompt cursor doesn't come back to editing mode. it stays at executing mode.
    regards
    dhilip

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    What OS are you using?

    What is "executing mode" and "editing mode"?

  5. #5
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    Quote Originally Posted by Norm View Post
    What OS are you using?

    What is "executing mode" and "editing mode"?
    OS is windows XP..
    executing mode, I mean, the cursor of CMD doesn't come to the next line, and we can't edit the line containing the cursor..
    javaro.bmp
    now see.. after clicking Ctrl+C, it comes to editing mode..
    javaro1.bmp

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    How does the java program exit? Does it execute System.exit()?

    Holding the ALT key with PrintScreen will get only the active window. Your images include too much junk.

  7. #7
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    Quote Originally Posted by Norm View Post
    How does the java program exit? Does it execute System.exit()?

    Holding the ALT key with PrintScreen will get only the active window. Your images include too much junk.
    well, I didn't use the command "System.exit" yet.. and atm,
    when i click close button on the JFrame ,while the java program is running,
    the cursor on CMD stays there, until I press Ctrl+C.
    Hope U got me, thx
    regards
    dhilip

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    I don't know what the code is doing.
    Can you make a small simple program that compiles, executes and shows the problem?

    close button on the JFrame ,while the java program is running
    Hiding the frame does NOT stop the program.

  9. #9
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    Quote Originally Posted by Norm View Post
    I don't know what the code is doing.
    Can you make a small simple program that compiles, executes and shows the problem?


    Hiding the frame does NOT stop the program.
    these are the codes..
    Tester.java
    Java Code:
    import java.awt.Container;
    import java.awt.Font;
    import java.awt.FontMetrics;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.geom.CubicCurve2D;
    import java.util.Vector;
     
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
     
    class Tester extends JFrame {
           
         
        public static void main(String[] args) {
            final JFrame f = new JFrame("My frame");
            f.setSize(600, 400);
            f.setVisible(true);
             
            f.add(new JComponent(){
                 
                public void paintComponent(Graphics g)
                {
                    g.drawLine(0,0,0,f.getHeight());
                    g.drawLine(0, f.getHeight()/2, f.getWidth(), f.getHeight()/2);
                    Graphics2D g2 = (Graphics2D) g;
                    g2.drawString("1", 10,25);
                    g2.drawString("-1",10,f.getHeight()-50);
                    g2.draw(new CubicCurve2D.Double( 10,100, 50, f.getHeight()/3,100,f.getHeight()/2,100,10));
                }
            });
             
          }
    }

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    I don't see anything in the program that would make it exit to the OS. Closing the JFrame does not stop the program.
    Look at the API doc for the JFrame class for a method that will cause the program to exit when it is closed.

  11. #11
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    Quote Originally Posted by Norm View Post
    I don't see anything in the program that would make it exit to the OS. Closing the JFrame does not stop the program.
    Look at the API doc for the JFrame class for a method that will cause the program to exit when it is closed.
    that's what i need..
    my eclipse doesn't show API docs and tells, my doc file doesn't contain docs ..
    is there a single syntax to exit the program , or doc is neceessary?
    thx
    dhilip

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    Here is a link to the Api docs:
    Java Platform SE 6
    This is something you need to have. I look at it many times a day.
    Find the class in the lower left and click the link for the doc to come into the main frame.

  13. #13
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    Quote Originally Posted by Norm View Post
    Here is a link to the Api docs:
    Java Platform SE 6
    This is something you need to have. I look at it many times a day.
    Find the class in the lower left and click the link for the doc to come into the main frame.
    thx a lot, and ..
    does System.exit help out?

  14. #14
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    Read the API doc for the System class to see how to code it.

  15. #15
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    Quote Originally Posted by Norm View Post
    Read the API doc for the System class to see how to code it.
    ok and thx again for the link

  16. #16
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    Quote Originally Posted by Norm View Post
    Read the API doc for the System class to see how to code it.
    why doesn't adding "System.exit(int n);" to the end of the main class work? it shows errors
    regards
    dhilip

  17. #17
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

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

  18. #18
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    it shows errors
    Post the code and the error message. No way to tell what is wrong without seeing the evidence.

  19. #19
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro


  20. #20
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro

    Quote Originally Posted by Norm View Post
    Post the code and the error message. No way to tell what is wrong without seeing the evidence.
    kl man... im trying "System.exit(0):" an brb

Page 1 of 2 12 LastLast

Similar Threads

  1. help me to finish my project..
    By syedabu in forum NetBeans
    Replies: 1
    Last Post: 07-19-2010, 09:13 PM
  2. convert please...to finish project
    By syedabu in forum Web Frameworks
    Replies: 1
    Last Post: 02-24-2010, 07:17 PM
  3. please clear my doubt
    By syedabu in forum Web Frameworks
    Replies: 1
    Last Post: 02-11-2010, 10:11 AM
  4. Please clear my doubt...............
    By vinaytvijayan in forum Advanced Java
    Replies: 0
    Last Post: 12-26-2007, 06:23 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
  •