kg.apc.jmeter.gui.JAbsrtactDialogPanel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmeter-plugins-cmn-jmeter Show documentation
Show all versions of jmeter-plugins-cmn-jmeter Show documentation
Various utility classes to ease development of plugins
The newest version!
package kg.apc.jmeter.gui;
import java.awt.Dimension;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public abstract class JAbsrtactDialogPanel extends JPanel{
private int minWidth = 0;
public int getMinWidth() {
return minWidth;
}
public void setMinWidth(int minWidth) {
this.minWidth = minWidth;
}
protected void repack() {
JDialog dlgParent = getAssociatedDialog();
if(dlgParent != null) {
Dimension newSize = dlgParent.getPreferredSize();
if(newSize.width < minWidth) {
newSize.width = minWidth;
}
dlgParent.setSize(newSize);
dlgParent.validate();
}
}
protected JDialog getAssociatedDialog() {
return (JDialog)SwingUtilities.getWindowAncestor(this);
}
}