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

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

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

JToolBar.getWidth介绍

暂无

代码示例

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

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

代码示例来源: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: abbot/abbot

? bar.getHeight() : bar.getWidth();
if (BorderLayout.NORTH.equals(constraint)) {
  x = dock.getWidth()/2;

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

int offset = isHorizontal(toolBar) ? toolBar.getHeight() : toolBar.getWidth();
Dimension dockSize = dock.getSize();
if (NORTH.equals(constraint)) {

代码示例来源:origin: com.metsci.glimpse/glimpse-docking

@Override
  protected void paintComponent( Graphics g0 )
  {
    Graphics2D g = ( Graphics2D ) g0;
    super.paintComponent( g );
    // Certain L&Fs get messed up if we don't reset the stroke back how we found it
    Stroke origStroke = g.getStroke( );
    g.setColor( lineColor );
    g.setStroke( new BasicStroke( lineThickness, CAP_BUTT, JOIN_MITER ) );
    g.drawRoundRect( lineThickness / 2, lineThickness / 2, getWidth( ) - lineThickness, getHeight( ) + cornerRadius, cornerRadius, cornerRadius );
    for ( View view : views )
    {
      if ( view != selectedView )
      {
        CustomTab tab = viewMap.get( view.viewId ).tab;
        // CAP_BUTT behaves differently when line-width is 1
        int wExtra = ( lineThickness > 1 ? lineThickness : 0 );
        g.drawLine( tab.getX( ), getHeight( ) - 1 - lineThickness / 2, tab.getX( ) + tab.getWidth( ) + wExtra, getHeight( ) - 1 - lineThickness / 2 );
      }
    }
    g.drawLine( tabBar.getWidth( ) - lineThickness, getHeight( ) - 1 - lineThickness / 2, getWidth( ) - 1, getHeight( ) - 1 - lineThickness / 2 );
    g.setStroke( origStroke );
  }
};

代码示例来源:origin: com.metsci.glimpse/glimpse-docking

int xOverflowBar = tabBar.getX( ) + tabBar.getWidth( );
overflowBar.setBounds( xOverflowBar, y + lineThickness, wOverflowBar, hTotal - lineThickness );
overflowBar.setVisible( true );

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

contentRect.width = tb.getWidth() - handleWidth;
contentRect.height = tb.getHeight();
int x = ltr ? handleWidth + insets.left : tb.getWidth() - handleWidth - insets.right;
int baseY = insets.top;
int baseH = tb.getHeight() - insets.top - insets.bottom;
if (glueCount > 0) {
  int minWidth = minimumLayoutSize(parent).width;
  extraSpacePerGlue = (tb.getWidth() - minWidth) / glueCount;
  if (extraSpacePerGlue < 0) extraSpacePerGlue = 0;
contentRect.width = tb.getWidth();
contentRect.height = tb.getHeight() - handleHeight;
int baseW = tb.getWidth() - insets.left - insets.right;
int y = handleHeight + insets.top;

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

protected void paint(SeaGlassContext context, Graphics g) {
  if (handleIcon != null && toolBar.isFloatable()) {
    int startX = toolBar.getComponentOrientation().isLeftToRight() ? 0 : toolBar.getWidth()
        - SeaGlassIcon.getIconWidth(handleIcon, context);
    SeaGlassIcon.paintIcon(handleIcon, context, g, startX, 0, SeaGlassIcon.getIconWidth(handleIcon, context), SeaGlassIcon.getIconHeight(
      handleIcon, context));
  }
  SeaGlassContext subcontext = getContext(toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
  // paintContent(subcontext, g, contentRect);
  subcontext.dispose();
}

相关文章

JToolBar类方法