ALIGNING LABEL TEXT

Hi people, could I please get a hand I am stuck. I need to center the text of label in my gui. What does the method setHorizontalAlignment(int Alignment) mean??? How do I incorporate it into my program? The JAVA Api is difficult to understand.
Your java pal

if the Java API is difficult to understand for you, my advice is
1.) Stop coding ...
2.) Go to the "New to Java" forum
3.) Do more testing

Similar Messages

  • How to align label text to the left in Spark Button (no "textAlign" style)?

    Hi all,
    "textAlign" style is excluded for Spark Button, and probably for a good reason.
    [Exclude(name="textAlign", kind="style")]
      If I want to align Spark Button text label to the left, should I create custom skin to accomplish that?
    Something e.g:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:mx="library://ns.adobe.com/flex/mx"
            minWidth="21" minHeight="21"
            alpha.disabled="0.5">
    <s:Label
            id="labelDisplay"       
            textAlign="left"               
            left="2" right="2" top="2" bottom="2"/>
    </s:Skin>

        Right, I though about this approach vith setStyle too, but this is not that convenient.
        I looked into source code and find out that spark.components.Button class adds to the spark.components.supportClasses.ButtonBase only one public property "emphasized".
      Because I do not need this property in my project, I've extended my custom LinkButton component from ButtonBase to allow setting "textAlign" style in MXML for this component.
    import spark.components.supportClasses.ButtonBase;
    public class LinkButton extends ButtonBase {
       Also,  inside custom Skin from my Button component I do not set explicitly "textAlign" style value to the button label, I let button label to inherit style value specified in MXML for the style textAlign of my ListButton component.
    <s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            minWidth="21" minHeight="21"
            alpha.disabled="0.5">       
        <fx:Metadata>
            [HostComponent("component.LinkButton")]
        </fx:Metadata>   
    <s:Label
            id="labelDisplay"
            textDecoration="underline"
            maxDisplayedLines="1"
            verticalAlign="middle"
            color="{getStyle('color')}"
            color.over="{getStyle('textRollOverColor')}"       
            color.down="{getStyle('textSelectedColor')}"       
            left="10" right="10" top="2" bottom="2"/>
    </s:Skin>

  • Flahs CS3 Datagrid Dynamically align Header Text

    Hello!
    I am getting problem with Flash CS3 Datagrid. I am not able to align Header Text dynamically. Can any one sujest How to set Text Alignment dynamically. I want align first header column Text "left align" and rest of the columns Text are "right align".
    My code as bellow but it is not working
    .as code
    package {
        import fl.controls.dataGridClasses.HeaderRenderer;
        import flash.text.TextFormat;
        public class headerRender extends HeaderRenderer {
            public var headerTxt :TextFormat;
            public function headerRender()
                //this.super();       
                headerTxt = new TextFormat();
                headerTxt.font =  "Verdana";
                headerTxt.color = 0x000000;
                headerTxt.align = "right";
                headerTxt.size = 11;
                setStyle("textFormat", headerTxt);
    FLA code
    import fl.controls.DataGrid;
    import MyCellRenderer;
    import fl.data.DataProvider;
    import fl.managers.StyleManager
    import fl.controls.dataGridClasses.DataGridColumn;
    var dp:DataProvider = new DataProvider();
    dp.addItem({label:"Item a", data:0});
    dp.addItem({label:"Item b", data:1});
    dp.addItem({label:"Item c", data:2});
    dp.addItem({label:"Item d", data:3});
    dp.addItem({label:"Item e", data:4});
    dp.addItem({label:"Item f", data:5});
    dp.addItem({label:"Item g", data:6});
    dp.addItem({label:"Item h", data:7});
    dp.addItem({label:"Item i", data:8});
    dp.addItem({label:"Item j", data:9});
    var myDataGrid:DataGrid = new DataGrid();
    myDataGrid.addColumn("label");
    myDataGrid.addColumn("data");
    myDataGrid.dataProvider = dp;
    myDataGrid.width = 200;
    myDataGrid.rowCount = dp.length;
    myDataGrid.move(10, 10);
    addChild(myDataGrid);
    //set second header colum right align
    myDataGrid.getColumnAt(1).headerRenderer = headerRenders;
    Please let me know where I am wrong
    Mandar Mukadam
    Sr. Multimedia Developer

    This forum is about the Cloud as a delivery process, not about using individual programs
    If you start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • JLabel: How to Left Align the text

    Hi.
    I created a JLabel and wanted to left align the text. However, the text is always centered in the frame that contains it. Can you tell me what I need to add to the code?
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Frame.*;
    public class S extends JFrame
         public S()
              setSize(300, 300);
              setTitle("Title Bar");
              setResizable(false);          
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JLabel label = new JLabel("A label", JLabel.LEFT);
              label.setHorizontalAlignment(JLabel.LEFT);           
              label.setToolTipText("Should be left aligned");
              JPanel pane = new JPanel();          
              pane.add(label);
              setContentPane(pane);     
         public static void main(String[] args)
              S f = new S();
              f.show();     
    }Thanks
    Raja

    Read this section from the Swing tutorial on "Using Layout Managers":
    http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html
    Layout Managers layout the components based on rules for each layout manager.
    By default a JPanel uses a FlowLayout. By default FlowLayout aligns components in the center of the space allocated to it. In your case you allocated 300 to the width of the frame, therefore the panel has a width of 300, therefore the label is centered in the 300 pixels.

  • Align labels of the category axis (Y)

    Hi. How can I align labels of the category axis (Y) to the left?
    I suppose, it is aligned to the right, take a look on the picture. Thank you

    Badunit,
    The only way I have found to get the labels to wrap at all is to create the chart in Pages and insert Line Breaks into the Chart Table Label field. I'd be surprised if that Chart began its life in Numbers and I have to idea how to change the justification of the labels. The justification controls are grayed out in Pages when editing the chart data.
    Your suggestion of making labels in a table or text box is the only practical solution I can imagine.
    Jerry

  • How can i  change the column label text in a alv table display

    how can i change the column label text in a alv table display??
    A similar kinda of question was posted previuosly where the requirement was the label text was needed and following below code was given as solution :
    <i>*  declare column, settings, header object
    DATA: lr_column TYPE REF TO cl_salv_wd_column.
    DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    DATA: lr_column_header type ref to CL_SALV_WD_COLUMN_HEADER.
    get column by specifying column name.
    lr_column = lr_column_settings->get_column( 'COLUMN_NAME1' ).
    set Header Text as null
    lr_column_header = lr_column->get_header( ).
    lr_column_header->set_text( ' ' ).</i>
    My specific requirement is i have an input field on the screen and i want reflect that value as the column label for one of the column in the alv table. I have used he above code with slight modification in the MODIFYVIEW method of the view since it is a process after input. The component gets activated without any errors but while run time i get an error stating
    <i>"The following error text was processed in the system CDV : Access via 'NULL' object reference not possible."</i>
    i have checked in debugging and the error occured at the statement :
    <i>lr_column = lr_column_settings->get_column( 'CURRENT_YEAR' ).</i>Please can you provide me an alternative for my requirement or correct me if i have done it wrong.
    Thanks,
    Suri

    I found it myself how to do it. The error says that it is not able to find the reference object i.e  it is asking us to refer to the table. The following piece of code will solve this problem. Have to implement this in WDDOMODIFYVIEW method of the view. This thing works comrades enjoy...
      DATA : lr_cmp_usage TYPE REF TO if_wd_component_usage,
             lr_if_controller  TYPE REF TO iwci_salv_wd_table,
             lr_cmdl   TYPE REF TO cl_salv_wd_config_table,
             lr_col    TYPE REF TO cl_salv_wd_column.
      DATA : node_year  TYPE REF TO if_wd_context_node,
             elem_year  TYPE REF TO if_wd_context_element,
             stru_year  TYPE if_alv_layout=>element_importing,
             item_year  LIKE stru_year-i_current_year,
             lf_string    TYPE char(x),
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      DATA: lr_column_header TYPE REF TO cl_salv_wd_column_header.
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    Get the entered value from the input field of the screen
    node_year  = wd_context->get_child_node( name = 'IMPORTING_NODE' ).
    elem_year  = node_year->get_element( ).
      elem_year->get_attribute(
       EXPORTING
        name = 'IMPORT_NODE-PARAMETER'
       IMPORTING
        value = L_IMPORT_PARAM ).
      WRITE L_IMPORT_PARAM TO lf_string.
    Get the reference of the table
      lr_cmp_usage  =  wd_this->wd_cpuse_alv( ).
      IF lr_cmp_usage->has_active_component( ) IS INITIAL.
        lr_cmp_usage->create_component( ).
      ENDIF.
      lr_if_controller  = wd_this->wd_cpifc_alv( ).
      lr_column_settings = lr_if_controller->get_model( ).
    get column by specifying column name.
      IF lr_column_settings IS BOUND.
        lr_column = lr_column_settings->get_column( 'COLUMN_NAME').
    set Header Text as null
        lr_column_header = lr_column->get_header( ).
        lr_column_header->set_text( lf_string ).
    endif.

  • How can I align a text object by the visible text and NOT by its bounding box?

    Illustrator CS4.
    I am trying to align some text to the center of the artboard. The bounding box is bigger than the text, so when I try to align it to the artboard it doesn't actually center align the artwork as I need it to. The text is needing to be aligned with another text object, so I can't just center align the text and then align to the artboard (which would eliminate the bounding box problem, I think). To make matters worse, the text I want to align has a stroke.
    The only way I know to currently align the text properly is to convert it to outlines. This is what I've done, but I need something better. I want to be able to have my illustrator file that has all editable text and then be able to make a separate identical file with all text converted to outlined paths. The only thing holding me back right now is that I can't get the exact alignment while everything is still as text.

    The solution is to simple to believe and probably why you over looked it.
    You make two text frames to exactly the height and width of the text. You position the text in the relative location and then group the text frames  then center that group on the artboard.
    Like such:
    If you ever want to add text that should be no problem but you have to re center.

  • How to change a labels text which created at runtime?

    hi,
    i am creating label controls in runtime dynamically and adding them to a group component. this group component is in another custom component and i have lots of custom comp. in my app.
    my question is how can access (via id) and change a labels text whict created at runtime?
    i can change like this but i am setting id's and want to reach via id.
    var lbl:mx.controls.Label = mx.controls.Label(subMenu5.group_subMenu5.getElementAt(1));
    lbl.text = "good job";
    thank you, have a good day.

    First off, if you are already using a Spark Group, I would suggest you use a Spark Label instead of an MX Label. If you want to reference the Labels from the group, loop through the group's elements and check the if the element id matches the Label you want to assign text to.
    var lbl:Label;
    var n:int = myGroup.numElements;
    for (var i:int = 0; i < n; i++)
         lbl = myGroup.getElementAt(i) as Label;
         if (lbl && lbl.id == "myLabel")
              lbl.text = "newText";

  • How to create label & text items in a page dynamicly(TOP URGENT)

    Dear all;
    did any1 tried before to create a PLSQL which can create labels or text items?!! i have a page which i want to create labels according to the count of rows in the Database table?
    Regards;

    I would first try creating an 'On Load - Before Header' PL/SQL Computation to count the rows, and store the result in a hidden page/application item, e.g. P120_ROW_COUNT.
    Then in the label of the item, put &P120_ROW_COUNT. as the Label Text.
    I haven't tested it - but it should work.

  • How to change the field label text in standard WD application

    Hello All,
    I have a requirement to change the filed label text in standard WebDynpro  application.
    Application Name: /SAPSRM/WDC_UI_DO_BIDDER
    View: V_DO_BIDDER_SEARCH_C
    I want to change the label text from "Last Name" to "Vendor Name".
    Can anyone please provide me the possible options to change label text?
    Thanks in Advance.
    Regards,
    Shyam

    Thread closed...Found the solution ... 

  • Can't change the label text for the first time of  loading

    I have some problem to change the label text in the prerender method.
    I put a label on the form and set the text value to "Customer" on the text properities , and I would like to change the lable text to "Supplier" in the prerender method, I found some strange behaviour.
    If I type nothing on the label text of the properties , I can change the lable text on the prerender method on the first time of the form load .
    If I put something on the label text of the properties , the text label can't be changed on the first time of form loaded, the lable can be changed if I refresh the form or reload the form.
    Could anyone help me to solve this kinds of problem ?
    Thanks

    This is a tough one to explain. Here is one explanation from the Delving Into Components tutorial:
    As with the JavaServer Pages implementation, when the server constructs a page from JSP source, the tag attribute settings in the JSP source take precedence over runtime settings. For example, if you set the text property for a Static Text component to "moon," the IDE adds text="moon" to the Static Text component's tag in the JSP file. Even if the page's prerender method has a staticText1.setText("sun") statement, the Static Text component shows "moon" when the application renders the page. If the page is rerendered, the staticText1.setText("sun") statement takes affect and the Static Text component shows "sun." If you visit another page and come back, the server once again constructs the page from the JSP source, the values set in the JSP tag attributes take precedence, and the page displays "moon."

  • How to show mandatory icon after the Label text?

    Hi ,
    I am using JDeveloper 11.1.1.4.
    My Scenario is I have  <af:inputtext>  with Property required="true".
    Label look like ,
    "*Name but I want to show like Name* .I want to show the * icon after the label text .
    How to achieve this in ADF ? ..
    Thanks ...

    Hi rfh,
    Thanks for the updates ,
    I tried with ,
    .AFRequiredIconStyle
      float:right;
    this CSS moving the * icon to right side but not after the label ,It's moveing infront of the InputText Value the output looks like,
    Label   *Value
    I tried with ,
    AFRequiredIcon:alias
        content:inhibit;
    It's diabled * icon entire application .This solution is ok ...But I want to diable * icon for only particular places.
    How to hide * icon for particular fields ? ......
    Thanks......

  • Alignment of text in textField

    hi
    how to change the alignment of text when typing in textField ?

    I don't think JavaFX support right to left oriented languages like Arabic (I think support is scheduled for JavaFX 3.0).

  • Af:query how to control the query combobox and change it's label text

    My colleague designed a well working af:query search page with several selectable predefined queries. Now it's up to me to control this combobox from outside the component with big colored buttons for user convenience. If the user clicks on one of the big buttons, the assigned item of the combobox is selected and then the query is submitted.
    I though about doing this with javascript, but the difficulty is, that I have no idea and didn't find a way to reference the id of the combobox? The combobox is a 'built in' component in he af:query component and there is no way to give it an id in the properties.
    The second problem is that I didn't find a way to change the label text of the combobox. It seems to be hard coded?
    Thanks in advance for your suggestion!

    Hi,
    the text should be coming from a message bundle and some other look and feel related elements should be settable through skinning in CSS
    http://www.oracle.com/technology/products/adf/adffaces/11/doc/skin-selectors.html
    search for af|query
    Regarding the JavaScript access, use firebug JS debugger. The af query class is AdfRichQuery.js
    http://www.oracle.com/technology/products/adf/adffaces/11/doc/multiproject/adf-richclient-api/js_docs_out/AdfRichQuery.html
    Note however that you should be able to do in Java what you are aimning for in JavaScript. However the usecase you want to implement is not fully clear to me - to be honest
    Frank

  • How to align the text in justify format with SQL Server Reporting Services?

            How to align the text in justify format In SQL server Reporting Services? Is there any code to do so?

    Hi,
    I'm afraid that if you want to have this kind of functionality, you will need to write a custom control. Here is an example: http://msdn2.microsoft.com/en-us/library/ms345265.aspx. The issue with custom controls is that it needs to be known by all the reportservers that will render your report.
    Greetz,
    Geert
    Geert Verhoeven
    Consultant @ Ausy Belgium
    My Personal Blog

Maybe you are looking for

  • Big screen TV leaning forward on table bracket

    My son bought a 70' screen TV and mounted on table bracket. however it leans forward like = / instead of straight like = |. is it mounted incorrectly?

  • Adobe Flash Play won't install update!!!!!

    In the past I have used Adobe Flash Player with not problem on my MacBook Air using OX 10.7.5, but recently, various Websites tell me I must update my version, but when I try to update I get this... Adobe Flash Player could not be installed. You can

  • Capture sharpening ?

    I am going to try using ACR for capture sharpening with a 1dsMkIII after regularly using PS. Does anyone have a any recommendations for initial settings to start with for this camera? And, possibly for several shooting situations ie. landscape, fine

  • Desktop touch?

    Does Photoshop CC work as a touch application on a Windows 8 desktop with a 27" screen?

  • HOW DO I GET RID OF FIRE FOX X-MARKS TOTALLY

    HOW IN THE HELL DO I GET RID OF FIRE FOX X-MARKS OR DO I HAVE TO REMOVE FIRE FOX FROM MY PC. WHEN I START I GET A FIRE FOX LOGIN POP UP THEN MY PC LOCKS UP REALLY GETTING SICK AND TIRED OF IT. THEN I HAVE TO SHUT DOWN PC TO CONTINUE