• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Multiple javaw.exe instances created while creating swing components

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am trying to create new swing components like Jcalendar of my
own and when i try to create a sample application which is using that
swing component, when i try to run that sample application multiple
instances of javaw.exe are being created and the system gets hanged.

Why is this happening and how to solve this? Kindly help me ASAP.

Thanks,
Smitha
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Smitha!
It should not create multiple instances of java.exe. could you through some code over here to understand what you have done excatly. I think you are doing some simple mistake in your code itself.

Regards,
Saaaaaaachin!!!
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Smitha, you have to either:

1) myjframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

or

2) add a window listener to the frame and System.exit on window close.

If you do not do this the java/javaw process will never terminate.
 
Smitha Bhat
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Please find the sample code. The sample code uses the swing component which i have created. After adding the last line the javaw instances are being closed. But whether its necessary that everytime i run this code the javaw.exe instance should be created. This is my doubt.

Sample Code:

JFrame frame = new JFrame("FileUpload Demo");

//Instantiating my own swing component
FileUploadDemo app = new FileUploadDemo();


Component cont = app.createComponent();
frame.getContentPane().add(cont, BorderLayout.CENTER);


frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);

//Added after your comment - Its working
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic