Question

I created a new project in Netbeans IDE 7.0.1. In that project I created a new JFrame form. But that frame is not loading.

Then I tried to run the program anyway and it gave the following exceptions:

Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: 
  Uncompilable source code - package org.jdesktop.layout does not exist
at login.initComponents(login.java:33)
at login.<init>(login.java:20)
at login$1.run(login.java:78)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

I am using Ubuntu 12.10

No correct solution

OTHER TIPS

Looks like you have to add the Swing Layout Extensions Library to your project, to do so go to the Projects explorer, do right-click on Libraries > Add Library... and select Swing Layout Extensions Library. Problem solved.

BTW this is a Duplicate from https://stackoverflow.com/questions/19304700/netbeans-jframes-do-not-work

Example:

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class App {

public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable(){
        public void run(){
            JFrame frame = new JFrame("Hello world");

            frame.setVisible(true);
            frame.setSize(600,500);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }
    });
}

}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top