/*
* 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.
*/
/**
* Factory object that can vend Borders appropriate for the metal L & F.
* @author Steve Wilson
*/
public class MetalBorders {
/**
* Client property indicating the button shouldn't provide a rollover
* indicator. Only used with the Ocean theme.
*/
new StringUIClientPropertyKey("NoButtonRollover");
int w, int h) {
if (c.isEnabled()) {
MetalUtils.drawFlush3DBorder(g, x, y, w, h);
} else {
MetalUtils.drawDisabledBorder(g, x, y, w, h);
}
}
return newInsets;
}
}
if (!(c instanceof AbstractButton)) {
return;
}
if (MetalLookAndFeel.usingOcean()) {
paintOceanBorder(c, g, x, y, w, h);
return;
}
MetalUtils.drawDefaultButtonPressedBorder(g, x, y, w, h);
} else if (isPressed) {
MetalUtils.drawPressed3DBorder( g, x, y, w, h );
} else if (isDefault) {
MetalUtils.drawDefaultButtonBorder( g, x, y, w, h, false);
} else {
MetalUtils.drawButtonBorder( g, x, y, w, h, false);
}
} else { // disabled state
}
}
int w, int h) {
g.translate(x, y);
}
}
else {
"Button.toolBarBorderBackground"));
}
}
else {
"Button.disabledToolBarBorderBackground"));
}
}
}
else if (pressed) {
}
NO_BUTTON_ROLLOVER) == null) {
}
else {
}
}
else {
}
}
}
return newInsets;
}
}
int w, int h) {
} else {
}
g.setColor(background);
// Draw outermost lines
// Draw the bulk of the border
for (int i = 1; i < 5; i++) {
}
if (c instanceof JInternalFrame &&
((JInternalFrame)c).isResizable()) {
// Draw the Long highlight lines
// Draw the Long shadow lines
}
}
return newInsets;
}
}
/**
* Border for a Frame.
* @since 1.4
*/
int w, int h) {
} else {
}
g.setColor(background);
// Draw outermost lines
// Draw the bulk of the border
for (int i = 1; i < 5; i++) {
}
// Draw the Long highlight lines
// Draw the Long shadow lines
}
}
{
return newInsets;
}
}
/**
* Border for a Frame.
* @since 1.4
*/
{
{
return MetalLookAndFeel.getPrimaryControlDarkShadow();
}
{
return MetalLookAndFeel.getPrimaryControlShadow();
}
{
return MetalLookAndFeel.getPrimaryControlInfo();
}
{
return MetalLookAndFeel.getControlDarkShadow();
}
{
return MetalLookAndFeel.getControlShadow();
}
{
return MetalLookAndFeel.getControlInfo();
}
{
shadow = getActiveShadow();
} else {
shadow = getInactiveShadow();
}
g.setColor(background);
// Draw outermost lines
// Draw the bulk of the border
for (int i = 1; i < 5; i++) {
}
// Draw the Long highlight lines
// Draw the Long shadow lines
}
}
{
return newInsets;
}
}
/**
* Border for an Error Dialog.
* @since 1.4
*/
{
}
}
/**
* Border for a QuestionDialog. Also used for a JFileChooser and a
* JColorChooser..
* @since 1.4
*/
{
}
}
/**
* Border for a Warning Dialog.
* @since 1.4
*/
{
}
}
/**
* Border for a Palette.
* @since 1.3
*/
g.translate(x,y);
g.translate(-x,-y);
}
return newInsets;
}
}
g.translate(x,y);
if (c instanceof JInternalFrame) {
"JInternalFrame.messageType");
}
}
switch (messageType) {
case(JOptionPane.ERROR_MESSAGE):
"OptionPane.errorDialog.border.background");
break;
case(JOptionPane.QUESTION_MESSAGE):
"OptionPane.questionDialog.border.background");
break;
case(JOptionPane.WARNING_MESSAGE):
"OptionPane.warningDialog.border.background");
break;
case(JOptionPane.INFORMATION_MESSAGE):
case(JOptionPane.PLAIN_MESSAGE):
default:
break;
}
g.setColor(borderColor);
// Draw outermost lines
// Draw the bulk of the border
for (int i = 1; i < 3; i++) {
}
g.translate(-x,-y);
}
return newInsets;
}
}
g.translate( x, y );
if (MetalLookAndFeel.usingOcean()) {
// Only paint a border if we're not next to a horizontal
// toolbar
}
}
else {
}
g.translate( -x, -y );
}
if (MetalLookAndFeel.usingOcean()) {
}
else {
}
return newInsets;
}
}
if (!(c instanceof JMenuItem)) {
return;
}
g.translate( x, y );
}
} else {
} else {
}
}
g.translate( -x, -y );
}
return newInsets;
}
}
g.translate( x, y );
g.translate( -x, -y );
}
return newInsets;
}
}
AbstractButton b = (AbstractButton) c;
super.paintBorder( c, g, x, y, w, h );
}
}
}
/**
* A border which is like a Margin border but it will only honor the margin
* if the margin has been explicitly set by the developer.
*
* Note: This is identical to the package private class
* BasicBorders.RolloverMarginBorder and should probably be consolidated.
*/
public RolloverMarginBorder() {
super(3,3,3,3); // hardcoded margin for JLF requirements.
}
if (c instanceof AbstractButton) {
}
// default margin so replace
} else {
// Margin which has been explicitly set by the user.
}
return insets;
}
}
{
{
if (!(c instanceof JToolBar)) {
return;
}
g.translate( x, y );
if ( ((JToolBar) c).isFloatable() )
{
{
if( MetalUtils.isLeftToRight(c) ) {
} else {
2 + shift );
}
}
else // vertical
{
}
}
}
g.translate( -x, -y );
}
if (MetalLookAndFeel.usingOcean()) {
}
else {
}
if (!(c instanceof JToolBar)) {
return newInsets;
}
if ( ((JToolBar) c).isFloatable() ) {
if (c.getComponentOrientation().isLeftToRight()) {
} else {
}
} else {// vertical
}
}
}
return newInsets;
}
}
/**
* Returns a border instance for a JButton
* @since 1.3
*/
if (buttonBorder == null) {
new MetalBorders.ButtonBorder(),
new BasicBorders.MarginBorder());
}
return buttonBorder;
}
/**
* Returns a border instance for a text component
* @since 1.3
*/
if (textBorder == null) {
new MetalBorders.Flush3DBorder(),
new BasicBorders.MarginBorder());
}
return textBorder;
}
/**
* Returns a border instance for a JTextField
* @since 1.3
*/
if (textFieldBorder == null) {
new MetalBorders.TextFieldBorder(),
new BasicBorders.MarginBorder());
}
return textFieldBorder;
}
int w, int h) {
if (!(c instanceof JTextComponent)) {
// special case for non-text components (bug ID 4144840)
if (c.isEnabled()) {
MetalUtils.drawFlush3DBorder(g, x, y, w, h);
} else {
MetalUtils.drawDisabledBorder(g, x, y, w, h);
}
return;
}
MetalUtils.drawFlush3DBorder(g, x, y, w, h);
} else {
MetalUtils.drawDisabledBorder(g, x, y, w, h);
}
}
}
int w, int h) {
if (!(c instanceof JScrollPane)) {
return;
}
int colHeaderHeight = 0;
int rowHeaderWidth = 0;
g.translate( x, y);
g.translate( -x, -y);
}
return insets;
}
}
/**
* Returns a border instance for a JToggleButton
* @since 1.3
*/
if (toggleButtonBorder == null) {
new MetalBorders.ToggleButtonBorder(),
new BasicBorders.MarginBorder());
}
return toggleButtonBorder;
}
/**
* @since 1.3
*/
if (MetalLookAndFeel.usingOcean()) {
super.paintBorder(c, g, x, y, w, h);
}
else {
}
return;
}
if (! c.isEnabled() ) {
} else {
MetalUtils.drawPressed3DBorder( g, x, y, w, h );
} else if ( model.isSelected() ) {
MetalUtils.drawDark3DBorder( g, x, y, w, h );
} else {
MetalUtils.drawFlush3DBorder( g, x, y, w, h );
}
}
}
}
/**
* Border for a Table Header
* @since 1.3
*/
g.translate( x, y );
g.translate( -x, -y );
}
return insets;
}
}
/**
* Returns a border instance for a Desktop Icon
* @since 1.3
*/
return new BorderUIResource.CompoundBorderUIResource(
}
if (MetalLookAndFeel.usingOcean()) {
return new CompoundBorder(
new MetalBorders.ButtonBorder(),
new MetalBorders.RolloverMarginBorder());
}
new MetalBorders.RolloverMarginBorder());
}
if (MetalLookAndFeel.usingOcean()) {
new CompoundBorder(
new MetalBorders.ButtonBorder(),
new MetalBorders.RolloverMarginBorder());
}
new MetalBorders.RolloverMarginBorder());
}
}