aboutsummaryrefslogtreecommitdiff
path: root/libjava/javax/swing/SwingUtilities.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/javax/swing/SwingUtilities.java')
-rw-r--r--libjava/javax/swing/SwingUtilities.java97
1 files changed, 49 insertions, 48 deletions
diff --git a/libjava/javax/swing/SwingUtilities.java b/libjava/javax/swing/SwingUtilities.java
index a123ad83438..a9113f0ff40 100644
--- a/libjava/javax/swing/SwingUtilities.java
+++ b/libjava/javax/swing/SwingUtilities.java
@@ -58,70 +58,71 @@ import javax.accessibility.AccessibleStateSet;
public class SwingUtilities implements SwingConstants
{
public static FontMetrics getFontMetrics (Font font)
-{
- return Toolkit.getDefaultToolkit().getFontMetrics(font);
- }
+ {
+ return Toolkit.getDefaultToolkit ().getFontMetrics (font);
+ }
public static JRootPane getRootPane (Component a)
- {
- if (a instanceof JRootPane)
- return (JRootPane) a;
+ {
+ if (a instanceof JRootPane)
+ return (JRootPane) a;
- a = a.getParent();
-
- if (a != null)
- {
- return getRootPane(a);
- }
+ a = a.getParent();
- return null;
- }
+ if (a != null)
+ {
+ return getRootPane(a);
+ }
+
+ return null;
+ }
public static void updateComponentTreeUI(JFrame comp)
- {
- }
+ {
+ }
public static String layoutCompoundLabel(JComponent c,
- FontMetrics fm,
- String text,
- Icon i,
- int vert_a,
- int hor_i,
- int vert_text_pos,
- int hor_text_pos,
- Rectangle vr,
- Rectangle ir,
- Rectangle tr,
- int gap)
- {
- // view rect 'vr' already ok,
- // we need to compute ir (icon rect) and tr (text-rect)
+ FontMetrics fm,
+ String text,
+ Icon i,
+ int vert_a,
+ int hor_i,
+ int vert_text_pos,
+ int hor_text_pos,
+ Rectangle vr,
+ Rectangle ir,
+ Rectangle tr,
+ int gap)
+ {
+ // view rect 'vr' already ok,
+ // we need to compute ir (icon rect) and tr (text-rect)
- int next_x = 0;//vr.x;
- int next_y = 0;//vr.y;
+ int next_x = 0;//vr.x;
+ int next_y = 0;//vr.y;
- ir.height = ir.width = ir.y = ir.x = 0;
+ ir.height = ir.width = ir.y = ir.x = 0;
- if (i != null)
- {
- ir.x = vr.x;
- ir.y = vr.y;
- ir.width = i.getIconWidth();
- ir.height = i.getIconWidth();
+ if (i != null)
+ {
+ ir.x = vr.x;
+ ir.y = vr.y;
+ ir.width = i.getIconWidth();
+ ir.height = i.getIconWidth();
- next_x += gap + i.getIconWidth();
- next_y += gap + i.getIconHeight();
- }
+ next_x += gap + i.getIconWidth();
+ next_y += gap + i.getIconHeight();
+ }
- tr.x = next_x;
- tr.y = vr.y + (vr.height/2);
+ tr.x = next_x;
+ tr.y = vr.y + (vr.height/2);
+
+ tr.width = fm.stringWidth(text);
+ tr.height = fm.getHeight() + fm.getAscent()/2;
- tr.width = fm.stringWidth(text);
- tr.height = fm.getHeight() + fm.getAscent()/2;
+ return text;
+ }
- return text;
- }
}