aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes GUI Netbeans Swing: How to get this code into GUI form? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "GUI Netbeans Swing: How to get this code into GUI form?" Watch "GUI Netbeans Swing: How to get this code into GUI form?" New topic
Forums: Java in General Swing / AWT / SWT
Author

GUI Netbeans Swing: How to get this code into GUI form?

Ofelia Stewart
Ranch Hand

Joined: Feb 02, 2014
Posts: 47
Okay, so I fooled around and made this out of examples I found and I put my revised code from last week with it. How do I get my GUI code into a GUI format? I wrote this put it will not make a GUI image.



I get errors:

debug:
java.lang.NoClassDefFoundError: ofelia_inventory_4/Ofelia_Inventory_4 (wrong name: Ofelia_Inventory_4/Ofelia_Inventory_4)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Exception in thread "main" Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

When I debug with my program.


Here's the rest of the program if you need it. I'm sorry to do this, I know you guys get tired of all this long code:







Ofelia Stewart
Ranch Hand

Joined: Feb 02, 2014
Posts: 47
On another note, I created GUI not in a Swing GUI Form, every time I try to implement code into it I get lost. Any suggestions? I just need a simple GUI that will run each item one after the other.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3450
    
  47

It probably doesn't have anything to do with Swing. Looks like a wrong name of the package or directory.

I'd suggest renaming the package to not contain upper case letters at all and also remove underscores (it is probably legal, but very usunual). So your package name could be ofeliainventory4. The rename the directory containing your class to ofeliainventory4 as well.

For your main class I'd also suggest to use a name different from package name, more than in just letter case. You can rename your class just to Main, or perhaps OfeliaMain if you must. The reason is that at this time, when you see Ofelia_Inventory_4 in some error message, it isn't immediately clear whether the error pertains to the package or to the class.

Then rebuild your entire project and try to run it again.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: GUI Netbeans Swing: How to get this code into GUI form?
 
Similar Threads
Questions about Inventory part 3
Inventory 3 to 4 GUI- Java
Java Beginner: My Inventory Program
Inventory 4 GUI / Connecting Elements
Move implemenation out of main(String[ ] args)