How can I set the width of a Text element?

Hello! I have created a custom button with this class:
import javafx.scene.Node;
import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Cursor;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import javafx.scene.effect.DropShadow;
import javafx.scene.text.Text;
import javafx.scene.input.MouseEvent;
public class Button extends CustomNode {
    public var text: String;
    public var x: Integer = 0;
    public var y: Integer = 0;
    public var width: Integer = 90;
    var height: Integer = 25;
    override public function create(): Node {
        return Group {
            content: [
                Rectangle {
                    cursor: Cursor.HAND;
                    x: this.x;
                    y: this.y
                    width: this.width;
                    height: this.height;
                    arcWidth: 15;
                    arcHeight: 15;
                    effect: DropShadow {radius: 6};
                    fill: LinearGradient {
                        startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0
                        stops: [
                            Stop {offset: 0.0, color: Color.WHITE}
                            Stop {offset: 1.0, color: Color.LIGHTGRAY}
                    onMouseEntered: function(e: MouseEvent): Void {
                        (e.node as Rectangle).fill = LinearGradient {
                            startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0
                            stops: [
                                Stop {offset: 0.2, color: Color.WHITE}
                                Stop {offset: 1.0, color: Color.LIGHTGRAY}
                    onMouseExited: function(e: MouseEvent): Void {
                        (e.node as Rectangle).fill = LinearGradient {
                            startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0
                            stops: [
                                Stop {offset: 0.0, color: Color.WHITE}
                                Stop {offset: 1.0, color: Color.LIGHTGRAY}
                    onMousePressed: function(e: MouseEvent): Void {
                        (e.node as Rectangle).fill = LinearGradient {
                            startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0
                            stops: [
                                Stop {offset: 0.0, color: Color.LIGHTGRAY}
                                Stop {offset: 1.0, color: Color.WHITE}
                    onMouseReleased: function(e: MouseEvent): Void {
                        (e.node as Rectangle).fill = LinearGradient {
                            startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0
                            stops: [
                                Stop {offset: 0.0, color: Color.WHITE}
                                Stop {offset: 1.0, color: Color.LIGHTGRAY}
                Text {
                    x: this.x + 5, y: this.y + 16
                    content: this.text
}But, how can I set the Text element centered into the button?

Stack {
                    layoutInfo: LayoutInfo {
                        width: bind width;
                        height: bind height;
                    content: [Rectangle {
                            width: bind width, height: bind height
                            //fill: bind color;
                            fill: Color.GREEN
                            arcHeight: 20; arcWidth: 20;
                        Text {
                            font: Font {
                                size: 24
                            textAlignment: TextAlignment.CENTER;
                            wrappingWidth: width;
                            boundsType: TextBoundsType.VISUAL;
                            fill: Color.WHITE;
                            content: bind text;
                }wrappingWidth: Sets the maximun width of the text
boundsType: If you put the wrappingWidth var and you want to center a text you MUST set this var to VISUAL

Similar Messages

  • How can I get the content of a text element to insert in a different block

    I have two blocks. The first one (block_control) is a non based block with a text element (EXERCICE). When I go to the second block (block_data) and I want to insert a new record, I need in my record the value of EXERCICE who is in the first block (block_control). How can I get this balue if I want to be able to do an execute_query too on the second block ? Because if I use pre-block or post-block or when-new-record-instance trigger to make the content of EXERCICE follow from block_control to block_data in a hidden field, I can't execute_query.
    Thank's

    First , when you want to insert a record in the second block , override the default commit_form processing and create a commit-form trigger which is called by a button to commit your form. The when-button-pressed trigger of this button should be : do_key('commit_form'); . And you create the key-commit trigger on the second block. Inside the key-commit trigger write this :
    :second_block.item_name := name_in('block_control_name.exercice');
    commit_form;
    In this way you get the exercice data into your record.
    Secondly, in the post-query trigger of the second block, set the exercice column of the second block to the exercice column of the block_control.
    And that's it.

  • How can I set the tab order of text box controls on each page of a tab control?

    I need to be able to select the tabbing order of individual controls on a single page of a tabbed control. How??

    In LV 6.1 an up you should be ablel to right click on the edge of the tab control when the tab-page in question is selected.
    The bttom selcetion in the pop-up is "Reoder controls in page..."
    selecting this option will switch editing modes to allow you to specify the ored, just like in a cluster.
    I seem to remeber in older versions you had to drag the tabable controls off the tab control, specify the tabbing oder and then drag them back on. The oldest version I have on this machine is 6.1 so that all I can speak for at the moment.
    I hope this helps,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How can i set the column width in the jtable?

    how can i set the column width in the jtable?
    can anybody send me a simple example??

    TableColumn column = table.getColumnModel().getColumn( columnIndex );
    column.setWidth( desiredColumnWidth);
    column.setMinWidth( desiredMinColumnWidth);
    column.setMaxWidth( desiredMaxColumnWidth);

  • How can I set the size of an image in java?

    How can I set the size of an image in java? I have to choose the width and height of image...thanks to everybody...sorry for my english :-)

    Hi 43477
    Can you provide more details, do you want to setsize to display an image on a screen of when saving image etc?
    PS.
    There is a good invention called googlegoogle is good, but sometimes it's better to use more specific search, there is a search field avove on this page :)

  • How can we configure the width of the table in SAP DB

    Hello sirs,
    How can we configure the width of the table in SAP DB? (<b>i.e to specify the total width of the sum of all columns</b>). I need to change the default value of table width for adding fields with biggger sizes...
    With best regards,
    Sudheesh....

    Hi,
      The restrictions for using SAPDB are available at the following link http://dev.mysql.com/doc/maxdb/en/f6/069940ccd42a54e10000000a1550b0/content.htm
      The 'internal length of the table' is 8088 bytes, which intern maps to the column width attribute.
    Can we change the column width?
    The answer is 'NO'.
    check the general Column width error (-1115) at link below where it is specified that the column width can be altered http://dev.mysql.com/doc/maxdb/en/bb/57f18204fd11d2a96c00a0c9449261/content.htm
    Refer link below for more details on the width of each column (based on the datatype associated with the column). http://orgs.man.ac.uk/documentation/mysql/manual_Column_types.html
    So we will have to judiciously look into the boundary values for each column and set the right length because if the column is char(200) and it holds a null value then length allocated is 200 bytes.
    The restriction cannot be broken.
    Regards,
    S.Divakar

  • How can I set column width in JTable?

    How can I set column width in JTable?

    Also, read the JTable API before posting questions. You will find a link to the Swing tutorial on "How to Use Tables", which contains an example of doing exactly this.

  • How can i set the alternating colors for a table rows

    Dear All,
    Please any one help me how can i set the Alternating colors for Table Rows.
    i created a theam there i set the background alternating color to brown and i set the table design properity to alternating. but it is not reflecting.

    Hi,
    The design property in Table properties should work for your requirement. Select "alternating" value for design.
    Please see the API below:
    design
    Determines the appearance of the table. The property design can take the following values and is represented by enumeration type WDTableDesign.
    alternating - The table rows are displayed alternately in a different color.
    standard - The table background has one color. The individual table rows are displayed with grid net lines.
    transparent - The table background is transparent. The individual table rows are displayed without grid net lines.
    Check whether you have changed the right property or not? Also table should contain more than one rows to test this scenario.
    Regards,
    Jaya.
    Edited by: VJR on Jun 17, 2009 6:43 PM

  • How can I set the page that will open, when I open a new tab, to be the same as the homepage?

    How can I set the page that will open, when I open a new tab, to be the same as the homepage?
    An app changed it to some other search engine, before installing the app, I the tab that would open was the homepage I set.
    In my case it is Google, and I want my new tabs to open on Google like they did before the installation.
    thank you,
    Asaf Privman.

    You can middle-click or Ctrl left-click the Home button on the Navigation toolbar to open the Home page in a new tab.
    You can look at one of these extensions:
    * NewTabURL : https://addons.mozilla.org/firefox/addon/newtaburl/
    * New Tab Homepage : https://addons.mozilla.org/firefox/addon/new-tab-homepage/

  • Formatting issues: when I open a msg, the font is sooo small you need a magnifier to read it. How can I set the font size to one I can easily read?

    == Issue
    ==
    I have another kind of problem with Firefox
    == Description
    ==
    I have various formatting issues:
    a. When I open a msg from my web browser (Cablevision), the font is sooo small I need a magnifier to read it. How can I set the font to a size I can easily read?
    b. When I forward msgs, the text gets all distorted and I need to clean it up (some symbols, lots of spaces between words). How can this be fixed?
    c. When I want to tell someone about a website, I cannot type the URL in so that all they have to do is click on it. How can this be fixed?
    d. When I open messages, the text opens in a small window and covers the "Show Images" button. Why?
    == This happened
    ==
    Every time Firefox opened
    == Ever since I started using Firefox (a few months ago)
    ==
    '''Troubleshooting information'''
    I didn't find any results
    == Firefox version
    ==
    3.6.3
    == Operating system
    ==
    Windows 7
    == User Agent
    ==
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
    == Plugins installed
    ==
    *-nphpclipbook
    *Office Plugin for Netscape Navigator
    *The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
    *Default Plug-in
    *Adobe PDF Plug-In For Firefox and Netscape "9.3.2"
    *NPRuntime Script Plug-in Library for Java(TM) Deploy
    *The Hulu Desktop Plugin allows Hulu.com to integrate with the Hulu Desktop application.
    *Shockwave Flash 10.0 r45
    *Adobe Shockwave for Director Netscape plug-in, version 11.5
    *iTunes Detector Plug-in
    *3.0.40624.0
    *NPWLPG
    *Next Generation Java Plug-in 1.6.0_20 for Mozilla browsers

    The text editor is the text area that you use on the webmail (Yahoo, Hotmail) website to create a new mail.
    You can compare that with the ''Post new message'' text area that you use to create a new post on this forum.
    Just above the text area that you use to enter the message text there is usually a button bar with buttons that allows some text formatting like Bold and Italic and can also include a button to make a clickable hyperlink.
    Check the tooltip of each button by hovering with the mouse over each button.
    Make Link - https://addons.mozilla.org/firefox/addon/142

  • How can I set the language when sending an e-mail with attachment - 'Html'?

    "Character Broken"
    I made an ALV program, and this convert to "HTML',  and send an e-mail with this.
    Used Process is:
    DATA: gt_abaplist LIKE TABLE OF abaplist,
          gt_html LIKE TABLE OF w3html,
          doc_chng LIKE sodocchgi1,
          objpack LIKE TABLE OF sopcklsti1 WITH HEADER LINE,
          objhead LIKE TABLE OF solisti1 WITH HEADER LINE,
          mail LIKE TABLE OF solisti1 WITH HEADER LINE,
          reclist LIKE TABLE OF somlreci1 WITH HEADER LINE,
          lv_line TYPE i.
    DELETE FROM MEMORY ID '%_LIST'.
    SUBMIT z_template
       AND RETURN EXPORTING LIST TO MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = gt_abaplist
      EXCEPTIONS
        not_found  = 1
        OTHERS     = 2.
    CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
      TABLES
        html       = gt_html
        listobject = gt_abaplist.
    doc_chng-obj_name   = 'URGENT'.
    doc_chng-sensitivty = 'O'.
    doc_chng-obj_descr  = ' '.
    doc_chng-obj_langu  = '3'.
    objhead-line        = ' '.
    APPEND objhead.
    mail[] = gt_html[].
    DESCRIBE TABLE mail LINES lv_line.
    CLEAR: objpack.
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = lv_line.
    objpack-doc_type   = 'htm'.
    objpack-obj_descr  = ' '. 
    objpack-doc_size   = lv_line * 255.
    objpack-obj_langu = '3'.
    APPEND objpack.
    CLEAR: reclist.
    reclist-receiver = 'e-mail address'.
    reclist-rec_type = 'U'.
    APPEND reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng 
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list               = objpack
        object_header              = objhead
        contents_bin               = mail
        receivers                  = reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        document_type_not_exist    = 3
        operation_no_authorization = 4
        parameter_error            = 5
        x_error                    = 6
        enqueue_error              = 7
        OTHERS                     = 8.
    SUBMIT rsconn01 AND RETURN.
    I want to show  this by "Japanese".
    But the character is broken.
    LIke This:
    u01D1u072C          u0205|            u0205u072C          u0508           QC u04B90m
    How can I set the language?  How can I solve "Charancter Broken" ?
    Plesse, let me know.
    Thank you so much.
    Edited by: Jaime White 999 on Nov 21, 2011 8:45 AM
    Edited by: Jaime White 999 on Nov 21, 2011 8:46 AM

    Hi Jaime,
    Are you saying, you are getting junk characters in the email attachment? Then pls check the following. Since you want to send Japanese fonts, please pass language 'J' in both  objpack-obj_langu = '3' & doc_chng-obj_langu  = '3' instead of '3' please replace it with 'J'.
    Another thing which you may have to check is the SCOT device type. As I understand from my basis colleague, this may also affect your attachment fonts since the emails are sent through SCOT. Go to transaction SCOT-> Settings-> Device types for format conversion. Check whether wrong device type is defined for Japanese there. Hope this helps
    Regards,
    Gokul

  • How can I set the data binding between Web Dynpro & Database table

    Dear friend,
    I am a beginner of Web Dynpro. I want to develop my simple project like these:
    1. Create my own database table via Dictionary Project such as TAB_USER and have 3 fields: USER_ID, USER_NAME, USER_POSITION and I have already deployed & archived it.
    2. Create my own Web Dynpro Project, and create the input fields as User ID, User name, User position and icon 'Save' on the selection screen and I have deployed it already.
    For the process, I want to input data at the screen and save the data in the table, please give me the guide line like these:
    1. How can I set the data binding between Web Dynpro and Database table ?
    2.  Are there any nescessary steps that I will concern for this case?
    Sorry if my question is simple, I had try  to find solution myself, but it not found
    Thanks in advances,
    SeMs

    Hi,
    You can write your own connection class for establishing the connection with DB.
    Ex:
    public class  ConnectionClass {
    static Connection con = null;
    public static Connection getConnection() {
    try{
    Context ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("jdbc/TSPAGE");
    con = ds.getConnection();
    return con;
    }catch(Exception e){
    return null;
    You can place the above class file in src folder and you can use this class in webdynpro.
    You can have another UserInfo class for reading and writing the data into the DB .
    Regards, Anilkumar
    PS : Refer
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/simple java bean generator for database.pdf
    Message was edited by: Anilkumar Vippagunta

  • In EIC, how can we set the SLA of a subcategory to none SLA-related.

    Hi Experts,
    This is our current setup in EIC...
    Category 0501 has an SLA of 8 hours. Subcategory 050101 has to be none SLA relevant. But if we put zero or blank to the SLA Target Value field, it will automatically have a due date defaulted to today. If we will not indicate 050101 on the configuration, it will have the 0501 SLA of 8 hours.
    How can we set the 050101 SLA off?
    The path: IMG --> Personnel Management --> Employee Interaction Center (EIC) --> Interaction Center Web-Client --> Application Functions --> Activity --> Service Level Agreement (SLA) --> Define SLV Properties
    Thanks in advance.

    Hi Harish and Jarret.
    @Harish, I already tried unchecking the checkbox of the Display field but the problem with this is, it will also apply for the rest of the categories. It should only be for this specific subcategory.
    @Jarret, apology, but can you explain to me further about your instruction/advise? I get the feeling that we're on to something with your advise but I didn't quite get it on how to exactly.
    1. You should build the SLA from the lowest level up...
                        -I'm not really sure how, actually.
    2. If you have 8 subcats... will put the 8 entries in the table...
                        -where do I put the 1 subcat? This is because if I don't put that "No SLA" subcat in the table, the due date of that specific subcat will automatically appear todayu2019s date.
    Thanks for both of you. I really appreciate your help. 

  • How can I set the insert date to auto update in Pages 5.2.2

    how can I set the insert date to auto update in Pages 5.2.2
    I am attempting to have the date in header auto update in a Pages file.
    I can insert it, but where is the AUTO UPDATE selection
    OS10.9.4
    thank you

    Apple never included the auto-update feature for dates in Pages v5.2.2. You would have to single-click the date, and deliberately update it.
    If you have Pages ’09 v4.3 in /Applications/iWork '09, then it will allow you to configure auto-update of the date field. Right-click on the date, set the format, and click the selection for automatically update on open.

  • How can I set the order of search engines on my Macbook?

    When I use "Manage Search Engines" to rearrange the order of my search engines, the order changes temporarily, only to revert to the order the search engine add-ons were installed, the next time Firefox is restarted. How can I set the hierarchy of search engines to suit my preference, and have it stay that way?

    It may be your preferences problem.
    Try to Reset your firefox and try it newly
    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

Maybe you are looking for