This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

adding custom swing component problem

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am a java beginner.i had built a java program MyCalculaterGuI in notepad,compiled and run it on commond prompt.now i am using netbeans 11.1.i have created a jar file of MyCalculterGUI.class by commond prompt.it runs,works fine.now when i want to add MyCalculater.jar file in my netbeans swing controls as a custom component so that i reuse it
by just drag and drop in any JFrame form.first i added this jar file in my gradle project custom library 'libs' folder which is included in project dependencies.then i added this jar file into swing control by pallete manager.MyCalculater.jar is added in swing control.but when i drag and drop it.it gives following error.
component instantiation error
failed to create an instance of pkg/MyCalculaterGUI class
the class itself was loaded but intantiating failed............
please guide me.
regards
Sheraz Ahmad
 
Bartender
Posts: 1200
38
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to verify that you have a default constructor defined in your class. Most of times I had a similar error with Matisse (the GUI palette in NB 8) it was dued to a null pointer exception raised by constructor.
 
Sheraz Ahmad
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
following is only constructor in my class .
public MyCalculaterGUI()
{
initGUI();
}
now please tell me how should it look like to solve the above mentioned problem.
regards
 
Marshal
Posts: 66237
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That isn't a default constructor.
 
Yup, yup, yup. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!