jdk/test/javax/swing/border/Test4856008.java
author psadhukhan
Fri, 21 Jul 2017 10:23:37 +0530
changeset 47159 8261a0f79e90
parent 47131 3c5b1a40f573
permissions -rw-r--r--
8184813: Class javax/swing/plaf/metal/MetalFontDesktopProperty is broken in JDK10 Reviewed-by: prr, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
31448
1066345d2a8a 8076468: Add @modules to tests in jdk_desktop test group
yan
parents: 8988
diff changeset
     2
 * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3102
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3102
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3102
diff changeset
    21
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * @test
8988
a4ce9022541e 7025987: Nimbus L&F increases insets unexpectedly
malenkov
parents: 5506
diff changeset
    26
 * @bug 4856008 7025987
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * @summary Tests border insets
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * @author Sergey Malenkov
31448
1066345d2a8a 8076468: Add @modules to tests in jdk_desktop test group
yan
parents: 8988
diff changeset
    29
 * @modules java.desktop/com.sun.java.swing.plaf.motif
1066345d2a8a 8076468: Add @modules to tests in jdk_desktop test group
yan
parents: 8988
diff changeset
    30
 *          java.desktop/com.sun.java.swing.plaf.windows
1066345d2a8a 8076468: Add @modules to tests in jdk_desktop test group
yan
parents: 8988
diff changeset
    31
 *          java.desktop/sun.swing.plaf.synth
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import com.sun.java.swing.plaf.motif.MotifBorders;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import com.sun.java.swing.plaf.windows.WindowsBorders;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.awt.Color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.awt.Font;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.awt.Insets;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
3102
f637322451dc 6848364: javax/swing/border/Test4856008.java regression test fails due to BorderedComponent package not found
malenkov
parents: 2
diff changeset
    41
import javax.swing.ActionMap;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import javax.swing.JComponent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import javax.swing.JFileChooser;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import javax.swing.JLabel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import javax.swing.JPopupMenu;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import javax.swing.JToggleButton;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
import javax.swing.JToolBar;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
import javax.swing.border.AbstractBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
import javax.swing.border.BevelBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
import javax.swing.border.Border;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
import javax.swing.border.CompoundBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
import javax.swing.border.EmptyBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
import javax.swing.border.EtchedBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
import javax.swing.border.LineBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
import javax.swing.border.MatteBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
import javax.swing.border.SoftBevelBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
import javax.swing.border.TitledBorder;
3102
f637322451dc 6848364: javax/swing/border/Test4856008.java regression test fails due to BorderedComponent package not found
malenkov
parents: 2
diff changeset
    58
import javax.swing.plaf.ActionMapUIResource;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
import javax.swing.plaf.BorderUIResource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
import javax.swing.plaf.synth.SynthLookAndFeel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
import javax.swing.plaf.basic.BasicBorders;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
import javax.swing.plaf.basic.BasicToolBarUI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
import javax.swing.plaf.metal.MetalBorders;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
import javax.swing.plaf.metal.MetalComboBoxEditor;
8988
a4ce9022541e 7025987: Nimbus L&F increases insets unexpectedly
malenkov
parents: 5506
diff changeset
    65
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
import sun.swing.plaf.synth.SynthFileChooserUI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
public class Test4856008 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    private static final JLabel LABEL = new JLabel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    private static final JPopupMenu POPUP = new JPopupMenu();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    private static final JToolBar TOOLBAR = new JToolBar();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    private static final Border[] BORDERS = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            new MotifBorders.BevelBorder(true, Color.BLACK, Color.WHITE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            new MotifBorders.ButtonBorder(Color.CYAN, Color.MAGENTA, Color.YELLOW, Color.BLACK),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
            new MotifBorders.FocusBorder(Color.BLACK, Color.WHITE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
            new MotifBorders.FrameBorder(LABEL),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            new MotifBorders.MenuBarBorder(Color.CYAN, Color.MAGENTA, Color.YELLOW, Color.BLACK),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            new MotifBorders.MotifPopupMenuBorder(new Font(null, Font.PLAIN, 10), Color.CYAN, Color.MAGENTA, Color.YELLOW, Color.BLACK),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
            new MotifBorders.ToggleButtonBorder(Color.CYAN, Color.MAGENTA, Color.YELLOW, Color.BLACK),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
            new WindowsBorders.ProgressBarBorder(Color.BLACK, Color.WHITE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            new WindowsBorders.ToolBarBorder(Color.BLACK, Color.WHITE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            //- WindowsInternalFrameUI.XPBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            //? WindowsTableHeaderUI.IconBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            //- XPStyle.XPEmptyBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            //- XPStyle.XPFillBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            //- XPStyle.XPImageBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            new BevelBorder(BevelBorder.RAISED),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            new CompoundBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
            new EmptyBorder(1, 2, 3, 4),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            new EtchedBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            new LineBorder(Color.BLACK, 2, true),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            new MatteBorder(1, 2, 3, 4, Color.BLACK),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
            new SoftBevelBorder(BevelBorder.LOWERED),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            new TitledBorder("4856008"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            new BorderUIResource(new EmptyBorder(1, 2, 3, 4)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            new BasicBorders.ButtonBorder(Color.CYAN, Color.MAGENTA, Color.YELLOW, Color.BLACK),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
            new BasicBorders.FieldBorder(Color.CYAN, Color.MAGENTA, Color.YELLOW, Color.BLACK),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            new BasicBorders.MarginBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
            new BasicBorders.MenuBarBorder(Color.BLACK, Color.WHITE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            new BasicBorders.RadioButtonBorder(Color.CYAN, Color.MAGENTA, Color.YELLOW, Color.BLACK),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            //+ BasicBorders.RolloverMarginBorder:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
            new ToolBar().getRolloverMarginBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            new BasicBorders.SplitPaneBorder(Color.BLACK, Color.WHITE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            //+ BasicBorders.SplitPaneDividerBorder:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            BasicBorders.getSplitPaneDividerBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            new BasicBorders.ToggleButtonBorder(Color.CYAN, Color.MAGENTA, Color.YELLOW, Color.BLACK),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            new MetalBorders.ButtonBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            //- MetalBorders.DialogBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            new MetalBorders.Flush3DBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            //- MetalBorders.FrameBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
            new MetalBorders.InternalFrameBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            new MetalBorders.MenuBarBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            new MetalBorders.MenuItemBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
            new MetalBorders.OptionDialogBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            new MetalBorders.PaletteBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            new MetalBorders.PopupMenuBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            //- MetalBorders.RolloverMarginBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            new MetalBorders.ScrollPaneBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            new MetalBorders.TableHeaderBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            new MetalBorders.ToolBarBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            //+ MetalComboBoxEditor.EditorBorder:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            new MetalEditor().getEditorBorder(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            //- SynthBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            //- SynthScrollPaneUI.ViewportBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            //? CSSBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            //? CommentView.CommentBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            //- HiddenTagView.EndTagBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            //- HiddenTagView.StartTagBorder is not accessible: check it visually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            //+ SynthFileChooserUI.UIBorder:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            new SynthFileChooser().getUIBorder(),
8988
a4ce9022541e 7025987: Nimbus L&F increases insets unexpectedly
malenkov
parents: 5506
diff changeset
   141
a4ce9022541e 7025987: Nimbus L&F increases insets unexpectedly
malenkov
parents: 5506
diff changeset
   142
            //+ LoweredBorder:
a4ce9022541e 7025987: Nimbus L&F increases insets unexpectedly
malenkov
parents: 5506
diff changeset
   143
            new NimbusLookAndFeel().getDefaults().getBorder("TitledBorder.border"),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    public static void main(String[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        for (Border border : BORDERS) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            System.out.println(border.getClass());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            test(border, border.getBorderInsets(getComponent(border)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            if (border instanceof AbstractBorder) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                test((AbstractBorder) border);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    private static void test(AbstractBorder border) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        Insets insets = new Insets(0, 0, 0, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        if (insets != border.getBorderInsets(getComponent(border), insets)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            throw new Error("both instances are differ for " + border.getClass());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        test(border, insets);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    private static void test(Border border, Insets insets) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        Insets result = border.getBorderInsets(getComponent(border));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        if (insets == result) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            throw new Error("both instances are the same for " + border.getClass());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        if (!insets.equals(result)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            throw new Error("both insets are not equal for " + border.getClass());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    private static JComponent getComponent(Border border) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        Class type = border.getClass();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        if (type.equals(MotifBorders.MotifPopupMenuBorder.class)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            return POPUP;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        if (type.equals(WindowsBorders.ToolBarBorder.class)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            return TOOLBAR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        if (type.equals(MetalBorders.ToolBarBorder.class)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            return TOOLBAR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        return LABEL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    // This class is used to get the instance of BasicBorders.RolloverMarginBorder
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    private static class ToolBar extends BasicToolBarUI {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        private Border getRolloverMarginBorder() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            JToggleButton button = new JToggleButton();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            CompoundBorder border = (CompoundBorder) getNonRolloverBorder(button);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            return border.getInsideBorder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    // This class is used to get the instance of MetalComboBoxEditor.EditorBorder
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    private static class MetalEditor extends MetalComboBoxEditor {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        private Border getEditorBorder() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            return editor.getBorder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    // This class is used to get the instance of SynthFileChooserUI.UIBorder
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    private static class SynthFileChooser extends SynthFileChooserUI {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        private static final JFileChooser CHOOSER = new JFileChooser();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        private String name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        private SynthFileChooser() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            super(CHOOSER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        private Border getUIBorder() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            new SynthLookAndFeel().initialize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            CHOOSER.setBorder(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            installDefaults(CHOOSER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            return CHOOSER.getBorder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        @Override
3102
f637322451dc 6848364: javax/swing/border/Test4856008.java regression test fails due to BorderedComponent package not found
malenkov
parents: 2
diff changeset
   221
        protected ActionMap createActionMap() {
f637322451dc 6848364: javax/swing/border/Test4856008.java regression test fails due to BorderedComponent package not found
malenkov
parents: 2
diff changeset
   222
            return new ActionMapUIResource();
f637322451dc 6848364: javax/swing/border/Test4856008.java regression test fails due to BorderedComponent package not found
malenkov
parents: 2
diff changeset
   223
        }
f637322451dc 6848364: javax/swing/border/Test4856008.java regression test fails due to BorderedComponent package not found
malenkov
parents: 2
diff changeset
   224
f637322451dc 6848364: javax/swing/border/Test4856008.java regression test fails due to BorderedComponent package not found
malenkov
parents: 2
diff changeset
   225
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        public String getFileName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            return this.name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        public void setFileName(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            this.name = name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
}