javax.swing.JSplitPane.getSize()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中javax.swing.JSplitPane.getSize()方法的一些代码示例,展示了JSplitPane.getSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSplitPane.getSize()方法的具体详情如下:
包路径:javax.swing.JSplitPane
类名称:JSplitPane
方法名:getSize

JSplitPane.getSize介绍

暂无

代码示例

代码示例来源:origin: magefree/mage

@Override
  public void actionPerformed(ActionEvent actionEvent) {
    imagePanelState = !imagePanelState;
    if (!imagePanelState) {
      jSplitPane0.resetToPreferredSizes();
      jSplitPane0.setDividerLocation(jSplitPane0.getSize().width - jSplitPane0.getInsets().right - jSplitPane0.getDividerSize() - 260);
    } else {
      jSplitPane0.setDividerLocation(1.0);
    }
  }
});

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

private int getDividerLocation(int wantedBottomComponentHeight, JSplitPane splitPn)
  {
   int splitBarSize =
     splitPn.getSize().height -
     splitPn.getBottomComponent().getSize().height -
     splitPn.getTopComponent().getSize().height - 1;

   int divLoc = splitPn.getSize().height - wantedBottomComponentHeight - splitBarSize;
   return divLoc;
  }
}

代码示例来源:origin: realXuJiang/bigtable-sql

private int getDividerLocation(int wantedBottomComponentHeight, JSplitPane splitPn)
  {
   int splitBarSize =
     splitPn.getSize().height -
     splitPn.getBottomComponent().getSize().height -
     splitPn.getTopComponent().getSize().height - 1;

   int divLoc = splitPn.getSize().height - wantedBottomComponentHeight - splitBarSize;
   return divLoc;
  }
}

代码示例来源:origin: org.activecomponents.jadex/jadex-commons-gui

/**
 *  Get the proportional split location.
 */
public static double getProportionalDividerLocation(JSplitPane pane)
{
  double full = pane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT? pane.getSize().getWidth(): pane.getSize().getHeight();
  double ret = ((double)pane.getDividerLocation())/full;
  return ret;
}

代码示例来源:origin: girtel/Net2Plan

@Override
  public void propertyChange(PropertyChangeEvent changeEvent) {
    JSplitPane src = (JSplitPane) changeEvent.getSource();
    String propertyName = changeEvent.getPropertyName();
    if (propertyName.equals(JSplitPane.LAST_DIVIDER_LOCATION_PROPERTY)) {
      if (src.getOrientation() == JSplitPane.HORIZONTAL_SPLIT)
        src.setResizeWeight(src.getDividerLocation() / src.getSize().getWidth());
      else
        src.setResizeWeight(src.getDividerLocation() / src.getSize().getHeight());
    }
  }
}

代码示例来源:origin: net.sourceforge.jadex/jadex-tools-comanalyzer

public void run()
  {
    double mainWidth = main.getSize().getWidth();
    double optionsWidth = options.getPreferredSize().getWidth();
    // consider scrollbar width if visible
    double scrollWidth = options.getVerticalScrollBar().isVisible() ? options.getVerticalScrollBar().getWidth() : 0;
    double	loc	= (mainWidth - optionsWidth - scrollWidth) / mainWidth;
    if(loc>=0 && loc<=1)	// Might be NaN, if plugin is switched before panel is shown.
      main.setDividerLocation(loc);
  }
});

代码示例来源:origin: MegaMek/mekhq

@Override
  public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() == 2) {
      if ((splitUnit.getSize().width - splitUnit.getDividerLocation() + splitUnit
          .getDividerSize()) < HangarTab.UNIT_VIEW_WIDTH) {
        // expand
        splitUnit.resetToPreferredSizes();
      } else {
        // collapse
        splitUnit.setDividerLocation(1.0);
      }
    }
  }            
});

代码示例来源:origin: javax.help/javahelp

public void run() {
    // The first time, arrange for the split size...
    // This should be customizable
    // setting a ratio at this point doesn't really work.
    // instead we will set the point based on the ratio and the
    // preferred sizes
    if (dividerLocation == 0d) {
      Dimension dem = splitPane.getSize();
      // if there is a size then perform the estimate
      // otherwise use the default sizes
      if (dem.width != 0) {
        splitPane.setDividerLocation((int)
        ((double)(dem.width -
        splitPane.getDividerSize())
        * dividerLocationRatio));
      }
      dividerLocation = splitPane.getDividerLocation();
    }
  }
});

代码示例来源:origin: MegaMek/mekhq

@Override
  public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() == 2) {
      if ((splitPersonnel.getSize().width
          - splitPersonnel.getDividerLocation() + splitPersonnel
            .getDividerSize()) < PersonnelTab.PERSONNEL_VIEW_WIDTH) {
        // expand
        splitPersonnel.resetToPreferredSizes();
      } else {
        // collapse
        splitPersonnel.setDividerLocation(1.0);
      }
    }
  }            
});

代码示例来源:origin: org.codehaus.jtstand/jtstand-ui

public static int getPref(JSplitPane jSplitPane) {
  if (jSplitPane == null) {
    return 0;
  }
  Component c = jSplitPane.getTopComponent();
  if (c == null || c.getPreferredSize() == null) {
    if (jSplitPane.getSize() != null) {
      return jSplitPane.getSize().height;
    } else {
      return 0;
    }
  }
  if (JScrollPane.class.isAssignableFrom(c.getClass())) {
    JScrollBar jsb = ((JScrollPane) c).getHorizontalScrollBar();
    if (jsb.isShowing()) {
      return jsb.getSize().height + c.getPreferredSize().height + jSplitPane.getInsets().top;
    }
  }
  return c.getPreferredSize().height + jSplitPane.getInsets().top;
}

代码示例来源:origin: realXuJiang/bigtable-sql

int dividerLoc;	
final Dimension parentDim = _splitPane.getSize();

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

int dividerLoc;	
final Dimension parentDim = _splitPane.getSize();

代码示例来源:origin: joel-costigliola/assertj-swing

@RunsInCurrentThread
private int calculateMaximum(@Nonnull JSplitPane splitPane) {
 Component rightComponent = splitPane.getRightComponent();
 if (splitPane.getLeftComponent() == null || rightComponent == null) {
  return -1; // Don't allow dragging.
 }
 Insets insets = splitPane.getInsets();
 int dividerSize = splitPane.getDividerSize();
 int bottom = (insets != null) ? insets.bottom : 0;
 int splitPaneHeight = splitPane.getSize().height;
 if (!rightComponent.isVisible()) {
  return max(0, splitPaneHeight - (dividerSize + bottom));
 }
 return max(0, splitPaneHeight - (dividerSize + bottom) - rightComponent.getMinimumSize().height);
}

代码示例来源:origin: joel-costigliola/assertj-swing

@RunsInCurrentThread
private int calculateMaximum(@Nonnull JSplitPane splitPane) {
 Component rightComponent = splitPane.getRightComponent();
 if (splitPane.getLeftComponent() == null || rightComponent == null) {
  return -1; // Don't allow dragging.
 }
 Insets insets = splitPane.getInsets();
 int dividerSize = splitPane.getDividerSize();
 int right = (insets != null) ? insets.right : 0;
 int splitPaneWidth = splitPane.getSize().width;
 if (!rightComponent.isVisible()) {
  return max(0, splitPaneWidth - (dividerSize + right));
 }
 return max(0, splitPaneWidth - (dividerSize + right) - rightComponent.getMinimumSize().width);
}

代码示例来源:origin: org.cytoscape/swing-application-impl

width = EAST_MIN_WIDTH;
jsp.setDividerLocation(jsp.getSize().width
            -jsp.getInsets().right
            -jsp.getInsets().left

代码示例来源:origin: cytoscape/application

else if (width < EAST_MIN_WIDTH)
  width = EAST_MIN_WIDTH;
jsp.setDividerLocation(jsp.getSize().width
            -jsp.getInsets().right
            -jsp.getInsets().left

代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui

this.leftSplitPane.setResizeWeight(0.5);
this.rightSplitPane.setDividerLocation(this.rightSplitPane.getSize().height - portViewHight);

代码示例来源:origin: openstreetmap/osmembrane

splitMain.setDividerLocation(splitMain.getSize().width
    - splitMain.getInsets().right - splitMain.getDividerSize()
    - 384);

相关文章

JSplitPane类方法