コード例 #1
0
ファイル: DynamicCustomizer.java プロジェクト: Rajmohan/acre
 /**
  * Returns the preferred size of the viewport for a view component. For example the preferredSize
  * of a JList component is the size required to acommodate all of the cells in its list however
  * the value of preferredScrollableViewportSize is the size required for
  * JList.getVisibleRowCount() rows. A component without any properties that would effect the
  * viewport size should just return getPreferredSize() here.
  *
  * @return The preferredSize of a JViewport whose view is this Scrollable.
  * @see JViewport#getPreferredSize
  */
 public Dimension getPreferredScrollableViewportSize() {
   Dimension size = getPreferredSize();
   Dimension retval = new Dimension();
   retval.width = size.width > 600 ? 600 : size.width;
   retval.height = size.height > 400 ? 400 : size.height;
   return retval;
 }
コード例 #2
0
ファイル: Viewport.java プロジェクト: TurboVNC/turbovnc
 public Dimension getBorderSize() {
   if (cc.opts.fullScreen) return new Dimension(0, 0);
   Insets vpInsets = VncViewer.insets;
   Dimension borderSize =
       new Dimension(vpInsets.left + vpInsets.right, vpInsets.top + vpInsets.bottom);
   if (cc.showToolbar) borderSize.height += 22;
   return borderSize;
 }
コード例 #3
0
ファイル: JopSpider.java プロジェクト: jordibrus/proview
 public static void openFrame(Object frame) {
   boolean packFrame = false;
   if (packFrame) {
     ((JFrame) frame).pack();
   } else {
     ((JFrame) frame).validate();
   }
   // Center the window
   Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
   Dimension frameSize = ((JFrame) frame).getSize();
   if (frameSize.height > screenSize.height) {
     frameSize.height = screenSize.height;
   }
   if (frameSize.width > screenSize.width) {
     frameSize.width = screenSize.width;
   }
   ((JFrame) frame)
       .setLocation(
           (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
   ((JFrame) frame).setVisible(true);
 }
コード例 #4
0
ファイル: Viewport.java プロジェクト: TurboVNC/turbovnc
 public Dimension getAvailableSize() {
   Dimension availableSize = getSize();
   if (!cc.opts.fullScreen) {
     Insets vpInsets = VncViewer.insets;
     availableSize.width -= vpInsets.left + vpInsets.right;
     availableSize.height -= vpInsets.top + vpInsets.bottom;
   }
   if (tb.isVisible()) availableSize.height -= tb.getHeight();
   if (availableSize.width < 0) availableSize.width = 0;
   if (availableSize.height < 0) availableSize.height = 0;
   return availableSize;
 }