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

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

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

JToolBar.getMargin介绍

暂无

代码示例

代码示例来源:origin: com.jidesoft/jide-oss

public Insets getBorderInsets(Component c, Insets insets) {
    Insets margin = null;
    //
    // Ideally we'd have an interface defined for classes which
    // support margins (to avoid this hackery), but we've
    // decided against it for simplicity
    //
    if (c instanceof AbstractButton) {
      margin = ((AbstractButton) c).getMargin();
    }
    else if (c instanceof JToolBar) {
      margin = ((JToolBar) c).getMargin();
    }
    else if (c instanceof JTextComponent) {
      margin = ((JTextComponent) c).getMargin();
    }
    insets.top = (margin != null ? margin.top : 0) + thickness;
    insets.left = (margin != null ? margin.left : 0) + thickness;
    insets.bottom = (margin != null ? margin.bottom : 0) + thickness;
    insets.right = (margin != null ? margin.right : 0) + thickness;
    return insets;
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

public Insets getBorderInsets(Component c) {
  Insets insets = new Insets(2, 2, 2, 2);
  if (((JToolBar) c).isFloatable()) {
    if (((JToolBar) c).getOrientation() == HORIZONTAL) {
      if (JTattooUtilities.isLeftToRight(c)) {
        insets.left = 15;
      } else {
        insets.right = 15;
      }
    } else {
      insets.top = 15;
    }
  }
  Insets margin = ((JToolBar) c).getMargin();
  if (margin != null) {
    insets.left += margin.left;
    insets.top += margin.top;
    insets.right += margin.right;
    insets.bottom += margin.bottom;
  }
  return insets;
}

代码示例来源:origin: com.jtattoo/JTattoo

public Insets getBorderInsets(Component c) {
  Insets insets = new Insets(2, 2, 2, 2);
  if (((JToolBar) c).isFloatable()) {
    if (((JToolBar) c).getOrientation() == HORIZONTAL) {
      if (JTattooUtilities.isLeftToRight(c)) {
        insets.left = 15;
      } else {
        insets.right = 15;
      }
    } else {
      insets.top = 15;
    }
  }
  Insets margin = ((JToolBar) c).getMargin();
  if (margin != null) {
    insets.left += margin.left;
    insets.top += margin.top;
    insets.right += margin.right;
    insets.bottom += margin.bottom;
  }
  return insets;
}

代码示例来源:origin: com.jtattoo/JTattoo

public Insets getBorderInsets(Component c) {
  Insets insets = new Insets(2, 2, 2, 2);
  if (((JToolBar) c).isFloatable()) {
    if (((JToolBar) c).getOrientation() == HORIZONTAL) {
      if (JTattooUtilities.isLeftToRight(c)) {
        insets.left = 15;
      } else {
        insets.right = 15;
      }
    } else {
      insets.top = 15;
    }
  }
  Insets margin = ((JToolBar) c).getMargin();
  if (margin != null) {
    insets.left += margin.left;
    insets.top += margin.top;
    insets.right += margin.right;
    insets.bottom += margin.bottom;
  }
  return insets;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-terminal-nb

private void fixSize(JToolBar actionBar) {
  Insets ins = actionBar.getMargin();
  JButton dummy = new JButton();
  dummy.setBorderPainted(false);
  dummy.setOpaque(false);
  dummy.setText(null);
  dummy.setIcon(new Icon() {
  @Override
    public int getIconHeight() {
      return 16;
    }
  @Override
    public int getIconWidth() {
      return 16;
    }
    @SuppressWarnings(value = "empty-statement")
  @Override
    public void paintIcon(Component c, Graphics g, int x, int y) {
      ;
    }
  });
  actionBar.add(dummy);
  Dimension buttonPref = dummy.getPreferredSize();
  Dimension minDim = new Dimension(buttonPref.width + ins.left + ins.right, buttonPref.height + ins.top + ins.bottom);
  actionBar.setMinimumSize(minDim);
  actionBar.setPreferredSize(minDim);
  actionBar.remove(dummy);
}

代码示例来源:origin: com.jidesoft/jide-oss

margin = ((JToolBar) c).getMargin();

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

margin = ((JTextComponent) c).getMargin();
} else if (region == Region.TOOL_BAR && (c instanceof JToolBar)) {
  margin = ((JToolBar) c).getMargin();
} else if (region == Region.MENU_BAR && (c instanceof JMenuBar)) {
  margin = ((JMenuBar) c).getMargin();

代码示例来源:origin: net.sf.nimrod/nimrod-laf

public Insets getBorderInsets( Component c, Insets ins) {
  ins.top = ins.left = ins.bottom = ins.right = 3;
  if ( ((JToolBar)c).isFloatable() ) {
   if ( ((JToolBar)c).getOrientation() == HORIZONTAL ) {
    if (c.getComponentOrientation().isLeftToRight()) {
      ins.left += bumpWidth;
    } else {
      ins.right += bumpWidth;
    }
   } else {// vertical
    ins.top += bumpWidth;
   }
  }
  Insets margin = ((JToolBar)c).getMargin();
  if ( margin != null ) {
   ins.left   += margin.left;
   ins.top    += margin.top;
   ins.right  += margin.right;
   ins.bottom += margin.bottom;
  }
  return ins;
 }
}

代码示例来源:origin: net.sf.tinylaf/tinylaf

public Insets getBorderInsets(Component c, Insets newInsets) {
  newInsets.top = newInsets.left = newInsets.bottom = newInsets.right = 2;
  
  // we cannot assume that c is a JToolBar
  if(!(c instanceof JToolBar)) return newInsets;
  if(((JToolBar)c).isFloatable()) {
    if(((JToolBar)c).getOrientation() == HORIZONTAL) {
      if(c.getComponentOrientation().isLeftToRight()) {
        newInsets.left = TinyToolBarUI.FLOATABLE_GRIP_SIZE + 2;
      } else {
        newInsets.right = TinyToolBarUI.FLOATABLE_GRIP_SIZE + 2;
      }
    } else { // vertical
      newInsets.top = TinyToolBarUI.FLOATABLE_GRIP_SIZE + 2;
    }
  }
  Insets margin = ((JToolBar)c).getMargin();
  if(margin != null) {
    newInsets.left += margin.left;
    newInsets.top += margin.top;
    newInsets.right += margin.right;
    newInsets.bottom += margin.bottom;
  }
  return newInsets;
}

代码示例来源:origin: com.github.arnabk/pgslookandfeel

public Insets getBorderInsets(Component c, Insets newInsets) {
    newInsets.left = 2;
    newInsets.top = 1;
    newInsets.bottom = 2;
    newInsets.right = 2;
    if (((JToolBar) c).isFloatable()) {
      if (((JToolBar) c).getOrientation() == HORIZONTAL) {
        if (c.getComponentOrientation().isLeftToRight()) {
          newInsets.left = 16;
        } else {
          newInsets.right = 16;
        }
      } else {
        newInsets.top = 16;
      }
    }
    Insets margin = ((JToolBar) c).getMargin();
    if (margin != null) {
      newInsets.left += margin.left;
      newInsets.top += margin.top;
      newInsets.right += margin.right;
      newInsets.bottom += margin.bottom;
    }
    return newInsets;
  }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

public Insets getBorderInsets( Component c, Insets insets )
 {
  Insets margin = null;
  if( c instanceof AbstractButton )
  {
   margin = ((AbstractButton)c).getMargin();
  }
  else if( c instanceof JToolBar )
  {
   margin = ((JToolBar)c).getMargin();
  }
  else if( c instanceof JTextComponent )
  {
   margin = ((JTextComponent)c).getMargin();
  }
  else if( c instanceof JComboBox )
  {
   margin = ((JTextField)((JComboBox)c).getEditor().getEditorComponent()).getMargin();
  }
  insets.top = (margin != null ? margin.top : 0) + thickness;
  insets.left = (margin != null ? margin.left : 0) + thickness;
  insets.bottom = (margin != null ? margin.bottom : 0) + thickness;
  insets.right = (margin != null ? margin.right : 0) + thickness;
  return insets;
 }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

public Insets getBorderInsets( Component c, Insets insets )
 {
  Insets margin = null;
  if( c instanceof AbstractButton )
  {
   margin = ((AbstractButton)c).getMargin();
  }
  else if( c instanceof JToolBar )
  {
   margin = ((JToolBar)c).getMargin();
  }
  else if( c instanceof JTextComponent )
  {
   margin = ((JTextComponent)c).getMargin();
  }
  else if( c instanceof JComboBox )
  {
   margin = getBorderInsets( ((JComboBox)c).getEditor().getEditorComponent() );
  }
  insets.top = (margin != null ? margin.top : 0) + thickness;
  insets.left = (margin != null ? margin.left : 0) + thickness;
  insets.bottom = (margin != null ? margin.bottom : 0) + thickness;
  insets.right = (margin != null ? margin.right : 0) + thickness;
  return insets;
 }
}

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

Insets margin = toolbar.getMargin();

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

Insets margin = toolbar.getMargin();

相关文章

JToolBar类方法