src/macosx/classes/sun/lwawt/LWCheckboxPeer.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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,26 +39,31 @@
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
- protected CheckboxDelegate createDelegate() {
+ CheckboxDelegate createDelegate() {
return new CheckboxDelegate();
}
@Override
- protected Component getDelegateFocusOwner() {
+ Component getDelegateFocusOwner() {
return getDelegate().getCurrentButton();
}
@Override
void initializeImpl() {
@@ -135,10 +140,11 @@
@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;