-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package btbvv.btuitools; | ||
|
||
import java.awt.Frame; | ||
|
||
import javax.swing.JDialog; | ||
|
||
/** | ||
* A {@code JDialog} that delays {@code pack()} calls until the dialog is made visible. | ||
*/ | ||
|
||
public class DelayedPackDialogBT extends JDialog | ||
{ | ||
private volatile boolean packIsPending = false; | ||
|
||
public DelayedPackDialogBT( Frame owner, String title, boolean modal ) | ||
{ | ||
super( owner, title, modal ); | ||
} | ||
|
||
@Override | ||
public void pack() | ||
{ | ||
if ( isVisible() ) | ||
{ | ||
packIsPending = false; | ||
super.pack(); | ||
} | ||
else | ||
packIsPending = true; | ||
} | ||
|
||
@Override | ||
public void setVisible( boolean visible ) | ||
{ | ||
if ( visible && packIsPending ) | ||
{ | ||
packIsPending = false; | ||
super.pack(); | ||
} | ||
super.setVisible( visible ); | ||
} | ||
} |