我有一个包含 5 个 JTextArea 组件的程序,这些组件在运行时添加到容器中。以下代码是我正在做的一个示例(在我的代码中,所有内容实际上都是导入的,并且此代码是从 JFrame 子类中运行的)。
JFrame frame = new JFrame("test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel container = new JPanel();
getContentPane().add(container);
JTextArea example = new JTextArea("//There is some text here");
container.add(example);
frame.setVisible(true);
运行后,以下内容将输出到控制台。
17:16.43 1[dbg] In DllGetClassObject
17:16.43 2[dbg] CShellExtClassFactory::CShellExtClassFactory()
17:16.43 3[dbg] CShellExtClassFactory::QueryInterface()
17:16.43 4[dbg] CShellExtClassFactory::CreateInstance()
17:16.43 5[dbg] CShellExt::CShellExt()
17:16.43 6[dbg] Looping before Zumo is running
17:16.43 7[dbg] Drive not mounted
17:16.43 8[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
17:16.43 9[dbg] CShellExt::AddRef()
17:16.43 10[dbg] CShellExt::AddRef()
17:16.43 11[dbg] CShellExt::Release()
17:16.43 12[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
17:16.43 13[dbg] CShellExt::AddRef()
17:16.43 14[dbg] CShellExt::Release()
17:16.43 15[dbg] Entering CShellExt::GetOverlayInfo
17:16.43 16[dbg] Icon path: C:\Program Files (x86)\Hewlett-Packard\HP CloudDrive\icons\deflated.ico
17:16.43 17[dbg] Exiting CShellExt::GetOverlayInfo successfully.
17:16.43 18[dbg] Time to execute: 0ms
17:16.43 19[dbg] Entering CShellExt::GetPriority
17:16.43 20[dbg] Exiting CShellExt::GetPriority
17:16.43 21[dbg] In DllGetClassObject
17:16.43 22[dbg] CShellExtClassFactory::CShellExtClassFactory()
17:16.43 23[dbg] CShellExtClassFactory::QueryInterface()
17:16.43 24[dbg] CShellExtClassFactory::CreateInstance()
17:16.43 25[dbg] CShellExt::CShellExt()
17:16.43 26[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
17:16.43 27[dbg] CShellExt::AddRef()
17:16.43 28[dbg] CShellExt::AddRef()
17:16.43 29[dbg] CShellExt::Release()
17:16.43 30[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
17:16.43 31[dbg] CShellExt::AddRef()
17:16.43 32[dbg] CShellExt::Release()
17:16.43 33[dbg] Entering CShellExt::GetOverlayInfo
17:16.43 34[dbg] Icon path: C:\Program Files (x86)\Hewlett-Packard\HP CloudDrive\icons\download.ico
17:16.43 35[dbg] Exiting CShellExt::GetOverlayInfo successfully.
17:16.43 36[dbg] Time to execute: 0ms
17:16.43 37[dbg] Entering CShellExt::GetPriority
17:16.43 38[dbg] Exiting CShellExt::GetPriority
17:16.43 39[dbg] In DllGetClassObject
17:16.43 40[dbg] CShellExtClassFactory::CShellExtClassFactory()
17:16.43 41[dbg] CShellExtClassFactory::QueryInterface()
17:16.43 42[dbg] CShellExtClassFactory::CreateInstance()
17:16.43 43[dbg] CShellExt::CShellExt()
17:16.43 44[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
17:16.43 45[dbg] CShellExt::AddRef()
17:16.43 46[dbg] CShellExt::AddRef()
17:16.43 47[dbg] CShellExt::Release()
17:16.43 48[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
17:16.43 49[dbg] CShellExt::AddRef()
17:16.43 50[dbg] CShellExt::Release()
17:16.43 51[dbg] Entering CShellExt::GetOverlayInfo
17:16.43 52[dbg] Icon path: C:\Program Files (x86)\Hewlett-Packard\HP CloudDrive\icons\share.ico
17:16.43 53[dbg] Exiting CShellExt::GetOverlayInfo successfully.
17:16.43 54[dbg] Time to execute: 0ms
17:16.43 55[dbg] Entering CShellExt::GetPriority
17:16.43 56[dbg] Exiting CShellExt::GetPriority
17:16.43 57[dbg] In DllGetClassObject
17:16.43 58[dbg] CShellExtClassFactory::CShellExtClassFactory()
17:16.43 59[dbg] CShellExtClassFactory::QueryInterface()
17:16.43 60[dbg] CShellExtClassFactory::CreateInstance()
17:16.43 61[dbg] CShellExt::CShellExt()
17:16.43 62[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
17:16.43 63[dbg] CShellExt::AddRef()
17:16.43 64[dbg] CShellExt::AddRef()
17:16.43 65[dbg] CShellExt::Release()
17:16.43 66[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
17:16.43 67[dbg] CShellExt::AddRef()
17:16.43 68[dbg] CShellExt::Release()
17:16.43 69[dbg] Entering CShellExt::GetOverlayInfo
17:16.43 70[dbg] Icon path: C:\Program Files (x86)\Hewlett-Packard\HP CloudDrive\icons\upload.ico
17:16.43 71[dbg] Exiting CShellExt::GetOverlayInfo successfully.
17:16.43 72[dbg] Time to execute: 0ms
17:16.43 73[dbg] Entering CShellExt::GetPriority
17:16.43 74[dbg] Exiting CShellExt::GetPriority
17:16.43 75[dbg] In DllGetClassObject
17:16.43 76[dbg] CShellExtClassFactory::CShellExtClassFactory()
17:16.43 77[dbg] CShellExtClassFactory::QueryInterface()
17:16.43 78[dbg] CShellExtClassFactory::CreateInstance()
17:16.43 79[dbg] CShellExt::CShellExt()
17:16.43 80[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
17:16.43 81[dbg] CShellExt::AddRef()
17:16.43 82[dbg] CShellExt::AddRef()
17:16.43 83[dbg] CShellExt::Release()
17:16.43 84[dbg] CShellExt::QueryInterface()==>IID_IShellIconOverlayIdentifier
17:16.43 85[dbg] CShellExt::AddRef()
17:16.43 86[dbg] CShellExt::Release()
17:16.43 87[dbg] Entering CShellExt::GetOverlayInfo
17:16.43 88[dbg] Icon path: C:\Program Files (x86)\Hewlett-Packard\HP CloudDrive\icons\fw.ico
17:16.43 89[dbg] Exiting CShellExt::GetOverlayInfo successfully.
17:16.43 90[dbg] Time to execute: 0ms
17:16.43 91[dbg] Entering CShellExt::GetPriority
17:16.43 92[dbg] Exiting CShellExt::GetPriority
17:16.48 93[dbg] Looping before Zumo is running
17:16.48 94[dbg] Drive not mounted
17:16.51 95[dbg] In DLLCanUnloadNow
我不知道这是什么(除了调试信息),我对它没有任何用处,重复 5 次对控制台来说只是垃圾邮件(用户可以用来报告错误)。
如何禁用此功能(或将此输出重定向到一次性 PrintStream)?
编辑:
下面的代码给了我相同的输出,可以直接复制粘贴到一个空类中。
public static void main(String[] args) {
javax.swing.JFrame frame = new javax.swing.JFrame("test");
frame.setSize(200, 100);
frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
javax.swing.JPanel container = new javax.swing.JPanel();
frame.getContentPane().add(container);
javax.swing.JTextArea example = new javax.swing.JTextArea("//There is some text here");
container.add(example);
frame.setVisible(true);
}
这就是我的输出结果。