Hi,
I was able to isolate the problem.to the following program, it runs well
from the command line but fail to show the frame when running within
Eclipse
Why does System.in.read(buffer); prevent the frame creation within
Eclipse?
Thanks in advance
/Yaron
import java.io.IOException;
import javax.swing.JFrame;
public class WhereIsMyJFrame
{
public static void main(String[] args)
{
new WhereIsMyJFrame();
}
private WhereIsMyJFrame()
{
Thread thread = new Thread()
{
public void run()
{
System.out.println("run");
WhereIsMyJFrame.loop();
}
};
System.out.println("starting the thread");
thread.start();
System.out.println("creating the main window");
JFrame frame = new JFrame("WhereIsMyJFrame");
System.out.println("main window created");
frame.setVisible(true);
}
private static void loop()
{
try
{
byte buffer[] = { 0 };
do
System.in.read(buffer);
while ((char) buffer[0] != 'x');
}
catch (IOException ioexception)
{
ioexception.printStackTrace();
}
}
}