This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 187608
Collapse All | Expand All

(-)a/projectuiapi/src/org/netbeans/modules/project/uiapi/CustomizerDialog.java (-2 / +20 lines)
Lines 44-52 Link Here
44
44
45
package org.netbeans.modules.project.uiapi;
45
package org.netbeans.modules.project.uiapi;
46
46
47
import com.sun.awt.AWTUtilities;
47
import java.awt.Dialog;
48
import java.awt.Dialog;
48
import java.awt.Dimension;
49
import java.awt.Dimension;
49
import java.awt.Frame;
50
import java.awt.Frame;
51
import java.awt.GraphicsConfiguration;
50
import java.awt.Rectangle;
52
import java.awt.Rectangle;
51
import java.awt.event.ActionEvent;
53
import java.awt.event.ActionEvent;
52
import java.awt.event.ActionListener;
54
import java.awt.event.ActionListener;
Lines 163-180 Link Here
163
        int dialogWidth = prefs.getInt(CUSTOMIZER_DIALOG_WIDTH, 0);
165
        int dialogWidth = prefs.getInt(CUSTOMIZER_DIALOG_WIDTH, 0);
164
        int dialogHeight = prefs.getInt(CUSTOMIZER_DIALOG_HEIGHT, 0);
166
        int dialogHeight = prefs.getInt(CUSTOMIZER_DIALOG_HEIGHT, 0);
165
        if ((dialogWidth != 0) && (dialogHeight != 0)) {
167
        if ((dialogWidth != 0) && (dialogHeight != 0)) {
168
169
            GraphicsConfiguration gf = WindowManager.getDefault().getMainWindow().getGraphicsConfiguration();
170
            Rectangle gbounds = gf.getBounds();
171
166
            //Check bounds if saved size is bigger than size of current display, dialog should use the same display
172
            //Check bounds if saved size is bigger than size of current display, dialog should use the same display
167
            //as main window
173
            //as main window
168
            int maxWidth = WindowManager.getDefault().getMainWindow().getGraphicsConfiguration().getBounds().width;
174
            int maxWidth = gbounds.width;
169
            if (dialogWidth > maxWidth) {
175
            if (dialogWidth > maxWidth) {
170
                dialogWidth = maxWidth * 3 / 4;
176
                dialogWidth = maxWidth * 3 / 4;
171
            }
177
            }
172
            int maxHeight = WindowManager.getDefault().getMainWindow().getGraphicsConfiguration().getBounds().height;
178
            int maxHeight = gbounds.height;
173
            if (dialogHeight > maxHeight) {
179
            if (dialogHeight > maxHeight) {
174
                dialogHeight = maxHeight * 3 / 4;
180
                dialogHeight = maxHeight * 3 / 4;
175
            }
181
            }
176
182
183
            int minx = gbounds.x;
184
            int maxx = minx + gbounds.width;
185
            int miny = gbounds.y;
186
            int maxy = miny + gbounds.height;
187
177
            dialog.setBounds(dialogX, dialogY, dialogWidth, dialogHeight);
188
            dialog.setBounds(dialogX, dialogY, dialogWidth, dialogHeight);
189
190
            //make sure the dialog remains in some visible area of the screen
191
            //see issue http://netbeans.org/bugzilla/show_bug.cgi?id=187608
192
            //issue 187608
193
            if(dialogX < minx || dialogX > maxx || dialogY < miny || dialogY > maxy){
194
                dialog.setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
195
            }
178
        }
196
        }
179
197
180
        dialog.addWindowListener(new WindowAdapter() {
198
        dialog.addWindowListener(new WindowAdapter() {

Return to bug 187608