How to get the text to the next line of the Label


I am trying to write a code where when I press Enter the text in the text box appears on the next line of the label. However, each new text is get printed on the same line...

Here is my code:

java.applet import. *;

import java.awt.*. *;

java.awt.event import. *;

public class ChatBox extends implements ActionListener Applet


TextField firstNum, secondNum, resultNum;

Label label1;

String str1 = "start chat".

public ChatBox()


setLayout (new GridLayout (3, 2, 10, 15));

setBackground (Color.cyan);

String message;

message = "start typing and see the magic."

setLayout (new GridLayout (2,1,10,120)); 10, 15));

setBackground (Color.cyan);

firstNum = new TextField (5);

firstNum.addActionListener (this);

Label1 = new Label (firstNum.getText ());

Add (Label1);

Add (firstNum);


public void actionPerformed (ActionEvent e)


String line = System.getProperty ("line.separator");

String message = "start typing and see the magic."

str1 = str1 + newline + firstNum.getText ();


message = message + str1;

Label1.SetText (str1);




Is it not possible?
Guide of nicely with another way to do it.

Tags: Java

Similar Questions

  • How to get the label of the COM ports?

    If I go to System Manager, I got this information:

    But if I use the resource to find VISA, I get this:

    Is it possible to get the label?

    Try this:

    The list:

    (I have a special virtual TCPIP COM port on my machine, which gives error thats why the first element of the indicator table is empty for me)

  • How to get the label of the image?

    In accordance with common rules, I want to put all my as2 code in the first frame of a layer named 'code '.

    Then there was this question: how to implement that "certain actions when a given (better by using"image tag "not" frame index number") is entered to take ' in the 'framework of code' using as2.

    I can call to mind, listen to the message of frame entry of the current MC it's how can I check if the current entered image is the image specified?

    Any solution to this problem is welcome!

    Thanks in advance!

    Here is an example of what I mentioned in my first post:

    var labelA:Array = ["framelabel 1", "label 2", etc.];

    var frameA:Array = [];

    Preloader code

    function loadCompleteF() {}

    for (var i: Number = 0; i<>

    this.gotoAndStop (labelA [i]);

    frameA.push (this._currentframe);





  • Symbol of victory-box.  Can not get the Label AutoSize


    I'm following the instructions on a tutorial on how to get the label on the 'Win'-> Checkbox symbol on automatic size:

    For example: I changed the label on the "Quantity" box, but it goes down.  I double click to align with the symbol-editing window.  I double-click on the text box and the top right blue square seems hollow (which is supposed to signify his now automatic resizing mode?), but when I go back to the main window.  The Word will not auto-size of the 'quantity '.

    The default value for symbols is "fixed" size 9indicated by the "Cube" at the top right in the text editing Mode.

    Just double-click, this little cube and it will return to a cicrle, which means that you have activated just this block of text for "Auto size". In other worlds, the limits of the block will be "conform to the / auto size" to the width of the text that it houses.


  • How to get the text formatting in the tables

    Dear experts and aid

    For my project, I import an RTF file and then read the data into 3 tables. It works fine when just using the contents of the string of paragraphs. However, the final script should be able to read and to replace the text formatted...
    Why use intermediate tables? Because otherwise I need to swap between two fm-documents (and you can be a part of the book).

    The imported file starts with a certain number of lines separated into two parts by a TAB ("designates a TAB in \x08 FM)
    [[Garneau, 1990 #12]]    »   [9]
    The good article can also be locally as text, e.g. [9]
    Then follow the same (or smaller) number of paragraphs with text formatted like this:
    [9]"D. Garneau, ed., National Language Support Reference Manual (national language Information Design Guide. Toronto, CDN: IBM National Language technical Centre, 1990.

    Is it possible to replace in the body of the function below the next song

      while(pgf.ObjectValid()) {
        pgfText = GetText (pgf, newDoc);
        pgf = pgf.NextPgfInFlow;

    with this

      while(pgf.ObjectValid()) { 
        pgf = pgf.NextPgfInFlow;

    Do I need a special statement of the gaBibliography range?
    And how to get the right part of the lines as formatted intro thingy in table gaFmtCitsFmt ?

    Currently, I read in the tables as "strings" (function GetText not shown):

    var gaFmtCitsRaw  = [];                           // left column in processed RTF
    var gaFmtCitsFmt  = [];                           // right column in processed RTF
    var gaBibliography= [];                           // bibliography lines from processed RTF
    // filename is something like E:\_DDDprojects\FM+EN-escript\FM-testfiles\BibFM-collected-IEEE.rtf 
    function ReadFileRTF (fileName) {
      var nCits=0, nBib = 0, openParams, openReturnParams, newDoc, pgf, pgfText ;
      var TAB = String.fromCharCode(8);               // FM has wrong ASCI for TAB
      var parts = [];
      openParams = GetOpenDefaultParams();
      openReturnParams =  new PropVals();  
      newDoc = Open (fileName, openParams, openReturnParams);  
      pgf = newDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;  // get first pgf in flow
    // --- read the temp/formatted citations  
      while(pgf.ObjectValid()) {
        pgfText = GetText (pgf, newDoc);
        if (pgfText.substring (0,2) == "[[") {        // citation lines start with [[
          parts = pgfText.split(TAB);                 // get the two parts of the line
          gaFmtCitsRaw.push (parts[0]);               // Push the result onto the global array
          gaFmtCitsFmt.push (parts[1]);
          pgf = pgf.NextPgfInFlow;
        } else { break }
    // --- read the bibliography
      while(pgf.ObjectValid()) {                      // until end of doc
        pgfText = GetText (pgf, newDoc);
        pgf = pgf.NextPgfInFlow;
      newDoc.Close (Constants.FF_CLOSE_MODIFIED);
    } // --- end ReadFileRTF

    The following questions will then be how to change the script of FindAndReplace of Ian Proudfoot for managing text formatted as replacement. I will need to use the copy and paste IMHO...

    Klaus, okay, before pasting, you must assign the TextSelection object at your insertion point.

    // Add a new paragraph after the current paragraph.
    var newPgf = oDoc.NewSeriesPgf (lastPgf);
    var textRange = new TextRange (new TextLoc (newPgf, 0), new TextLoc (newPgf, 0));
    oDoc.TextSelection = textRange;
    oDoc.Paste ();


  • How to get the text have the same effect as the video?


    For the first time post here, but I wonder how to get the text of the titles have the same effect as the video behind her.

    For my video, I use 'bad tv' and other effects such as Gaussian that obviously changes the appearance of video, creating the look of VHS. However, I then inserted text via the title, but it normally appears. How can I make this text have the same effects as the video behind it?

    A friend told me I might need to add text to the video first, then do the effects, I have not tried, but wonder if there is an easier way, as this would require me to restart.

    EDIT: That's what I'm looking for. The text has the same effect as the video.

    Thank you

    One way is to create a clip made up based on the title and the original clip. Then apply the effect.

    Another way is to use an adjustment layer.

    Good luck.


  • How to get the bar display of title in pixels text length?


    Does anyone know how to get the length of the title bar text (in pixels) display?  Just to clarify, that's what I'm looking for:

    I don't see a CVI function for this.  The attribute ATTR_TITLE_FONT for GetPanelAttribute (...) is only valid for the panels of the child which prevents me from using the GetTextDisplaySize (...) to get the size.  Dive into the Windows SDK I can not even find an answer here.  Any ideas?  Thank you.

    Figured out how to do this.  Go to the SDK to get the font properties - is kind of nonobviousness.  But once you have the font properties, you can create a font of meta in CVI, with properties, and once you have the meta font you can use GetTextDisplaySize (...) to get the size.  For any future reference:

    //define a NONCLIENTMETRICS structureNONCLIENTMETRICS ncmtest;//We have to set the cbSize parameter to the size of the passed structure before retrieving it
    ncmtest.cbSize = sizeof(NONCLIENTMETRICS);
    //Get NONCLIENTMETRICS structure
    result = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncmtest, 0);
    //copy the title font name to a c-string
    while(ncmtest.lfCaptionFont.lfFaceName[i] != 0)
        thefont[i] = (char)ncmtest.lfCaptionFont.lfFaceName[i];
    //null terminate
    thefont[i] = '\0';
    //create meta font with title font properties.  lfWeight & 0x700 indicates bold.  CreateMetaFontWithCharacterSet() doesn't recognize DEFAULT_CHARSET so we replace it with VAL_NATIVE_CHARSET(?).
    uir_status = CreateMetaFontWithCharacterSet ("TheTitleFont", thefont, abs(ncmtest.lfCaptionFont.lfHeight), ncmtest.lfCaptionFont.lfWeight & 0x700 ? 1 : 0, ncmtest.lfCaptionFont.lfItalic, ncmtest.lfCaptionFont.lfUnderline, ncmtest.lfCaptionFont.lfStrikeOut, 0, ncmtest.lfCaptionFont.lfCharSet == DEFAULT_CHARSET ? VAL_NATIVE_CHARSET : ncmtest.lfCaptionFont.lfCharSet);
    //get titlebar text
    uir_status = GetPanelAttribute (panelhandle, ATTR_TITLE, thetext);
    //get title bar length
    uir_status = GetTextDisplaySize (thetext, "TheTitleFont", &height, &width);

    I have a 79 for the duration of the screenshot above.

  • How to get the element selected listfield and goto next page?


    I try parsing the XML from a url and show in listfield.


    How to get the selected item and passing the variable and than goto next page?

    my code:

    package parsepack;

    import java.util.Vector;


    Import net.rim.device.api.system.Bitmap;
    Import net.rim.device.api.system.Display;
    Import net.rim.device.api.ui.DrawStyle;
    Import net.rim.device.api.ui.Field;
    Import net.rim.device.api.ui.FieldChangeListener;
    Import net.rim.device.api.ui.Graphics;
    Import net.rim.device.api.ui.Manager;
    Import net.rim.device.api.ui.UiApplication;
    Import net.rim.device.api.ui.component.ListField;
    Import net.rim.device.api.ui.component.ListFieldCallback;
    Import net.rim.device.api.ui.container.MainScreen;
    Import net.rim.device.api.ui.container.VerticalFieldManager;
    Import net.rim.device.api.xml.parsers.DocumentBuilder;
    Import net.rim.device.api.xml.parsers.DocumentBuilderFactory;

    to import org.W3C.DOM.document;
    Import org.w3c.dom.Node;
    Import org.w3c.dom.NodeList;

    extends xmlparsing public class UiApplication implements ListFieldCallback, FieldChangeListener

    Public Shared Sub main (String [] args)
    xmlparsing app = new xmlparsing();
    app.enterEventDispatcher ();

    public long mycolor;
    Connection _connectionthread;
    private static ListField _list;
    private static Vector listElements is new Vector();.
    public display display = new MainScreen();
    MainManager VerticalFieldManager;
    VerticalFieldManager subManager;

    public xmlparsing()
    pushScreen (screen);

    final Bitmap Imagearriereplan = Bitmap.getBitmapResource ("blackbackground.png");

    mainManager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL |) Manager.NO_VERTICAL_SCROLLBAR)

    public void paint (Graphics graphics)
    graphics.drawBitmap (0, 0, Display.getWidth (), Display.getHeight (), Imagearriereplan, 0, 0);

    Super.Paint (Graphics);


    subManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL |) Manager.VERTICAL_SCROLLBAR)
    protected void sublayout (int maxWidth, maxHeight int)
    int displayWidth = Display.getWidth ();
    int displayHeight = Display.getHeight ();

    Super.sublayout (displayWidth, displayHeight);
    setExtent (displayWidth, displayHeight);

    Screen.Add (mainManager);

    _list = new ListField()


    public void paint (Graphics graphics)

    graphics.setColor ((int) mycolor);
    Super.Paint (Graphics);


    myColor = 0x00FFFFFF;
    _list. Invalidate();
    _list.setEmptyString ("* only supplies not available *", DrawStyle.HCENTER "");
    _list.setRowHeight (50);
    _list.setCallback (this);
    mainManager.add (subManager);
    listElements.removeAllElements ();
    _connectionthread = New Connection();
    _connectionthread. Start();

    protected boolean navigationClick (int status, int time)
    Here, go to another screen if you need.

    catch (System.Exception e)
    System.out.println ("Exception:-: navigationClick()" + try ());
    Returns true;

    private class login extends thread
    Public connection()

    public void run() {}
    Doc document;
    StreamConnection conn = null;
    InputStream is = null;
    try {}

    Conn = (StreamConnection) ("

    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance ();
    docBuilderFactory.setIgnoringElementContentWhitespace (true);
    docBuilderFactory.setCoalescing (true);
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder ();
    docBuilder.isValidating ();
    is = conn.openInputStream ();
    doc = docBuilder.parse (is);
    doc.getDocumentElement () .normalize ();
    List of NodeList = doc.getElementsByTagName ("ID");
    for (int i = 0; i)< list.getlength();="" i++)="">
    Node node = list.item (i) .getFirstChild ();
    listElements.addElement (textNode.getNodeValue ());
    } catch (Exception e) {}
    System.out.println (try ());
    } {Finally
    If (is! = null) {}
    try {is.close ();
    } catch (IOException ignored) {}
    } If (conn! = null) {}
    Try {conn.close () ;}
    catch (IOException ignored) {}
    }} UiApplication.getUiApplication () .invokeLater (new Runnable() {}
    public void run() {}
    _list. SetSize (listElements.Size ());
    subManager.add (_list);
    Screen.Invalidate ();


    ' public void drawListRow (list ListField, Graphics g, int index, int y, int w)
    Your string = (String) listElements.elementAt (index);
    int yPos = 0 + y;
    g.drawLine (0, yPos, w, yPos);
    g.drawText (, 5, 15 + y, 0, w);

    public {get {Object (ListField list, int index)
    Return listElements.elementAt (index);
    public int indexOfList (String prefix, ListField list, int, string)
    Return listElements.indexOf (prefix, string);
    public int getPreferredWidth (ListField list)
    Return Display.getWidth ();
    public final void insert (String toInsert, int index) {}
    listElements.addElement (toInsert);

    ' Public Sub fieldChanged (field field, int context) {}


    Thank you.

    I told you that replace the navigationclick() method where initialize you your listfield

    as I think that changing your code and then answer me

    _list = new ListField()
    protected boolean navigationClick(int status, int time)
      return true;
    public void paint(Graphics graphics)
    graphics.setColor((int) mycolor);
  • How to get the text of a SystemPrompt (Cascades)


    I've been struggling with this for a few hours now. I followed the example of "dialogues" on github, so I have successfully created a SystemPrompt (the dialog box that allows the user to enter text and accept / reject). Curiously, in this example there is no use of user text input. Do you know how to get the text in my QML? Here you have an example of code that I use:

    My QML:

    // Default empty project template
    import bb.cascades 1.0
    import bb.system 1.0
    // creates one page with a label
    NavigationPane {
        id: navigationPane
        Page {
            attachedObjects: [
                SystemPrompt {
                    id: prompt
                    title: qsTr("Enter a text for the label")
                    modality: SystemUiModality.Application
                    inputField.inputMode: SystemUiInputMode.Default
                    inputField.emptyText: "Label text..."
                    confirmButton.label: qsTr("Ok")
                    confirmButton.enabled: true
                    cancelButton.label: qsTr("Cancel")
                    cancelButton.enabled: true
                    onFinished: {
                        if (result == SystemUiResult.ConfirmButtonSelection) {
                            lab1.text = ????? // Here is where I don't know what to do
            Container {
                layout: StackLayout {}
                Label {
                            id: lab1              text: "Label text"
                    objectName: "lab1"
                    textStyle.base: SystemDefaults.TextStyles.TitleText
                    horizontalAlignment: HorizontalAlignment.Center
                Button {
                    text: "Update label"
                    horizontalAlignment: HorizontalAlignment.Center
                    topMargin: 150.0
                    onClicked: {

    Be sure to add this in your .cpp file or all of app:


    and don't forget to include them in your app .cpp file (probably not all are needed, but just in case I leave here for the moment):

    qmlRegisterType("bb.system", 1, 0, "SystemUiButton");
        qmlRegisterType("bb.system", 1, 0, "SystemUiInputField");
        qmlRegisterType("bb.system", 1, 0, "SystemToast");
        qmlRegisterType("bb.system", 1, 0, "SystemPrompt");
        qmlRegisterType("bb.system", 1, 0, "SystemCredentialsPrompt");
        qmlRegisterType("bb.system", 1, 0, "SystemDialog");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiError", "");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiResult", "");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiPosition", "");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiInputMode", "");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiModality", "");

    Thank you very much

    If you look very carefully by the docs, you'll trip over

    So, replace your? with inputFieldTextEntry() and you will get the text you need.

  • How to get the description of text box with some HTML &lt; P &gt; tag

    Hi friends,

    I created two point, an element of box P1_RICH_TEXT_FIELD rich text field and a text item field area P1_TEXT_AREA. I created the calculation process to copy the value of P1_RICH_TEXT_FIELD in P1_TEXT_AREA. Calculation works well but contect copy in P1_TEXT_AREA are

    < p >

    Test Test description description < /p >

    < p >

    Test DescritionTest DescritionTest description < /p >

    < p >

    Test DescritionTest DescritionTest description Test Test DescritionTest Test Test Test Descritionhkjhkh < /p > description description description description

    I need to copy with the tag < p >.

    How to get the description of text box with the HTML < P > tag

    Thank you

    Hi Alex,

    Thank you very much. You want very criticle problem for me. Thank you very much.

    Now, there are several tags in the rich text field

    "span, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, big, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, b, u, I, Center, dl, dt, dd, ol, ul, li, label, table, caption, tbody, tfoot, thead, tr, th, td" etc.

    How can I move all these in REGEXP_REPLACE (: P1_RICH_TEXT_FIELD, ')


    (", 1, 0, im ') code.

    Thank you

  • How to get the text block, given anchor (~ a)

    I need to dynamically position anchored with anchor text blocks (but the relative position will be different for each anchor). If I grep ~ i can get the anchor marker - how to get the text block once I got this marker?

    Thank you

    The marker "anchor" is a character of "simple".

    So you can do the following if you have identified the character (and in this example selected it):

    //Start with an "Anchor Marker" selected:
    var myCharacter = app.selection[0];
    if (myCharacter.texts[0].textFrames.length == 1){
    var myAnchoredTextFrame = myCharacter.texts[0].textFrames[0];
        //do something with the anchored text frame:
        myAnchoredTextFrame.fillColor = "Yellow";

    You can set the myCharacter variable differently, if you know the index of the character according to his history of parent.

    Or if you have found the character as part of a search GREP or TEXT by ExtendScript (JavaScript).


  • How to get the text of TextEditBox on Panel

    Hi all

    I would ask you, what should I use when I want to get the text of TextEditBox. I have the observer, who listens to the chages (when the user hits enter, the Update method of the observer is called). The only thing I don't know is how to get the text, which was placed in the text edit box. I know that this observer of the dialog box, GetTextControlData method, but I sign...


    Hi Ondrej

    You can get the text using the ITextControlData interface. Like this:

    InterfacePtr iCtrlView (this, UseDefaultIID());
    if(!iCtrlView) break; put some say message
    InterfacePtr iTextData (iCtrlView, UseDefaultIID());
    if(!iTextData) break; put some say message
    PMString theString = iTextData-> GetString()



  • How to get the smartlist for calcscript text


    How to get the smartlist for hyperion planning calcscript and calcscript tx example text


    Uka fp

    Published by: uka firman on November 25, 2010 10:35

    I think that ENUMTEXT is purely essbase and MDX to retrieve the value of text against the essbase text measures that are not the same as planning for the smart lists.

    See you soon


  • How to get the color of the text information in the text layer?

    How to get the color of the text information in the text layer?  I mean using scripts Photoshop, Version of Photoshop CS 8.0

    The color textItem is readable for me in VBS Note expects the activeLayer be a textLayer and displays the HexValue of the color of the text.

    Option Explicit
    Dim appRef
    Dim docRef
    Dim textItemRef
    Dim artLayerRef
    Dim textColor
    Set appRef = CreateObject( "Photoshop.Application" )
    Set docRef = appRef.ActiveDocument
    Set artLayerRef = docRef.ActiveLayer
    Set textItemRef = artLayerRef.TextItem
    Set textColor = textItemRef.Color
    MsgBox textColor.RGB.HexValue

    And returns the color of the text if the text is the same color. But if the text is more than a color textItem.color returns only the color of the first text range.

  • How to get the value of viewattribute and how to assign the text field. URG

    Hi all,
    I created messagestyled text programmatically and I want the value of viewAttribute.
    I don't know how to define the instance of the view and display attribute.

    I tried this way, it is what is called the vo class but after that i dnt know how to set

    Here the code that I used...

    (1) I create the messagestyled text
    OAFormattedTextBean cctextbean = (OAFormattedTextBean) pageContext.getWebBeanFactory () .createWebBean (pageContext, FORMATTED_TEXT_BEAN, OAWebBeanConstants.VARCHAR2_DATATYPE, "CCText");

    OAMessageStyledTextBean ccidbean = (OAMessageStyledTextBean) pageContext.getWebBeanFactory () .createWebBean (pageContext, MESSAGE_STYLED_TEXT_BEAN, OAWebBeanConstants.VARCHAR2_DATATYPE, "CCId");

    (2) and I called the view object
    OAViewObject ccview = (OAViewObject) AM.findViewObject ("CmpnyDetVO1");

    (3) I want to set the view instance and viewattribute using code. This stage i dnt know how to define.

    (4) I want to know, how to get the value of the attribute to display and how to set the value to the messagestyled text field.

    I'm new to OFA. It's Urgent.

    Thanks in advance


    Import oracle.jbo.Row;

    OAViewObject ccview = (OAViewObject) AM.findViewObject ("CmpnyDetVO1");
    Line line (Row) = ccview.first ();
    Test String = (String) row.getAttribute ("");

    then to set the value of the text of messagestyled

    OAMessageStyledTextBean bean = (OAMessageStyledTextBean) webBean.findindexedchildrecursive ("CCId");
    bean.setText (test);

    Thank you

    Published by: Gauravv on August 4, 2009 09:38

  • How to get the whole text of value special hashi


    can someone let me know how to get the full text of sql data hash_value in report statsapck...
    SQL> select SQL_TEXT from v$sql where HASH_VALUE=3102119461;



















    select sql_text
    from v$sqltext
    where hash_value='&hash_value'
    and address='&address'
    order by piece;

    Note: In 10g and more, you can use instead of HASH_VALUE SQL_ID and ADDRESS.

    Additonally, in 10g and above, you can also query V$ SQLSTATS where the text is stored in a CLOB called 'SQL_FULLTEXT', we must therefore DEFINE the LONG value when using SQLPlus.

Maybe you are looking for