java - Can I limit the length of text in a JTextField which can be painted, while still storing the full text? -


I have a text field in my application, even though it is a text field, users sometimes get too much text in it In addition, in addition to the other tasks of the problem, large amounts are also set.

Sometimes there is too much text that JVM gets access violation in fontmanager.dll. Oracle does not seem interested in fixing the problem, so I want to try at least to avoid it.

Limiting the amount of text User information is not acceptable (otherwise it will be the most obvious solution) but it is acceptable to allow it to be set and then disable the text field. When the text is forced back to the model, then the full text should be repeated in it.

Since this is a bug in naturally viewing, I thought the fix must be in the scene, as opposed to working to add more properties to the model around it.

My first attempt went something like this:

  Public Class LimitedTextField JTextField Extended {Fixed final full range = 10000; Personal string fullstring; @ Override Public Zero Set Text (String Text) {if (text! = Null & text.length ()> LIMIT) {fullString = text; SetEnabled (false); } Else {fullString = null; Super.setText (text); SetEnabled (true); }} @ Override public string getText () {If (fullString! = Null) {return fullString; } And {return super.getText (); }}}  

This naive unit passes the test, but once I wrote an extra test for beansbing, I came to know that this is not working because the properties of beansbading text Is not connected to, but instead binds the document, imitates a text property, then getText () actually returns an empty string on that test.

Now I am trying to implement a document that I want, but to make sure it is not easy to do this, move on the document level. I can see all those methods, but I can not find a good way to get the text, whenever the call can gettext () while making the text unavailable.

This is no problem, there is no doubt in it. In addition to not trying to render too much text, you want to influence the painting of the field with minimal impact. I have the only suggestion to create your own painting strategy (see) and where the text is drawn, just the characters Attract a sub-set You can try to create a new UIDlete for text component drawing, but it can also be very difficult to let you know It can be helpful in relating to color painting. It can help you to apply a custom UI representative to all text fields or just the ones you are trying to correct.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -