summaryrefslogtreecommitdiff
path: root/javax/swing/plaf/basic/BasicTabbedPaneUI.java
blob: f9134a8ce745a29514c6a126e9dd76a01cefa78a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package javax.swing.plaf.basic;

import javax.swing.*;
import java.awt.*;
import javax.swing.plaf.*;

public class BasicTabbedPaneUI  extends TabbedPaneUI 
{
    public static ComponentUI createUI(final JComponent c) 
    {
	return new BasicTabbedPaneUI();
    }
    
    public void installUI(final JComponent c) 
    {
	super.installUI(c);
    }
    
    public Dimension getPreferredSize(JComponent c) 
    {
	JTabbedPane p = (JTabbedPane) c;

	Dimension d = new Dimension(50,50);
	
	for (int i=0;i<p.getTabCount();i++)
	    {
		Component comp = p.getComponentAt(i);
		
		Dimension pr = comp.getPreferredSize();

		d.width = Math.max(d.width, comp.width);
		d.height = Math.max(d.height, comp.height);
	    }
	
	Insets i = p.getInsets();
	
	d.width  += i.left + i.right;
	d.height += i.top + i.bottom;

	int height_of_tabs = 25;

	d.height += height_of_tabs;

	// FIXME: should be max of panes in p
	return d;
    }
    

    Rectangle getTabBounds(JTabbedPane pane, int index)
    {
	return null;
    }

    int getTabRunCount(JTabbedPane pane)
    {
	return 0;
    }

    int tabForCoordinate(JTabbedPane pane, int x, int y)
    {
	return 0;
    }
}