src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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. Oracle designates this
@@ -985,11 +985,12 @@
final Component component = getTabComponentAt(i);
final JMenuItem menuItem;
if (component == null) {
menuItem = new JMenuItem(tabPane.getTitleAt(i), tabPane.getIconAt(i));
} else {
- menuItem = new JMenuItem() {
+ @SuppressWarnings("serial") // anonymous class
+ JMenuItem tmp = new JMenuItem() {
public void paintComponent(final Graphics g) {
super.paintComponent(g);
final Dimension size = component.getSize();
component.setSize(getSize());
component.validate();
@@ -999,10 +1000,11 @@
public Dimension getPreferredSize() {
return component.getPreferredSize();
}
};
+ menuItem = tmp;
}
final Color background = tabPane.getBackgroundAt(i);
if (!(background instanceof UIResource)) {
menuItem.setBackground(background);