How to set maximum characters to TextBox?`

i have a textBox and i dont want that to user will fill in more than two
characters
Thanks

That only works on a JTextField. The OP is using a TextField.You're right - I hadn't seen that.
I've already asked the OP to be clear and precise with the question.I'm not sure what you mean - the question is not that unclear, is it? What I understand from it (and I like guessing) is that he wants to restrict the number of characters that can be entered into a text field.
It's been a long time since I last worked with AWT, but looking at the Javadocs, I don't see an easy solution. You could override processEvent and not forward key events if the maximum length has been met, but that would fail when text is being pasted. You'd have to look at the code if there is a single entry point for text inserts.

Similar Messages

  • IView Deployment - how to set maximum file size?

    Hello,
    we have a problem while deploying iViews and uploading files to enterprise portal . The maximum upload file size seems to be limited to 1 MB. I have to deploy an iView greater than 1 MB. While deploying with netweaver developer studio I get following error message
    in logfile of developer studio:
    [19.10.04 / 13:33] #ERROR LEVEL#
    com.sap.portal.developmentTools.ideSpecific.eclipse.wizards.sapmakepar.SAPMPWizard$1 > No Information
    java.io.IOException: Error writing to server
    The direct upload of *.par with EP Component Manager also does not work. After clicking upload-button I get a standard http error page "aktion abgebrochen".
    Also on upload of any other document, for example personal documents which are bigger than 1 MB, I get this error.
    If I reduce file size of portal archiv lower than 1MB I can deploy and upload the iView.
    How canI set maximum upload file size in Enterprise Portal?
    Our Version: 6.0.2.4.7.Enterprise_Portal_Service_Pack_2
    Thanks for helping me,
    Nicole

    You need to use a precision argument:
    String foo = "a long name to print";
    System.out.printf("foo say: %.8s", foo); // 8 maxhttp://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html#syntax

  • How to set maximum number of jobs in oracle

    Could pls tell explain me about how to set maximum number of jobs in oracle....
    Regd,
    Mahi

    I don't think there is any limit on number of jobs that can be submitted to Oracle. However, there is a limit on the number of processes that would execute those jobs (governed by JOB_QUEUE_PROCESSES).
    Message was edited by:
    Satish Kandi
    Typo corrected.

  • How to set Maximum Character into OAMessageTextInputBean?

    Hi,
    Can anyone please show me how to set a maximum characters into an OAMessageTextInputBean programatically?
    Thank you.
    Jon

    TextInputBean.setMaximumLength(11);

  • How to set maximum length for TextEdit

    Hi all,
        I have a TextEdit UI element in my webdynpro page and I want to set the maximum number of characters that can be entered in this TextEdit. How can I do this?
    Thanks,
    Satyajit.

    Hi Arun,
         thanks for the reply. But I also want to use the same scenario for an Inputfield. Now I used the same method here and when viewed in the browser, the entire InputField has been stretched. How can I keep the view of the InputField as default but still have a restriction on the number of characters that can be entered in this InputField? It works for TextEdit.
    Thanks,
    Satyajit.

  • How to Testrict Maximum Characters in tabular form

    How can I restrict user for maximum character length in tabular form ? in master forms we can define maximum character lenght by using option "Maximum width"
    Thanks,
    Suhaib

    Andy,
    I've tried to put the following in my "Element Attributes" of a tabular form "text" element:
    maxlength="5" onChange....
    A test of the tabular form does not restrict character entry to 5 characters. The page source actually shows both maxlength="2000" and maxlength="3' for the input type tag. It looks as if the first maxlength is used and the maxlength that I added is ignored. It's curious that a tabular form element does not have a "maxlength" attribute to set like a non-tabular form "text" element.
    Any suggestions on what else to try?
    Alex.

  • How to set maximum number of data points displayed on waveform chart?

    I have a waveform chart set to x-autoscale, but after about 1000 data points, it begins to scroll again. How can I display all of the data points being collected, say 2000 points?

    Right click on the chart and select Chart History Length. Enter the value that you need. The maximum is 2147483647 points.

  • JLabel: how to set maximum size in layout?

    I have a BorderLayout that i want to show a JLabel in NORTH. I use HTML in the label message text with one line being centered with <center>. If the overall text of the label is long/big enough, i.e. subsequent text results in line breaks, the cenetered line is cenetered correctly.
    however, if the subsequent text is just small, all lines are left justified/adjusted. i guess, the JLabel dimension is not maximized to the maximum available spave in the NORTH area of BorderLayout.
    I tried adding the JLabel directly or within a JPanel (also with BorderLayout, then with add(label, BorderLayout.CENTER)), also first set the size of the dialog, added all components and just added the text to the label at the last position. doesn't help.

    Tip: putting a border on a JComponent like JLabel helps you see how its parent container is sizing it. I don't know what HTML mark-up you are using, but is the centering necessary?
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class Ex {
        public static void main(String[] args) {
            JFrame f = new JFrame("Ex");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            Container cp = f.getContentPane();
            String text = "Example text";
            Border b = BorderFactory.createLineBorder(Color.BLUE);
            JLabel label0 = new JLabel(text, SwingConstants.CENTER);
            label0.setBorder(b);
            JLabel label1 = new JLabel(text);
            label1.setBorder(b);
            cp.add(label0, BorderLayout.NORTH);
            cp.add(label1, BorderLayout.SOUTH);
            f.setSize(400,100);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • How to set "Maximum Lenght" column property for database block at RUNTIME?

    Hi folks,
    Is it possible to somehow set a "Maximum Length" property for database block column at runtime?
    I have a dynamic form, which maintains mostly "STATIC DATA" within all application which are stored in different static data tables (which have similar structure). But now, description column in some of those tables was extended (not in all at this stage). I would like to avoid truncating form error while reading data from those extended tables, so I would like to set an MAXIMUM SIZE to accurate value at the time when I'm specifying TABLE NAME for that database block.
    What property should I use to set it?
       -- before executing query in "MAIN_BLOCK" I always set QUERY_DATA_SOURCE_NAME to user defined value => STATIC DATA TABLE name
       Set_block_Property('MAIN_BLOCK',QUERY_DATA_SOURCE_NAME,:control.table_name);
       Set_block_Property('MAIN_BLOCK',DML_DATA_TARGET_NAME,:control.table_name);
       -- here I would like to set also MAXIMUM LENGHT for particular column (based on some condition, etc.. correct value I can get from ALL_TAB_COLS dictionary
       SET_ITEM_PROPERTY('MAIN_BLOCK.DESCRIPTION', <<XXXXXXX>>, 300);What should I use instead of "<<XXXXXXX>>" if I want to overwrite MAIN_BLOCK.DESCRIPTION column's maximum length to 300?
    Thanks,
    Tomas

    Hi Magoo, thanks for reply.
    Yes, but then user can get other errors while trying to set description with value longer than in database (for all not extended tables).
    Aby idea how to implement SET_CUSTOM_PROPERTY like mentioned here?
    Oracle Forms - "maximum length" property.
    Thanks,
    Tomas

  • How to set maximum redelivery count

    hi,
    Within my JCD I am throwing an exception to roll back a message so that it will be redelivered in case of an error. From the log I can see that the message is redelivered.
    Now, I'm trying to find a way to set the maximum redelivery count within the JCD. Or a better way maybe find out how many times the message has been redelivered, so I can send it to a dead message/error queue when it reaches a certain number.
    Is this possible? Has anyone done similar thing?
    thanks
    Ari

    For JCAPS 5.1.1 see
    <CAPSInstallRoot>/lofgicalhost/extra/JMSJCA-readme.html, section named
    Redelivery Handling (deadletter queue).
    Thanks Frederic :-)

  • How to set Maximum Open Socket on WLS 6.1

    I can find that WLS 7.0 allows us to set the maximum open socket at the Configuration
    => Tuning. How about WLS 6.1? Is there any way to set it?
    Thanks!

    Upgrade to SP3 and u will see the option in the console.
    Mullin Yu wrote:
    I can find that WLS 7.0 allows us to set the maximum open socket at the Configuration
    => Tuning. How about WLS 6.1? Is there any way to set it?
    Thanks!--
    Rajesh Mirchandani
    Developer Relations Engineer
    BEA Support

  • How to set MAXIMUM size of a formatted string?

    Hello
    Assume I have an Object foo with a
    toString(){ return "a long name to print"; }and that I want to print it with minimum space of 40, I would say
    System.out.printf("foo say: %1$40s", foo.toString() )But I need very often to set a maximum width, so that any strings or fields wider than this is truncated. Eg:
    System.out.printf("foo say: %1$5s", foo.toString())gives i.e. "foo say: a l..". Is this possible, using the Formatter class (or similar) in Java? So far I have created my own class to enable this, but I want to use as much predefiend classes as possible.
    Regards
    Fluid

    You need to use a precision argument:
    String foo = "a long name to print";
    System.out.printf("foo say: %.8s", foo); // 8 maxhttp://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html#syntax

  • Xsd:integer - how to set maximum length

    Hi,
    In a structure, I have set some of fields as xsd:integer.  my scenario is file to proxy.  while generating the inbound proxy, for those elements which are xsd:integer, the data dictionary fields are authomatically set to INT4.  Whereas the actual field length is 15.  so when i test with the data the proxy fails as there is a mismatch is the length.  how do i overcome this problem.
    can i set the length of the field when the data type is xsd:integer so that while generating the proxy automatically this field length is taken. or otherwise can i change the data type in the dictionary table.
    kindly advise.
    Bala

    experts,
    can anyone suggest how to deal with this issue.
    thanks in advance. bala

  • How to set maximum bound for JDialog

    Hai..
    I want to resize the JDialog ...but it should particular size ....
    In JFrame ,We will define maximum Size using
    setMaximizedBounds(Rectangle bounds)
    like that i want in JDialog....
    give Solution
    Thanks in Advance....

    What you are asking doesn't make much sense because, setMaximizedBounds() only defines the bounds for the window in the maximized state, not the maximum size you can manually resize. And JDialogs don't have a maximized state. So what you are asking is not possible.
    If you want to restrict manual resizes, then use a component listener and restrict the bounds as it's resized.

  • TPY: How to set maximum charging limit?

    In my Win 7 X220 and Win 8 Yoga11s, both had Lenovo programs (Power Manager and Lenovo Energy Management respectively) that allowed me to maximize battery health by setting a charging threshold.
    In the TPY, is there any Lenovo programs that does that too?
    Solved!
    Go to Solution.

    Lenovo removed the program in Windows 8.1. The battery is set to fully charge under all condition.
    Regards,
    Jin Li
    May this year, be the year of 'DO'!
    I am a volunteer, and not a paid staff of Lenovo or Microsoft

Maybe you are looking for