/*
* 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.
*/
/**
* Windows button.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is appropriate
* for short term storage or RMI between applications running the same
* version of Swing. A future release of Swing will provide support for
* long term persistence.
*
* @author Jeff Dinkins
*
*/
{
protected int dashedRectGapX;
protected int dashedRectGapY;
protected int dashedRectGapWidth;
protected int dashedRectGapHeight;
private boolean defaults_initialized = false;
// ********************************
// Create PLAF
// ********************************
if (windowsButtonUI == null) {
windowsButtonUI = new WindowsButtonUI();
}
return windowsButtonUI;
}
// ********************************
// Defaults
// ********************************
super.installDefaults(b);
if(!defaults_initialized) {
defaults_initialized = true;
}
}
}
super.uninstallDefaults(b);
defaults_initialized = false;
}
return focusColor;
}
// ********************************
// Paint Methods
// ********************************
/**
* Overridden method to render the text without the mnemonic
*/
}
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect){
// focus painted same color as text on Basic??
g.setColor(getFocusColor());
}
}
// ********************************
// Layout Methods
// ********************************
Dimension d = super.getPreferredSize(c);
/* Ensure that the width and height of the button is odd,
* to allow for the focus line if focus is painted
*/
AbstractButton b = (AbstractButton)c;
if (d != null && b.isFocusPainted()) {
}
return d;
}
/* These rectangles/insets are allocated once for all
* ButtonUI.paint() calls. Re-using rectangles rather than
* allocating them in each paint call substantially reduced the time
* it took paint to run. Obviously, this method can't be re-entered.
*/
}
super.paint(g, c);
}
if(b instanceof JCheckBox) {
return Part.BP_CHECKBOX;
}
if(b instanceof JRadioButton) {
return Part.BP_RADIOBUTTON;
}
}
switch (part) {
case BP_RADIOBUTTON:
/* falls through */
case BP_CHECKBOX:
} else if (model.isRollover()) {
} else {
}
break;
case BP_PUSHBUTTON:
/* falls through */
case TP_BUTTON:
if (toolbar) {
} else if (model.isSelected()) {
} else if (model.isRollover()) {
} else if (b.hasFocus()) {
}
} else {
|| model.isSelected()) {
} else if (b instanceof JButton
&& ((JButton)b).isDefaultButton()) {
} else if (b.hasFocus()) {
}
}
break;
default :
}
return state;
}
AbstractButton b = (AbstractButton)c;
int dx = 0;
int dy = 0;
// Note: The border may be compound, containing an outer
// opaque border (supplied by the application), plus an
// inner transparent margin border. We want to size the
// background to fill the transparent part, but stay
// inside the opaque part.
} else {
}
}
}
}
/**
* returns - b.getBorderInsets(c) if border is opaque
* - null if border is completely non-opaque
* - somewhere inbetween if border is compound and
* outside border is opaque and inside isn't
*/
if (b == null) {
return null;
}
if (b.isBorderOpaque()) {
return b.getBorderInsets(c);
} else if (b instanceof CompoundBorder) {
// Outside border is opaque, keep looking
// Inside is non-opaque, use outside insets
return iOut;
} else {
// Found non-opaque somewhere in the inside (which is
// also compound).
}
} else {
// Outside is either all non-opaque or has non-opaque
// border inside another compound border
return iOut;
}
} else {
return null;
}
}
}