javax.swing.JToolBar.getInsets()方法的使用及代码示例

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

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

JToolBar.getInsets介绍

暂无

代码示例

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

public Point getPoint(Component c) {
    JToolBar bar = (JToolBar)c;
    Insets insets = bar.getInsets();
    int x, y;
    if (Math.max(Math.max(Math.max(insets.left, insets.top), 
               insets.right), insets.bottom) == insets.left){
      x = insets.left/2;
      y = c.getHeight()/2;
    }
    else if (Math.max(Math.max(insets.top, insets.right), 
             insets.bottom) == insets.top) {
      x = c.getWidth()/2;
      y = insets.top/2;
    }
    else if (Math.max(insets.right, insets.bottom) == insets.right) {
      x = c.getWidth() - insets.right/2;
      y = c.getHeight()/2;
    }
    else {
      x = c.getWidth()/2;
      y = c.getHeight() - insets.bottom/2;
    }
    return new Point(x, y);
  }
}

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

/**
 * <p>
 * Returns the point where to grab the given {@code JToolBar}.
 * </p>
 * 
 * <p>
 * <b>Note:</b> This method is accessed in the current executing thread. Such thread may or may not be the event
 * dispatch thread (EDT). Client code must call this method from the EDT.
 * </p>
 * 
 * @param toolBar the target {@code JToolBar}.
 * @return the point where to grab the given {@code JToolBar}.
 */
@RunsInCurrentThread
@Nonnull public Point pointToGrab(@Nonnull JToolBar toolBar) {
 Insets insets = toolBar.getInsets();
 int width = toolBar.getWidth();
 int height = toolBar.getHeight();
 if (max(max(max(insets.left, insets.top), insets.right), insets.bottom) == insets.left) {
  return new Point(insets.left / 2, height / 2);
 }
 if (max(max(insets.top, insets.right), insets.bottom) == insets.top) {
  return new Point(width / 2, insets.top / 2);
 }
 if (max(insets.right, insets.bottom) == insets.right) {
  return new Point(width - insets.right / 2, height / 2);
 }
 return new Point(width / 2, height - insets.bottom / 2);
}

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

public Dimension preferredLayoutSize(Container parent) {
  JToolBar tb = (JToolBar) parent;
  Insets insets = tb.getInsets();
  Dimension dim = new Dimension();
  SeaGlassContext context = getContext(tb);

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

public Dimension minimumLayoutSize(Container parent) {
  JToolBar tb = (JToolBar) parent;
  Insets insets = tb.getInsets();
  Dimension dim = new Dimension();
  SeaGlassContext context = getContext(tb);

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

public void layoutContainer(Container parent) {
  JToolBar tb = (JToolBar) parent;
  Insets insets = tb.getInsets();
  boolean ltr = tb.getComponentOrientation().isLeftToRight();
  SeaGlassContext context = getContext(tb);

相关文章

JToolBar类方法