On 03/21/2012 09:15 PM, Pavel Porvatov wrote:
Hi Charles,
Hi guys,
I am trying to fix 7026933 and 4310381.
Patch @ http://cr.openjdk.java.net/~littlee/7026933/webrev.00/
<http://cr.openjdk.java.net/%7Elittlee/7026933/webrev.00/>
The test case is @ 4310381 and 7026933.
My patch fix the padding problem on all the tabs except the top tab.
The reason about this is Metal look and feel does not want to pad the
last one. Please check the code in MetalTabbedPaneUI:
// Don't pad last run
protected boolean shouldPadTabRun( int tabPlacement, int run ) {
return runCount > 1 && run < runCount - 1;
}
Does anyone has some knowledge about this? If metal does not want pad
that tab, my patch should be consider fixing the problem :-)
That strange line was introduced with fix of CR 4253906 (since 1999).
Looks strange indeed...
The fix looks good for me. What about a test? I'm not sure automatic
test is possible here, so you can write manual test...
Regards, Pavel
Hi Pavel,
Test case is attached. I am trying to make it in the webrev, but I am
not quite understand "@run ****/manual=******". Should I use
applet/manual? Should I provide a bug7026933.html?
PS:
CR 4253906 does not have enough info......
--
Yours Charles
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.
*/
/*
* Portions Copyright (c) 2012 IBM Corporation
*/
/*
* @test
* @bug 7026933
* @summary Large JTabbedPane tab titles are truncated in an unpleasant way
* @author Charles Lee
*/
import javax.swing.*;
import java.awt.*;
public class Test7026933 extends JFrame{
public static void main(String[] args){
Test7026933 frame = new Test7026933();
frame.setPreferredSize(new Dimension(300,400));
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
Test7026933(){
Container c = getContentPane();
c.setLayout(new GridLayout(1,2));
JTabbedPane tab = new JTabbedPane();
String a2z = "abcdefghijklmnopqrstuvwxyz";
tab.addTab("0"+a2z+a2z,new JLabel("0" + a2z));
tab.addTab("1"+a2z,new JLabel("1" + a2z));
tab.addTab("2"+a2z,new JLabel("2" + a2z));
tab.addTab("3"+a2z+a2z,new JLabel("3" + a2z));
c.add(tab);
JPanel p = new JPanel();
p.setLayout(new BorderLayout());
p.add(new JLabel("Demo: main panel"), BorderLayout.CENTER);
c.add(p);
}
}