• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

One Jdialog class for multiple panel classes

 
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having trouble adding and removing panels to JDialog based on abstract action used by the used. Here is an example: In this example the dialog class adds the jpanel on the first attempt of the action but whenever the dialog closes and the user repeats the same action the jpanel doesn't show in the jdialog. Just an FYI I am trying to do this through the MVC Architecture.







 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can't see anything obviously wrong in the code you posted. To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates the problem.
 
Charles Sexton
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SSCCE, I wasn't able to solve but did narrow down the problem. I tried every way possible that I know to add the jar file for miglayout. Miglayout













 
Charles Sexton
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the problem was that I was disposing the dialog and using JDialog add() instead of getting the contentpane and using the add method.

dialog.getContentPane.removeAll();
dialog.getContentPane.add(panel);

dialog by default on window closing hides the dialog, so dispose or setVisible wasn't needed in the WindowAdapter
reply
    Bookmark Topic Watch Topic
  • New Topic