5344N/A/*
5344N/A * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
5344N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5344N/A *
5344N/A * This code is free software; you can redistribute it and/or modify it
5344N/A * under the terms of the GNU General Public License version 2 only, as
5344N/A * published by the Free Software Foundation.
5344N/A *
5344N/A * This code is distributed in the hope that it will be useful, but WITHOUT
5344N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5344N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5344N/A * version 2 for more details (a copy is included in the LICENSE file that
5344N/A * accompanied this code).
5344N/A *
5344N/A * You should have received a copy of the GNU General Public License version
5344N/A * 2 along with this work; if not, write to the Free Software Foundation,
5344N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5344N/A *
5344N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5344N/A * or visit www.oracle.com if you need additional information or have any
5344N/A * questions.
5344N/A */
5344N/A
5344N/A/*
5344N/A * Portions Copyright (c) 2012 IBM Corporation
5344N/A */
5344N/A
5344N/A/*
5344N/A * @test
5344N/A * @bug 4310381
5344N/A * @summary Text in multi-row/col JTabbedPane tabs can be truncated/clipped
5344N/A * @author Charles Lee
5344N/A @run applet/manual=yesno bug4310381.html
5344N/A */
5344N/A
5344N/A
5344N/Aimport javax.swing.*;
5344N/Aimport java.awt.*;
5344N/Aimport java.lang.reflect.InvocationTargetException;
5344N/A
5344N/Apublic class bug4310381 extends JApplet {
5344N/A public static void main(String[] args) throws Exception {
5344N/A SwingUtilities.invokeLater(new Runnable() {
5344N/A public void run() {
5344N/A JFrame frame = new JFrame();
5344N/A
5344N/A frame.setContentPane(createContentPane());
5344N/A frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
5344N/A frame.setSize(150, 200);
5344N/A frame.setLocationRelativeTo(null);
5344N/A
5344N/A frame.setVisible(true);
5344N/A
5344N/A }
5344N/A });
5344N/A }
5344N/A
5344N/A @Override
5344N/A public void init() {
5344N/A try {
5344N/A SwingUtilities.invokeAndWait(new Runnable() {
5344N/A @Override
5344N/A public void run() {
5344N/A setContentPane(createContentPane());
5344N/A }
5344N/A });
5344N/A } catch (InterruptedException | InvocationTargetException e) {
5344N/A throw new RuntimeException(e);
5344N/A }
5344N/A }
5344N/A
5344N/A private static Container createContentPane() {
5344N/A JTabbedPane tab = new JTabbedPane();
5344N/A String a2z = "abcdefghijklmnopqrstuvwxyz";
5344N/A
5344N/A tab.addTab("0" + a2z + a2z, new JLabel("0"));
5344N/A tab.addTab("1" + a2z, new JLabel("1" + a2z));
5344N/A tab.addTab("2" + a2z, new JLabel("2" + a2z));
5344N/A tab.addTab("3", new JLabel("3" + a2z)); // The last tab in Metal isn't truncated, that's ok
5344N/A
5344N/A return tab;
5344N/A }
5344N/A}