Two JTextArea text input

Hi,
Here is a tough one, if all you gurus would like to give it a try.
There are two JTextArea components. I would like users to be able to input text in the first JTextarea. When the text reaches the maximum on the line, it should go to the second JTextarea and continue inputting text.
I need to create an application where the output should be a document with alternating lines of images and text.
Any thoughts? Thanks alot.

There are two JTextArea components. I would like
users to be able to input text in the first
JTextarea. When the text reaches the maximum on the
line, it should go to the second JTextarea and
continue inputting text. You could try calling component.requestFocus() when you want to switch areas but it's kind of a kludge solution.
I need to create an application where the output
should be a document with alternating lines of images
and text.Then don't use JTextArea. Use JTextPane.
It sounds like your answer could be either JTextPane or a custom solution.

Similar Messages

  • Text Input: How To Perform Procedure on Console Input Without Variables

    Problem Defined:
    Need to analyze text input on console to ensure it meets conditional statements before assigning to a variable.
    I can't find a method to take scanner input from the console without first assigning it to a variable. I don't want to assign it to a variable unless it meets a certain condition.
    This is for a class assignment and I must use the console for input--no dialog boxes.
    This is what I want to do:
    Read Input; Hold In Memory; Test if Null; Test if Length is 14 Digits; Assign to Acct if All Conditions Are Met
    If Null, tell the user he needs to actually enter input or q to quit. Exit after five failures.
    If input is not equal to 14 digits, inform user. Offer escape with q. Exit after five failures.
    I only know how to assign a value to a variable from the various methods that take input. How do I take input and store it in memory to analyze without assigning it to a variable?
    I have this and the code is probably not correct. I'm a rank newbie. I've written several programs, but they're all basic, mostly using only the methods I learned in class and what I pulled out of books. My prof doesn't even intend on going over if, for and while! She's happy with us just copying verbatim and editing one or two lines so the source isn't exactly what she wrote on the board. I'm trying to learn how to do things that I know are useful, like making sure input is in the proper format, asking questions like what did people use before scanner just gets me blank responses with a quizzical look, but no answer.
    new Scanner = console scanner (system.in);
    String Acct
    Acct = console.next();
    if Acct == null . You entered nothing. Try again or press q to exit.");
    return to Line 1 //No idea how to do this.
    if Acct == 'q'
    Close Program
    if length.Acct = 14 ( Acct = Acct )
    else System.out.print("Your account number is 14 digits. You didn't enter 14 digits. Try again. Or press q to quit.")
    goto Acct = console.next
    Also, if you need to read an address from the console entered on one line, what methods can you use to pull one word at a time and then position them onto multiple lines?
    Enter Address: 123 Main Street Apt 321 Port View, FL 32547
    123 Main Street
    Apartment 121
    Port View FL
    32547
    Any help putting this together would be greatly appreciated. Thanks in advance.
    Alec

    805228 wrote:
    How do I take input and store it in memory to analyze without assigning it to a variable?Where do you think variables are stored? In memory. So no, you're not gonna be able to do anything to the value before you assign it to a variable. Then you can do any checks you need and
    possibly assign it to another variable (or more likely, ask the user for valid input if the checks don't pass).
    You can use loops and other constructs to keep asking for user input until valid values are provided.
    if Acct == null . You entered nothing. Try again or press q to exit.");
    return to Line 1 //No idea how to do this.Read up on while loops.
    Also, if you need to read an address from the console entered on one line, what methods can you use to pull one word at a time and then position them onto multiple lines?
    Enter Address: 123 Main Street Apt 321 Port View, FL 32547
    123 Main Street
    Apartment 121
    Port View FL
    32547Well that depends. How do you know that the street is "123 Main Street" and not "123 Main Street Apartment" or "123 Main Street Apartment 121".
    You can get the whole String from the user and then split the String into smaller Strings _if_ you can answer the question on the previous line.

  • Text input boxes same colour as background - so "invisible", and button text or buttons often missingt

    I have turned off all addons/extensions/plugins - still the same problem:
    1: Text input boxes appear to be the same colour as the background - and hence "invisible"
    2: Clickable buttons on websites are often invisible, or if they display have no text; e.g. button to right of google search ("go" button?) is seen as a plain box with no text - although button is clickable.
    3: Google webpage usually has an image - this is missing, and merely has "UK" to the top left of the input box.
    4: On this page for example I can see directly above this text box two vertical black lines - it appears to be a button with a pop-up "insert a link" - it can obviously be clicked when I mouse over it.

    See:
    * http://kb.mozillazine.org/Website_colors_are_wrong
    * http://kb.mozillazine.org/Websites_look_wrong

  • How to Disable client side validation for the message text input

    Hi,
    I have scenario where i need to by pass the client side validation for a message text input
    Scenario is
    I have a message text input field(say XYZ), i set the max length for the item as 20
    Now when im trying to enter the greek characters into it, it is allowing me to enter till 20 characters
    But when i try to submit the form ..my client side validation is firing..
    The Error says the XYZ is too long
    The problem is, in greek each character takes two bytes.(In english it is only 1).While entering the content it allowing 20 characters and when validating it is checking for bytes(if we enter in greek the length will be 40 bytes not 20)
    I cannot increase the max length .coz i have restrict the character length to 20 only.(english or Greek).
    Please help me in this regard.
    Regards
    Sandeep.

    Thanks for the information.But we dont have any option either declaratively or programatically to disable the client side validation for the message text input..I referred java docs ..i dint find any method which does..
    Correct me if im wrong

  • ENTER keystroke on text input entry not always submitting

    I have run into a problem where once a user has completed the
    text input entry and has clicked the ENTER button to "submit" this
    entry, the ENTER keystroke event is not always "submitting" the
    input entry. Sometimes it requires hitting the ENTER key two or
    three times before the slide moves on.
    We are loading the captivate files into a custom flash
    interface (but there are no key events in this interface that could
    conflict with the captivate's ENTER keystroke) and I have the
    maximum number of attempts set to 1.
    I did some debugging from the custom flash interface, and in
    the captivate .swf, the proper input field has focus and the ENTER
    keystroke is being captured
    Has anyone else experienced this problem? Does anyone know a
    possible solution?

    I’ll try to explain the problem more clearly.
    I want the name that is loaded from the textfile into the combobox to be selected from the list.
    Once an item is selected everything works just fine. But I don't want the user to select the item, when the name is loaded into the combobox. The user will expect that the item will be selected automatically. Is that possible?
    The function I want is the opposite of combobox.selectedItem. Instead of having a selected item and getting the name, I have a name and I want to select the item.
    The name is a correct name, because the name is saved from the combobox.

  • Setting JTextArea text within a JScrollPane

    Hey all. I'm attempting to use the setText() method of JTextArea to set the text of various areas located in various scroll panes. The general procedure I'm following is to initialize a new JTextArea and JScrollPane within an initializeGui function, set the properties of the JTextArea, then add it to the scroll pane using .getViewport().add(). After that, a separate function goes through all my form fields loading them with whatever data type is appropriate, in the case of the text areas I'm trying to use setText() to set a string. However, after using setText() the text area is displaying nothing. Here's some code for example (workerPane is using a layout manager exclusive to the environment I'm working in, but I don't believe it's the problem).
    workerLabel = new JLabel("Customer Address:");
              JScrollPane sp = new JScrollPane();          
              JTextArea ta = new JTextArea();          
              //set ta's properties to whatever is needed
              ta.addKeyListener(new java.awt.event.KeyAdapter(){
                   public void keyTyped(KeyEvent e){
                        JTextArea text = (JTextArea)e.getSource();                    
                        String txt = text.getText();                    
                        int nameLength = 240;
                        if ( txt.length() >= nameLength ){
                             text.setText ( txt.substring( 0, nameLength-1 ) );                         
                             Toolkit.getDefaultToolkit().beep();                    
              sp.getViewport().add(ta);          
              workerPane.add("3.1.right.top",workerLabel);
              workerPane.add("3.2.left.center",custAddScrollPane);After each area has been initialized, another function is called to load the data into it. Here are some methods I've tried that haven't worked.
    //basic, but leaves an empty field.
    ta.setText(formProperties[2].getStringValue());
    //this results in two NullPointerException warning windows popping
    ta=(JTextArea)sp.getViewport().getView();
    if(formProperties[2].getStringValue() != null)         ta.setText(formProperties[2].getStringValue());
    sp.getViewport().removeAll();
    sp.getViewport().add(ta);Can anyone point me in the right direction as to how to set my textarea's text?

    I usually use the approach given above. The other option is:
    scrollPane.setViewportView( textArea );

  • Horizontal paragraph rule across two-column text frame?

    Hi,
    as the title suggests, how do i get a horizontal rule to run across a two-column text frame?
    I have either had the rule just apply to the entered text; had a gap where the column gutter is;
    or I have had to set the column gutter to 0mm/px and manually set carriage returns to give the impression of a gutter.
    Surely there is a better way?
    I'll attach a jpeg of my various options.
    Hope I've been clear-enough. All help is appreciated.
    Cheers, Matt

    You can put the rule in a paragraph which is spanning a columns.
    Or you can extend the paragraph rules by inputing minus values to left and right (e.g. -5mm)
    Or you can use a table instead.
    Or you can use negative left and right intend for the text but extend the rule to the end of the frame.
    Never set a carriage return manually.

  • Issues with iOS 7 Text Input

    Hi All!
    I have come across a very interesting problem since upgrading my iPhone 5 and iPad Mini to iOS 7.
    The problem, thankfully, is one that is easily replicated, and comes in two forms:
    Scenario 1:
    Open Messages
    Create a Message
    In the text input, type a word (any word will do)
    Tap 'return' on the keyboard
    attempt to bring up the 'Copy/Paste' context menu on the new line
    This is where I run into the problem - I cannot under any circumstance invoke the 'Copy/Paste' menu
    Scenario 2:
    Similarly;
    Open Messages
    Create a Message
    In the text input, type a word (any word will do)
    Tap 'return' on the keyboard
    type another word
    Tap 'return' on the keyboard
    type another word
    You should have 3 lines of text - attempt to place the text cursor after the first or second word, as if you wanted to add another word to that line
    You will find that the cursor will disappear, making it very hard to tell if you are on the end of the line you want to be on, or at the beginning of the following line.
    Has anybody else come across this problem?
    I was very excited to see iOS 7.0.2 hoping that the problem would be resolved, but it has not been addressed yet.
    I find it quite annoying...

    Hello there, HeavyJ251.
    The following iPhone Troubleshooting assistant should help resolve performance issue you are describing as well as provide additional information:
    Apple - Support - iPhone - iPhone Troubleshooting Assistant
    http://www.apple.com/support/iphone/assistant/phone/
    Keep in mind, that step "Close App" looks a little different now in iOS 7. For that, when closing apps, once you are in the multi-tasking display, swipe up on the window. I would also recommend closing all apps you see on this step.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro D.

  • Text input options missing

    Hi,
    After running some updates yesterday, the "show text input options" is no longer available in the options. Neither can I select suretype when writing a message. Would appreciate some help.
    Thanks
    Solved!
    Go to Solution.

    Had to re-boot after removing an application and everything back to normal! What bugs me is that my service provider tech never brought up a re-boot but rather wanted me to delete all my data and start all over!

  • How to make numbers in message text input  fields left aligned?

    Hi Friends
    I have completed one of my task .but getting result right side of the field.
    how to make numbers in message text input  fields left aligned?
    Thanks
    Aravinda

    Hi ,
    Sorry for late replay i am trying this alos not set that page....
    pageContext.forwardImmediatelyToCurrentPage(null, true, null);
    and one more that kff field working is fine for ex display any text pled displayed properly and only problem is not set the value and HrSitKeyFlex6 and HrSitKeyFlex7 fields are perfectly get the values but not pront HrSitKeyFlex8 that only my issue....
    Regards,
    Srini

  • Conditional for a text input box NOT being null? Sorry for asking so many questions!

    Okay, here's the situation. I'm creating a simulation of a form on which there are several text input boxes, 7 of which are mandatory fields. I know I can use a conditional to check whether the box has nothing in it by creating a null variable with no value and doing "if [box variable] is equal to [null variable] then", but the problem is that the validation captions I need to show need to be shown in order, that is to say that the caption for entering a value for the first box will always be shown if that box is null regardless of the contents of other boxes, the second will be shown if that one is null and the first one isn't etc.
    When I was investigating this I noticed a post by Lilybiri saying that comparison with a null variable doesn't work for "not equal to" so I'm having a hard time figuring out how to show the captions based on priority. For example, to show the second caption I need to not only check whether the second box variable is null, but also whether the first one isn't.
    It gets pretty crazy further along the line where I get to the 7th mandatory field and need to check whether the first, second, third, fourth, fifth and sixth boxes are NOT null and whether the 7th one IS. Help!
    I did come up with one potential solution to this prior to posting: if I set a different advanced action for each input box losing focus which checks whether the variable is null and if so sets a "flag" variable to 0, and in the else set it to 1, I imagine I can then replace the "not equal to" with a check to that flag variable being equal to 1 (which means there is text in the box). I think this will work but I thought I'd check to see if there's an easier way first.

    No it DOESN'T require everything to be on one slide.  It just has to LOOK as if that's what it is.
    I would suggest that it doesn't really matter how many Captivate slides are involved in the final solution, as long as it works the same way (or as close as possible) to the original software that you are simulating.  Your users don't frankly know or care how you achieved the simulation.  I guarantee they won't be thinking of you or Captivate.
    In my experience, you can make creating elearning a lot more difficult than it needs to be in Captivate by trying to rebuild the app, rather than just simulating how it works. For example, thinking that if everything happened on one web page or screen in the app then it must also happen on a single slide in Captivate.  The fact of the matter is IT DOESN'T need to work this way.  And in some cases it might even be impossible to reproduce in Captivate this way.
    So the quickest path to a solution is often to use multiple slides, which has the advantage of allowing you to "fix" certain things on screen (e.g. the contents of fields already visited) by using READ ONLY variable output in transparent captions, focusing only on one element of the interface that the user can interact with on that slide.  It doesn't necessarily prevent you from moving back and forth between elements, just as you can in the original app.  But it is far easier to create and maintain.
    I'm not saying you wouldn't be able to pull this off on one slide in Captivate, but it is going to require a LOT of variables and Advanced Actions to build and debug.  So the term Rapid Elearning becomes something of a misnomer if it takes you a long time to complete one slide.

  • Text input box for displaying notes

    How can I use a text input box so delegates can write notes in which then appear on other pages as they work through the course.
    Ken

    It seems you would be able to do this with user variables, in which you store the content retrieved from the Text Entry Box. Later on (other slides) you can use this content by adding it to a Text Caption. Beware: I'm not sure about the amount of characters that can be stored.

  • Text Input Prompt

    Does anyone tried to build some text input field that can do prompt? Something like auto-complete in source code edit. It would mean that:
    - we have to make the rest of the prompt text gray
    - the cursor blinks right after the user input characters
    - if user click space bar, the first word in prompt become solid and cursor moves to next word.
    Is this something that's possible to do for iPhone?

    - How do I programmatically place the cursor in the middle of a word
    - How do I font/color part of word in text input control
    - How do I select the text up to or from where the cursor is...
    You can't. You can't. You can't. At least not with a UITextField.
    I've done more or less of what you are looking for in PocketMoney for auto completing transaction. You need to do a lot of rolling of your own code to pretend you have UITextField.
    What I ended up doing is drawing the uncompleted text at the end of the current text input of the UITextField that I subclassed.
    - Hardy

  • Text input field

    How can I create a text input field?

    Ok, I found the solution by a lot of searching and trial and error:
    sym.$('#nickname').val("XXX");
    ..., where "nickname" is the id of the input field.

  • Text Input Autocomplete

    How do you make a text input control behave like a normal web
    form control that displays suggestion as you type in the control.
    I'm sure Flex can do this I am apparently looking in the wrong
    places. Any help would be greatly appreciated. Thanks so much!
    curtkauf

    The Adobe site has an Exchange section where there are many
    flex components, some are free, some are not.
    Here's one that does what you need
    http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1340 018

Maybe you are looking for