3309N/A/*
5743N/A * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
3309N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3309N/A *
3309N/A * This code is free software; you can redistribute it and/or modify it
3309N/A * under the terms of the GNU General Public License version 2 only, as
3309N/A * published by the Free Software Foundation.
3309N/A *
3309N/A * This code is distributed in the hope that it will be useful, but WITHOUT
3309N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3309N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3309N/A * version 2 for more details (a copy is included in the LICENSE file that
3309N/A * accompanied this code).
3309N/A *
3309N/A * You should have received a copy of the GNU General Public License version
3309N/A * 2 along with this work; if not, write to the Free Software Foundation,
3309N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3309N/A *
3309N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3309N/A * or visit www.oracle.com if you need additional information or have any
3309N/A * questions.
3309N/A */
3309N/A
3309N/A/* @test
5743N/A * @bug 6532833 7077259
5743N/A * @summary PIT: Metal LAF - The right side border is not shown for the Spinner after the removing the buttons
5743N/A * @author Pavel Porvatov
5743N/A * @run main/othervm -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel bug6532833
5743N/A */
3309N/A
3309N/Aimport javax.swing.*;
3309N/Aimport java.awt.*;
3309N/A
3309N/Apublic class bug6532833 {
3309N/A public static void main(String[] args) throws Exception {
3309N/A SwingUtilities.invokeAndWait(new Runnable() {
3309N/A public void run() {
3309N/A JSpinner[] spinners = new JSpinner[2];
3309N/A
3309N/A for (int i = 0; i < spinners.length; i++) {
3309N/A JSpinner spinner = new JSpinner();
3309N/A
3309N/A spinner.setValue(2010);
3309N/A
3309N/A Component arrowUp = spinner.getComponent(0);
3309N/A Component arrowDown = spinner.getComponent(1);
3309N/A
3309N/A LayoutManager layout = spinner.getLayout();
3309N/A
3309N/A layout.removeLayoutComponent(arrowUp);
3309N/A layout.removeLayoutComponent(arrowDown);
3309N/A
3309N/A if (i == 1) {
3309N/A spinner.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
3309N/A }
3309N/A
3309N/A spinners[i] = spinner;
3309N/A }
3309N/A
3309N/A // Do layout of spinners components
3309N/A JFrame frame = new JFrame();
3309N/A
3309N/A for (JSpinner spinner : spinners) {
3309N/A frame.getContentPane().add(spinner);
3309N/A }
3309N/A
3309N/A frame.pack();
3309N/A
3309N/A for (JSpinner spinner : spinners) {
3309N/A Insets insets = spinner.getInsets();
3309N/A
3309N/A if (spinner.getWidth() != insets.left + insets.right + spinner.getEditor().getWidth()) {
3309N/A throw new RuntimeException("Spinner editor width is invalid");
3309N/A }
3309N/A }
3309N/A
3309N/A frame.dispose();
3309N/A }
3309N/A });
3309N/A }
3309N/A}