How to create a multiple-line TextBox in a jfx script?

How to create a multiple-line TextBox in a jfx script?
Or
How to use the Swing component JTextArea in a jfx script?
Please post a brief code segment.
Thanks,
Asghar

This supports two way binding between JavaFX and Java and also cut and paste.
Enjoy.
  * MyTextArea.fx
  * Created on Dec 14, 2008, 7:23:49 AM
package twifxer.components;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.Font;
import javafx.ext.swing.SwingComponent;
import javax.swing.JComponent;
import javax.swing.JTextArea;
import java.awt.Color;
  * @author Steven Herod
public class TweetTextComponent extends SwingComponent{
     var myComponent: JTextArea;
     public var length: Integer;
     public var readText:String;
     public var text: String on replace{
         myComponent.setText(text);
     public var toolTipText: String on replace{
         myComponent.setToolTipText(toolTipText);
     public override function createJComponent():JComponent{
         translateX = 15;
         translateY = 5;
         var f:Font = new Font("sanserif",Font.PLAIN, 11);
         myComponent = new JTextArea(4, 33);
         myComponent.setOpaque(false);
         myComponent.setFont(f);
         myComponent.setWrapStyleWord(true);
         myComponent.setLineWrap(true);
         myComponent.addKeyListener( KeyListener{
             public override function
             keyPressed(keyEvent:KeyEvent) {
                 if (keyEvent.VK_PASTE == keyEvent.getKeyCode())
                     myComponent.paste();
             public override function
             keyReleased( keyEvent:KeyEvent) {
                 var pos = myComponent.getCaretPosition();
                 text = myComponent.getText();
                 myComponent.setCaretPosition(pos);
             public override function
             keyTyped(keyEvent:KeyEvent) {
                 length = myComponent.getDocument().getLength();
         return myComponent;
}

Similar Messages

  • How to create a multiple line label?

    Hi,
    I need to set a multiple line label. If I enter the following code:
    strTitle = "<html><body><b><font color=red>The first line,<br>";
    strTitle = strTitle + "the second line.</font></b></body></html>";
    jLabelTitle.setText( strTitle );
    I can see a two line label. However, with such code, if I go to the UI editor for that frame, the jdev immediately crashed. I am using jdev 9i_902. If I go to UI editor for any other frames without such code, everything is fine, no problem at all.
    Can anybody explain why? Is there other way to create a multiple line label?
    Thanks!
    Harvey

    Harvey - I have reproduced this in the production and the latest build. I have logged bug 2446385 but have found a work around. If
    you code:
    strTitle = "<html><body><b><font color=red>The first line,<br>"+"the second line.</font></b></body></html>";
    jLabel1.setText(strTitle);
    It seems to work ok.
    Hpoe this helps and thanks for posting this.
    Regards
    Grant Ronald
    Product Management

  • How to create a single line textbox with up-down button?

    Hello,
    I mean for example is a text box for percentage. You can type in the value, or click the up or down button to get the value you desire. I tried attaching a small-sized vertical JScrollBar to a JTextField, but it is getting complicated that I need 2 different listeners(AdjustmentListener & FocusListener) for this.
    If you have done this before, or maybe you have some suggestions, I would appreciate the help. These are some conditions that the percent text box needs:
    - a click on up/down button increase/decrease the value by 1.
    - the user types in a value more than 100 or less than 0 and press one of the button(up/down), setText to 100 or 0.
    - the user types in a value in range, increase/decrease that value when up/down button is clicked.
    Thank you for your time.

    That's called a "spinner". I understand that it's a standard component in SDK 1.4, but I haven't looked at that myself, it's still in its beta stages. If you go to this page:
    http://www.toedter.com/en/jcalendar.html
    you will see an example (JSpinField), and you can download it for your own use.

  • Create a Multiple-Line JButton Without Using HTML format

    I used html format for multiple-line JButton and it took a long time to load that button up (about 5 seconds more). Does anyone know how to create a multiple-line JButton without using html?
    Any suggestion or sample code will be appreciated.
    javamesser

    Hello,
    You could try using the following:
    -give your button some layout (e.g.: BoxLayout.Y_AXIS, or BorderLayout).
    -create the wrapped text in separate JLabels (one line in each label)
    -add your labels to the button
    Advantage:
    this solution does not affect the laf classes
    Disadvantage:
    focus rectangle is not calculated accurately
    Regards,
    G

  • How to create a muli line text area using JavaFx

    Hi all,
    Since the preview SDK does not contain TextArea any more, I am wondering how to create a muli line text area using JavaFX. The behaviour of this text area/field should be somehow similar to JTextArea in Swing or StyledTextWidget in SWT.
    Does JavaFX have any support for this? What would be a sensible approach to create such a widget?
    Thanks for your suggestions,
    br michael

    This is a pretty old thread (I know I came across this while searching for something similar recently), but I figured I'd throw this out there in case other people might find this useful. As I write this, JavaFX's latest version is 1.3... which may have added the needed functionality since the last post.
    You can now create a multi-line text area using a TextBox and by specifying the nubmer of lines and setting the "multiline" value to true. It may not offer all of the same functionality as JTextArea, but it did the job for what I needed... newlines by pressing enter, scrollbar if text surpasses height, etc.
    Here's a simple example:
    Group {
       content: [
          TextBox {
             text: "This is a multi-line textbox"
             lines: 10  // <-- this may/may not be necessary depending on your situation. Default is 5.
             multiline: true
    }Edited by: loeschg on Jul 29, 2010 2:59 PM

  • How to do the multiple-line String at JList?

    hey everyone,
    i want to create a JList have to display multiple-line string.
    i have use String a="text1"+"\n"+"text2" inside my JList...
    the "\n" change to a sequare box...
    how cum like that.................??
    i need ur kindly helping...

    Because the default renderer for a JList element is a
    JLabel, and that is how JLabel behaves. The question
    "how to do a multiple-line JLabel" has been asked
    hundreds of times in this forum, search for that.i have search for it already but i no get it..anything!
    so, can u give me the url for me? thank you!

  • How to create a new line in label in Xcode

    How to create a new line in label. for example I have two buttons & one label. when i press first button, l want to change the label text to "Hello World". then when I press the second button, on the same label I need to display"Good Bye" on the next line in xcode 5?
    I want to display the lablel like below:
    Hello World
    Good Bye

    I am using Xcode to develop an app for iOS.
    I tried using multi-line label & belwo is my code.
    - (IBAction)change:(UIButton *)sender {
        self.Screen.text = @"\nHello World";
    - (IBAction)newChange:(UIButton *)sender {
          self.Screen.text = @"\nGood bye";
    everytime when i pressed the button, it replacing the whold lable text instead of adding the second line.

  • How to handle the multiple line items in the Inbound idoc FM

    Hi ,
    Can any body give me how to handle the multiple line item in the idoc when we reprocessing it from workitem....
    Thanks in Advance,,,,
    Regards,
    Bharani

    Hi ,
    Can any body give me how to handle the multiple line item in the idoc when we reprocessing it from workitem....
    Thanks in Advance,,,,
    Regards,
    Bharani

  • Itunes - how do i select multiple line items not in sequence ?

    itunes - how do i select multiple line items not in sequence ?

    Hold down the Command key and click each in succession.
    To extend the selection across items that ARE contiguous, use the Shift key.

  • How to create a multi-line table/column comment

    Can someone tell me how to create a multi-line table or column comment?
    Apparently, the concatenate operator (||) does not work with the COMMENT statement.
    I've searched the Oracle manuals and couldn't find an answer.
    COMMENT ON TABLE sometbl IS 'i would like to break up this comment into several lines in order to improve readability'; Effectively, this is what I'd like to do (but it doesn't work):
    COMMENT ON TABLE sometbl IS
      'i would like to break up ' || CHAR(10) ||
      'this comment into several lines ' || CHAR(10) ||
      'in order to improve readability' || CHAR(10); Oracle version is 10.2.0.4

    Why not just
    SQL> create table t (a int)
    Createtable successfully completed.
    SQL> comment on table t is 'i would like to break up 
    this comment into several lines 
    in order to improve readability'
    Commenton successfully completed.
    SQL> select * from user_tab_comments where table_name = 'T'
    TABLE_NAME           TABLE_TYPE  COMMENTS                               
    T                    TABLE       i would like to break up               
                                     this comment into several lines        
                                     in order to improve readability        
    1 row selected.?

  • How to create the multiple desktops

    Hi,
    Can anybody help me out how to create the multiple desktops in weblogic portal.After creating the desktops how to run them.Can you provide me the any document or send me the solution for it. I will be waiting for the reply.Thanks in advance..
    Thanks & Regards
    Kalyan Kurmam

    Hi Kalyan
    Please see a post of mine with the info you want and some additional information on what exactly Desktops and Portals are. Hope this helps.
    Re: Portals vs Desktop
    Thanks
    Ravi Jegga

  • How to create curve fitted line chart?

    Line chart is formed with straight lines, but how to create curve fitted line chart?

    Jasper wrote a blog on curve fitting charts

  • HELP! PDF objects - How to create a program line object?

    Hi Experts,
    I would like to know how to create a Program lines object (icon cog wheels). I need to create additional coding inside the context tab but when I try to right click on a folder --> create -->graphic,address,text,alternative...single record... No
    program lines can be created.
    Hope someone could help me.
    Thanks,
    Jeff

    There are two ways of doing it, depending on what you want to accomplish. Both require that you edit the file ~/.bashrc (I assume you use bash)
    1) If the application places all the executable files in a given directory (let's say /opt/Application/bin/), you can access all those executables directly by simply telling your shell where to look (in the same way the shell automatically looks for executable files in eg. /usr/bin). In ~/.bashrc, you would have to add a line that looks like this:
    PATH="$PATH:/opt/Application/bin"
    2) If you just want to make a traditional "shortcut" that executes a given command, this can be done with alias. Add this command to your ~/.bashrc:
    alias shortcut="some command"
    In this case, typing shortcut into a terminal will be interpreted just like if you had typed some command instead.
    In order to try out these changes, either restart your terminal or run this command:
    source ~/.bashrc
    [EDIT]
    I was obviously beaten to it
    Last edited by Peanut (2009-05-26 23:12:47)

  • How to create a stroked line that randomize each stroke color?

    Hi all, I am strating out designing in illustrator and I need help on how to created a stroked line, -----------, with each stroke (  -  )  a different colour, like, each stroke having a different randomized color which differs from the next one.
    Also, I need help on how to mask out parts of a template given to me by my school so i dont infringe that boundary when I add my lines to it. All helps appreciated, thank you.

    Ok thank you for your responses, Monika, I followed your instruction but it isnt working, is there any steps that I might have done wrongly? Here are some screenshots that depicts my problem:
    Here it is after I outline the stroke,
    And here it is when I apply the script:
    However, after I clicked okay, nothing changed and the strokes are still in their original color(yellow) as seen in the first picture. Did I do any steps wrong that result in this outcome? Also I've tried to put 99 instead of 99s and still, it didnt work.

  • How to create a new Oracle OSB project automaticaly with script without IDE

    Hello,
    I want to create automatically an "Oracle service bus project" and an "Oracle service bus configuration project" with scripts (ANT or Maven or ...) without using IDE, without using workshop or Eclipse. I want to create automatically (ANT or Maven) just a skeleton of an OSB project witch i can use after in workshop.
    I want to create 1 "Oracle service bus configuration project" with many "Oracle service bus project" automatically (ANT or Maven or scripts) witch i can use after in workshop. How to create a new Oracle OSB project automaticaly with script without IDE ? How can i do this ?
    I'm using Oracle service bus 10.3.1
    Thank you for your help.

    Thank you for your response,
    I do not want to just create the services (proxy services and business services) but I want to create a template for 40 OSB project with the same scripts ANT/Maven.
    Template="Oracle service bus configuration project" + "Oracle service bus project" + services of 40 OSB projects
    The goal is that I have more than 40 projects to create and just the name of the projects that changes (when I say the name of the project ie the name of the OSB project, the name of proxy services and the name of business services ).
    So I want to give my script (ANT/Maven) the name of 40 OSB project and the script must generate the skeleton of the 40 projects at once time and after generation of skeleton of the 40 project, I will import them in the workshop to add manually mapping and routing and other things that differs from one project to another.
    So i want to generate automatically a skeletons of 40 OSB projects using a script (ANT / Maven) and I give to the script juste the names of the 40 projects.
    I want to create a "Oracle service bus configuration project" and "Oracle service bus project" automatically of 40 OSB projects (ANT or Maven or scripts) witch i can use after in workshop.
    I want to create one 'template' of all 40 projects in the same time, with the same directory structure (Transforlation, Business services, proxy services, WSDL .....) and all 40 project have the same transport, just the names of projects and services witch changes and i can give to the script all names of projects and services and i can give also all WSDL.
    Regards,
    Tarik

Maybe you are looking for

  • Open New Browser Window Behavior Issue

    I've got a site that has a list of names of deceased people. When a viewer clicks on a name I have a new browser window open that is a small memorial page specific for that person. This list is fairly long so the viewer has to scroll down a ways to g

  • How to change Asset Capitalization date ?

    Hello All Experts, I want to chnage asset capitilizatio date so how can I ? Experts guidance is needed. Regards, Pankaj.

  • Problem closing popup window in flash player 10.0.32.18

    Hello, I'm new to the forum so please bear with me. I posted this in the actual "Flash" forum yesterday but I realized afterward that the ActionScript forum would be a better place to post the question (sorry about that). I'm a web designer but I don

  • Nokia N900 does not support USSD

    nokia n900 does not send USSD numbers such as the * or # before the number it shows incorrect number and most of prepaid customers can't chek there balance such as in United Arab Emirates i cant check my balance and balance enquiry number is *121# an

  • OCCS Disconnects from Meeting place toll free number every 30 minutes

    Hi, I have Oracle Communicator 10.1.3.31002 (Build 070925.0901) installed. I use it to take meeting place calls using the toll free number provided. But, exactly after 30 minutes, the call gets disconnected without any hint or message... I have to re