src/macosx/classes/sun/lwawt/LWTextComponentPeer.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2011, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 46,59 **** abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent> 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, final PlatformComponent platformComponent) { super(target, platformComponent); --- 46,56 ---- abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent> extends LWComponentPeer<T, D> implements DocumentListener, TextComponentPeer, InputMethodListener { ! private volatile boolean firstChangeSkipped; LWTextComponentPeer(final T target, final PlatformComponent platformComponent) { super(target, platformComponent);
*** 93,114 **** /** * This method should be called under getDelegateLock(). */ abstract JTextComponent getTextComponent(); ! public Dimension getPreferredSize(final int rows, final int columns) { final Insets insets; synchronized (getDelegateLock()) { ! insets = getDelegate().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); } @Override public final void setEditable(final boolean editable) { synchronized (getDelegateLock()) { --- 90,109 ---- /** * This method should be called under getDelegateLock(). */ abstract JTextComponent getTextComponent(); ! public Dimension getMinimumSize(final int rows, final int columns) { final Insets insets; synchronized (getDelegateLock()) { ! insets = getTextComponent().getInsets(); } final int borderHeight = insets.top + insets.bottom; final int borderWidth = insets.left + insets.right; final FontMetrics fm = getFontMetrics(getFont()); ! return new Dimension(fm.charWidth(WIDE_CHAR) * columns + borderWidth, ! fm.getHeight() * rows + borderHeight); } @Override public final void setEditable(final boolean editable) { synchronized (getDelegateLock()) {
*** 185,194 **** --- 180,190 ---- synchronized (getDelegateLock()) { return getTextComponent().getInputMethodRequests(); } } + //TODO IN XAWT we just return true.. @Override public final boolean isFocusable() { return getTarget().isFocusable(); }