• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

adding custom swing component problem

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1327
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 76802
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That isn't a default constructor.
 
Why should I lose weight? They make bigger overalls. And they sure don't make overalls for tiny ads:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic