我在程序主框架启动时加了这么几句: //将默认的空格触发按钮改为回车触发
InputMap map = new InputMap();
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), "pressed");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true), "released");
UIManager.put("Button.focusInputMap", map);然后,界面启动完毕后, 我在程序中更新为另一种界面,例如:
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
SwingUtilities.updateComponentTreeUI(myframe);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
// You may handle the exception here
}然后就死了一样,更新不了,这怎么解决呢?
InputMap map = new InputMap();
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), "pressed");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true), "released");
UIManager.put("Button.focusInputMap", map);然后,界面启动完毕后, 我在程序中更新为另一种界面,例如:
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
SwingUtilities.updateComponentTreeUI(myframe);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
// You may handle the exception here
}然后就死了一样,更新不了,这怎么解决呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货