Pessoal,
Eu estou com o seguinte problema, quando eu tento iniciar um JFrame dá o seguinte erro:
Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at java.awt.Window.initGC(Window.java:464)
at java.awt.Window.init(Window.java:484)
at java.awt.Window.(Window.java:533)
at java.awt.Frame.(Frame.java:418)
at java.awt.Frame.(Frame.java:383)
at javax.swing.JFrame.(JFrame.java:180)
at br.ufpa.linc.view.principal.Principal.(Principal.java:27)
at br.ufpa.linc.view.principal.Principal.getPrincipal(Principal.java:280)
at br.ufpa.linc.view.principal.Principal$6.run(Principal.java:295)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)
at java.awt.EventQueue.access$000(EventQueue.java:101)
at java.awt.EventQueue$3.run(EventQueue.java:666)
at java.awt.EventQueue$3.run(EventQueue.java:664)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:240)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:142)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:134)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
public class NewJFrame extends javax.swing.JFrame {
public NewJFrame() {
super("Teste");
initComponents();
}
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 300, Short.MAX_VALUE)
);
pack();
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
}
});
}
}
Eu estou utilizando o JDK 1.7.0 Developer Preview para o Snow Leopard, quando eu vou executar no Windows 7 funciona perfeitamente. Alguém sabe me dizer o motivo?