src/share/classes/javax/swing/LayoutFocusTraversalPolicy.java
Print this page
*** 96,106 ****
public Component getComponentAfter(Container aContainer,
Component aComponent) {
if (aContainer == null || aComponent == null) {
throw new IllegalArgumentException("aContainer and aComponent cannot be null");
}
! Comparator comparator = getComparator();
if (comparator instanceof LayoutComparator) {
((LayoutComparator)comparator).
setComponentOrientation(aContainer.
getComponentOrientation());
}
--- 96,106 ----
public Component getComponentAfter(Container aContainer,
Component aComponent) {
if (aContainer == null || aComponent == null) {
throw new IllegalArgumentException("aContainer and aComponent cannot be null");
}
! Comparator<? super Component> comparator = getComparator();
if (comparator instanceof LayoutComparator) {
((LayoutComparator)comparator).
setComponentOrientation(aContainer.
getComponentOrientation());
}
*** 132,142 ****
public Component getComponentBefore(Container aContainer,
Component aComponent) {
if (aContainer == null || aComponent == null) {
throw new IllegalArgumentException("aContainer and aComponent cannot be null");
}
! Comparator comparator = getComparator();
if (comparator instanceof LayoutComparator) {
((LayoutComparator)comparator).
setComponentOrientation(aContainer.
getComponentOrientation());
}
--- 132,142 ----
public Component getComponentBefore(Container aContainer,
Component aComponent) {
if (aContainer == null || aComponent == null) {
throw new IllegalArgumentException("aContainer and aComponent cannot be null");
}
! Comparator<? super Component> comparator = getComparator();
if (comparator instanceof LayoutComparator) {
((LayoutComparator)comparator).
setComponentOrientation(aContainer.
getComponentOrientation());
}
*** 156,166 ****
*/
public Component getFirstComponent(Container aContainer) {
if (aContainer == null) {
throw new IllegalArgumentException("aContainer cannot be null");
}
! Comparator comparator = getComparator();
if (comparator instanceof LayoutComparator) {
((LayoutComparator)comparator).
setComponentOrientation(aContainer.
getComponentOrientation());
}
--- 156,166 ----
*/
public Component getFirstComponent(Container aContainer) {
if (aContainer == null) {
throw new IllegalArgumentException("aContainer cannot be null");
}
! Comparator<? super Component> comparator = getComparator();
if (comparator instanceof LayoutComparator) {
((LayoutComparator)comparator).
setComponentOrientation(aContainer.
getComponentOrientation());
}
*** 180,190 ****
*/
public Component getLastComponent(Container aContainer) {
if (aContainer == null) {
throw new IllegalArgumentException("aContainer cannot be null");
}
! Comparator comparator = getComparator();
if (comparator instanceof LayoutComparator) {
((LayoutComparator)comparator).
setComponentOrientation(aContainer.
getComponentOrientation());
}
--- 180,190 ----
*/
public Component getLastComponent(Container aContainer) {
if (aContainer == null) {
throw new IllegalArgumentException("aContainer cannot be null");
}
! Comparator<? super Component> comparator = getComparator();
if (comparator instanceof LayoutComparator) {
((LayoutComparator)comparator).
setComponentOrientation(aContainer.
getComponentOrientation());
}
*** 231,241 ****
} else if (SunToolkit.isInstanceOf(aComponent, "javax.swing.JTable")) {
// JTable only has ancestor focus bindings, we thus force it
// to be focusable by returning true here.
return true;
} else if (SunToolkit.isInstanceOf(aComponent, "javax.swing.JComboBox")) {
! JComboBox box = (JComboBox)aComponent;
return box.getUI().isFocusTraversable(box);
} else if (aComponent instanceof JComponent) {
JComponent jComponent = (JComponent)aComponent;
InputMap inputMap = jComponent.getInputMap(JComponent.WHEN_FOCUSED,
false);
--- 231,241 ----
} else if (SunToolkit.isInstanceOf(aComponent, "javax.swing.JTable")) {
// JTable only has ancestor focus bindings, we thus force it
// to be focusable by returning true here.
return true;
} else if (SunToolkit.isInstanceOf(aComponent, "javax.swing.JComboBox")) {
! JComboBox<?> box = (JComboBox)aComponent;
return box.getUI().isFocusTraversable(box);
} else if (aComponent instanceof JComponent) {
JComponent jComponent = (JComponent)aComponent;
InputMap inputMap = jComponent.getInputMap(JComponent.WHEN_FOCUSED,
false);
*** 254,267 ****
private void writeObject(ObjectOutputStream out) throws IOException {
out.writeObject(getComparator());
out.writeBoolean(getImplicitDownCycleTraversal());
}
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException
{
! setComparator((Comparator)in.readObject());
setImplicitDownCycleTraversal(in.readBoolean());
}
}
// Create our own subclass and change accept to public so that we can call
--- 254,268 ----
private void writeObject(ObjectOutputStream out) throws IOException {
out.writeObject(getComparator());
out.writeBoolean(getImplicitDownCycleTraversal());
}
+ @SuppressWarnings("unchecked") // Cast to (Comparator<? super Component>)
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException
{
! setComparator((Comparator<? super Component>)in.readObject());
setImplicitDownCycleTraversal(in.readBoolean());
}
}
// Create our own subclass and change accept to public so that we can call