-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b89
-
generic
-
generic
Platform: all
JDK: 7b84 (since availability of SynthTabbedPaneUI for use)
Method SynthTabbedPaneUI.paintTabArea() says:
Description copied from class: BasicTabbedPaneUI
Paints the tabs in the tab area. Invoked by paint().
...
Class has two overloaded methods
1. paint(SynthContext context, Graphics g)
2. paint(Graphics g, JComponent c)
The original description of paintTabArea() mentions the second one which is not used in SynthUI.
The spec should be updated or method paintTabArea() should be called from the first paint() method.
Please see the following code sample as the illustration:
---
import javax.swing.*;
import javax.swing.plaf.synth.*;
import java.awt.*;
public class PaintTest {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
runTest();
}
});
}
private static void runTest() {
try {
UIManager.setLookAndFeel(new SynthLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
throw new RuntimeException(e);
}
JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.add("first", new JLabel("first"));
tabbedPane.add("second", new JLabel("second"));
tabbedPane.add("third", new JLabel("third"));
tabbedPane.setUI(new SynthTabbedPaneUI() {
@Override
public void paint(Graphics g, JComponent c) {
System.out.println("called paint(Graphics g, JComponent c)");
super.paint(g, c);
}
@Override
protected void paint(SynthContext context, Graphics g) {
System.out.println("called paint(SynthContext context, Graphics g)");
super.paint(context, g);
}
@Override
protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) {
System.out.println("called called paint(SynthContext context, Graphics g)");
super.paintTabArea(g, tabPlacement, selectedIndex);
}
});
JFrame jFrame = new JFrame();
jFrame.getContentPane().add(tabbedPane);
jFrame.pack();
jFrame.setVisible(true);
}
}
---
JDK: 7b84 (since availability of SynthTabbedPaneUI for use)
Method SynthTabbedPaneUI.paintTabArea() says:
Description copied from class: BasicTabbedPaneUI
Paints the tabs in the tab area. Invoked by paint().
...
Class has two overloaded methods
1. paint(SynthContext context, Graphics g)
2. paint(Graphics g, JComponent c)
The original description of paintTabArea() mentions the second one which is not used in SynthUI.
The spec should be updated or method paintTabArea() should be called from the first paint() method.
Please see the following code sample as the illustration:
---
import javax.swing.*;
import javax.swing.plaf.synth.*;
import java.awt.*;
public class PaintTest {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
runTest();
}
});
}
private static void runTest() {
try {
UIManager.setLookAndFeel(new SynthLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
throw new RuntimeException(e);
}
JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.add("first", new JLabel("first"));
tabbedPane.add("second", new JLabel("second"));
tabbedPane.add("third", new JLabel("third"));
tabbedPane.setUI(new SynthTabbedPaneUI() {
@Override
public void paint(Graphics g, JComponent c) {
System.out.println("called paint(Graphics g, JComponent c)");
super.paint(g, c);
}
@Override
protected void paint(SynthContext context, Graphics g) {
System.out.println("called paint(SynthContext context, Graphics g)");
super.paint(context, g);
}
@Override
protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) {
System.out.println("called called paint(SynthContext context, Graphics g)");
super.paintTabArea(g, tabPlacement, selectedIndex);
}
});
JFrame jFrame = new JFrame();
jFrame.getContentPane().add(tabbedPane);
jFrame.pack();
jFrame.setVisible(true);
}
}
---