aboutsummaryrefslogtreecommitdiff
path: root/src/share/classes/javax/swing/text/WrappedPlainView.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/classes/javax/swing/text/WrappedPlainView.java')
-rw-r--r--src/share/classes/javax/swing/text/WrappedPlainView.java64
1 files changed, 4 insertions, 60 deletions
diff --git a/src/share/classes/javax/swing/text/WrappedPlainView.java b/src/share/classes/javax/swing/text/WrappedPlainView.java
index e192c0776..7d01cd904 100644
--- a/src/share/classes/javax/swing/text/WrappedPlainView.java
+++ b/src/share/classes/javax/swing/text/WrappedPlainView.java
@@ -24,8 +24,6 @@
*/
package javax.swing.text;
-import java.util.Vector;
-import java.util.Properties;
import java.awt.*;
import java.lang.ref.SoftReference;
import javax.swing.event.*;
@@ -236,9 +234,6 @@ public class WrappedPlainView extends BoxView implements TabExpander {
Segment segment = SegmentCache.getSharedSegment();
loadText(segment, p0, p1);
int currentWidth = getWidth();
- if (currentWidth == Integer.MAX_VALUE) {
- currentWidth = (int) getDefaultSpan(View.X_AXIS);
- }
if (wordWrap) {
p = p0 + Utilities.getBreakLocation(segment, metrics,
tabBase, tabBase + currentWidth,
@@ -324,53 +319,6 @@ public class WrappedPlainView extends BoxView implements TabExpander {
tabSize = getTabSize() * metrics.charWidth('m');
}
- /**
- * Return reasonable default values for the view dimensions. The standard
- * text terminal size 80x24 is pretty suitable for the wrapped plain view.
- *
- * The size should not be larger than the component housing the view's
- * container.
- */
- private float getDefaultSpan(int axis) {
- Container host = getContainer();
- Component parent = null;
-
- if (host != null) {
- parent = host.getParent();
- }
-
- switch (axis) {
- case View.X_AXIS:
- int defaultWidth = 80 * metrics.getWidths()['M'];
- int parentWidth = 0;
-
- if (parent != null) {
- parentWidth = parent.getWidth();
- }
-
- if (defaultWidth > parentWidth) {
- return parentWidth;
- }
- return defaultWidth;
-
- case View.Y_AXIS:
- int defaultHeight = 24 * metrics.getHeight();
- int parentHeight = 0;
-
- if (parent != null) {
- parentHeight = parent.getHeight();
- }
-
- if (defaultHeight > parentHeight) {
- return parentHeight;
- }
- return defaultHeight;
-
- default:
- throw new IllegalArgumentException("Invalid axis: " + axis);
- }
- }
-
// --- TabExpander methods ------------------------------------------
/**
@@ -605,18 +553,14 @@ public class WrappedPlainView extends BoxView implements TabExpander {
if (width == Integer.MAX_VALUE) {
// We have been initially set to MAX_VALUE, but we don't
// want this as our preferred.
- width = getDefaultSpan(axis);
+ return 100f;
}
return width;
case View.Y_AXIS:
- if (getDocument().getLength() > 0) {
- if ((lineCount < 0) || widthChanging) {
- breakLines(getStartOffset());
- }
- return lineCount * metrics.getHeight();
- } else {
- return getDefaultSpan(axis);
+ if (lineCount < 0 || widthChanging) {
+ breakLines(getStartOffset());
}
+ return lineCount * metrics.getHeight();
default:
throw new IllegalArgumentException("Invalid axis: " + axis);
}