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

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

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

JSplitPane.getWidth介绍

暂无

代码示例

代码示例来源:origin: nz.ac.waikato.cms.moa/moa

private void UpdateSplitVisualDivider() {
  if(splitVisual != null)
    splitVisual.setDividerLocation(splitVisual.getWidth()/2);
}

代码示例来源:origin: nz.ac.waikato.cms.moa/moa

@Override
public void repaint() {
  if(splitVisual!=null)
    splitVisual.setDividerLocation(splitVisual.getWidth()/2);
  super.repaint();
}

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

@Override
public void componentShown(ComponentEvent ce) {
  jSplitPane1.setDividerLocation(jSplitPane1.getWidth()-300);
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = WIDTH_JSDOC)
@Override
public int getWidth() {
  return super.getWidth();
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

public void setDividerLocation(double proportionalLocation) {
  myBrowserSplitPane.setDividerLocation(Math.max((int) ((double) (myBrowserSplitPane.getWidth() - myBrowserSplitPane.getDividerSize()) * proportionalLocation), 100));
  invalidate();
}

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

@RunsInCurrentThread
@Nonnull private static GenericRange<Point> whereToMoveDividerVertically(@Nonnull JSplitPane splitPane, int location) {
 int x = splitPane.getWidth() / 2;
 int dividerLocation = splitPane.getDividerLocation();
 return new GenericRange<Point>(new Point(x, dividerLocation), new Point(x, location));
}

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

public void run()
  {
    double mainWidth = main.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: net.sourceforge.jadex/jadex-tools-comanalyzer

public void run()
  {
    double mainWidth = main.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: de.richtercloud/flexdock-core

public static int getSplitPaneSize(JSplitPane splitPane) {
  if(splitPane==null) {
    return 0;
  }
  boolean horiz = splitPane.getOrientation()==JSplitPane.HORIZONTAL_SPLIT? true: false;
  return horiz? splitPane.getWidth(): splitPane.getHeight();
}

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

private void onCreateBarChart()
{
 if(_overviewPanel.btnCreateBarChart.isSelected())
 {
   _overviewPanel.split.setDividerSize(_overviewPanel.standardDividerSize);
   int distToRight = Preferences.userRoot().getInt(PREF_KEY_CHART_PANEL_SPLIT, Math.max(0, _overviewPanel.split.getWidth() - _chartConfigController.getPanel().getPreferredSize().width));
   _overviewPanel.split.setDividerLocation(_overviewPanel.split.getWidth() - distToRight);
 }
 else
 {
   int distToRight = _overviewPanel.split.getWidth() - _overviewPanel.split.getDividerLocation();
   Preferences.userRoot().putInt(PREF_KEY_CHART_PANEL_SPLIT, distToRight);
   _overviewPanel.split.setDividerSize(0);
   _overviewPanel.split.setDividerLocation(Integer.MAX_VALUE);
 }
}

代码示例来源:origin: nativelibs4java/JNAerator

void switchOrientation() {
  boolean hor = sp.getOrientation() == JSplitPane.HORIZONTAL_SPLIT;
  int l = sp.getDividerLocation(), d = hor ? sp.getWidth() : sp.getHeight();
  sp.setOrientation(hor ? JSplitPane.VERTICAL_SPLIT : JSplitPane.HORIZONTAL_SPLIT);
  if (d != 0) {
    sp.setDividerLocation(l / (double) d);
  }
}
Action switchOrientationAction = new AbstractAction("Switch Orientation") {

代码示例来源:origin: com.nativelibs4java/jnaerator

void switchOrientation() {
  boolean hor = sp.getOrientation() == JSplitPane.HORIZONTAL_SPLIT;
  int l = sp.getDividerLocation(), d = hor ? sp.getWidth() : sp.getHeight();
  sp.setOrientation(hor ? JSplitPane.VERTICAL_SPLIT : JSplitPane.HORIZONTAL_SPLIT);
  if (d != 0) {
    sp.setDividerLocation(l / (double) d);
  }
}
Action switchOrientationAction = new AbstractAction("Switch Orientation") {

代码示例来源:origin: protegeproject/protege

public void splitVertically(View bottomView) {
  bottomView.setSyncronizing(false);
  JSplitPane sp = createSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  View view = (View) getComponent(0);
  remove(view);
  add(sp);
  validate();
  sp.setLeftComponent(new ViewContainer(view));
  sp.setRightComponent(new ViewContainer(bottomView));
  sp.setDividerLocation(sp.getWidth() / 2);
}

代码示例来源:origin: nativelibs4java/JNAerator

protected static double getProportionalDividerLocation(JSplitPane sp) {
    boolean hor = sp.getOrientation() == JSplitPane.HORIZONTAL_SPLIT;
    int l = sp.getDividerLocation(), d = hor ? sp.getWidth() : sp.getHeight();
    sp.setOrientation(hor ? JSplitPane.VERTICAL_SPLIT : JSplitPane.HORIZONTAL_SPLIT);
    return d != 0 ? l / (double) d : 0.5;
  }
}

代码示例来源:origin: org.protege/protege-editor-core-application

public void splitVertically(View bottomView) {
  bottomView.setSyncronizing(false);
  JSplitPane sp = createSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  View view = (View) getComponent(0);
  remove(view);
  add(sp);
  validate();
  sp.setLeftComponent(new ViewContainer(view));
  sp.setRightComponent(new ViewContainer(bottomView));
  sp.setDividerLocation(sp.getWidth() / 2);
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.core.application

public void splitVertically(View bottomView) {
  bottomView.setSyncronizing(false);
  JSplitPane sp = createSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  View view = (View) getComponent(0);
  remove(view);
  add(sp);
  validate();
  sp.setLeftComponent(new ViewContainer(view));
  sp.setRightComponent(new ViewContainer(bottomView));
  sp.setDividerLocation(sp.getWidth() / 2);
}

代码示例来源:origin: de.richtercloud/flexdock-core

public static float getDividerProportion(JSplitPane splitPane) {
  if(splitPane==null) {
    return 0;
  }
  int size = splitPane.getOrientation()==JSplitPane.HORIZONTAL_SPLIT? splitPane.getWidth(): splitPane.getHeight();
  int divLoc = splitPane.getDividerLocation();
  return size==0? 0: divLoc/((float)size - splitPane.getDividerSize());
}

代码示例来源:origin: com.nativelibs4java/jnaerator

protected static double getProportionalDividerLocation(JSplitPane sp) {
    boolean hor = sp.getOrientation() == JSplitPane.HORIZONTAL_SPLIT;
    int l = sp.getDividerLocation(), d = hor ? sp.getWidth() : sp.getHeight();
    sp.setOrientation(hor ? JSplitPane.VERTICAL_SPLIT : JSplitPane.HORIZONTAL_SPLIT);
    return d != 0 ? l / (double) d : 0.5;
  }
}

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

protected int getSplitDividerLocation() {
  int dividerLocation = 0;
  switch (anchor) {
    case LEFT:
    case TOP:
      dividerLocation = splitPane.getDividerLocation();
      break;
    case RIGHT:
      dividerLocation = splitPane.getWidth() - splitPane.getDividerLocation();
      break;
    case BOTTOM:
      dividerLocation = splitPane.getHeight() - splitPane.getDividerLocation();
  }
  return dividerLocation;
}

代码示例来源:origin: khuxtable/seaglass

public void finishedPaintingChildren(JSplitPane jc, Graphics g) {
    if (jc == splitPane && getLastDragLocation() != -1 && !isContinuousLayout() && !draggingHW) {
      if (jc.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
        paintDragDivider(g, getLastDragLocation(), 0, dividerSize - 1, splitPane.getHeight() - 1);
      } else {
        paintDragDivider(g, 0, getLastDragLocation(), splitPane.getWidth() - 1, dividerSize - 1);
      }
    }
  }
}

相关文章

JSplitPane类方法