dialog size fix

This commit is contained in:
fros4943 2007-04-02 10:32:37 +00:00
parent 6e3dc4d24b
commit 0054bab730

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: ProjectDirectoriesDialog.java,v 1.1 2007/03/23 23:34:33 fros4943 Exp $ * $Id: ProjectDirectoriesDialog.java,v 1.2 2007/04/02 10:32:37 fros4943 Exp $
*/ */
package se.sics.cooja.dialogs; package se.sics.cooja.dialogs;
@ -422,6 +422,16 @@ class ConfigViewer extends JDialog {
myDialog.setLocationRelativeTo(parentFrame); myDialog.setLocationRelativeTo(parentFrame);
myDialog.setAlwaysOnTop(true); myDialog.setAlwaysOnTop(true);
Rectangle maxSize = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
if (maxSize != null &&
(myDialog.getSize().getWidth() > maxSize.getWidth()
|| myDialog.getSize().getHeight() > maxSize.getHeight())) {
Dimension newSize = new Dimension();
newSize.height = Math.min((int) maxSize.getHeight(), (int) myDialog.getSize().getHeight());
newSize.width = Math.min((int) maxSize.getWidth(), (int) myDialog.getSize().getWidth());
myDialog.setSize(newSize);
}
if (myDialog != null) { if (myDialog != null) {
myDialog.setVisible(true); myDialog.setVisible(true);
} }