Skip to content

Commit

Permalink
add DelayPackDialogBT
Browse files Browse the repository at this point in the history
  • Loading branch information
ekatrukha committed Oct 23, 2024
1 parent 2bc590d commit b215032
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/main/java/btbvv/btuitools/BrightnessColorDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;


import bdv.tools.DelayedPackDialog;
import bdv.util.InvokeOnEDT;
import bdv.viewer.AbstractViewerPanel;
import bdv.viewer.ConverterSetups;
Expand All @@ -70,7 +68,7 @@
import btbvv.core.VolumeViewerFrame;


public class BrightnessColorDialog extends DelayedPackDialog
public class BrightnessColorDialog extends DelayedPackDialogBT
{
private final SourceToConverterSetupBimap converters;

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/btbvv/btuitools/BrightnessDialogBT.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
import bdv.tools.brightness.SliderPanel;
import bdv.tools.brightness.SliderPanelDouble;
import bdv.util.BoundedValueDouble;
import bdv.tools.DelayedPackDialog;
import btbvv.core.VolumeViewerFrame;
import mpicbg.spim.data.generic.sequence.BasicViewSetup;
import net.imglib2.type.numeric.ARGBType;
Expand All @@ -91,7 +90,7 @@
* @author Tobias Pietzsch
*/
@Deprecated
public class BrightnessDialogBT extends DelayedPackDialog
public class BrightnessDialogBT extends DelayedPackDialogBT
{
ConverterSetupsBT convSet;

Expand Down
42 changes: 42 additions & 0 deletions src/main/java/btbvv/btuitools/DelayedPackDialogBT.java
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 );
}
}

0 comments on commit b215032

Please sign in to comment.