65 |
public Dimension getPreferredSize(JComponent c) |
public Dimension getPreferredSize(JComponent c) |
66 |
{ |
{ |
67 |
JLabel b = (JLabel)c; |
JLabel b = (JLabel)c; |
68 |
|
/* |
69 |
|
We cannot use this method because it is not part of the |
70 |
|
official Swing API. |
71 |
|
|
72 |
Dimension d = BasicGraphicsUtils.getPreferredSize(b, |
Dimension d = BasicGraphicsUtils.getPreferredSize(b, |
73 |
gap, |
gap, |
74 |
b.getText(), |
b.getText(), |
78 |
b.getHorizontalTextPosition(), |
b.getHorizontalTextPosition(), |
79 |
b.getVerticalTextPosition()); |
b.getVerticalTextPosition()); |
80 |
System.out.println("JLABEL->^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.getText()); |
System.out.println("JLABEL->^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.getText()); |
81 |
return d; |
*/ |
82 |
|
return new Dimension(100, 30); |
83 |
} |
} |
84 |
|
|
85 |
|
|
95 |
|
|
96 |
g.setFont(f); |
g.setFont(f); |
97 |
|
|
98 |
FontMetrics fm = SwingUtilities.getFontMetrics(f); |
FontMetrics fm = g.getFontMetrics(f); |
99 |
|
|
100 |
Insets i = c.getInsets(); |
Insets i = c.getInsets(); |
101 |
|
|