/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
final int iconSize;
}
}
public AquaButtonLabeledUI() {
widgetBorder = getPainter();
}
super.applySizeFor(c, newSize);
}
return regularIcon.get();
}
super.setThemeBorder(b);
// Set the correct border
}
}
final AbstractButton b = (AbstractButton)c;
g.setFont(f);
// This was erroneously removed to fix [3155996] but really we wanted the controls to just be
// opaque. So we put this back in to fix [3179839] (radio buttons not being translucent)
if (b.isOpaque() || isCellEditor) {
g.setColor(b.getBackground());
}
// only do this if borders are on!
if (border instanceof AquaButtonBorder) {
((AquaButtonBorder)border).paintButton(c, g, viewRect.x, viewRect.y, viewRect.width, viewRect.height);
}
}
// normal size ??
// at some point we substitute the small icon instead of the normal icon
// we should base this on height. Use normal unless we are under a certain size
// see our button code!
final String text = SwingUtilities.layoutCompoundLabel(c, fm, b.getText(), altIcon != null ? altIcon : getDefaultIcon(b), b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, iconRect, textRect, b.getText() == null ? 0 : b.getIconTextGap());
// fill background
// draw the native radio button stuff here.
} else {
// Paint the button
if (model.isSelected()) {
altIcon = b.getDisabledSelectedIcon();
} else {
altIcon = b.getDisabledIcon();
}
altIcon = b.getPressedIcon();
// Use selected icon
altIcon = b.getSelectedIcon();
}
} else if (model.isSelected()) {
altIcon = b.getRolloverSelectedIcon();
altIcon = b.getSelectedIcon();
}
} else {
altIcon = b.getSelectedIcon();
}
altIcon = b.getRolloverIcon();
}
}
}
// Draw the Text
if (v != null) {
} else {
}
}
}
/**
* The preferred size of the button
*/
final AbstractButton b = (AbstractButton)c;
if (buttonIcon == null) {
buttonIcon = getDefaultIcon(b);
}
SwingUtilities.layoutCompoundLabel(c, fm, text, buttonIcon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), prefViewRect, prefIconRect, prefTextRect, text == null ? 0 : b.getIconTextGap());
// find the union of the icon and text rects (from Rectangle.java)
final int y2 = Math.max(prefIconRect.y + prefIconRect.height, prefTextRect.y + prefTextRect.height);
}
super(sizeDescriptor);
}
super(other);
}
return painter;
}
protected void doButtonPaint(final AbstractButton b, final ButtonModel model, final Graphics g, final int x, final int y, final int width, final int height) {
((ValueState)painter.state).setValue(model.isSelected() ? isIndeterminate(b) ? 2 : 1 : 0); // 2=mixed, 1=on, 0=off
}
return state;
}
}
}
}