private Window updateMaskAndAlpha(Window window) {
    if (window == null) return window;

    final WindowManagerEx wndManager = getWndManager();
    if (wndManager == null) return window;

    if (!wndManager.isAlphaModeEnabled(window)) return window;

    if (myAlpha != myLastAlpha) {
      wndManager.setAlphaModeRatio(window, myAlpha);
      myLastAlpha = myAlpha;
    }

    if (myMaskProvider != null) {
      final Dimension size = window.getSize();
      Shape mask = myMaskProvider.getMask(size);
      wndManager.setWindowMask(window, mask);
    }

    WindowManagerEx.WindowShadowMode mode =
        myShadowed
            ? WindowManagerEx.WindowShadowMode.NORMAL
            : WindowManagerEx.WindowShadowMode.DISABLED;
    WindowManagerEx.getInstanceEx().setWindowShadow(window, mode);

    return window;
  }
 @Override
 public Dimension getSize() {
   if (myPopup != null) {
     final Window popupWindow = SwingUtilities.windowForComponent(myContent);
     return popupWindow.getSize();
   } else {
     return myForcedSize;
   }
 }
Esempio n. 3
0
 void saveWindowLocations() {
   Window win = WindowManager.getWindow("B&C");
   if (win != null) Prefs.saveLocation(ContrastAdjuster.LOC_KEY, win.getLocation());
   win = WindowManager.getWindow("Threshold");
   if (win != null) Prefs.saveLocation(ThresholdAdjuster.LOC_KEY, win.getLocation());
   win = WindowManager.getWindow("Results");
   if (win != null) {
     Prefs.saveLocation(TextWindow.LOC_KEY, win.getLocation());
     Dimension d = win.getSize();
     Prefs.set(TextWindow.WIDTH_KEY, d.width);
     Prefs.set(TextWindow.HEIGHT_KEY, d.height);
   }
   win = WindowManager.getWindow("Log");
   if (win != null) {
     Prefs.saveLocation(TextWindow.LOG_LOC_KEY, win.getLocation());
     Dimension d = win.getSize();
     Prefs.set(TextWindow.LOG_WIDTH_KEY, d.width);
     Prefs.set(TextWindow.LOG_HEIGHT_KEY, d.height);
   }
   win = WindowManager.getWindow("ROI Manager");
   if (win != null) Prefs.saveLocation(RoiManager.LOC_KEY, win.getLocation());
 }
 public void setUiVisible(final boolean visible) {
   if (myPopup != null) {
     if (visible) {
       myPopup.show();
       final Window window = getPopupWindow();
       if (window != null && myRestoreWindowSize != null) {
         window.setSize(myRestoreWindowSize);
         myRestoreWindowSize = null;
       }
     } else {
       final Window window = getPopupWindow();
       if (window != null) {
         myRestoreWindowSize = window.getSize();
         window.setVisible(true);
       }
     }
   }
 }
Esempio n. 5
0
 /** Centre a Window on the screen */
 public static void centre(Window w) {
   Dimension us = w.getSize(), them = Toolkit.getDefaultToolkit().getScreenSize();
   int newX = (them.width - us.width) / 2;
   int newY = (them.height - us.height) / 2;
   w.setLocation(newX, newY);
 }
Esempio n. 6
0
 public static void center(Window w) {
   Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
   Dimension windowSize = w.getSize();
   w.setLocation(
       (screenSize.width - windowSize.width) / 2, (screenSize.height - windowSize.height) / 2);
 }