日期:2014-05-20  浏览次数:20644 次

帮帮忙吧 各位大神 !!!!!!!
java.lang.NullPointerException
at com.jiaotong.contrl.WindowCenter.showCenter(WindowCenter.java:53)
at com.jiaotong.frame.EmpAddingView.<init>(EmpAddingView.java:95)
at com.jiaotong.contrl.MenuHandler.actionPerformed(MenuHandler.java:70)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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)

------解决方案--------------------
异常告诉你了,
at com.jiaotong.contrl.WindowCenter.showCenter(WindowCenter.java:53)

打个断点调试下。

在这个方法中,我想应该某一个类是NULL,然后你再调用它的方法就抛出这个异常了。
  public static void showCenter(JFrame frame) {

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

Dimension frameSize = frame.getSize();

if (frameSize.width > screenSize.width) {

frameSize.width = screenSize.width;

}

------解决方案--------------------
at com.jiaotong.contrl.WindowCenter.showCenter(WindowCenter.java:53)

调试看看。