-
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
-
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
Quote:
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?
-
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
Quote:
Originally Posted by
Norm
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
-
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"?
-
2 Attachment(s)
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
Quote:
Originally Posted by
Norm
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..
Attachment 3170
now see.. after clicking Ctrl+C, it comes to editing mode..
Attachment 3171
-
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.
-
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
Quote:
Originally Posted by
Norm
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
-
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?
Quote:
close button on the JFrame ,while the java program is running
Hiding the frame does NOT stop the program.
-
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
Quote:
Originally Posted by
Norm
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
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));
}
});
}
}
-
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.
-
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
Quote:
Originally Posted by
Norm
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
-
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.
-
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
Quote:
Originally Posted by
Norm
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?
-
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.
-
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
Quote:
Originally Posted by
Norm
Read the API doc for the System class to see how to code it.
ok and thx again for the link
-
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
Quote:
Originally Posted by
Norm
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
-
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
-
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
Post the code and the error message. No way to tell what is wrong without seeing the evidence.
-
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
Quote:
Originally Posted by
DarrylBurke
thx for the link :)-:
-
Re: finish a running swing through cmd, help plz i need to clear the doubt for my pro
Quote:
Originally Posted by
Norm
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