• Post Reply Bookmark Topic Watch Topic
  • New Topic

One Jdialog class for multiple panel classes

 
Charles Sexton
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • 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.







 
Darryl Burke
Bartender
Posts: 5154
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!