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

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

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

JSplitPane.getBottomComponent介绍

暂无

代码示例

代码示例来源:origin: nodebox/nodebox

public void close() {
  Container parent = getParent();
  if (!(parent instanceof JSplitPane)) return;
  JSplitPane split = (JSplitPane) parent;
  Component firstComponent = split.getTopComponent();
  Component secondComponent = split.getBottomComponent();
  Component remainingComponent = firstComponent == this ? secondComponent : firstComponent;
  split.setTopComponent(null);
  split.setBottomComponent(null);
  Container grandParent = parent.getParent();
  if (grandParent instanceof JSplitPane) {
    JSplitPane grandSplit = (JSplitPane) grandParent;
    // Remove the split pane.
    if (split == grandSplit.getTopComponent()) {
      grandSplit.setTopComponent(remainingComponent);
    } else {
      grandSplit.setBottomComponent(remainingComponent);
    }
  } else {
    grandParent.remove(parent);
    grandParent.add(remainingComponent);
  }
  grandParent.validate();
}

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

public void actionPerformed(ActionEvent e)
  {
   int msgPanelHeight = _splitPn.getBottomComponent().getSize().height;
   Preferences.userRoot().putInt(PREFS_KEY_MESSAGEPANEL_HEIGHT, msgPanelHeight);
  }
};

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

public void actionPerformed(ActionEvent e)
  {
   int msgPanelHeight = _splitPn.getBottomComponent().getSize().height;
   Preferences.userRoot().putInt(PREFS_KEY_MESSAGEPANEL_HEIGHT, msgPanelHeight);
  }
};

代码示例来源:origin: antlr/antlrworks

private void makeBottomTabVisible() {
  if(horizontalSplit.getBottomComponent().getHeight() == 0) {
    horizontalSplit.setDividerLocation(horizontalSplit.getLastDividerLocation());
  }
}

代码示例来源:origin: cmf/psiviewer

public void showProperties(boolean showProperties)
{
  _splitPane.getBottomComponent().setVisible(showProperties);
  updatePropertySheet();
}

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

private void onModeChanged()
{
 _bottomPanelContainer.removeAll();
 _bottomPanelContainer.add(_modeManager.getBottomPanel());
 _bottomPanelContainer.revalidate();
 _bottomPanelContainer.repaint();
 if (null != _split.getBottomComponent())
 {
   _split.remove(_split.getBottomComponent());
 }
 onHide();
}

代码示例来源: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.netbeans.modules/org-netbeans-lib-profiler-ui

private Component getSecondComponent(JSplitPane splitPane) {
  if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
    return splitPane.getRightComponent();
  } else {
    return splitPane.getBottomComponent();
  }
}

代码示例来源:origin: com.github.tornaia/aott-desktop-client-core

@Override
  public void propertyChange(PropertyChangeEvent evt) {
    int min = jSplitPane.getMinimumDividerLocation();
    int max = jSplitPane.getMaximumDividerLocation();
    int previous = lastDividerLocation.get();
    int actual = jSplitPane.getDividerLocation();
    boolean initial = lastDividerLocation.get() == -1;
    boolean attachToTop = actual < (max - min) * 0.15D && previous > actual;
    boolean attachToBottom = actual > (max - min) * 0.85D && actual > previous;
    boolean detachFromTop = previous == min && actual > previous;
    boolean detachFromBottom = previous == max && actual < previous;
    if (!initial) {
      if (attachToTop) {
        jSplitPane.setDividerLocation(min);
        jSplitPane.getTopComponent().setVisible(false);
      } else if (detachFromTop) {
        jSplitPane.setDividerLocation((int) ((max - min) * 0.15D));
        jSplitPane.getTopComponent().setVisible(true);
      } else if (attachToBottom) {
        jSplitPane.setDividerLocation(max);
        jSplitPane.getBottomComponent().setVisible(false);
      } else if (detachFromBottom) {
        jSplitPane.setDividerLocation((int) ((max - min) * 0.85D));
        jSplitPane.getBottomComponent().setVisible(true);
      }
    }

    lastDividerLocation.set(actual);
  }
}

代码示例来源:origin: edu.stanford.protege/ca.uvic.cs.chisel.cajun

@Override
  public void componentResized(ComponentEvent e) {
    if(getRightPanel().getTopComponent() == null && getRightPanel().getBottomComponent() == null) {
      horizontalSplitPane.setDividerLocation(1.0);
    }
    
    super.componentResized(e);
  }
});

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

@Subscribe
public void handle(OptionsChangedEvent ev) {
  splitScenario.getBottomComponent().setVisible(getCampaignOptions().getUseAtB());
  splitScenario.resetToPreferredSizes();
}

代码示例来源: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: edu.stanford.protege/ca.uvic.cs.chisel.cajun

/**
 * Repaints the this panel so that the right panel will properly resize.
 */
private void refeshRightPanel() {
  this.invalidate();
  this.validate();
  this.repaint();
  if(rightPanel.getTopComponent() == null && rightPanel.getBottomComponent() == null) {
    horizontalSplitPane.setDividerLocation(1.0);
  }
  
  if (rightPanel.getTopComponent() == null || rightPanel.getBottomComponent() == null) {
    rightPanel.setDividerSize(0);
  } else {
    rightPanel.setDividerSize(2);
    rightPanel.setDividerLocation(0.5);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-highlight

@Override
  public void hierarchyChanged(HierarchyEvent e) {
    if ((HierarchyEvent.SHOWING_CHANGED & e.getChangeFlags()) == HierarchyEvent.SHOWING_CHANGED){
      JSplitPane p = (JSplitPane)e.getSource();
      if (show) {
        int l1 = p.getTopComponent().getHeight();
        int l2 = p.getBottomComponent().getHeight();
        if (l1 > 0 && l2 > 0) {
          NbPreferences.forModule(ErrorIncludeDialog.class).putDouble("verticalDivider", ((double)l1)/(l1+l2)); // NOI18N
        }
      } else {
        p.setDividerLocation(NbPreferences.forModule(ErrorIncludeDialog.class).getDouble("verticalDivider", 0.65)); // NOI18N
        show = true;
      }
    }
  }
});

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

public static int dividerChanged(JXTable jTable, JSplitPane jSplitPane) {
    if (jTable == null) {
      return 0;
    }
    if (jSplitPane.getBottomComponent() == null || !jSplitPane.getBottomComponent().isVisible()) {
      return jTable.getVisibleRowCount();
    }
    if (jTable.getRowCount() == 0) {
      return 0;
    }
    int rc = jTable.getRowCount();
    int pref = Util.getPref(jSplitPane);
    int vrc = jTable.getVisibleRowCount();
    int hh = pref - vrc * jTable.getRowHeight();
    int current = jSplitPane.getDividerLocation();
//        System.out.println("hh:" + hh + " current:" + current);
//        int rc = (current - jScrollPaneTop.getInsets().top - hh + jTable.getRowHeight() / 3) / jTable.getRowHeight();
    int cvrc = Math.min(rc, (current - hh + jTable.getRowHeight() / 3) / jTable.getRowHeight());
    if (cvrc == 0) {
      cvrc = 1;
    }
//        System.out.println("current: " + current + " row count: " + rc + " current visible row count: " + vrc + " computed visible row count: " + cvrc + " preferred: " + pref);
    if (cvrc != vrc) {
      Util.setVisibleRowCount(jTable, cvrc, jSplitPane);
    } else {
      Util.setDividerLocation(jSplitPane, jTable);
    }
    return cvrc;
  }

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

private static SplitNode createNode(DockingPort port, JSplitPane split) {
  int orientation = split.getOrientation();
  boolean topLeft = split.getLeftComponent()==port? true: false;
  int region = 0;
  String siblingId = null;
  if(topLeft) {
    region = orientation==JSplitPane.VERTICAL_SPLIT? TOP: LEFT;
    siblingId = getSiblingId(split.getRightComponent());
  } else {
    region = orientation==JSplitPane.VERTICAL_SPLIT? BOTTOM: RIGHT;
    siblingId = getSiblingId(split.getLeftComponent());
  }
  int size = orientation==JSplitPane.VERTICAL_SPLIT? split.getHeight(): split.getWidth();
  int divLoc = split.getDividerLocation();
  int testSize = 0;
  if (orientation == JSplitPane.VERTICAL_SPLIT) {
    testSize += split.getTopComponent().getHeight() + split.getBottomComponent().getHeight() + split.getDividerSize();
  } else {
    testSize += split.getLeftComponent().getWidth() + split.getRightComponent().getWidth() + split.getDividerSize();
  }
  float percentage;
  if (split instanceof DockingSplitPane && ((DockingSplitPane) split).getPercent() != -1) {
    percentage = (float) ((DockingSplitPane) split).getPercent();
  } else {
    percentage = divLoc / (float)size;
  }
  return new SplitNode(orientation, region, percentage, siblingId);
}

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

Util.setVisibleRowCount(jTable, rc, jSplitPane);
if (jSplitPane.getBottomComponent() == null) {
  statsPanel = new StatsPanel(this);
  jSplitPane.setBottomComponent(statsPanel);

代码示例来源:origin: com.fifesoft.rtext/fife.common

case TOP:
  add(collapsedPanel, BorderLayout.NORTH);
  add(splitPane.getBottomComponent());
  break;
case LEFT:

相关文章

JSplitPane类方法