Bom dia!
Eu estou tentando criar uma tecla de atalho…mas da o seguinte erro:
java.lang.NullPointerException
at br.com.mrsautomacao.gui.PainelFinanceiro.initGUI(PainelFinanceiro.java:1242)
at br.com.mrsautomacao.gui.PainelFinanceiro.(PainelFinanceiro.java:194)
at br.com.mrsautomacao.gui.DialogServico.(DialogServico.java:557)
at br.com.mrsautomacao.gui.PainelServico$1.actionPerformed(PainelServico.java:67)
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.plaf.basic.BasicButtonListener.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.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)
segue o codigo:
[code]pressF1 = new AbstractAction(“F1”){
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null, “Dinheiro”);
}
};
int cond = JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT;
KeyStroke f1 = KeyStroke.getKeyStroke(KeyEvent.VK_F1,0);
//GUARDA O ROOTPANE
JRootPane rootPane = getRootPane();
//F1
rootPane.getInputMap(cond).put(f1, "F1");
rootPane.getActionMap().put("F1", pressF1);[/code]
Alguem sabe o que pode estar acontecendo?!
Desde já agradeço!