jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
changeset 13993 8b3fe3d8badb
parent 13357 6a75209a8aeb
child 20153 d5bf90bfcb6d
--- a/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java	Mon Sep 24 18:24:30 2012 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java	Mon Sep 24 21:33:41 2012 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, 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
@@ -48,10 +48,7 @@
         extends LWComponentPeer<T, D>
         implements DocumentListener, TextComponentPeer, InputMethodListener {
 
-    /**
-     * Character with reasonable value between the minimum width and maximum.
-     */
-    protected static final char WIDE_CHAR = 'w';
+
     private volatile boolean firstChangeSkipped;
 
     LWTextComponentPeer(final T target,
@@ -95,18 +92,16 @@
      */
     abstract JTextComponent getTextComponent();
 
-    public Dimension getPreferredSize(final int rows, final int columns) {
+    public Dimension getMinimumSize(final int rows, final int columns) {
         final Insets insets;
         synchronized (getDelegateLock()) {
-            insets = getDelegate().getInsets();
+            insets = getTextComponent().getInsets();
         }
         final int borderHeight = insets.top + insets.bottom;
         final int borderWidth = insets.left + insets.right;
         final FontMetrics fm = getFontMetrics(getFont());
-        final int charWidth = (fm != null) ? fm.charWidth(WIDE_CHAR) : 10;
-        final int itemHeight = (fm != null) ? fm.getHeight() : 10;
-        return new Dimension(columns * charWidth + borderWidth,
-                             rows * itemHeight + borderHeight);
+        return new Dimension(fm.charWidth(WIDE_CHAR) * columns + borderWidth,
+                             fm.getHeight() * rows + borderHeight);
     }
 
     @Override
@@ -187,6 +182,7 @@
         }
     }
 
+    //TODO IN XAWT we just return true..
     @Override
     public final boolean isFocusable() {
         return getTarget().isFocusable();