Java 类javax.swing.plaf.ScrollBarUI 实例源码

项目:intellij-ce-playground    文件:bigFile.java   
/**
 * This is helper method. It returns height of the top (decrease) scroll bar
 * button. Please note, that it's possible to return real height only if scroll bar
 * is instance of BasicScrollBarUI. Otherwise it returns fake (but good enough :) )
 * value.
 */
int getDecScrollButtonHeight() {
  ScrollBarUI barUI = getUI();
  Insets insets = getInsets();
  int top = Math.max(0, insets.top);
  if (barUI instanceof ButtonlessScrollBarUI) {
    return top + ((ButtonlessScrollBarUI)barUI).getDecrementButtonHeight();
  }
  if (barUI instanceof BasicScrollBarUI) {
    try {
      JButton decrButtonValue = (JButton)decrButtonField.get(barUI);
      LOG.assertTrue(decrButtonValue != null);
      return top + decrButtonValue.getHeight();
    }
    catch (Exception exc) {
      throw new IllegalStateException(exc);
    }
  }
  return top + 15;
}
项目:intellij-ce-playground    文件:bigFile.java   
/**
 * This is helper method. It returns height of the bottom (increase) scroll bar
 * button. Please note, that it's possible to return real height only if scroll bar
 * is instance of BasicScrollBarUI. Otherwise it returns fake (but good enough :) )
 * value.
 */
int getIncScrollButtonHeight() {
  ScrollBarUI barUI = getUI();
  Insets insets = getInsets();
  if (barUI instanceof ButtonlessScrollBarUI) {
    return insets.top + ((ButtonlessScrollBarUI)barUI).getIncrementButtonHeight();
  }
  if (barUI instanceof BasicScrollBarUI) {
    try {
      JButton incrButtonValue = (JButton)incrButtonField.get(barUI);
      LOG.assertTrue(incrButtonValue != null);
      return insets.bottom + incrButtonValue.getHeight();
    }
    catch (Exception exc) {
      throw new IllegalStateException(exc);
    }
  }
  if (APPLE_LAF_AQUA_SCROLL_BAR_UI_CLASS.equals(barUI.getClass().getName())) {
    return insets.bottom + 30;
  }
  return insets.bottom + 15;
}
项目:intellij-ce-playground    文件:bigFile.java   
/**
 * This is helper method. It returns height of the top (decrease) scroll bar
 * button. Please note, that it's possible to return real height only if scroll bar
 * is instance of BasicScrollBarUI. Otherwise it returns fake (but good enough :) )
 * value.
 */
int getDecScrollButtonHeight() {
  ScrollBarUI barUI = getUI();
  Insets insets = getInsets();
  int top = Math.max(0, insets.top);
  if (barUI instanceof ButtonlessScrollBarUI) {
    return top + ((ButtonlessScrollBarUI)barUI).getDecrementButtonHeight();
  }
  if (barUI instanceof BasicScrollBarUI) {
    try {
      JButton decrButtonValue = (JButton)decrButtonField.get(barUI);
      LOG.assertTrue(decrButtonValue != null);
      return top + decrButtonValue.getHeight();
    }
    catch (Exception exc) {
      throw new IllegalStateException(exc);
    }
  }
  return top + 15;
}
项目:intellij-ce-playground    文件:bigFile.java   
/**
 * This is helper method. It returns height of the bottom (increase) scroll bar
 * button. Please note, that it's possible to return real height only if scroll bar
 * is instance of BasicScrollBarUI. Otherwise it returns fake (but good enough :) )
 * value.
 */
int getIncScrollButtonHeight() {
  ScrollBarUI barUI = getUI();
  Insets insets = getInsets();
  if (barUI instanceof ButtonlessScrollBarUI) {
    return insets.top + ((ButtonlessScrollBarUI)barUI).getIncrementButtonHeight();
  }
  if (barUI instanceof BasicScrollBarUI) {
    try {
      JButton incrButtonValue = (JButton)incrButtonField.get(barUI);
      LOG.assertTrue(incrButtonValue != null);
      return insets.bottom + incrButtonValue.getHeight();
    }
    catch (Exception exc) {
      throw new IllegalStateException(exc);
    }
  }
  if (APPLE_LAF_AQUA_SCROLL_BAR_UI_CLASS.equals(barUI.getClass().getName())) {
    return insets.bottom + 30;
  }
  return insets.bottom + 15;
}
项目:intellij-ce-playground    文件:JBScrollPane.java   
public static boolean canBePreprocessed(MouseEvent e, JScrollBar bar) {
  if (e.getID() == MouseEvent.MOUSE_MOVED || e.getID() == MouseEvent.MOUSE_PRESSED) {
    ScrollBarUI ui = bar.getUI();
    if (ui instanceof BasicScrollBarUI) {
      BasicScrollBarUI bui = (BasicScrollBarUI)ui;
      try {
        Rectangle rect = (Rectangle)ReflectionUtil.getDeclaredMethod(BasicScrollBarUI.class, "getThumbBounds", ArrayUtil.EMPTY_CLASS_ARRAY).invoke(bui);
        Point point = SwingUtilities.convertPoint(e.getComponent(), e.getX(), e.getY(), bar);
        return !rect.contains(point);
      }
      catch (Exception e1) {
        return true;
      }
    }
  }
  return true;
}
项目:intellij-ce-playground    文件:EditorImpl.java   
/**
 * This is helper method. It returns height of the top (decrease) scroll bar
 * button. Please note, that it's possible to return real height only if scroll bar
 * is instance of BasicScrollBarUI. Otherwise it returns fake (but good enough :) )
 * value.
 */
int getDecScrollButtonHeight() {
  ScrollBarUI barUI = getUI();
  Insets insets = getInsets();
  int top = Math.max(0, insets.top);
  if (barUI instanceof ButtonlessScrollBarUI) {
    return top + ((ButtonlessScrollBarUI)barUI).getDecrementButtonHeight();
  }
  if (barUI instanceof BasicScrollBarUI) {
    try {
      JButton decrButtonValue = (JButton)decrButtonField.get(barUI);
      LOG.assertTrue(decrButtonValue != null);
      return top + decrButtonValue.getHeight();
    }
    catch (Exception exc) {
      throw new IllegalStateException(exc);
    }
  }
  return top + 15;
}
项目:intellij-ce-playground    文件:EditorImpl.java   
/**
 * This is helper method. It returns height of the bottom (increase) scroll bar
 * button. Please note, that it's possible to return real height only if scroll bar
 * is instance of BasicScrollBarUI. Otherwise it returns fake (but good enough :) )
 * value.
 */
int getIncScrollButtonHeight() {
  ScrollBarUI barUI = getUI();
  Insets insets = getInsets();
  if (barUI instanceof ButtonlessScrollBarUI) {
    return insets.top + ((ButtonlessScrollBarUI)barUI).getIncrementButtonHeight();
  }
  if (barUI instanceof BasicScrollBarUI) {
    try {
      JButton incrButtonValue = (JButton)incrButtonField.get(barUI);
      LOG.assertTrue(incrButtonValue != null);
      return insets.bottom + incrButtonValue.getHeight();
    }
    catch (Exception exc) {
      throw new IllegalStateException(exc);
    }
  }
  if (APPLE_LAF_AQUA_SCROLL_BAR_UI_CLASS.equals(barUI.getClass().getName())) {
    return insets.bottom + 30;
  }
  return insets.bottom + 15;
}
项目:tools-idea    文件:JBScrollPane.java   
public static boolean canBePreprocessed(MouseEvent e, JScrollBar bar) {
  if (e.getID() == MouseEvent.MOUSE_MOVED || e.getID() == MouseEvent.MOUSE_PRESSED) {
    ScrollBarUI ui = bar.getUI();
    if (ui instanceof BasicScrollBarUI) {
      BasicScrollBarUI bui = (BasicScrollBarUI)ui;
      try {
        Method m = BasicScrollBarUI.class.getDeclaredMethod("getThumbBounds", ArrayUtil.EMPTY_CLASS_ARRAY);
        m.setAccessible(true);
        Rectangle rect = (Rectangle)m.invoke(bui);
        Point point = SwingUtilities.convertPoint(e.getComponent(), e.getX(), e.getY(), bar);
        return !rect.contains(point);
      }
      catch (Exception e1) {
        return true;
      }
    }
  }
  return true;
}
项目:tools-idea    文件:EditorImpl.java   
/**
 * This is helper method. It returns height of the top (decrease) scroll bar
 * button. Please note, that it's possible to return real height only if scroll bar
 * is instance of BasicScrollBarUI. Otherwise it returns fake (but good enough :) )
 * value.
 */
int getDecScrollButtonHeight() {
  ScrollBarUI barUI = getUI();
  Insets insets = getInsets();
  if (barUI instanceof ButtonlessScrollBarUI) {
    return insets.top + ((ButtonlessScrollBarUI)barUI).getDecrementButtonHeight();
  }
  else if (barUI instanceof BasicScrollBarUI) {
    try {
      JButton decrButtonValue = (JButton)decrButtonField.get(barUI);
      LOG.assertTrue(decrButtonValue != null);
      return insets.top + decrButtonValue.getHeight();
    }
    catch (Exception exc) {
      throw new IllegalStateException(exc);
    }
  }
  else {
    return insets.top + 15;
  }
}
项目:tools-idea    文件:EditorImpl.java   
/**
 * This is helper method. It returns height of the bottom (increase) scroll bar
 * button. Please note, that it's possible to return real height only if scroll bar
 * is instance of BasicScrollBarUI. Otherwise it returns fake (but good enough :) )
 * value.
 */
int getIncScrollButtonHeight() {
  ScrollBarUI barUI = getUI();
  Insets insets = getInsets();
  if (barUI instanceof ButtonlessScrollBarUI) {
    return insets.top + ((ButtonlessScrollBarUI)barUI).getIncrementButtonHeight();
  }
  if (barUI instanceof BasicScrollBarUI) {
    try {
      JButton incrButtonValue = (JButton)incrButtonField.get(barUI);
      LOG.assertTrue(incrButtonValue != null);
      return insets.bottom + incrButtonValue.getHeight();
    }
    catch (Exception exc) {
      throw new IllegalStateException(exc);
    }
  }
  if (APPLE_LAF_AQUA_SCROLL_BAR_UI_CLASS.equals(barUI.getClass().getName())) {
    return insets.bottom + 30;
  }
  return insets.bottom + 15;
}
项目:consulo    文件:JBScrollPane.java   
public static boolean canBePreprocessed(MouseEvent e, JScrollBar bar) {
  if (e.getID() == MouseEvent.MOUSE_MOVED || e.getID() == MouseEvent.MOUSE_PRESSED) {
    ScrollBarUI ui = bar.getUI();
    if (ui instanceof BasicScrollBarUI) {
      BasicScrollBarUI bui = (BasicScrollBarUI)ui;
      try {
        Rectangle rect = (Rectangle)ReflectionUtil.getDeclaredMethod(BasicScrollBarUI.class, "getThumbBounds", ArrayUtil.EMPTY_CLASS_ARRAY).invoke(bui);
        Point point = SwingUtilities.convertPoint(e.getComponent(), e.getX(), e.getY(), bar);
        return !rect.contains(point);
      }
      catch (Exception e1) {
        return true;
      }
    }
  }
  return true;
}
项目:openjdk-jdk10    文件:JScrollBarOperator.java   
/**
 * Maps {@code JScrollBar.getUI()} through queue
 */
public ScrollBarUI getUI() {
    return (runMapping(new MapAction<ScrollBarUI>("getUI") {
        @Override
        public ScrollBarUI map() {
            return ((JScrollBar) getSource()).getUI();
        }
    }));
}
项目:openjdk9    文件:JScrollBarOperator.java   
/**
 * Maps {@code JScrollBar.getUI()} through queue
 */
public ScrollBarUI getUI() {
    return (runMapping(new MapAction<ScrollBarUI>("getUI") {
        @Override
        public ScrollBarUI map() {
            return ((JScrollBar) getSource()).getUI();
        }
    }));
}
项目:tools-idea    文件:EditorPlace.java   
@Nullable
private static Rectangle calcThumbBounds(JScrollBar scrollBar) {
  ScrollBarUI scrollBarUI = scrollBar.getUI();
  if (scrollBarUI instanceof ButtonlessScrollBarUI) {
    return ((ButtonlessScrollBarUI)scrollBarUI).getThumbBounds();
  }
  return null;
}
项目:jediterm    文件:JBScrollBar.java   
/**
 * Returns a new instance of {@link ScrollBarUI}.
 * Do not share it between different scroll bars.
 *
 * @param c a target component for this UI
 * @return a new instance of {@link ScrollBarUI}
 */
@SuppressWarnings("UnusedParameters")
public static ScrollBarUI createUI(JComponent c) {
  if (Registry.is("ide.scroll.new.layout")) {
    if (!SystemInfo.isMac) return new DefaultScrollBarUI();
    if (Registry.is("mac.scroll.new.ui")) return new MacScrollBarUI();
  }
  return ButtonlessScrollBarUI.createNormal();
}
项目:j2se_for_android    文件:JScrollBar.java   
public void setUI(ScrollBarUI ui) {
    //由于J2SE/JScrollPane需要ScrollBarUI不可见时,设置尺寸为0。故本方法被调用
    AndroidClassUtil.callEmptyMethod();
    super.setUI(ui);
}
项目:j2se_for_android    文件:JScrollBar.java   
public ScrollBarUI getUI() {
    AndroidClassUtil.callEmptyMethod();
    return null;
}
项目:javify    文件:JScrollBar.java   
/**
 * This method changes the UI to be the
 * default for the current look and feel.
 */
public void updateUI()
{
  setUI((ScrollBarUI) UIManager.getUI(this));
}
项目:intellij-ce-playground    文件:bigFile.java   
void setPersistentUI(ScrollBarUI ui) {
  myPersistentUI = ui;
  setUI(ui);
}
项目:intellij-ce-playground    文件:bigFile.java   
@Override
public void setUI(ScrollBarUI ui) {
  if (myPersistentUI == null) myPersistentUI = ui;
  super.setUI(myPersistentUI);
  setOpaque(false);
}
项目:intellij-ce-playground    文件:bigFile.java   
@Override
protected boolean isOverlaidScrollbar(@Nullable JScrollBar scrollbar) {
  ScrollBarUI vsbUI = scrollbar == null ? null : scrollbar.getUI();
  return vsbUI instanceof ButtonlessScrollBarUI && !((ButtonlessScrollBarUI)vsbUI).alwaysShowTrack();
}
项目:intellij-ce-playground    文件:bigFile.java   
void setPersistentUI(ScrollBarUI ui) {
  myPersistentUI = ui;
  setUI(ui);
}
项目:intellij-ce-playground    文件:bigFile.java   
@Override
public void setUI(ScrollBarUI ui) {
  if (myPersistentUI == null) myPersistentUI = ui;
  super.setUI(myPersistentUI);
  setOpaque(false);
}
项目:intellij-ce-playground    文件:bigFile.java   
protected boolean isOverlaidScrollbar(@Nullable JScrollBar scrollbar) {
  ScrollBarUI vsbUI = scrollbar == null ? null : scrollbar.getUI();
  return vsbUI instanceof ButtonlessScrollBarUI && !((ButtonlessScrollBarUI)vsbUI).alwaysShowTrack();
}
项目:intellij-ce-playground    文件:JBScrollPane.java   
protected boolean isOverlaidScrollbar(@Nullable JScrollBar scrollbar) {
  if (!ButtonlessScrollBarUI.isMacOverlayScrollbarSupported()) return false;

  ScrollBarUI vsbUI = scrollbar == null ? null : scrollbar.getUI();
  return vsbUI instanceof ButtonlessScrollBarUI && !((ButtonlessScrollBarUI)vsbUI).alwaysShowTrack();
}
项目:intellij-ce-playground    文件:EditorImpl.java   
void setPersistentUI(ScrollBarUI ui) {
  myPersistentUI = ui;
  setUI(ui);
}
项目:intellij-ce-playground    文件:EditorImpl.java   
@Override
public void setUI(ScrollBarUI ui) {
  if (myPersistentUI == null) myPersistentUI = ui;
  super.setUI(myPersistentUI);
  setOpaque(false);
}
项目:intellij-ce-playground    文件:EditorImpl.java   
@Override
protected boolean isOverlaidScrollbar(@Nullable JScrollBar scrollbar) {
  ScrollBarUI vsbUI = scrollbar == null ? null : scrollbar.getUI();
  return vsbUI instanceof ButtonlessScrollBarUI && !((ButtonlessScrollBarUI)vsbUI).alwaysShowTrack();
}
项目:intellij-ce-playground    文件:EditorMarkupModelImpl.java   
@Nullable
private MyErrorPanel getErrorPanel() {
  ScrollBarUI ui = myEditor.getVerticalScrollBar().getUI();
  return ui instanceof MyErrorPanel ? (MyErrorPanel)ui : null;
}
项目:jvm-stm    文件:JScrollBar.java   
/**
 * This method changes the UI to be the
 * default for the current look and feel.
 */
public void updateUI()
{
  setUI((ScrollBarUI) UIManager.getUI(this));
}
项目:cn1    文件:JScrollBar.java   
public void setUI(final ScrollBarUI ui) {
    super.setUI(ui);
}
项目:cn1    文件:JScrollBar.java   
public ScrollBarUI getUI() {
    return (ScrollBarUI)ui;
}
项目:cn1    文件:JScrollBar.java   
public void updateUI() {
    setUI((ScrollBarUI)UIManager.getUI(this));
}
项目:JamVM-PH    文件:JScrollBar.java   
/**
 * This method changes the UI to be the
 * default for the current look and feel.
 */
public void updateUI()
{
  setUI((ScrollBarUI) UIManager.getUI(this));
}
项目:tools-idea    文件:EditorImpl.java   
void setPersistentUI(ScrollBarUI ui) {
  myPersistentUI = ui;
  setUI(ui);
}
项目:tools-idea    文件:EditorImpl.java   
@Override
public void setUI(ScrollBarUI ui) {
  if (myPersistentUI == null) myPersistentUI = ui;
  super.setUI(myPersistentUI);
}
项目:tools-idea    文件:EditorMarkupModelImpl.java   
@Nullable
private MyErrorPanel getErrorPanel() {
  ScrollBarUI ui = myEditor.getVerticalScrollBar().getUI();
  return ui instanceof MyErrorPanel ? (MyErrorPanel)ui : null;
}
项目:classpath    文件:JScrollBar.java   
/**
 * This method changes the UI to be the
 * default for the current look and feel.
 */
public void updateUI()
{
  setUI((ScrollBarUI) UIManager.getUI(this));
}
项目:freeVM    文件:JScrollBar.java   
public void setUI(final ScrollBarUI ui) {
    super.setUI(ui);
}
项目:freeVM    文件:JScrollBar.java   
public ScrollBarUI getUI() {
    return (ScrollBarUI)ui;
}