src/macosx/classes/sun/lwawt/LWCheckboxPeer.java

Print this page


   1 /*
   2  * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 166         public void setEnabled(final boolean enabled) {
 167             super.setEnabled(enabled);
 168             rb.setEnabled(enabled);
 169             cb.setEnabled(enabled);
 170         }
 171 
 172         @Override
 173         public void setOpaque(final boolean isOpaque) {
 174             super.setOpaque(isOpaque);
 175             rb.setOpaque(isOpaque);
 176             cb.setOpaque(isOpaque);
 177         }
 178 
 179         @Override
 180         @Deprecated
 181         public void reshape(final int x, final int y, final int w,
 182                             final int h) {
 183             super.reshape(x, y, w, h);
 184             cb.setBounds(0, 0, w, h);
 185             rb.setBounds(0, 0, w, h);





 186         }
 187 
 188         @Override
 189         @Transient
 190         public Dimension getMinimumSize() {
 191             return getCurrentButton().getMinimumSize();
 192         }
 193 
 194         void setRadioButton(final boolean showRadioButton) {
 195             rb.setVisible(showRadioButton);
 196             cb.setVisible(!showRadioButton);
 197         }
 198 
 199         @Transient
 200         JToggleButton getCurrentButton() {
 201             return cb.isVisible() ? cb : rb;
 202         }
 203 
 204         void setText(final String label) {
 205             cb.setText(label);
   1 /*
   2  * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 166         public void setEnabled(final boolean enabled) {
 167             super.setEnabled(enabled);
 168             rb.setEnabled(enabled);
 169             cb.setEnabled(enabled);
 170         }
 171 
 172         @Override
 173         public void setOpaque(final boolean isOpaque) {
 174             super.setOpaque(isOpaque);
 175             rb.setOpaque(isOpaque);
 176             cb.setOpaque(isOpaque);
 177         }
 178 
 179         @Override
 180         @Deprecated
 181         public void reshape(final int x, final int y, final int w,
 182                             final int h) {
 183             super.reshape(x, y, w, h);
 184             cb.setBounds(0, 0, w, h);
 185             rb.setBounds(0, 0, w, h);
 186         }
 187 
 188         @Override
 189         public Dimension getPreferredSize() {
 190             return getCurrentButton().getPreferredSize();
 191         }
 192 
 193         @Override
 194         @Transient
 195         public Dimension getMinimumSize() {
 196             return getCurrentButton().getMinimumSize();
 197         }
 198 
 199         void setRadioButton(final boolean showRadioButton) {
 200             rb.setVisible(showRadioButton);
 201             cb.setVisible(!showRadioButton);
 202         }
 203 
 204         @Transient
 205         JToggleButton getCurrentButton() {
 206             return cb.isVisible() ? cb : rb;
 207         }
 208 
 209         void setText(final String label) {
 210             cb.setText(label);