src/macosx/classes/sun/lwawt/LWCheckboxPeer.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 39,64 ****
import javax.swing.JComponent;
import javax.swing.JRadioButton;
import javax.swing.JToggleButton;
import javax.swing.SwingUtilities;
final class LWCheckboxPeer
extends LWComponentPeer<Checkbox, LWCheckboxPeer.CheckboxDelegate>
implements CheckboxPeer, ItemListener {
LWCheckboxPeer(final Checkbox target,
final PlatformComponent platformComponent) {
super(target, platformComponent);
}
@Override
! protected CheckboxDelegate createDelegate() {
return new CheckboxDelegate();
}
@Override
! protected Component getDelegateFocusOwner() {
return getDelegate().getCurrentButton();
}
@Override
void initializeImpl() {
--- 39,69 ----
import javax.swing.JComponent;
import javax.swing.JRadioButton;
import javax.swing.JToggleButton;
import javax.swing.SwingUtilities;
+ /**
+ * Lightweight implementation of {@link CheckboxPeer}. Delegates most of the
+ * work to the {@link JCheckBox} and {@link JRadioButton}, which are placed
+ * inside an empty {@link JComponent}.
+ */
final class LWCheckboxPeer
extends LWComponentPeer<Checkbox, LWCheckboxPeer.CheckboxDelegate>
implements CheckboxPeer, ItemListener {
LWCheckboxPeer(final Checkbox target,
final PlatformComponent platformComponent) {
super(target, platformComponent);
}
@Override
! CheckboxDelegate createDelegate() {
return new CheckboxDelegate();
}
@Override
! Component getDelegateFocusOwner() {
return getDelegate().getCurrentButton();
}
@Override
void initializeImpl() {
*** 135,144 ****
--- 140,150 ----
@Override
public boolean isFocusable() {
return true;
}
+ @SuppressWarnings("serial")// Safe: outer class is non-serializable.
final class CheckboxDelegate extends JComponent {
private final JCheckBox cb;
private final JRadioButton rb;