当前位置: 首页>>代码示例>>Java>>正文


Java AccessibleStateSet类代码示例

本文整理汇总了Java中javax.accessibility.AccessibleStateSet的典型用法代码示例。如果您正苦于以下问题:Java AccessibleStateSet类的具体用法?Java AccessibleStateSet怎么用?Java AccessibleStateSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AccessibleStateSet类属于javax.accessibility包,在下文中一共展示了AccessibleStateSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
/**
 * Returns a state set describing this component's state.
 *
 * @return a new state set
 * @see AccessibleState
 */
public AccessibleStateSet getAccessibleStateSet()
{
  AccessibleStateSet s = new AccessibleStateSet();
  if (Component.this.isEnabled())
    s.add(AccessibleState.ENABLED);
  if (isFocusable())
    s.add(AccessibleState.FOCUSABLE);
  if (isFocusOwner())
    s.add(AccessibleState.FOCUSED);
  // Note: While the java.awt.Component has an 'opaque' property, it
  // seems that it is not added to the accessible state set here, even
  // if this property is true. However, it is handled for
  // javax.swing.JComponent, so we add it there.
  if (Component.this.isShowing())
    s.add(AccessibleState.SHOWING);
  if (Component.this.isVisible())
    s.add(AccessibleState.VISIBLE);
  return s;
}
 
开发者ID:vilie,项目名称:javify,代码行数:26,代码来源:Component.java

示例2: getAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
/**
 * Returns the accessible state set of this accessible table cell.
 *
 * @return the accessible state set of this accessible table cell
 */
public AccessibleStateSet getAccessibleStateSet()
{
  AccessibleStateSet state = new AccessibleStateSet();

  // Figure out the SHOWING state.
  Rectangle visibleRect = getVisibleRect();
  Rectangle cellRect = getCellRect(row, column, false);
  if (visibleRect.intersects(cellRect))
    state.add(AccessibleState.SHOWING);

  // Figure out SELECTED state.
  if (isCellSelected(row, column))
    state.add(AccessibleState.SELECTED);

  // Figure out ACTIVE state.
  if (row == getSelectedRow() && column == getSelectedColumn())
    state.add(AccessibleState.ACTIVE);

  // TRANSIENT seems to be always set in the RI.
  state.add(AccessibleState.TRANSIENT);

  // TODO: Any other state to handle here?
  return state;
}
 
开发者ID:vilie,项目名称:javify,代码行数:30,代码来源:JTable.java

示例3: getAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
/**
 * Returns the accessible state set of this list item.
 *
 * @return the accessible state set of this list item
 */
public AccessibleStateSet getAccessibleStateSet()
{
  AccessibleStateSet states = new AccessibleStateSet();
  if (isVisible())
    states.add(AccessibleState.VISIBLE);
  if (isShowing())
    states.add(AccessibleState.SHOWING);
  if (isFocusTraversable())
    states.add(AccessibleState.FOCUSABLE);
  // TODO: How should the active state be handled? The API docs
  // suggest that this state is set on the activated list child,
  // that is the one that is drawn with a box. However, I don't know how
  // to implement this.

  // TODO: We set the selectable state here because list children are
  // selectable. Is there a way to disable single children?
  if (parent.isEnabled())
    states.add(AccessibleState.SELECTABLE);

  if (parent.isSelectedIndex(listIndex))
    states.add(AccessibleState.SELECTED);

  // TODO: Handle more states here?
  return states;
}
 
开发者ID:vilie,项目名称:javify,代码行数:31,代码来源:JList.java

示例4: getAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
/**
 * Returns the accessible state set of this list item.
 *
 * @return the accessible state set of this list item
 */
public AccessibleStateSet getAccessibleStateSet()
{
  AccessibleStateSet states = new AccessibleStateSet();
  if (isVisible())
    states.add(AccessibleState.VISIBLE);
  if (isShowing())
    states.add(AccessibleState.SHOWING);
  if (isFocusTraversable())
    states.add(AccessibleState.FOCUSABLE);
  // TODO: How should the active state be handled? The API docs
  // suggest that this state is set on the activated list child,
  // that is the one that is drawn with a box. However, I don't know how
  // to implement this.

  // TODO: We set the selectable state here because list children are
  // selectable. Is there a way to disable single children?
  if (parent.isEnabled())
    states.add(AccessibleState.SELECTABLE);
 
  if (parent.isSelectedIndex(listIndex))
    states.add(AccessibleState.SELECTED);

  // TODO: Handle more states here?
  return states;
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:31,代码来源:JList.java

示例5: getAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
@Override
public AccessibleStateSet getAccessibleStateSet() {
    toolkit.lockAWT();
    try {
        AccessibleStateSet set = super.getAccessibleStateSet();
        if (isFocused()) {
            set.add(AccessibleState.ACTIVE);
        }
        if (isResizable()) {
            set.add(AccessibleState.RESIZABLE);
        }
        return set;
    } finally {
        toolkit.unlockAWT();
    }
}
 
开发者ID:mike10004,项目名称:appengine-imaging,代码行数:17,代码来源:Window.java

示例6: getAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
@Override
public AccessibleStateSet getAccessibleStateSet() {
    toolkit.lockAWT();
    try {
        AccessibleStateSet aStateSet = super.getAccessibleStateSet();
        AccessibleState aState = null;
        switch (getOrientation()) {
            case VERTICAL:
                aState = AccessibleState.VERTICAL;
                break;
            case HORIZONTAL:
                aState = AccessibleState.HORIZONTAL;
                break;
        }
        if (aState != null) {
            aStateSet.add(aState);
        }
        return aStateSet;
    } finally {
        toolkit.unlockAWT();
    }
}
 
开发者ID:mike10004,项目名称:appengine-imaging,代码行数:23,代码来源:Scrollbar.java

示例7: testGetAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
public final void testGetAccessibleStateSet() {
    AccessibleStateSet aStateSet = ac.getAccessibleStateSet();
    assertFalse("accessible dialog is active",
               aStateSet.contains(AccessibleState.ACTIVE));
    assertTrue("accessible dialog is resizable",
               aStateSet.contains(AccessibleState.RESIZABLE));
    assertFalse("accessible dialog is NOT modal",
                aStateSet.contains(AccessibleState.MODAL));

    dialog.setResizable(false);
    aStateSet = ac.getAccessibleStateSet();
    assertFalse("accessible dialog is NOT resizable",
               aStateSet.contains(AccessibleState.RESIZABLE));
    dialog.setModal(true);
    aStateSet = ac.getAccessibleStateSet();
    assertTrue("accessible dialog is modal",
                aStateSet.contains(AccessibleState.MODAL));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:AccessibleAWTDialogTest.java

示例8: testGetAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public final void testGetAccessibleStateSet() {
    frame.show();
    window.setFocusable(true);
    window.setVisible(true);
    waitFocus();
    assertTrue(window.isFocusOwner());
    AccessibleStateSet aStateSet = ac.getAccessibleStateSet();
    assertTrue("accessible window is active",
               aStateSet.contains(AccessibleState.ACTIVE));
    assertTrue("accessible window is showing",
               aStateSet.contains(AccessibleState.SHOWING));
    assertTrue("accessible window is focusable",
               aStateSet.contains(AccessibleState.FOCUSABLE));
    assertTrue("accessible window is focused",
               aStateSet.contains(AccessibleState.FOCUSED));
    assertFalse("accessible window is NOT resizable",
                aStateSet.contains(AccessibleState.RESIZABLE));
    assertTrue(frame.isActive());
    aStateSet = frame.getAccessibleContext().getAccessibleStateSet();
    assertFalse("accessible frame is NOT active",
                aStateSet.contains(AccessibleState.ACTIVE));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:24,代码来源:AccessibleAWTWindowTest.java

示例9: getAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
public AccessibleStateSet getAccessibleStateSet() {
    AccessibleStateSet result = new AccessibleStateSet();

    if (isEnabled()) {
        result.add(AccessibleState.ENABLED);
    }
    if (isFocusable()) {
        result.add(AccessibleState.FOCUSABLE);
    }
    if (isVisible()) {
        result.add(AccessibleState.VISIBLE);
    }
    if (isOpaque()) {
        result.add(AccessibleState.OPAQUE);
    }
    if (getOrientation() == HORIZONTAL) {
        result.add(AccessibleState.HORIZONTAL);
    } else {
        result.add(AccessibleState.VERTICAL);
    }

    return result;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:24,代码来源:JScrollBar.java

示例10: checkStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
private void checkStateSet(final AccessibleStateSet ass) {
    if (jtc.isEnabled()) {
        checkState(ass, AccessibleState.ENABLED);
    }
    if (jtc.isFocusable()) {
        checkState(ass, AccessibleState.FOCUSABLE);
    }
    if (jtc.isVisible()) {
        checkState(ass, AccessibleState.VISIBLE);
    }
    if (jtc.isShowing()) {
        checkState(ass, AccessibleState.SHOWING);
    }
    if (jtc.isFocusOwner()) {
        checkState(ass, AccessibleState.FOCUSED);
    }
    if (jtc.isOpaque()) {
        checkState(ass, AccessibleState.OPAQUE);
    }
    assertEquals(0, ass.toArray().length);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:22,代码来源:JTextComponent_AccessibleJTextComponentTest.java

示例11: getAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
@Override
public AccessibleStateSet getAccessibleStateSet() {
    AccessibleStateSet set = super.getAccessibleStateSet();
    Window owner = null;
    for (Component c = Applet.this; c != null; c = c.getParent()) {
        if (c instanceof Window) {
            owner = (Window)c;
            break;
        }
    }
    
    if (owner != null) {
        if (owner.isActive()) {
            set.add(AccessibleState.ACTIVE);
        }
    }
    return set;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:Applet.java

示例12: getAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
public AccessibleStateSet getAccessibleStateSet() {
    AccessibleStateSet stateSet = new AccessibleStateSet();
    if( isHorizontal() ) {
        stateSet.add( AccessibleState.HORIZONTAL );
    } else {
        stateSet.add( AccessibleState.VERTICAL );
    }
    return stateSet;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:MultiSplitDivider.java

示例13: getAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
@Override
public AccessibleStateSet getAccessibleStateSet() {
    AccessibleStateSet states = super.getAccessibleStateSet();
    if( isHorizontalSplit() ) {
        states.add( AccessibleState.HORIZONTAL );
    } else {
        states.add( AccessibleState.VERTICAL );
    }
    return states;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:MultiSplitPane.java

示例14: getAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
public AccessibleStateSet getAccessibleStateSet() {
    AccessibleState[] states = new AccessibleState[] {
        AccessibleState.VISIBLE,
        AccessibleState.OPAQUE,
        AccessibleState.SHOWING,
        AccessibleState.MULTI_LINE,
    };
    return new AccessibleStateSet (states);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:10,代码来源:InstructionsPanel.java

示例15: getAccessibleStateSet

import javax.accessibility.AccessibleStateSet; //导入依赖的package包/类
/**
 * Get the state of this object.
 *
 * @return an instance of AccessibleStateSet containing the current
 * state set of the object
 * @see AccessibleState
 */
public AccessibleStateSet getAccessibleStateSet() {
    AccessibleStateSet states = super.getAccessibleStateSet();

    if (isResizable()) {
        states.add(AccessibleState.RESIZABLE);
    }
    if (getFocusOwner() != null) {
        states.add(AccessibleState.ACTIVE);
    }
    // FIXME:  [[[WDW - should also return ICONIFIED and ICONIFIABLE
    // if we can ever figure these out]]]
    return states;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:JFrame.java


注:本文中的javax.accessibility.AccessibleStateSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。