[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform] Re: Where is my JFrame? (was Strange behavior when trying to debug my application within eclipse)
|
Hi,
Thanks but I don't see how it can prevents the creation of a JFrame
/Yaron
"Tom Schindl" <tom.schindl@xxxxxxxxxxxxxxx> wrote in message
news:fhs2mh$5r5$1@xxxxxxxxxxxxxxxxxxxx
> Maybe because the streams in Eclipse are redirected to the ConsoleView?
>
> Tom
>
> Yaron Reinharts schrieb:
>> 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();
>>
>> }
>>
>> }
>>
>> }
>>
>>
>>
>
>
> --
> B e s t S o l u t i o n . at
> --------------------------------------------------------------------
> Tom Schindl JFace-Committer
> --------------------------------------------------------------------