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


Java BasicScrollBarUI類代碼示例

本文整理匯總了Java中javax.swing.plaf.basic.BasicScrollBarUI的典型用法代碼示例。如果您正苦於以下問題:Java BasicScrollBarUI類的具體用法?Java BasicScrollBarUI怎麽用?Java BasicScrollBarUI使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getDecScrollButtonHeight

import javax.swing.plaf.basic.BasicScrollBarUI; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:bigFile.java

示例2: getIncScrollButtonHeight

import javax.swing.plaf.basic.BasicScrollBarUI; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:bigFile.java

示例3: canBePreprocessed

import javax.swing.plaf.basic.BasicScrollBarUI; //導入依賴的package包/類
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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:JBScrollPane.java

示例4: canBePreprocessed

import javax.swing.plaf.basic.BasicScrollBarUI; //導入依賴的package包/類
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;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:20,代碼來源:JBScrollPane.java

示例5: getDecScrollButtonHeight

import javax.swing.plaf.basic.BasicScrollBarUI; //導入依賴的package包/類
/**
 * 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;
  }
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:27,代碼來源:EditorImpl.java

示例6: createTransparent

import javax.swing.plaf.basic.BasicScrollBarUI; //導入依賴的package包/類
public static BasicScrollBarUI createTransparent() {
  return new ButtonlessScrollBarUI() {
    @Override
    public boolean alwaysShowTrack() {
      return false;
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:ButtonlessScrollBarUI.java

示例7: createNormal

import javax.swing.plaf.basic.BasicScrollBarUI; //導入依賴的package包/類
public static BasicScrollBarUI createNormal() {
  return new ButtonlessScrollBarUI();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:ButtonlessScrollBarUI.java

示例8: changeUI

import javax.swing.plaf.basic.BasicScrollBarUI; //導入依賴的package包/類
@Override
public void changeUI(){
    super.changeUI();  
    jScrollPane2.getHorizontalScrollBar().setUI((BasicScrollBarUI)MyBasicScrollBarUI.createUI(jScrollPane2));
    jScrollPane2.getVerticalScrollBar().setUI((BasicScrollBarUI)MyBasicScrollBarUI.createUI(jScrollPane2));  
}
 
開發者ID:R3d-Dragon,項目名稱:jMovieManager,代碼行數:7,代碼來源:CreateSerieGUI.java

示例9: createNormal

import javax.swing.plaf.basic.BasicScrollBarUI; //導入依賴的package包/類
public static BasicScrollBarUI createNormal() {
  return new DarculaScrollBarUI();
}
 
開發者ID:bulenkov,項目名稱:Darcula,代碼行數:4,代碼來源:DarculaScrollBarUI.java

示例10: createTransparent

import javax.swing.plaf.basic.BasicScrollBarUI; //導入依賴的package包/類
public static BasicScrollBarUI createTransparent() {
  return new Transparent();
}
 
開發者ID:JetBrains,項目名稱:jediterm,代碼行數:4,代碼來源:ButtonlessScrollBarUI.java


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