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


Java AccessibleSelection类代码示例

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


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

示例1: getAccessibleSelection

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
/**
 * Returns the accessible selection from this AccssibleJComboBox.
 *
 * @param index the index of the selected child to fetch
 *
 * @return the accessible selection from this AccssibleJComboBox
 */
public Accessible getAccessibleSelection(int index)
{
  // Get hold of the actual popup.
  Accessible popup = getUI().getAccessibleChild(JComboBox.this, 0);
  Accessible selected = null;
  if (popup != null && popup instanceof ComboPopup)
    {
      ComboPopup cPopup = (ComboPopup) popup;
      // Query the list for the currently selected child.
      JList l = cPopup.getList();
      AccessibleContext listCtx = l.getAccessibleContext();
      if (listCtx != null)
        {
          AccessibleSelection s = listCtx.getAccessibleSelection();
          if (s != null)
            {
              selected = s.getAccessibleSelection(index);
            }
        }
    }
  return selected;
}
 
开发者ID:vilie,项目名称:javify,代码行数:30,代码来源:JComboBox.java

示例2: testSelectAllAccessibleSelection

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
public final void testSelectAllAccessibleSelection() {
    AccessibleSelection as = ac.getAccessibleSelection();
    list.add("item1");
    list.add("item2");
    assertEquals(0, list.getSelectedItems().length);
    as.selectAllAccessibleSelection();
    assertEquals(1, list.getSelectedItems().length);
    assertEquals("item1", list.getSelectedItem());
    as.selectAllAccessibleSelection();
    assertEquals(1, list.getSelectedItems().length);
    assertEquals("item1", list.getSelectedItem());
    list.setMultipleMode(true);
    as.selectAllAccessibleSelection();
    assertEquals(2, list.getSelectedItems().length);


}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:AccessibleAWTListTest.java

示例3: get

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
@Override
public Boolean get() {
	// For a JTree with an invisible root
	JTree tree = new JTree(new DefaultTreeModel(new DefaultMutableTreeNode()));
	tree.setRootVisible(false);

	// There are no accessible children
	AccessibleContext context = tree.getAccessibleContext();
	assert (context.getAccessibleChildrenCount() == 0);

	// If we select all the accessible children
	AccessibleSelection select = context.getAccessibleSelection();
	select.selectAllAccessibleSelection();

	// Then there should be 0 selected children
	if (select.getAccessibleSelectionCount() != 0) {
		log.debug("Applying workaround for Sun Java bug #7115912"); //$NON-NLS-1$
		return true;
	} else {
		return false;
	}
}
 
开发者ID:nomis,项目名称:cursus-ui,代码行数:23,代码来源:AccessibleJTreeFix.java

示例4: checkBug

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
@Test
@Ignore
public void checkBug() {
	// For a JTree with an invisible root
	JTree tree = new JTree(new DefaultTreeModel(new DefaultMutableTreeNode()));
	tree.setRootVisible(false);

	// There are no accessible children
	AccessibleContext context = tree.getAccessibleContext();
	Assert.assertEquals(0, context.getAccessibleChildrenCount());

	// If we select all the accessible children
	AccessibleSelection select = context.getAccessibleSelection();
	select.selectAllAccessibleSelection();

	// Then there should be 0 selected children
	Assert.assertEquals(0, select.getAccessibleSelectionCount());
}
 
开发者ID:nomis,项目名称:cursus-ui,代码行数:19,代码来源:Bug7115912.java

示例5: checkWorkaround

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
@Test
public void checkWorkaround() {
	// For a JTree with an invisible root
	JTree tree = new AccessibleJTreeFix(new DefaultTreeModel(new DefaultMutableTreeNode()));
	tree.setRootVisible(false);

	// There are no accessible children
	AccessibleContext context = tree.getAccessibleContext();
	Assert.assertEquals(0, context.getAccessibleChildrenCount());

	// If we select all the accessible children
	AccessibleSelection select = context.getAccessibleSelection();
	select.selectAllAccessibleSelection();

	// Then there should be 0 selected children
	Assert.assertEquals(0, select.getAccessibleSelectionCount());
}
 
开发者ID:nomis,项目名称:cursus-ui,代码行数:18,代码来源:Bug7115912.java

示例6: getAccessibleSelection

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
/**
 * Get the AccessibleSelection associated with this object.
 *
 * @return the accessible selection of the tree
 */
public AccessibleSelection getAccessibleSelection()
{
  TreeModel mod = getModel();
  if (mod != null)
    return (new AccessibleJTreeNode(JTree.this,
              new TreePath(mod.getRoot()), null)).getAccessibleSelection();
  return null;
}
 
开发者ID:vilie,项目名称:javify,代码行数:14,代码来源:JTree.java

示例7: getAccessibleSelection

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
public AccessibleSelection getAccessibleSelection()
{
  AccessibleContext ac = getAccessibleColumnHeaderRenderer();
  if (ac instanceof AccessibleValue)
    return (AccessibleSelection) ac;
  else
    return null;
}
 
开发者ID:vilie,项目名称:javify,代码行数:9,代码来源:JTableHeader.java

示例8: getAccessibleSelection

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
/**
 * Get the AccessibleSelection associated with this object.
 * 
 * @return the accessible selection of the tree
 */
public AccessibleSelection getAccessibleSelection()
{
  TreeModel mod = getModel();
  if (mod != null)
    return (new AccessibleJTreeNode(JTree.this, 
              new TreePath(mod.getRoot()), null)).getAccessibleSelection();
  return null;
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:14,代码来源:JTree.java

示例9: getAccessibleSelection

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
public AccessibleSelection getAccessibleSelection()
{
  AccessibleContext ac = getAccessibleColumnHeaderRenderer();
  if (ac instanceof AccessibleValue)
    return (AccessibleSelection) ac;
  else 
    return null;
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:9,代码来源:JTableHeader.java

示例10: testGetAccessibleSelectionCount

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
public final void testGetAccessibleSelectionCount() {
    list.add("item1");
    list.add("item2");
    AccessibleSelection as = ac.getAccessibleSelection();
    assertEquals(0, as.getAccessibleSelectionCount());
    list.select(0);
    assertEquals(1, as.getAccessibleSelectionCount());
    list.select(1);
    assertEquals(1, as.getAccessibleSelectionCount());
    list.setMultipleMode(true);
    list.select(0);
    assertEquals(2, as.getAccessibleSelectionCount());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:14,代码来源:AccessibleAWTListTest.java

示例11: testClearAccessibleSelection

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
public final void testClearAccessibleSelection() {
    list.add("item1");
    list.add("item2");
    list.setMultipleMode(true);
    AccessibleSelection as = ac.getAccessibleSelection();
    list.select(0);
    list.select(1);
    assertEquals(2, list.getSelectedItems().length);
    as.clearAccessibleSelection();
    assertEquals(0, list.getSelectedItems().length);
    assertEquals(0, as.getAccessibleSelectionCount());

}
 
开发者ID:shannah,项目名称:cn1,代码行数:14,代码来源:AccessibleAWTListTest.java

示例12: testAddAccessibleSelection

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
public final void testAddAccessibleSelection() {
    AccessibleSelection as = ac.getAccessibleSelection();
    list.add("item1");
    list.add("item2");
    assertEquals(0, list.getSelectedItems().length);
    as.addAccessibleSelection(1);
    assertEquals(1, list.getSelectedItems().length);
    assertEquals("item2", list.getSelectedItem());
    as.addAccessibleSelection(0);
    assertEquals(1, list.getSelectedItems().length);
    assertEquals("item1", list.getSelectedItem());
    list.setMultipleMode(true);
    as.addAccessibleSelection(1);
    assertEquals(2, list.getSelectedItems().length);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:AccessibleAWTListTest.java

示例13: testRemoveAccessibleSelection

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
public final void testRemoveAccessibleSelection() {
    AccessibleSelection as = ac.getAccessibleSelection();
    list.add("item1");
    list.add("item2");
    assertEquals(0, list.getSelectedItems().length);
    as.removeAccessibleSelection(0);
    as.removeAccessibleSelection(1);
    assertEquals(0, list.getSelectedItems().length);
    list.select(0);
    assertEquals(1, list.getSelectedItems().length);
    as.removeAccessibleSelection(1);
    assertEquals(1, list.getSelectedItems().length);
    as.removeAccessibleSelection(0);
    assertEquals(0, list.getSelectedItems().length);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:AccessibleAWTListTest.java

示例14: testIsAccessibleChildSelected

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
public final void testIsAccessibleChildSelected() {
    AccessibleSelection as = ac.getAccessibleSelection();
    list.add("item1");
    list.add("item2");
    assertFalse(as.isAccessibleChildSelected(0));
    assertFalse(as.isAccessibleChildSelected(1));
    list.select(1);
    assertFalse(as.isAccessibleChildSelected(0));
    assertTrue(as.isAccessibleChildSelected(1));
    list.select(0);
    assertFalse(as.isAccessibleChildSelected(1));
    assertTrue(as.isAccessibleChildSelected(0));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:14,代码来源:AccessibleAWTListTest.java

示例15: testGetAccessibleSelectionint

import javax.accessibility.AccessibleSelection; //导入依赖的package包/类
public final void testGetAccessibleSelectionint() {
    AccessibleSelection as = ac.getAccessibleSelection();
    list.add("item1");
    list.add("item2");
    assertNull(as.getAccessibleSelection(-1));
    assertNull(as.getAccessibleSelection(0));
    assertNull(as.getAccessibleSelection(1));
    list.select(1);
    assertNull(as.getAccessibleSelection(-1));
    assertTrue(as.getAccessibleSelection(0)
               instanceof AccessibleAWTList.AccessibleAWTListChild);
    assertNull(as.getAccessibleSelection(1));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:14,代码来源:AccessibleAWTListTest.java


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