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

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

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

JTabbedPane.getWidth介绍

暂无

代码示例

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) {
  Graphics2D g2d = (Graphics2D) g;
  g2d.setPaint(new GradientPaint(0, 0, defaultColorSet.topGradColor1, 0,
      10, defaultColorSet.topGradColor2));
  g2d.fillRect(0, 0, tabPane.getWidth(), 10);
  g2d.setPaint(new GradientPaint(0, 10, defaultColorSet.bottomGradColor1,
      0, 21, defaultColorSet.bottomGradColor2));
  g2d.fillRect(0, 10, tabPane.getWidth(), 11);
  super.paintTabArea(g, tabPlacement, selectedIndex);
  if (contentTopBorderDrawn) {
    g2d.setColor(lineColor);
    g2d.drawLine(0, 20, tabPane.getWidth() - 1, 20);
  }
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) {
  Graphics2D g2d = (Graphics2D) g;
  g2d.setPaint(new GradientPaint(0, 0, defaultColorSet.topGradColor1, 0,
      10, defaultColorSet.topGradColor2));
  g2d.fillRect(0, 0, tabPane.getWidth(), 10);
  g2d.setPaint(new GradientPaint(0, 10, defaultColorSet.bottomGradColor1,
      0, 21, defaultColorSet.bottomGradColor2));
  g2d.fillRect(0, 10, tabPane.getWidth(), 11);
  super.paintTabArea(g, tabPlacement, selectedIndex);
  if (contentTopBorderDrawn) {
    g2d.setColor(lineColor);
    g2d.drawLine(0, 20, tabPane.getWidth() - 1, 20);
  }
          
}

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

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

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

private void checkRollOver() {
    int currentRollOver = getRolloverTab();
    if (currentRollOver != lastRollOverTab) {
      lastRollOverTab = currentRollOver;
      Rectangle tabsRect = new Rectangle(0, 0, tabPane.getWidth(), 20);
      tabPane.repaint(tabsRect);
    }
  }
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) {
  Graphics2D g2d = (Graphics2D) g;
  g2d.setColor(defaultColorSet);
  g2d.fillRect(0, 0, tabPane.getWidth(), tabPane.getHeight());
  super.paintTabArea(g, tabPlacement, selectedIndex);
  g2d.setColor(lineColor);
  g2d.drawLine(0, tabHeight-1, tabPane.getWidth() - 1, tabHeight);
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

private void checkRollOver() {
    int currentRollOver = getRolloverTab();
    if (currentRollOver != lastRollOverTab) {
      lastRollOverTab = currentRollOver;
      Rectangle tabsRect = new Rectangle(0, 0, tabPane.getWidth(), 20);
      tabPane.repaint(tabsRect);
    }
  }
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

private void checkRollOver() {
    int currentRollOver = getRolloverTab();
    if (currentRollOver != lastRollOverTab) {
      lastRollOverTab = currentRollOver;
      Rectangle tabsRect = new Rectangle(0, 0, tabPane.getWidth(), 20);
      tabPane.repaint(tabsRect);
    }
  }
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) {
  Graphics2D g2d = (Graphics2D) g;
  g2d.setColor(unselectedColor);
  g2d.fillRect(0, 0, tabPane.getWidth(), tabPane.getHeight());
  super.paintTabArea(g, tabPlacement, selectedIndex);
  g2d.setColor(lineColor);
  g2d.drawLine(0, tabHeight-1, tabPane.getWidth() - 1, tabHeight);
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) {
  Graphics2D g2d = (Graphics2D) g;
  /*g2d.setPaint(new GradientPaint(0, 0, defaultColorSet.topGradColor1, 0,
      10, defaultColorSet.topGradColor2));
  g2d.fillRect(0, 0, tabPane.getWidth(), 10);
  g2d.setPaint(new GradientPaint(0, 10, defaultColorSet.bottomGradColor1,
      0, 21, defaultColorSet.bottomGradColor2));
  g2d.fillRect(0, 10, tabPane.getWidth(), 11);*/
  super.paintTabArea(g, tabPlacement, selectedIndex);
  if (contentTopBorderDrawn) {
    g2d.setColor(lineColor);
    g2d.drawLine(0, 20, tabPane.getWidth() - 1, 20);
  }
          
}

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

/**
 * Set the position of the tab container that is used to layout custom tab components.
 */
private void setTabContainerBounds() {
  Component tabContainer = getTabContainer();
  if (tabContainer != null) {
    int tabContainerX = tabPlacement == RIGHT ? contentRect.width : 0; 
    int tabContainerY =  tabPlacement == BOTTOM ? contentRect.height : 0;
    int tabContainerWidth = tabPlacement == LEFT || tabPlacement == RIGHT ? tabPane.getWidth() - contentRect.width : contentRect.width;
    int tabContainerHeight = tabPlacement == TOP || tabPlacement == BOTTOM ? tabPane.getHeight() - contentRect.height : contentRect.height;
    tabContainer.setBounds(tabContainerX, tabContainerY, tabContainerWidth, tabContainerHeight);
  }
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

private void checkRollOver() {
    int currentRollOver = getRolloverTab();
    if (currentRollOver != lastRollOverTab) {
      lastRollOverTab = currentRollOver;
      Rectangle tabsRect = new Rectangle(0, 0, tabPane.getWidth(), tabPane.getHeight());
      tabPane.repaint(tabsRect);
    }
  }
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

private void checkRollOver() {
    int currentRollOver = getRolloverTab();
    if (currentRollOver != lastRollOverTab) {
      lastRollOverTab = currentRollOver;
      Rectangle tabsRect = new Rectangle(0, 0, tabPane.getWidth(), tabPane.getHeight());
      tabPane.repaint(tabsRect);
    }
  }
}

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

public void stateChanged(ChangeEvent e) {
    resetTabItems();
    JTabbedPane tabPane = (JTabbedPane) e.getSource();
    tabPane.revalidate();
    tabPane.repaint(0, 0, tabPane.getWidth(), TAB_AREA_HEIGHT);
  }
}

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

protected int calculateTabAreaWidth(int tabPlacement, int vertRunCount, int maxTabWidth) {
  if (tabPlacement == JTabbedPane.LEFT || tabPlacement == JTabbedPane.RIGHT) {
    Insets insets = getTabAreaInsets(tabPlacement);
    int overlay = getTabRunOverlay(tabPlacement);
    return (vertRunCount > 0 ? vertRunCount * (maxTabWidth - overlay) + overlay + insets.left + insets.right : 0);
  } else {
    return tabPane.getWidth();
  }
}

代码示例来源:origin: datacleaner/DataCleaner

/**
 * Paints the border for the tab's content, ie. the area below the tabs
 */
@Override
protected void paintContentBorder(final Graphics g, final int tabPlacement, final int tabIndex) {
  final int w = tabPane.getWidth();
  final int h = tabPane.getHeight();
  final Insets tabAreaInsets = getTabAreaInsets(tabPlacement);
  final int x = 0;
  final int y = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight) + tabAreaInsets.bottom;
  g.setColor(_tabSelectedBackgroundColor);
  g.fillRect(x, y, w, h);
  g.setColor(_tabBorderColor);
  // top line, except below selected tab
  final Rectangle selectTabBounds = getTabBounds(tabPane, tabIndex);
  g.drawLine(x, y, selectTabBounds.x, y);
  g.drawLine(selectTabBounds.x + selectTabBounds.width, y, x + w, y);
}

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

@Override
protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) {
  if (this.substanceContentOpaque) {
    int width = calculateTabAreaWidth(tabPlacement, runCount,
        maxTabWidth);
    if ((tabPlacement == SwingConstants.TOP)
        || (tabPlacement == SwingConstants.BOTTOM))
      width = Math.max(width, tabPane.getWidth());
    int height = calculateTabAreaHeight(tabPlacement, runCount,
        maxTabHeight);
    if (toRotateTabsOnPlacement(tabPlacement))
      height = Math.max(height, tabPane.getHeight());
    // restrict the painting to the tab area only
    Graphics2D g2d = (Graphics2D) g.create(0, 0, width, height);
    BackgroundPaintingUtils.update(g2d, this.tabPane, true);
    g2d.dispose();
  }
  super.paintTabArea(g, tabPlacement, selectedIndex);
}

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

@Override
protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) {
  if (this.substanceContentOpaque) {
    int width = calculateTabAreaWidth(tabPlacement, runCount,
        maxTabWidth);
    if ((tabPlacement == SwingConstants.TOP)
        || (tabPlacement == SwingConstants.BOTTOM))
      width = Math.max(width, tabPane.getWidth());
    int height = calculateTabAreaHeight(tabPlacement, runCount,
        maxTabHeight);
    if (toRotateTabsOnPlacement(tabPlacement))
      height = Math.max(height, tabPane.getHeight());
    // restrict the painting to the tab area only
    Graphics2D g2d = (Graphics2D) g.create(0, 0, width, height);
    BackgroundPaintingUtils.update(g2d, this.tabPane, true);
    g2d.dispose();
  }
  super.paintTabArea(g, tabPlacement, selectedIndex);
}

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

@Override
  protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) {
//        super.paintContentBorder(g, tabPlacement, selectedIndex);
    int width = tabPane.getWidth();
    int height = tabPane.getHeight();
    Insets insets = tabPane.getInsets();
    Insets tabAreaInsets = getTabAreaInsets(tabPlacement);

    int x = insets.left;
    int y = insets.top;
    int w = width - insets.right - insets.left;
    int h = height - insets.top - insets.bottom;
    
    y += calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight);
    y -= tabAreaInsets.bottom;
    h -= (y - insets.top);
    
    if ( tabPane.getTabCount() > 0) {
      // Fill region behind content area
      g.setColor(ColorController.COR_PRINCIPAL);
      g.fillRect(x,y,w,h);
    }
    
  }

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

static void initGlassPane(Point tabPt, DnDTabbedPaneData localDnDTabbedPaneData, DnDTabbedPaneData outerDnDTabbedPaneData, GhostGlassPane localGlassPane)
{
 localDnDTabbedPaneData.getTabbedPane().getRootPane().setGlassPane(localGlassPane);
 if (localDnDTabbedPaneData.isHasGhost())
 {
   Rectangle rect = outerDnDTabbedPaneData.getTabbedPane().getBoundsAt(outerDnDTabbedPaneData.getDragTabIndex());
   BufferedImage image = new BufferedImage(outerDnDTabbedPaneData.getTabbedPane().getWidth(), outerDnDTabbedPaneData.getTabbedPane().getHeight(), BufferedImage.TYPE_INT_ARGB);
   Graphics g = image.getGraphics();
   outerDnDTabbedPaneData.getTabbedPane().paint(g);
   rect.x = rect.x < 0 ? 0 : rect.x;
   rect.y = rect.y < 0 ? 0 : rect.y;
   // When scrollable tabbed panes are used tabs might be displayed in part.
   rect.width = Math.min(rect.width, outerDnDTabbedPaneData.getTabbedPane().getWidth() - rect.x);
   image = image.getSubimage(rect.x, rect.y, rect.width, rect.height);
   localGlassPane.setImage(image);
 }
 Point glassPt = SwingUtilities.convertPoint(localDnDTabbedPaneData.getTabbedPane(), tabPt, localGlassPane);
 localGlassPane.setPoint(glassPt);
 localGlassPane.setVisible(true);
}

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

public void install(final URL url) {
    if (addOnInstallerPanel.isShowing()) {
      addOnInstallerPanel.getUrlField().setText(url.toString());
      tabbedPane.paintImmediately(0, 0, tabbedPane.getWidth(), tabbedPane.getHeight());
      addOnInstallerPanel.getInstallButton().doClick();
    }
    else {
      addOnInstallerPanel.addHierarchyListener(new HierarchyListener() {
        public void hierarchyChanged(HierarchyEvent e) {
          if (addOnInstallerPanel.isShowing()) {
            addOnInstallerPanel.removeHierarchyListener(this);
            install(url);
          }
        }
      });
      tabbedPane.setSelectedComponent(addOnInstallerPanel);
      if (!isVisible())
        setVisible(true);
    }
  }
}

相关文章

JTabbedPane类方法