本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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));
}
示例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));
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}