本文整理汇总了Java中javax.accessibility.AccessibleState类的典型用法代码示例。如果您正苦于以下问题:Java AccessibleState类的具体用法?Java AccessibleState怎么用?Java AccessibleState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AccessibleState类属于javax.accessibility包,在下文中一共展示了AccessibleState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAccessibleStateSet
import javax.accessibility.AccessibleState; //导入依赖的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: removeAccessibleSelection
import javax.accessibility.AccessibleState; //导入依赖的package包/类
/**
* Removes the specified selected item in the object from the
* object's selection.
*
* @param i - the specified item to remove
*/
public void removeAccessibleSelection(int i)
{
if (mod != null)
{
Object child = mod.getChild(tp.getLastPathComponent(), i);
if (child != null)
{
if (!states.contains(AccessibleState.MULTISELECTABLE))
clearAccessibleSelection();
if (selectionList.contains(child))
{
selectionList.remove(child);
tree.removeSelectionPath(tp.pathByAddingChild(child));
}
}
}
}
开发者ID:vilie,项目名称:javify,代码行数:24,代码来源:JTree.java
示例3: selectAllAccessibleSelection
import javax.accessibility.AccessibleState; //导入依赖的package包/类
/**
* Causes every selected item in the object to be selected if the object
* supports multiple selections.
*/
public void selectAllAccessibleSelection()
{
Object parent = tp.getLastPathComponent();
if (mod != null)
{
for (int i = 0; i < mod.getChildCount(parent); i++)
{
Object child = mod.getChild(parent, i);
if (child != null)
{
if (!states.contains(AccessibleState.MULTISELECTABLE))
clearAccessibleSelection();
if (selectionList.contains(child))
{
selectionList.add(child);
tree.addSelectionPath(tp.pathByAddingChild(child));
}
}
}
}
}
开发者ID:vilie,项目名称:javify,代码行数:26,代码来源:JTree.java
示例4: getAccessibleStateSet
import javax.accessibility.AccessibleState; //导入依赖的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
示例5: getAccessibleStateSet
import javax.accessibility.AccessibleState; //导入依赖的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
示例6: removeAccessibleSelection
import javax.accessibility.AccessibleState; //导入依赖的package包/类
/**
* Removes the specified selected item in the object from the
* object's selection.
*
* @param i - the specified item to remove
*/
public void removeAccessibleSelection(int i)
{
if (mod != null)
{
Object child = mod.getChild(tp.getLastPathComponent(), i);
if (child != null)
{
if (!states.contains(AccessibleState.MULTISELECTABLE))
clearAccessibleSelection();
if (selectionList.contains(child))
{
selectionList.remove(child);
tree.removeSelectionPath(tp.pathByAddingChild(child));
}
}
}
}
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:24,代码来源:JTree.java
示例7: selectAllAccessibleSelection
import javax.accessibility.AccessibleState; //导入依赖的package包/类
/**
* Causes every selected item in the object to be selected if the object
* supports multiple selections.
*/
public void selectAllAccessibleSelection()
{
Object parent = tp.getLastPathComponent();
if (mod != null)
{
for (int i = 0; i < mod.getChildCount(parent); i++)
{
Object child = mod.getChild(parent, i);
if (child != null)
{
if (!states.contains(AccessibleState.MULTISELECTABLE))
clearAccessibleSelection();
if (selectionList.contains(child))
{
selectionList.add(child);
tree.addSelectionPath(tp.pathByAddingChild(child));
}
}
}
}
}
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:26,代码来源:JTree.java
示例8: getAccessibleStateSet
import javax.accessibility.AccessibleState; //导入依赖的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
示例9: fireAccessibleStateChange
import javax.accessibility.AccessibleState; //导入依赖的package包/类
private void fireAccessibleStateChange(AccessibleState state, boolean value) {
if (behaviour.isLightweight()) {
return;
}
AccessibleContext ac = getAccessibleContext();
if (ac != null) {
AccessibleState oldValue = null;
AccessibleState newValue = null;
if (value) {
newValue = state;
} else {
oldValue = state;
}
ac.firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, oldValue,
newValue);
}
}
开发者ID:mike10004,项目名称:appengine-imaging,代码行数:18,代码来源:Component.java
示例10: getAccessibleStateSet
import javax.accessibility.AccessibleState; //导入依赖的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
示例11: getAccessibleStateSet
import javax.accessibility.AccessibleState; //导入依赖的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
示例12: testGetAccessibleStateSet
import javax.accessibility.AccessibleState; //导入依赖的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
示例13: testAddPropertyChangeListener
import javax.accessibility.AccessibleState; //导入依赖的package包/类
public final void testAddPropertyChangeListener() {
String propName = AccessibleContext.ACCESSIBLE_STATE_PROPERTY;
canvas.getAccessibleContext().addPropertyChangeListener(propListener);
assertNull(lastPropEvent);
Frame f = new Frame();
f.add(canvas);
canvas.setFocusable(true); //!
f.setVisible(true);
waitForEvent();
// focus events:
assertNotNull(lastPropEvent);
assertEquals(propName, lastPropEvent.getPropertyName());
assertEquals(AccessibleState.FOCUSED, lastPropEvent.getNewValue());
assertNull(lastPropEvent.getOldValue());
// component events:
lastPropEvent = null;
canvas.setVisible(false);
waitForEvent();
assertNotNull(lastPropEvent);
assertEquals(propName, lastPropEvent.getPropertyName());
assertEquals(AccessibleState.VISIBLE, lastPropEvent.getOldValue());
assertNull(lastPropEvent.getNewValue());
f.dispose();
}
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:AccessibleAWTCanvasTest.java
示例14: testGetAccessibleStateSet
import javax.accessibility.AccessibleState; //导入依赖的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
示例15: getAccessibleStateSet
import javax.accessibility.AccessibleState; //导入依赖的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
示例16: testGetAccessibleContext
import javax.accessibility.AccessibleState; //导入依赖的package包/类
public void testGetAccessibleContext() {
AccessibleContext c = frame.getAccessibleContext();
assertTrue("class is ok", c instanceof JFrame.AccessibleJFrame);
assertTrue("AccessibleRole is ok", c.getAccessibleRole() == AccessibleRole.FRAME);
assertNull("AccessibleDescription is ok", c.getAccessibleDescription());
assertTrue("AccessibleChildrenCount == 1", c.getAccessibleChildrenCount() == 1);
// test getAccessibleName()
assertTrue("AccessibleName is ok", c.getAccessibleName() == "");
frame.setTitle("aa");
assertTrue("AccessibleName is ok", c.getAccessibleName() == "aa");
// test getAccessibleStateSet()
AccessibleState[] states = c.getAccessibleStateSet().toArray();
assertTrue("more than 2 states", states.length > 2);
frame.setVisible(true);
states = c.getAccessibleStateSet().toArray();
assertTrue("more than 4 states", states.length > 4);
}
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:JFrameTest.java
示例17: checkStateSet
import javax.accessibility.AccessibleState; //导入依赖的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
示例18: testGetAccessibleContext
import javax.accessibility.AccessibleState; //导入依赖的package包/类
public void testGetAccessibleContext() {
AccessibleContext c = dialog.getAccessibleContext();
assertTrue("class is ok", c instanceof JDialog.AccessibleJDialog);
assertTrue("AccessibleRole is ok", c.getAccessibleRole() == AccessibleRole.DIALOG);
assertNull("AccessibleDescription is ok", c.getAccessibleDescription());
assertTrue("AccessibleChildrenCount == 1", c.getAccessibleChildrenCount() == 1);
// test getAccessibleName()
assertNull("AccessibleName is ok", c.getAccessibleName());
dialog.setTitle("aa");
assertTrue("AccessibleName is ok", c.getAccessibleName() == "aa");
// test getAccessibleStateSet()
AccessibleState[] states = c.getAccessibleStateSet().toArray();
assertTrue("more than 2 states", states.length > 2);
dialog.setVisible(true);
states = c.getAccessibleStateSet().toArray();
assertTrue("more than 4 states", states.length > 4);
}
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:JDialogTest.java
示例19: testSetCurrentAccessibleValue
import javax.accessibility.AccessibleState; //导入依赖的package包/类
public void testSetCurrentAccessibleValue() {
PropertyChangeController listener = new PropertyChangeController();
aContext.addPropertyChangeListener(listener);
assertTrue("returned value", aContext.setCurrentAccessibleValue(new Integer(100)));
assertEquals("CurrentAccessibleValue", new Integer(1), aContext
.getCurrentAccessibleValue());
assertTrue("button selected state", button.isSelected());
listener
.checkPropertyFired(aContext, "AccessibleState", null, AccessibleState.SELECTED);
listener
.checkPropertyFired(aContext, "AccessibleValue", new Integer(0), new Integer(1));
listener.reset();
assertTrue("returned value", aContext.setCurrentAccessibleValue(new Integer(0)));
assertEquals("CurrentAccessibleValue", new Integer(0), aContext
.getCurrentAccessibleValue());
assertFalse("button selected state", button.isSelected());
listener
.checkPropertyFired(aContext, "AccessibleState", AccessibleState.SELECTED, null);
listener
.checkPropertyFired(aContext, "AccessibleValue", new Integer(1), new Integer(0));
listener.reset();
assertTrue("returned value", aContext.setCurrentAccessibleValue(new Integer(0)));
assertFalse("no event's fired ", listener.isChanged());
}
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:AccessibleJButtonTest.java
示例20: testAccessibleContext
import javax.accessibility.AccessibleState; //导入依赖的package包/类
public void testAccessibleContext() {
progressBar.add(new JProgressBar());
AccessibleContext accessibleContext = progressBar.getAccessibleContext();
assertNull(accessibleContext.getAccessibleName());
assertNull(accessibleContext.getAccessibleDescription());
assertNull(accessibleContext.getAccessibleAction());
assertSame(accessibleContext.getAccessibleValue(), accessibleContext);
assertTrue(accessibleContext.getAccessibleStateSet().contains(
AccessibleState.HORIZONTAL));
AccessibleValue value = (AccessibleValue) accessibleContext;
int currentValue = (progressBar.getMinimum() + progressBar.getMaximum()) / 2;
progressBar.setValue(currentValue);
assertTrue(controller.isChanged());
assertEquals(new Integer(currentValue), value.getCurrentAccessibleValue());
assertEquals(new Integer(progressBar.getMaximum()), value.getMaximumAccessibleValue());
assertEquals(new Integer(progressBar.getMinimum()), value.getMinimumAccessibleValue());
value.setCurrentAccessibleValue(new Integer(currentValue + 1));
assertTrue(controller.isChanged());
assertEquals(currentValue + 1, progressBar.getValue());
assertEquals(new Integer(currentValue + 1), value.getCurrentAccessibleValue());
assertTrue(value.setCurrentAccessibleValue(new Integer(currentValue + 1)));
}
开发者ID:shannah,项目名称:cn1,代码行数:23,代码来源:JProgressBarTest.java
注:本文中的javax.accessibility.AccessibleState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论