use of javax.accessibility.AccessibleComponent in project Botnak by Gocnak.
the class DraggableTabbedPane method getPage.
public AccessibleComponent getPage(int index) {
try {
Field pages = JTabbedPane.class.getDeclaredField("pages");
pages.setAccessible(true);
Object p = pages.get(this);
return (AccessibleComponent) ((ArrayList) p).get(index);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
use of javax.accessibility.AccessibleComponent in project jdk8u_jdk by JetBrains.
the class JTableAccessibleGetLocationOnScreen method assertGetLocation.
private static void assertGetLocation() {
// the frame is now invisible
// test getLocationOnScreen() of
// JTable$AccessibleJTable$AccessibleJTableHeaderCell
// and JTable$AccessibleJTable$AccessibleJTableCell
AccessibleTable accessibleTable = (AccessibleTable) table.getAccessibleContext();
AccessibleTable header = accessibleTable.getAccessibleColumnHeader();
AccessibleComponent accessibleComp1 = (AccessibleComponent) header.getAccessibleAt(0, 0);
// is thrown
if (null != accessibleComp1.getLocationOnScreen()) {
throw new RuntimeException("JTable$AccessibleJTable$AccessibleJTableHeaderCell." + "getLocation() must be null");
}
JComponent.AccessibleJComponent accessibleJComponent = (JComponent.AccessibleJComponent) table.getAccessibleContext();
AccessibleComponent accessibleComp2 = (AccessibleComponent) accessibleJComponent.getAccessibleChild(3);
// is thrown
if (null != accessibleComp2.getLocationOnScreen()) {
throw new RuntimeException("JTable$AccessibleJTable$" + "AccessibleJTableCell.getLocation() must be null");
}
}
use of javax.accessibility.AccessibleComponent in project cytoscape-impl by cytoscape.
the class PreviewTablePanel method positionEditDialog.
private void positionEditDialog() {
if (editDialog != null) {
final JTableHeader hd = getPreviewTable().getTableHeader();
// Get the column header location
// (see: https://bugs.openjdk.java.net/browse/JDK-4408424)
final AccessibleComponent ac = hd.getAccessibleContext().getAccessibleChild(editDialog.index).getAccessibleContext().getAccessibleComponent();
final Point screenPt = ac.getLocationOnScreen();
final Point compPt = ac.getLocation();
int xOffset = screenPt.x - compPt.x;
int yOffset = screenPt.y - compPt.y + hd.getBounds().height;
final Point pt = ac.getBounds().getLocation();
pt.translate(xOffset, yOffset);
// This prevent the dialog from being positioned completely outside the parent panel
pt.x = Math.max(pt.x, getTableScrollPane().getLocationOnScreen().x - editDialog.getBounds().width);
pt.x = Math.min(pt.x, getTableScrollPane().getLocationOnScreen().x + getTableScrollPane().getBounds().width);
// Show the dialog right below the column header
editDialog.setLocation(pt);
}
}
Aggregations