Java控制台循环 [英] Java console loop

查看:53
本文介绍了Java控制台循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很奇怪,在这里还没有人回答这个问题,所以我想再试一试.希望有人可以提供帮助.已经去找我的Java老师了,他只是说我搞砸了,无法弄清楚,所以我无法继续前进.

Noticed no one has answered this yet on here so thought I'd give it a shot again. Hopefully someone can help. Already went to my Java teacher and he just said I messed something up and couldn't figure it out so I can't move on.

任何人,这是我的测试代码:

Anywho, here's my test code:

import javax.swing.JOptionPane;

public class Test {

    public static void main(String[] args) {
        System.out.println("hello");
        JOptionPane.showInputDialog("Enter a real number");
    }
}

这是我在控制台中收到的:

And this is what I receive in console:

hello

03:30.28 1[dbg] In DllGetClassObject
03:30.28 2[dbg] CShellExtClassFactory::CShellExtClassFactory()
03:30.28 3[dbg] CShellExtClassFactory::QueryInterface()
03:30.28 4[dbg] CShellExtClassFactory::CreateInstance()
03:30.28 5[dbg] CShellExt::CShellExt()
03:30.28 6[dbg] Looping before Zumo is running
03:30.28 7[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
03:30.28 8[dbg] CShellExt::AddRef()
03:30.28 9[dbg] CShellExt::AddRef()
03:30.28 10[dbg] CShellExt::Release()
03:30.28 11[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
03:30.28 12[dbg] CShellExt::AddRef()
03:30.28 13[dbg] CShellExt::Release()
03:30.28 14[dbg] Entering CShellExt::GetOverlayInfo
03:30.28 15[dbg] Icon path: C:\Program Files (x86)\Hewlett-Packard\HP CloudDrive\icons\deflated.ico
03:30.28 16[dbg] Exiting CShellExt::GetOverlayInfo successfully.

03:30.28 1[dbg] In DllGetClassObject
03:30.28 2[dbg] CShellExtClassFactory::CShellExtClassFactory()
03:30.28 3[dbg] CShellExtClassFactory::QueryInterface()
03:30.28 4[dbg] CShellExtClassFactory::CreateInstance()
03:30.28 5[dbg] CShellExt::CShellExt()
03:30.28 6[dbg] Looping before Zumo is running
03:30.28 7[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
03:30.28 8[dbg] CShellExt::AddRef()
03:30.28 9[dbg] CShellExt::AddRef()
03:30.28 10[dbg] CShellExt::Release()
03:30.28 11[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
03:30.28 12[dbg] CShellExt::AddRef()
03:30.28 13[dbg] CShellExt::Release()
03:30.28 14[dbg] Entering CShellExt::GetOverlayInfo
03:30.28 15[dbg] Icon path: C:\Program Files (x86)\Hewlett-Packard\HP CloudDrive\icons\deflated.ico
03:30.28 16[dbg] Exiting CShellExt::GetOverlayInfo successfully.

任何帮助将不胜感激.我已经尝试过重新安装所有可能的东西,包括eclipse和JDK 1.7.我还注意到,仅当我到目前为止尝试使用对话框JOptionPane时,才会发生这种情况.我正在使用Windows 7系统.

Any help would greatly be appreciated. I have already tried re installing everything I could which include eclipse and the JDK 1.7. I also noticed this only happens when I try to use the dialog JOptionPane so far. I am using a windows 7 system.

谢谢

推荐答案

只是一个猜测,因为我在其他系统上遇到了奇怪的AWT/Swing问题,您可以在这里尝试(有时底层UI系统未正确初始化) ,但正如我所说,这只是一个猜测):

Just a guess, because I have ran into strange AWT/Swing issues on other systems, you could try this here (sometimes the underlying UI system gets not initialized properly, but as I said, this is just a guess):

public class Test 
{
    public static void main(String[] args) 
    {
        SwingUtilities.invokeLater(new Runnable()
        {
            @Override
            public void run()
            {
                System.out.println("hello");
                JOptionPane.showInputDialog("Enter a real number");
            }
        });
    }
}

通过使用invokeLater强制整个UI系统进行初始化(将启动EDT并从EDT内部显示选项窗格),我不得不使用此技巧,例如使我的SDL绑定在OSX下工作. invokeLater为我初始化了整个可可系统.

By using invokeLater you force the whole UI system to get initialized (the EDT to be started and the option pane showed from inside the EDT), I had to use this trick e.g. for getting my SDL bindings under OSX to work. invokeLater initializes the whole Cocoa system for me.

这篇关于Java控制台循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆