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


Java Adjustable.getOrientation方法代碼示例

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


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

示例1: isAdjNeeded

import java.awt.Adjustable; //導入方法依賴的package包/類
/**
 * Determines whether a specified adjustable should
 * be displayed using scrollbar display policy
 * @param adj scrollbar
 * @return true if scrollbar should be displayed, false otherwise
 */
private boolean isAdjNeeded(Adjustable adj) {
    if (adj == null) {
        return false;
    }
    switch (scrollable.getAdjustableMode(adj)) {
        case Scrollable.ALWAYS:
            return true;
        case Scrollable.NEVER:
            return false;
        case Scrollable.AS_NEEDED:
            return calculateNeeded(adj);
        case Scrollable.HORIZONTAL_ONLY:
            return adj.getOrientation() == Adjustable.HORIZONTAL;
        case Scrollable.VERTICAL_ONLY:
            return adj.getOrientation() == Adjustable.VERTICAL;
    }
    return true;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:25,代碼來源:ScrollStateController.java

示例2: calculateNeeded

import java.awt.Adjustable; //導入方法依賴的package包/類
/**
 * Only for Scrollable.AS_NEEDED scrollbar display policy:
 *  determines if the specified scrollbar should be visible.
 *  Scrollbar is shown only if child component can be scrolled in
 *  corresponding direction, i. e. the size of the child exceeds
 *  container size, and there's enough space for
 *  scrollbar itself.
 * @param adj scrollbar
 * @return true if scrollbar is needed, false otherwise
 */
private boolean calculateNeeded(Adjustable adj) {
    Insets ins = scrollable.getInsets();
    Component comp = scrollable.getComponent();
    final int GAP = ins.left + ins.right;
    boolean isVertical = (adj.getOrientation() == Adjustable.VERTICAL);
    Dimension viewSize = comp.getSize();
    viewSize.width -= getHrzInsets(ins);
    viewSize.height -= getVrtInsets(ins);
    int viewWidth = viewSize.width;
    int viewHeight = viewSize.height;
    int spOtherSize = isVertical ? viewWidth : viewHeight;
    int spSize = isVertical ? viewHeight : viewWidth;

    int compSize = 0;
    int adjSize = (isVertical ? scrollable.getAdjustableWidth()
                             : scrollable.getAdjustableHeight());
    Dimension prefSize = scrollable.getSize();
    compSize = isVertical ? prefSize.height : prefSize.width;
    return ((spSize < compSize) && (spOtherSize > adjSize + GAP));
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:31,代碼來源:ScrollStateController.java

示例3: calculateNeeded

import java.awt.Adjustable; //導入方法依賴的package包/類
/**
 * Only for Scrollable.AS_NEEDED scrollbar display policy:
 *  determines if the specified scrollbar should be visible.
 *  Scrollbar is shown only if child component can be scrolled in
 *  corresponding direction, i. e. the size of the child exceeds
 *  container size, and there's enough space for
 *  scrollbar itself.
 * @param adj scrollbar
 * @return true if scrollbar is needed, false otherwise
 */
private boolean calculateNeeded(Adjustable adj) {
    Insets ins = scrollable.getInsets();
    Component comp = scrollable.getComponent();
    final int GAP = ins.left + ins.right;
    boolean isVertical = (adj.getOrientation() == Adjustable.VERTICAL);
    Dimension viewSize = comp.getSize();
    viewSize.width -= getHrzInsets(ins);
    viewSize.height -= getVrtInsets(ins);
    int viewWidth = viewSize.width;
    int viewHeight = viewSize.height;
    int spOtherSize = isVertical ? viewWidth : viewHeight;
    int spSize = isVertical ? viewHeight : viewWidth;

    int compSize = 0;
    int adjSize = (isVertical ? scrollable.getAdjustableWidth()
                             : scrollable.getAdjustableHeight());
    if (comp != null) {
        Dimension prefSize = scrollable.getSize();
        compSize = isVertical ? prefSize.height
                             : prefSize.width;
    }
    return ((spSize < compSize) &&
            (spOtherSize > adjSize + GAP));
}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:35,代碼來源:ScrollStateController.java

示例4: setUnitIncrement

import java.awt.Adjustable; //導入方法依賴的package包/類
public void setUnitIncrement (Adjustable adj, int u)
{
  if (adj.getOrientation()==Adjustable.HORIZONTAL)
    gtkScrolledWindowSetHScrollIncrement (u);
  else
    gtkScrolledWindowSetVScrollIncrement (u);
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:8,代碼來源:GtkScrollPanePeer.java

示例5: adjustmentValueChanged

import java.awt.Adjustable; //導入方法依賴的package包/類
@Override
public void adjustmentValueChanged(AdjustmentEvent evt) {
    Adjustable source = evt.getAdjustable();

    // getValueIsAdjusting() returns true if the user is currently
    // dragging the scrollbar's knob and has not picked a final value
    if (evt.getValueIsAdjusting()) {
        // The user is dragging the knob
        return;
    } else {
        ((javax.swing.JScrollBar) source).getParent().repaint();
    }

    // Determine which scrollbar fired the event
    int orient = source.getOrientation();
    if (orient == Adjustable.HORIZONTAL) {
        // Event from horizontal scrollbar
    } else {
        // Event from vertical scrollbar
    }

    // Determine the type of event
    int type = evt.getAdjustmentType();
    switch (type) {
        case AdjustmentEvent.UNIT_INCREMENT:
            // Scrollbar was increased by one unit
            break;
        case AdjustmentEvent.UNIT_DECREMENT:
            // Scrollbar was decreased by one unit
            break;
        case AdjustmentEvent.BLOCK_INCREMENT:
            // Scrollbar was increased by one block
            break;
        case AdjustmentEvent.BLOCK_DECREMENT:
            // Scrollbar was decreased by one block
            break;
        case AdjustmentEvent.TRACK:
            // The knob on the scrollbar was dragged
            break;
    }

    // Get current value
    //int value = evt.getValue();
}
 
開發者ID:CIRDLES,項目名稱:ET_Redux,代碼行數:45,代碼來源:SampleAnalysisWorkflowManagerIDTIMS.java

示例6: adjustmentValueChanged

import java.awt.Adjustable; //導入方法依賴的package包/類
public void adjustmentValueChanged(AdjustmentEvent evt) {
    Adjustable source = evt.getAdjustable();

    // getValueIsAdjusting() returns true if the user is currently
    // dragging the scrollbar's knob and has not picked a final value
    if (evt.getValueIsAdjusting()) {
        // The user is dragging the knob
        return;
    } else {
        ((javax.swing.JScrollBar) source).getParent().repaint();
    }

    // Determine which scrollbar fired the event
    int orient = source.getOrientation();
    if (orient == Adjustable.HORIZONTAL) {
        // Event from horizontal scrollbar
    } else {
        // Event from vertical scrollbar
    }

    // Determine the type of event
    int type = evt.getAdjustmentType();
    switch (type) {
        case AdjustmentEvent.UNIT_INCREMENT:
            // Scrollbar was increased by one unit
            break;
        case AdjustmentEvent.UNIT_DECREMENT:
            // Scrollbar was decreased by one unit
            break;
        case AdjustmentEvent.BLOCK_INCREMENT:
            // Scrollbar was increased by one block
            break;
        case AdjustmentEvent.BLOCK_DECREMENT:
            // Scrollbar was decreased by one block
            break;
        case AdjustmentEvent.TRACK:
            // The knob on the scrollbar was dragged
            break;
    }

    // Get current value
    //int value = evt.getValue();
}
 
開發者ID:CIRDLES,項目名稱:ET_Redux,代碼行數:44,代碼來源:SampleAnalysisWorkflowManagerLAICPMS.java

示例7: adjustmentValueChanged

import java.awt.Adjustable; //導入方法依賴的package包/類
public void adjustmentValueChanged(AdjustmentEvent evt) {
    Adjustable source = evt.getAdjustable();

    // getValueIsAdjusting() returns true if the user is currently
    // dragging the scrollbar's knob and has not picked a final value
    //if (evt.getValueIsAdjusting()) {
        // The user is dragging the knob
        // do not return...
        //return;
    //}

    // Determine which scrollbar fired the event
    int orient = source.getOrientation();
    if (orient == Adjustable.HORIZONTAL) {
        // Event from horizontal scrollbar
    } else {
        // Event from vertical scrollbar
    }

    // Determine the type of event
    int type = evt.getAdjustmentType();
    switch (type) {
      case AdjustmentEvent.UNIT_INCREMENT:
          // Scrollbar was increased by one unit
          break;
      case AdjustmentEvent.UNIT_DECREMENT:
          // Scrollbar was decreased by one unit
          break;
      case AdjustmentEvent.BLOCK_INCREMENT:
          // Scrollbar was increased by one block
          break;
      case AdjustmentEvent.BLOCK_DECREMENT:
          // Scrollbar was decreased by one block
          break;
      case AdjustmentEvent.TRACK:
          // The knob on the scrollbar was dragged
          break;
    }

    // Get current value
    int value = evt.getValue();
   
    triggerScrolled(source,value);
}
 
開發者ID:andreasprlic,項目名稱:spice-3d,代碼行數:45,代碼來源:AlignmentRenderer.java


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