當前位置: 首頁>>代碼示例>>Java>>正文


Java UIUtil.isUnderAquaBasedLookAndFeel方法代碼示例

本文整理匯總了Java中com.intellij.util.ui.UIUtil.isUnderAquaBasedLookAndFeel方法的典型用法代碼示例。如果您正苦於以下問題:Java UIUtil.isUnderAquaBasedLookAndFeel方法的具體用法?Java UIUtil.isUnderAquaBasedLookAndFeel怎麽用?Java UIUtil.isUnderAquaBasedLookAndFeel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.util.ui.UIUtil的用法示例。


在下文中一共展示了UIUtil.isUnderAquaBasedLookAndFeel方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: paintComponent

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
protected void paintComponent(final Graphics g) {
  final Insets i = getInsets();
  if (UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula()) {
    if (getParent() != null) {
      final JBColor col = new JBColor(Gray._128, Gray._111);
      final Graphics2D g2 = (Graphics2D)g;
      if (myOrientation == SwingConstants.HORIZONTAL) {
        UIUtil.drawDoubleSpaceDottedLine(g2, i.top + 2, getParent().getSize().height - 2 - i.top - i.bottom, 3, col, false);
      } else {
        UIUtil.drawDoubleSpaceDottedLine(g2, i.left + 2, getParent().getSize().width - 2 - i.left - i.right, 3, col, true);
      }
    }
  }
  else {
    g.setColor(UIUtil.getSeparatorColor());
    if (getParent() != null) {
      if (myOrientation == SwingConstants.HORIZONTAL) {
        UIUtil.drawLine(g, 3, 2, 3, getParent().getSize().height - 2);
      }
      else {
        UIUtil.drawLine(g, 2, 3, getParent().getSize().width - 2, 3);
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:ActionToolbarImpl.java

示例2: paint

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public void paint(Graphics g, JComponent c) {
  if (myWideSelection && !UIUtil.isUnderAquaBasedLookAndFeel() && !UIUtil.isUnderDarcula() && !UIUtil.isUnderIntelliJLaF()) {
    paintSelectedRows(g, ((JTree)c));
  }
  if (myWideSelection) {
    final int containerWidth = tree.getParent() instanceof JViewport ? tree.getParent().getWidth() : tree.getWidth();
    final int xOffset = tree.getParent() instanceof JViewport ? ((JViewport)tree.getParent()).getViewPosition().x : 0;
    final Rectangle bounds = g.getClipBounds();

    // draw background for the given clip bounds
    final Object sourceList = tree.getClientProperty(SOURCE_LIST_CLIENT_PROPERTY);
    if (sourceList != null && (Boolean)sourceList) {
      Graphics2D backgroundGraphics = (Graphics2D)g.create();
      backgroundGraphics.setClip(xOffset, bounds.y, containerWidth, bounds.height);
      LIST_BACKGROUND_PAINTER.paintBorder(tree, backgroundGraphics, xOffset, bounds.y, containerWidth, bounds.height);
      backgroundGraphics.dispose();
    }
  }

  super.paint(g, c);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:WideSelectionTreeUI.java

示例3: paintRowData

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private static void paintRowData(Tree tree, String duration, Rectangle bounds, Graphics2D g, boolean isSelected, boolean hasFocus) {
  final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
  g.setFont(tree.getFont().deriveFont(Font.PLAIN, UIUtil.getFontSize(UIUtil.FontSize.SMALL)));
  final FontMetrics metrics = tree.getFontMetrics(g.getFont());
  int totalWidth = metrics.stringWidth(duration) + 2;
  int x = bounds.x + bounds.width - totalWidth;
  g.setColor(isSelected ? UIUtil.getTreeSelectionBackground(hasFocus) : UIUtil.getTreeBackground());
  final int leftOffset = 5;
  g.fillRect(x - leftOffset, bounds.y, totalWidth + leftOffset, bounds.height);
  g.translate(0, bounds.y - 1);
  if (isSelected) {
    if (!hasFocus && UIUtil.isUnderAquaBasedLookAndFeel()) {
      g.setColor(UIUtil.getTreeForeground());
    }
    else {
      g.setColor(UIUtil.getTreeSelectionForeground());
    }
  }
  else {
    g.setColor(new JBColor(0x808080, 0x808080));
  }
  g.drawString(duration, x, SimpleColoredComponent.getTextBaseLine(tree.getFontMetrics(tree.getFont()), bounds.height) + 1);
  g.translate(0, -bounds.y + 1);
  config.restore();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:TestTreeView.java

示例4: append

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
/**
 * When the item is selected then we use default tree's selection foreground.
 * It guaranties readability of selected text in any LAF.
 */
@Override
public void append(@NotNull @Nls String fragment, @NotNull SimpleTextAttributes attributes, boolean isMainText) {
  if (mySelected && isFocused()) {
    super.append(fragment, new SimpleTextAttributes(attributes.getStyle(), UIUtil.getTreeSelectionForeground()), isMainText);
  }
  else if (mySelected && UIUtil.isUnderAquaBasedLookAndFeel()) {
    super.append(fragment, new SimpleTextAttributes(attributes.getStyle(), UIUtil.getTreeForeground()), isMainText);
  }
  else {
    super.append(fragment, attributes, isMainText);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:ColoredTreeCellRenderer.java

示例5: BegMenuItemUI

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public BegMenuItemUI() {
  myMaxGutterIconWidth = 18;

  if (UIUtil.isUnderAquaBasedLookAndFeel() && myAquaSelectedBackgroundPainter == null) {
    myAquaSelectedBackgroundPainter = (Border) UIManager.get("MenuItem.selectedBackgroundPainter");
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:BegMenuItemUI.java

示例6: getTreeCellRendererComponent

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public final Component getTreeCellRendererComponent(JTree tree,
                                                    Object value,
                                                    boolean selected,
                                                    boolean expanded,
                                                    boolean leaf,
                                                    int row,
                                                    boolean hasFocus){
  myTree = tree;

  clear();

  mySelected = selected;
  myFocusedCalculated = false;

  // We paint background if and only if tree path is selected and tree has focus.
  // If path is selected and tree is not focused then we just paint focused border.
  if (UIUtil.isFullRowSelectionLAF()) {
    setBackground(selected ? UIUtil.getTreeSelectionBackground() : null);
  }
  else if (tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
    setPaintFocusBorder(false);
    if (selected) {
      setBackground(hasFocus ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeUnfocusedSelectionBackground());
    }
  }
  else if (selected) {
    setPaintFocusBorder(true);
    if (isFocused()) {
      setBackground(UIUtil.getTreeSelectionBackground());
    }
    else {
      setBackground(null);
    }
  }
  else {
    setBackground(null);
  }

  if (value instanceof LoadingNode) {
    setForeground(JBColor.GRAY);
    setIcon(LOADING_NODE_ICON);
  }
  else {
    setForeground(tree.getForeground());
    setIcon(null);
  }

  if (UIUtil.isUnderGTKLookAndFeel()){
    super.setOpaque(false);  // avoid nasty background
    super.setIconOpaque(false);
  }
  else if (UIUtil.isUnderNimbusLookAndFeel() && selected && hasFocus) {
    super.setOpaque(false);  // avoid erasing Nimbus focus frame
    super.setIconOpaque(false);
  }
  else if (tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
    super.setOpaque(false);  // avoid erasing Nimbus focus frame
    super.setIconOpaque(false);
  }
  else {
    super.setOpaque(myOpaque || selected && hasFocus || selected && isFocused()); // draw selection background even for non-opaque tree
  }

  if (tree.getUI() instanceof WideSelectionTreeUI && UIUtil.isUnderAquaBasedLookAndFeel()) {
    setMyBorder(null);
    setIpad(new Insets(0, 2,  0, 2));
  }

  customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);

  return this;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:74,代碼來源:ColoredTreeCellRenderer.java

示例7: shouldPaintLines

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private boolean shouldPaintLines() {
  if (UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) {
    return false;
  }
  return myForceDontPaintLines || !"None".equals(tree.getClientProperty("JTree.lineStyle"));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:WideSelectionTreeUI.java

示例8: paintRow

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
protected void paintRow(final Graphics g,
                        final Rectangle clipBounds,
                        final Insets insets,
                        final Rectangle bounds,
                        final TreePath path,
                        final int row,
                        final boolean isExpanded,
                        final boolean hasBeenExpanded,
                        final boolean isLeaf) {
  final int containerWidth = tree.getParent() instanceof JViewport ? tree.getParent().getWidth() : tree.getWidth();
  final int xOffset = tree.getParent() instanceof JViewport ? ((JViewport)tree.getParent()).getViewPosition().x : 0;

  if (path != null && myWideSelection) {
    boolean selected = tree.isPathSelected(path);
    Graphics2D rowGraphics = (Graphics2D)g.create();
    rowGraphics.setClip(clipBounds);

    final Object sourceList = tree.getClientProperty(SOURCE_LIST_CLIENT_PROPERTY);
    Color background = tree.getBackground();

    if ((row % 2) == 0 && Boolean.TRUE.equals(tree.getClientProperty(STRIPED_CLIENT_PROPERTY))) {
      background = UIUtil.getDecoratedRowColor();
    }

    if (sourceList != null && (Boolean)sourceList) {
      if (selected) {
        if (tree.hasFocus()) {
          LIST_FOCUSED_SELECTION_BACKGROUND_PAINTER.paintBorder(tree, rowGraphics, xOffset, bounds.y, containerWidth, bounds.height);
        }
        else {
          LIST_SELECTION_BACKGROUND_PAINTER.paintBorder(tree, rowGraphics, xOffset, bounds.y, containerWidth, bounds.height);
        }
      }
      else if (myWideSelectionCondition.value(row)) {
        rowGraphics.setColor(background);
        rowGraphics.fillRect(xOffset, bounds.y, containerWidth, bounds.height);
      }
    }
    else {
      if (selected && (UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF())) {
        Color bg = UIUtil.getTreeSelectionBackground(tree.hasFocus() || Boolean.TRUE.equals(tree.getClientProperty(TREE_TABLE_TREE_KEY)));

        if (myWideSelectionCondition.value(row)) {
          rowGraphics.setColor(bg);
          rowGraphics.fillRect(xOffset, bounds.y, containerWidth, bounds.height);
        }
      }
    }

    if (shouldPaintExpandControl(path, row, isExpanded, hasBeenExpanded, isLeaf)) {
      paintExpandControl(rowGraphics, bounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf);
    }

    super.paintRow(rowGraphics, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf);
    rowGraphics.dispose();
  }
  else {
    super.paintRow(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:62,代碼來源:WideSelectionTreeUI.java


注:本文中的com.intellij.util.ui.UIUtil.isUnderAquaBasedLookAndFeel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。