javax.swing.JScrollPane.getComponentOrientation()方法的使用及代码示例

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

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

JScrollPane.getComponentOrientation介绍

暂无

代码示例

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

InputMap getInputMap(int condition) {
if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
  InputMap keyMap = (InputMap)UIManager.get("ScrollPane.ancestorInputMap");
  InputMap rtlKeyMap;
  if (scrollpane.getComponentOrientation().isLeftToRight() ||
  ((rtlKeyMap = (InputMap)UIManager.get("ScrollPane.ancestorInputMap.RightToLeft")) == null)) {
  return keyMap;
  } else {
  rtlKeyMap.setParent(keyMap);
  return rtlKeyMap;
  }
}
return null;
}

代码示例来源:origin: com.synaptix/SynaptixSwing

private void scrollEnd(JScrollPane scrollpane) {
  JViewport vp = scrollpane.getViewport();
  Component view;
  if (vp != null && (view = vp.getView()) != null) {
    Rectangle visRect = vp.getViewRect();
    Rectangle bounds = view.getBounds();
    if (scrollpane.getComponentOrientation().isLeftToRight()) {
      vp.setViewPosition(new Point(bounds.width - visRect.width, bounds.height - visRect.height));
    } else {
      vp.setViewPosition(new Point(0, bounds.height - visRect.height));
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void actionPerformed(ActionEvent e) {
  JScrollPane scrollpane = (JScrollPane)e.getSource();
  JViewport vp = scrollpane.getViewport();
  Component view;
  if (vp != null && (view = vp.getView()) != null) {
  if (scrollpane.getComponentOrientation().isLeftToRight()) {
    vp.setViewPosition(new Point(0, 0));
  } else {
    Rectangle visRect = vp.getViewRect();
    Rectangle bounds = view.getBounds();
    vp.setViewPosition(new Point(bounds.width - visRect.width, 0));
  }
  }
}
}

代码示例来源:origin: com.synaptix/SynaptixWidget

protected void updateColumnFooter(PropertyChangeEvent e) {
  JViewport newColFoot = (JViewport) (e.getNewValue());
  if (newColFoot != null) {
    JViewport viewport = scrollpane.getViewport();
    Point p = newColFoot.getViewPosition();
    if (viewport == null) {
      p.x = 0;
    } else {
      if (scrollpane.getComponentOrientation().isLeftToRight()) {
        p.x = viewport.getViewPosition().x;
      } else {
        p.x = Math.max(0, viewport.getViewPosition().x);
      }
    }
    newColFoot.setViewPosition(p);
  }
}

代码示例来源:origin: com.synaptix/SynaptixSwing

private void scrollHome(JScrollPane scrollpane) {
  JViewport vp = scrollpane.getViewport();
  Component view;
  if (vp != null && (view = vp.getView()) != null) {
    if (scrollpane.getComponentOrientation().isLeftToRight()) {
      vp.setViewPosition(new Point(0, 0));
    } else {
      Rectangle visRect = vp.getViewRect();
      Rectangle bounds = view.getBounds();
      vp.setViewPosition(new Point(bounds.width - visRect.width, 0));
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void actionPerformed(ActionEvent e) {
  JScrollPane scrollpane = (JScrollPane)e.getSource();
  JViewport vp = scrollpane.getViewport();
  Component view;
  if (vp != null && (view = vp.getView()) != null) {
  Rectangle visRect = vp.getViewRect();
  Rectangle bounds = view.getBounds();
  if (scrollpane.getComponentOrientation().isLeftToRight()) {
    vp.setViewPosition(new Point(bounds.width - visRect.width,
           bounds.height - visRect.height));
  } else {
    vp.setViewPosition(new Point(0, 
           bounds.height - visRect.height));
  }
  }
}
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

protected void updateColumnHeader(PropertyChangeEvent e) 
{
JViewport newColHead = (JViewport)(e.getNewValue());
if (newColHead != null) {
  JViewport viewport = scrollpane.getViewport();
  Point p = newColHead.getViewPosition();
  if (viewport == null) {
  p.x = 0;
  } else {
  if (scrollpane.getComponentOrientation().isLeftToRight()) {
    p.x = viewport.getViewPosition().x;
  } else {
    p.x = Math.max(0, viewport.getViewPosition().x);
  }
  }
  newColHead.setViewPosition(p);
  scrollpane.add(newColHead, COLUMN_HEADER);
}
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

protected void updateViewport(PropertyChangeEvent e) 
{
JViewport oldViewport = (JViewport)(e.getOldValue());
JViewport newViewport = (JViewport)(e.getNewValue());
if (oldViewport != null) {
  oldViewport.removeChangeListener(viewportChangeListener);
}

if (newViewport != null) {
  Point p = newViewport.getViewPosition();
  if (scrollpane.getComponentOrientation().isLeftToRight()) {
  p.x = Math.max(p.x, 0);
  } else {
  int max = newViewport.getViewSize().width;
  int extent = newViewport.getExtentSize().width;
  if (extent > max) {
    p.x = max - extent;
  } else {
    p.x = Math.max(0, Math.min(max - extent, p.x));
  }
  }
  p.y = Math.max(p.y, 0);
  newViewport.setViewPosition(p);
  newViewport.addChangeListener(viewportChangeListener);
}
}

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

boolean ltr = scrollpane.getComponentOrientation().isLeftToRight();
if (!ltr) {
  translateX = 15 + insets.right;

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

("UnitScrollDown", SwingConstants.VERTICAL, 1, false));
if (scrollpane.getComponentOrientation().isLeftToRight()) {
  map.put("scrollLeft", new ScrollAction("scrollLeft",
       SwingConstants.HORIZONTAL, -1, true));

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

Point p = viewport.getViewPosition();
int value = model.getValue();
if (scrollpane.getComponentOrientation().isLeftToRight()) {
  p.x = value;
} else {

代码示例来源:origin: com.synaptix/SynaptixTattoo

if (scroller != null && scroller.getComponentOrientation() != o) {
  scroller.setComponentOrientation(o);

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

Point p = viewport.getViewPosition();
int value = model.getValue();
if (scrollpane.getComponentOrientation().isLeftToRight()) {
  p.x = value;
} else {

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

void installOnScrollPane(JScrollPane aScrollPane) {
  if (theScrollPane != null)
    uninstallFromScrollPane();
  theScrollPane = aScrollPane;
  theFormerLayoutManager = theScrollPane.getLayout();
  theScrollPane.setLayout(new TweakedScrollPaneLayout());
  theScrollPane.firePropertyChange("layoutManager", false, true);
  theScrollPane.addPropertyChangeListener(COMPONENT_ORIENTATION,
      propertyChangeListener);
  theScrollPane.getViewport().addContainerListener(
      theViewPortViewListener);
  theScrollPane.setCorner(JScrollPane.LOWER_TRAILING_CORNER, theButton);
  Component comp = theScrollPane.getViewport().getView();
  theComponent = (comp instanceof JComponent) ? (JComponent) comp : null;
  this.theButton.setIcon(LafWidgetRepository.getRepository()
      .getLafSupport().getSearchIcon(
          UIManager.getInt("ScrollBar.width") - 3,
          theScrollPane.getComponentOrientation()));
  theScrollPane.doLayout();
}

代码示例来源:origin: com.synaptix/SynaptixWidget

@Override
protected void syncScrollPaneWithViewport() {
  super.syncScrollPaneWithViewport();
  JXYTableScrollPane xyTableScrollPane = (JXYTableScrollPane) scrollpane;
  JViewport viewport = scrollpane.getViewport();
  JViewport rowFoot = xyTableScrollPane.getRowFooter();
  JViewport colFoot = xyTableScrollPane.getColumnFooter();
  boolean ltr = scrollpane.getComponentOrientation().isLeftToRight();
  if (rowFoot != null) {
    Point p = rowFoot.getViewPosition();
    p.y = viewport.getViewPosition().y;
    p.x = 0;
    rowFoot.setViewPosition(p);
  }
  if (colFoot != null) {
    Point p = colFoot.getViewPosition();
    if (ltr) {
      p.x = viewport.getViewPosition().x;
    } else {
      p.x = Math.max(0, viewport.getViewPosition().x);
    }
    p.y = 0;
    colFoot.setViewPosition(p);
  }
}

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

JViewport viewport = scrollpane.getViewport();
Point p = viewport.getViewPosition();
if (scrollpane.getComponentOrientation().isLeftToRight()) {
  p.x = hsb.getValue();
} else {

代码示例来源:origin: JetBrains/jediterm

return BOTTOM;
boolean ltr = pane.getComponentOrientation().isLeftToRight();
if (component == pane.getVerticalScrollBar()) {
 return ltr ? RIGHT : LEFT;

代码示例来源:origin: org.java.net.substance/substance

SubstanceTableHeaderUI ui = (SubstanceTableHeaderUI) tableHeaderUI;
JComponent scrollPaneCornerFiller = ui.getScrollPaneCornerFiller();
String cornerKey = scrollpane.getComponentOrientation().isLeftToRight() ? JScrollPane.UPPER_RIGHT_CORNER
    : JScrollPane.UPPER_LEFT_CORNER;
Component cornerComp = scrollpane.getCorner(cornerKey);

代码示例来源:origin: com.github.insubstantial/substance

SubstanceTableHeaderUI ui = (SubstanceTableHeaderUI) tableHeaderUI;
JComponent scrollPaneCornerFiller = ui.getScrollPaneCornerFiller();
String cornerKey = scrollpane.getComponentOrientation().isLeftToRight() ? JScrollPane.UPPER_RIGHT_CORNER
    : JScrollPane.UPPER_LEFT_CORNER;
Component cornerComp = scrollpane.getCorner(cornerKey);

代码示例来源:origin: com.synaptix/SynaptixSwing

@Override
public void actionPerformed(ActionEvent e) {
  JScrollPane scrollPane = (JScrollPane) e.getSource();
  boolean ltr = scrollPane.getComponentOrientation().isLeftToRight();
  String key = getName();
  if (key == SCROLL_UP) {
    scroll(scrollPane, SwingConstants.VERTICAL, -1, true);
  } else if (key == SCROLL_DOWN) {
    scroll(scrollPane, SwingConstants.VERTICAL, 1, true);
  } else if (key == SCROLL_HOME) {
    scrollHome(scrollPane);
  } else if (key == SCROLL_END) {
    scrollEnd(scrollPane);
  } else if (key == UNIT_SCROLL_UP) {
    scroll(scrollPane, SwingConstants.VERTICAL, -1, false);
  } else if (key == UNIT_SCROLL_DOWN) {
    scroll(scrollPane, SwingConstants.VERTICAL, 1, false);
  } else if (key == SCROLL_LEFT) {
    scroll(scrollPane, SwingConstants.HORIZONTAL, ltr ? -1 : 1, true);
  } else if (key == SCROLL_RIGHT) {
    scroll(scrollPane, SwingConstants.HORIZONTAL, ltr ? 1 : -1, true);
  } else if (key == UNIT_SCROLL_LEFT) {
    scroll(scrollPane, SwingConstants.HORIZONTAL, ltr ? -1 : 1, false);
  } else if (key == UNIT_SCROLL_RIGHT) {
    scroll(scrollPane, SwingConstants.HORIZONTAL, ltr ? 1 : -1, false);
  }
}

相关文章

JScrollPane类方法