Hi Robert, looks good, please commit this (if you haven't already).
/Roman Am Mittwoch, den 22.02.2006, 10:51 +0100 schrieb Robert Schuster: > Hi. > > Roman Kennke wrote: > > Am Mittwoch, den 22.02.2006, 09:08 +0100 schrieb Robert Schuster: > > > >>Hi, > >>as mentioned in PR 26157[0] I observed that the JDK's JTextArea adjusts its > >>size > >>automatically when the characters leave the allocation area of the > >>component. > >>Our JTextArea did not have this functionality until now. > >> > >>It took me a while to find out where to place the code that could do the > >>neccessary checks which should prevent unneeded revalidate() calls. > >> > >>While implementing this I found and fixed two problems in PlainView: > >> > >>1) The switch statement in getPreferredSpan always fell into the Y_AXIS > >>case. > >> > >>2) In changeUpdate() the maxLineLength value could never shrink when > >>characters > >>are removed on one line only. I added a check whether the characters are > >>removed > >>from the current longest line and update the maxLineLength value if that is > >>the > >>case. > > > > > > Great! > > > > << > > switch (axis) > > { > > case X_AXIS: > > - span = determineMaxLineLength(); > > + return determineMaxLineLength(); > > case Y_AXIS: > > default: > > - span = metrics.getHeight() * el.getElementCount(); > > - break; > > + return metrics.getHeight() * el.getElementCount(); > > } > > - return span; > > > Done so. > > > > - private class RootView extends View > > + class RootView extends View > > > Not neccessary any more. > > > > > + /** Extends the RootView of BasicTextUI with the ability to adjust > > the size > > + * of the component after text was inserted, removed or changed. > > + */ > > + class TextAreaRootView extends BasicTextUI.RootView > > + { > > > As explained on IRC I added the appropriate preferenceChanged() calls into > PlainView. > > The new ChangeLog: > > 2006-02-21 Robert Schuster <[EMAIL PROTECTED]> > > * javax/swing/text/PlainDocument.java: > (getPreferredSpan): Added missing 'break'. > statement which corrects an unwanted fall through. > (updateDamage): Update maxLineLength correctly when text is > removed, call preferenceChanged accordingly. > (viewToModel): Restrict line number to be within 0 and the > number of elements-1. > > > What is the last entry? A fix for a small problem I stepped upon when > selecting > text with the mouse while hovering far above the component. I think it is a > minor glitch and the fix is appropriate that is why it is included in this > patch. > > cya > Robert
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil