2456N/A/*
2685N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2456N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2456N/A *
2456N/A * This code is free software; you can redistribute it and/or modify it
2456N/A * under the terms of the GNU General Public License version 2 only, as
2456N/A * published by the Free Software Foundation.
2456N/A *
2456N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2456N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2456N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2456N/A * version 2 for more details (a copy is included in the LICENSE file that
2456N/A * accompanied this code).
2456N/A *
2456N/A * You should have received a copy of the GNU General Public License version
2456N/A * 2 along with this work; if not, write to the Free Software Foundation,
2456N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2456N/A *
2685N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2685N/A * or visit www.oracle.com if you need additional information or have any
2685N/A * questions.
2456N/A */
2456N/A
2456N/A/**
2456N/A * @test
2456N/A * @bug 6739756
2456N/A * @author Alexander Potochkin
2456N/A * @summary JToolBar leaves space for non-visible items under Nimbus L&F
2456N/A * @run main bug6739756
2456N/A */
2456N/A
2456N/Aimport javax.swing.*;
2456N/Aimport java.awt.*;
2456N/A
2456N/Apublic class bug6739756 {
2456N/A
2456N/A public static void main(String[] args) throws Exception {
2456N/A try {
2456N/A UIManager.setLookAndFeel(
2456N/A "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
2456N/A }
2456N/A catch (Exception e) {
2456N/A e.printStackTrace();
2456N/A return;
2456N/A }
2456N/A SwingUtilities.invokeAndWait(new Runnable() {
2456N/A public void run() {
2456N/A JToolBar tb = new JToolBar();
2456N/A Dimension preferredSize = tb.getPreferredSize();
2456N/A JButton button = new JButton("Test");
2456N/A button.setVisible(false);
2456N/A tb.add(button);
2456N/A if (!preferredSize.equals(tb.getPreferredSize())) {
2456N/A throw new RuntimeException("Toolbar's preferredSize is wrong");
2456N/A }
2456N/A }
2456N/A });
2456N/A }
2456N/A}