src/macosx/classes/sun/lwawt/LWTextAreaPeer.java
Print this page
*** 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
--- 1,7 ----
/*
! * Copyright (c) 2011, 2013, 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
*** 42,52 ****
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
/**
* Lightweight implementation of {@link TextAreaPeer}. Delegates most of the
! * work to the {@link JTextArea} inside JScrollPane.
*/
final class LWTextAreaPeer
extends LWTextComponentPeer<TextArea, LWTextAreaPeer.ScrollableJTextArea>
implements TextAreaPeer {
--- 42,52 ----
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
/**
* Lightweight implementation of {@link TextAreaPeer}. Delegates most of the
! * work to the {@link JTextArea} inside {@link JScrollPane}.
*/
final class LWTextAreaPeer
extends LWTextComponentPeer<TextArea, LWTextAreaPeer.ScrollableJTextArea>
implements TextAreaPeer {
*** 64,74 ****
final PlatformComponent platformComponent) {
super(target, platformComponent);
}
@Override
! protected ScrollableJTextArea createDelegate() {
return new ScrollableJTextArea();
}
@Override
void initializeImpl() {
--- 64,74 ----
final PlatformComponent platformComponent) {
super(target, platformComponent);
}
@Override
! ScrollableJTextArea createDelegate() {
return new ScrollableJTextArea();
}
@Override
void initializeImpl() {
*** 83,102 ****
JTextComponent getTextComponent() {
return getDelegate().getView();
}
@Override
! protected Cursor getCursor(final Point p) {
final boolean isContains;
synchronized (getDelegateLock()) {
isContains = getDelegate().getViewport().getBounds().contains(p);
}
return isContains ? super.getCursor(p) : null;
}
@Override
! protected Component getDelegateFocusOwner() {
return getTextComponent();
}
@Override
public Dimension getPreferredSize() {
--- 83,102 ----
JTextComponent getTextComponent() {
return getDelegate().getView();
}
@Override
! Cursor getCursor(final Point p) {
final boolean isContains;
synchronized (getDelegateLock()) {
isContains = getDelegate().getViewport().getBounds().contains(p);
}
return isContains ? super.getCursor(p) : null;
}
@Override
! Component getDelegateFocusOwner() {
return getTextComponent();
}
@Override
public Dimension getPreferredSize() {
*** 198,208 ****
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
break;
}
}
! @SuppressWarnings("serial")
final class ScrollableJTextArea extends JScrollPane {
ScrollableJTextArea() {
super();
getViewport().setView(new JTextAreaDelegate());
--- 198,208 ----
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
break;
}
}
! @SuppressWarnings("serial")// Safe: outer class is non-serializable.
final class ScrollableJTextArea extends JScrollPane {
ScrollableJTextArea() {
super();
getViewport().setView(new JTextAreaDelegate());
*** 216,226 ****
public void setEnabled(final boolean enabled) {
getViewport().getView().setEnabled(enabled);
super.setEnabled(enabled);
}
- @SuppressWarnings("serial")
private final class JTextAreaDelegate extends JTextArea {
// Empty non private constructor was added because access to this
// class shouldn't be emulated by a synthetic accessor method.
JTextAreaDelegate() {
--- 216,225 ----