Java 类javax.swing.plaf.basic.BasicScrollBarUI 实例源码

项目: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;
}
项目:intellij-ce-playground    文件:ButtonlessScrollBarUI.java   
public static BasicScrollBarUI createTransparent() {
  return new ButtonlessScrollBarUI() {
    @Override
    public boolean alwaysShowTrack() {
      return false;
    }
  };
}
项目:intellij-ce-playground    文件:ButtonlessScrollBarUI.java   
public static BasicScrollBarUI createNormal() {
  return new ButtonlessScrollBarUI();
}
项目:jMovieManager    文件:CreateSerieGUI.java   
@Override
public void changeUI(){
    super.changeUI();  
    jScrollPane2.getHorizontalScrollBar().setUI((BasicScrollBarUI)MyBasicScrollBarUI.createUI(jScrollPane2));
    jScrollPane2.getVerticalScrollBar().setUI((BasicScrollBarUI)MyBasicScrollBarUI.createUI(jScrollPane2));  
}
项目:tools-idea    文件:ButtonlessScrollBarUI.java   
public static BasicScrollBarUI createNormal() {
  return new ButtonlessScrollBarUI();
}
项目:Darcula    文件:DarculaScrollBarUI.java   
public static BasicScrollBarUI createNormal() {
  return new DarculaScrollBarUI();
}
项目:jediterm    文件:ButtonlessScrollBarUI.java   
public static BasicScrollBarUI createNormal() {
  return new ButtonlessScrollBarUI();
}
项目:jediterm    文件:ButtonlessScrollBarUI.java   
public static BasicScrollBarUI createTransparent() {
  return new Transparent();
}