Len*_*och 0 java swing if-statement panel
if((wort[0] == "A") && (wort[1] == "P") && (wort[2] == "F") && (wort[3] == "E") && (wort[4] == "L") && (wort[5] == "K") && (wort[6] == "U") && (wort[7] == "C") && (wort[8] == "H") && (wort[9] == "E") && (wort[10] == "N")) {
frame.remove(panel);
frame.add(winpanel);
winpanel.add(winmeldung);
winpanel.add(beenden);
frame.validate();
Run Code Online (Sandbox Code Playgroud)
嗨,我这里有一个庞大的项目,所以我只发布一部分内容.我想检查一下,如果确实应该打开一个新的面板.但每次我跑,我都会因为"未知来源"而收到错误.为什么??
编辑:
错误:
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Run Code Online (Sandbox Code Playgroud)
肯定错误的一件事是:
wort[0] == "A"
Run Code Online (Sandbox Code Playgroud)
应该
wort[0].equals( "A")
Run Code Online (Sandbox Code Playgroud)
String比较总是应该使用equals()而不是==(除了字符串文字比较的情况)
| 归档时间: |
|
| 查看次数: |
104 次 |
| 最近记录: |