Right aligning a label in a jpanel

Hey not quite sure how to do this.
public MenuApp()
super("Hello World!");
setSize(400, 300);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
          Container cp = getContentPane();
          JMenu mnuFile = new JMenu("File");
          mnuFile.add(f_milFF);
          mnuFile.add(f_misTF);
mnuFile.addSeparator();
mnuFile.add(f_miExit);
          JMenu mnuEdit = new JMenu("Edit");
          mnuEdit.add(f_misNS);
          mnuEdit.addSeparator();
          mnuEdit.add(f_miclear);
JMenuBar mb = new JMenuBar();
mb.add(mnuFile);
          mb.add(mnuEdit);
setJMenuBar(mb);
          JPanel pan = new JPanel();
          pan.setLayout(new GridLayout(1,2));
          pan.add(f_lblNumberOfStudents);                    JScrollPane lstScroll = new JScrollPane(f_lstStudents);
          lstScroll.setBorder(BorderFactory.createEtchedBorder());
          cp.setLayout(new BorderLayout());
get this in mid cp.add(pan, BorderLayout.SOUTH);

i assume you need help with JLabel alone
JLabel f_lblNumberOfStudents;
f_lblNumberOfStudents = new JLabel("Align test",JLabel.RIGHT);
pan.add(f_lblNumberOfStudents);
By the way i just had a big naming convention guideline...
http://forum.java.sun.com/thread.jsp?forum=54&thread=459121&start=15&range=15&hilite=false&q=

Similar Messages

  • How to right align s:Label inside a s:controlBarContent ?

    My spark app has a control bar at the top and i want to right-align a label inside it so my button bar is on the left and my label is on the right. I tried using the 'horizontalAlign="right"' which works find inside a s:panel but not inside a s:controlBarContent. Does anyone have any idea how to achieve this please? Also, the flash builder 4 ide won't let you move the label over in design mode either...
    Thanks for your help,
    Regards,
    Mark.

    I figured it out myself. I added an s:Hgroup around my label and set width="100%" and horizontalAlign="right" you need to set the width to 100% otherwise you're just right aligning within the actual width of the component (which is pretty useless eh?).
    I hope this helps someone else too.
    Regards,
    Mark.

  • FPM_LIST_UIBB labels coming Right Aligned even if -WDSTYLE_LABELALIGNMENT is set Left

    Hi All,
    The label of the overview page created for the service created using - FPM_LIST_UIBB is coming as Right aligned. I have set the Application Parameter - WDSTYLE_LABELALIGNMENT = LEFT . The Label have become left aligned for Detail page which are of type FPM_FORM_UIBB.
    Any suggestion how to make the label left aligned .
    Thanks,
    Amol

    Your business requirement is to make fields shown in overview screen(FPM_LIST_UIBB) to be left aligned. In general, if we maintain WDSTYLE_LABELALIGNMENT=LEFT while launching HRESS_AC_PERSINFO application configuration then fields in detail screen(FPM_FORM_UIBB) maintained for FPM_FORM_UIBB becomes left aligned. In application HRESS_AC_PERSINFO for overview screen, we are using following : Component: FPM_LIST_UIBB Rendering style:Row Repeater When the fpm_list_uibb is rendered in mode "Rendering style:Row Repeater" then the UI elements are fixed and the layout cannot be influenced. We are aware of this restriction. Therefore there is a new fpm guibb in order to display a row repeater. The name of it is FPM_FORM_REPEATER_UIBB, but it is available only starting with sap_basis, 7.31, sp5.

  • Tabs Won't Work Right Aligned JPanel

    Hello
    I'm tring to setup a JPanel using a style object for formating, JPanel.setLogicalStyle(styleimade);, and I haver everything working beautifuly for a left alligned panel, but when I attempt to work with tabs on a panel that is right aligned, StyleConstants.setAlignment(styleimade, ALIGN_RIGHT), I can't seem to get tabs to work at all. Using StyleConstants.setTabSet(styleimade, atabsetimade) to set the tabs. When I make my tabset it doesn't matter what I have my tabstops set to the indention doesn't change. When I set the alignment back to left, the tabs start to work.
    When I try to do a search on documentation I naturally get a huge list of tabpanels, and can't seeem to find anything on this particular subject.
    Any suggestions or links to other forums would be a huge help.
    Thank you in advance!

    Ok, I had thought it meant I need to be able to compile and execture the code.
    Here it is...
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import java.lang.Object.*;
    import java.util.*;
    //enxtends JFrame because it is a window, Implements KeyListener, ActionListener
    //so it can accept keyed input.
    public class testGUI extends JFrame {
        //stores the device that this window is using to display itself.
        GraphicsDevice device;
        //both are used to store the height and width of the screen
        int ScreenHeight;
        int ScreenWidth;
        //create a bool to hold if the screen should be fullscreen or not
        boolean fullscreen = true;
        //create colors to hold default colors
        Color Blue;
        Color Orange;
        Color Black;
        //create text panels that will be displayed on the screen
        JTextPane TopLeft;
        StyledDocument DocTopLeft;
        //pass a graphics device so it knows which screen to take, the number of the
        //current display so it knows what to name the window, the height of the
        //current screen, and width so it can use that to set objects
        public testGUI(GraphicsDevice device, String NumberOfDisplay,
                              int WindowHeight, int WindowWidth) {
            //set the name and size of the screen.
            super("Screen " + NumberOfDisplay);
         setSize(800,600);
            //set the screenheight and width data types
            ScreenHeight = WindowHeight;
            ScreenWidth = WindowWidth;
            //start up everything is Design view
            //initComponents();
            //set the screen up
            setScreen();
            //setLocationRelativeTo nothing so the screen will center
         setLocationRelativeTo(null);
            //set the device for this window to the device passed to the class
            this.device = device;
            //when a close is initiated, exit
         setDefaultCloseOperation(EXIT_ON_CLOSE);    
            //as default show the screen
            setVisible(true);
        }//end default constructor
        public void setScreen() {
            //What happens when the X is clicked
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            //set the colors for this window
            Blue = new Color(0, 0, 204);
            Orange = new Color(244, 143, 0);
            Black = new Color(0, 0, 0);
            //change backgruond color of screen
            this.setBackground(Orange);
            this.getContentPane().setBackground(Orange);
    //....................................................Settings for TopLeft Pane
            //create the setup the panel
            TopLeft = new JTextPane();
            TopLeft.setEditable(false);
            TopLeft.setFocusable(false);
            TopLeft.setBackground(Orange);
            TopLeft.setPreferredSize(new java.awt.Dimension(((int) (ScreenWidth * .6)), ((int) (ScreenHeight * .6))));
            TopLeft.setDisabledTextColor(Black);
            //set Document to TopLeft
            DocTopLeft = TopLeft.getStyledDocument();
            //Create a list to hold tabstops
            java.util.List TabListLeft = new ArrayList();
            //create a tabstop, using the screen as a reference
            TabStop tstop = new TabStop(((int) (ScreenWidth * .25)), TabStop.ALIGN_CENTER, TabStop.LEAD_NONE);
            TabListLeft.add(tstop);
            //create another tab stop
            tstop = new TabStop(((int) (ScreenWidth * .33)), TabStop.ALIGN_CENTER, TabStop.LEAD_NONE);
            TabListLeft.add(tstop);
            //creating tab stop
            tstop = new TabStop(((int) (ScreenWidth * .41)), TabStop.ALIGN_CENTER, TabStop.LEAD_NONE);
            TabListLeft.add(tstop);
            //create a tab
            tstop = new TabStop(((int) (ScreenWidth * .49)), TabStop.ALIGN_CENTER, TabStop.LEAD_NONE);
            TabListLeft.add(tstop);       
            // Create a tab set from the tab stops that were made above
            TabStop[] TabStopsLeft = (TabStop[])TabListLeft.toArray(new TabStop[0]);
            TabSet TabsLeft = new TabSet(TabStopsLeft);
            // Add the tab set to the logical style;
            // the logical style is inherited by all paragraphs
            Style StyleTopLeft = TopLeft.getLogicalStyle();
            StyleConstants.setAlignment(StyleTopLeft, StyleConstants.ALIGN_RIGHT);
            StyleConstants.setTabSet(StyleTopLeft, TabsLeft);
            TopLeft.setLogicalStyle(StyleTopLeft);
            //add styles to document, in this case, it is just fonts formating
            addStylesToDocument(DocTopLeft);
            //insert text into the JPanels
            try{
                    //start with text pane at top left
                    DocTopLeft.insertString(TopLeft.getCaretPosition(), "Test", DocTopLeft.getStyle("titles"));
                    DocTopLeft.insertString(TopLeft.getCaretPosition(), ("\n\t" + "test\ttest\ttest"), DocTopLeft.getStyle("maintext"));
                    DocTopLeft.insertString(TopLeft.getCaretPosition(), "\n Test", DocTopLeft.getStyle("subtitles"));
                    DocTopLeft.insertString(TopLeft.getCaretPosition(), ("\t" + "test\ttest"), DocTopLeft.getStyle("maintext"));
                    }//end of try block for string insertion
            //I know I'm cheap there is no exception catch here
            //but the user doesn't edit anything so how can it be at the wrong location?!
            catch(Exception e) { }       
            //Make a layout that is based on things added to it
            GroupLayout layout = new GroupLayout(getContentPane());
            //set the layout for MenuDisplayGUI to the layout created above
            getContentPane().setLayout(layout);
            //Left and right                                    left and right
            layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(layout.createParallelGroup()
                    //create a sequential group that will hold all text boxes
                    .addGroup(layout.createSequentialGroup()
                        //create a paralle group to hold everyting on the left
                        .addGroup(layout.createParallelGroup()
                            .addComponent(TopLeft)
                            )//end of parallel group holding everything on left of screen
                        //.addContainerGap(1, Short.MAX_VALUE)
                    )//end of parallel group holding everything horizontally
            ));//close of layout.setHorizontalGroup
            //UP AND DOWN!!!                                      UP AND DOWN
            layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    //create a sequential group to contain the items vertically
                    .addGroup(layout.createSequentialGroup() 
                        //create a paralle group to hold the items at the top of the screen
                        .addGroup(layout.createParallelGroup()
                            //add the item at the top left
                            .addComponent(TopLeft)
                            )//end of parallel group holding the two top items
                            //.addContainerGap(1, Short.MAX_VALUE)
                        )//end of sequential group holding everything vertically
            );//close of setVerticalGroup
            pack();
        }//end member function setScreen
        protected void addStylesToDocument(StyledDocument doc) {
            //create the defualt style that all other styles will build off of
            Style def = StyleContext.getDefaultStyleContext().
                            getStyle(StyleContext.DEFAULT_STYLE);
            //create the baseline for your style type
            Style regular = doc.addStyle("regular", def);
            StyleConstants.setFontFamily(def, "Sans");
            StyleConstants.setBold(def, true);
            //create a style used for titles, set the font
            Style titles = doc.addStyle("titles", regular);
            StyleConstants.setFontSize(titles, ((int) (ScreenWidth * .05)));
            StyleConstants.setForeground(titles, Blue);
            //create a style for subtitles
            Style subtitles = doc.addStyle("subtitles", regular);
            StyleConstants.setFontSize(subtitles, ((int) (ScreenWidth * .025)));
            //create a style for all of the rest of the text
            Style maintext = doc.addStyle("maintext", regular);
            StyleConstants.setFontSize(maintext, ((int) (ScreenHeight * .025)));
        }//end of member class addStyleToDocument   
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
        private void initComponents() {
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 400, Short.MAX_VALUE)
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 300, Short.MAX_VALUE)
            pack();
        }// </editor-fold>                       
        * @param args the command line arguments
    public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                    }//end try block
                    catch (Exception ex) {
                            System.out.println(ex);
                    }//end catch block
                    //get the graphics enviroment for this local computer
                    GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
                    //create an array of graphics devices for all the "screen devices"
                    //in the env Graphics enviroment
              GraphicsDevice[] devices = env.getScreenDevices();
                    //create an integer for looping
                    int loop = 0;
                    //create a vector to hold multipe MenuDisplayGuis for systems
                    //that use multiple screen
                    Vector DisplayWindows;
                    DisplayWindows = new Vector();
                    //create a display mode which will later pass the height
                    //and width of the window to the MenuDisplayGUI object
                    DisplayMode DM;
                    //loop through all of the display devices on the local computer
                    //create a window for each screen
                    while( loop < devices.length ) {
                        //change the displaymode to the current display mode
                        DM = devices[loop].getDisplayMode();
                        //put a MenuDisplayGUI Window into the DisplyWindows vector
                        //for each display device that is on the computer. Pass the
                        //current iteration in this loop to the MenuDisplayGUI
                        //that is being created so it can name itself according to
                        //number, send the screen height and width to handle
                        //position of objects.
                        DisplayWindows.addElement(new testGUI(devices[loop],
                                                  String.valueOf(loop + 1),
                                                  DM.getHeight(), DM.getWidth()));
                        //iterate the loop
                        loop++;
                    }//end while loop
                }//end run block
        }//end static main
    }

  • Need LayoutManager that resizes and supports right-aligned children

    I have two labels that I want to appear inside JPanels such that
    they have minimum 2 pixels padding between the text and the
    border of the JPanel, and the leftmost label is right justified, while
    the rightmost label is left justified. For example)
    [+++++label1++][++label2+++++]
    (the '+' represent white space/padding)
    Additionally, the panels themselves are children of a JPanel that is
    resized via a JSplitPane, so I want the labels to get truncated or
    expanded depending on the size of their containing JPanel.
    Lastly, I want to have the leftmost label right justified within its
    containing JPanel, and the rightmost label to be left justified within
    its containing JPanel.
    I've found that FlowLayout doesn't work because once my text is
    painted truncated, if the containing JPanel is resized larger, the
    label does not change to fill the space.
    What I'm seeing is that when the label is too large for the JPanel,
    it correctly gets truncated such as:
    [++lab...++]
    '+' represents white space/padding
    "..." implies truncated text
    but when the JPanel is grown, it simply adds padding to the current
    text that is painted:
    [+++++++lab...++]
    when I want it to expand the text and keep the result right justified:
    [++++++label1++]
    BoxLayout doesn't work because I can't find a way to get the text to
    be right-justified within the JPanel.
    BorderLayout isn't viable because while my example only shows a single
    label in the JPanel, I could actually have many components to add
    to the JPanel. So, I could create a JPanel to hold the many comps,
    but then that JPanel would have the same issue with layout.
    GridBag seems way overkill for what I need to do, which is simply,
    right justify text that will be react to contain panel bounds changes.
    Any advice is greatly appreciated.
    -Andy.

    Thanks for the reply. Unfortuneately, other circumstances prevent me from being
    able to do it that way :(
    I basically have very HTML-ish XML used to define a table.
    The table uses a GridBagLayout that lays out the <td>'s that are
    currently JPanel's. The <tr>'s do not create any JComponent as
    they are simply used to define attributes that are applied to all
    row <td>'s.
    My XML looks something like:
    <table>
      <tr>
        <td style="align: right; hgap: 2;"><label text="Hello"/></td>
        <td style="align: left; hgap: 2;"><label text="World"/></td>
      </tr>
    </table>So, when this is displayed it should show like:
    [++Hello++][++World++]
    or when it's shrunk, it should become something like:
    [++He...++][++Wo...++]
    and when the row is grown, it should become something like:
    [++++++Hello++][++World++++++]
    Also, since the GUI is defined in the XML, there can be many labels,
    images, etc inside one of the <td> tags, and I want them to be displayed
    L to R within the <td> in the order they appear, but I want them to be
    left or right justified with respect to the <td> JPanel.
    Maybe I can use a Box as my <td> instead of a JPanel so I can
    add a glue component on the left for right justified, and glue on the right
    (or no glue component) for left justified? I'll try that next...
    Thanks again for your help.
    -Andy.

  • How to right align a read only numeric field in a panel form layout

    Hi, does anyone know how to right align a read only numeric field in a panel form layout? I am using: Style Class = AFFieldNumberMarker, but it only seems to work if the field is disabled. Disabling the field gives it a difference appearance that does not look right on our forms. These are calculated fields, which cannot be modified, so read only is necessary.
    I have looked online for some answers, and it seems that others are having similar issues.
    I have tried different combinations for the properties, but so far I cannot get it to work.
    Thanks
    Judy
    I am using JDEV 11.1.1.5

    Sorry for the delay in my response. Here is the code
    <af:inputText value="#{bindings.TotalAirlineCostEst.inputValue}"
    label="#{bindings.TotalAirlineCostEst.hints.label}"
    required="#{bindings.TotalAirlineCostEst.hints.mandatory}"
    columns="#{bindings.TotalAirlineCostEst.hints.displayWidth}"
    maximumLength="#{bindings.TotalAirlineCostEst.hints.precision}"
    shortDesc="#{bindings.TotalAirlineCostEst.hints.tooltip}"
    id="it20" readOnly="false"
    disabled="true"
    styleClass="AFFieldNumberMarker">
    <f:validator binding="#{bindings.TotalAirlineCostEst.validator}"/>
    <af:convertNumber groupingUsed="true"
    pattern="#{bindings.TotalAirlineCostEst.format}"
    type="number"
    maxFractionDigits="0"/>
    </af:inputText>
    thank you,
    Judy

  • Right alignment with SpringLayout

    I've just started playing with SpringLayout. I've been using mostly BoxLayout up to now but I thought it was time I gave an alternative a go. BoxLayout has it's own erratic sizing problems.
    Anyway I'm trying to generate a sub panel like:
    Title (centered)
    Quantity1 888
    Quantity2 99
    <Table> <PieChart>
    With the numbers against the RHS of the box
    First thing I've found is that putting a zero length Spring between the NORTH of the lable and the value doesn't work, I have to set both relative to the previous line or (mysteriously) no vertical separation happens at all.
    Here's the code that adds a lable/value pair:
        private static Component addPair(Component prev, String label, JLabel value) {
            Container c = prev.getParent();
            SpringLayout l = (SpringLayout)c.getLayout();
            JLabel nameLab  = new JLabel(label);
            c.add(nameLab);
            c.add(value);
            l.getConstraints(nameLab).setHeight(Spring.constant(12));
            l.putConstraint(SpringLayout.NORTH, nameLab, 2, SpringLayout.SOUTH, prev);
            l.putConstraint(SpringLayout.WEST, nameLab, 10, SpringLayout.WEST, c);
            l.putConstraint(SpringLayout.EAST, c, 10, SpringLayout.EAST, value);
            l.putConstraint(SpringLayout.NORTH, value, 2, SpringLayout.SOUTH, prev);
         //   l.putConstraint(SpringLayout.SOUTH, nameLab, 0, SpringLayout.SOUTH, value);
            l.putConstraint(SpringLayout.WEST, value, Spring.constant(10, 10, 500),
                    SpringLayout.EAST, nameLab);
            return nameLab;
        }prev being the label from the previous pair.
    It refuses to right align the value lable. It looks like the constraint between the EAST of the value and the EAST of the container has no effect. I've also set the alignment in the JLabels to RIGHT, which has no effect.
    If I take out the constraint between the WEST of the value and the EAST of the lable It plonks the lable and value on top of one another.
    Furthermore, though the hieght of the pie chart is set explictly by a constraint, the LayoutManager seems incapable of producing a sensible minimum height for the overall box.
    All of which makes me wonder if SpringLayout is worth persevering with or if there are just tricks and gaps I have to learn to deal with.

    I think I've cracked it. Some things they don't tell you about SpringLayout, which I found out mostly by reading the source.
    putConstraint is not symetrical. Logically
    putConstraint(SpringLayout.WEST, container, 10, SpringLayout.WEST,
    valueLab);might be expected to imply:
    putConstraint(SpringLayout.WEST, valueLab, -10,  SpringLayout.WEST,
    container);But it doesn't. Only the first object in the call is actually constrained.
    Secondly the "overconstraint" thing is very arbitary. Setting the NORTH or WEST clears the EAST or SOUTH wherease setting the EAST or SOUTH clears the height or width. Hence if you set, for example, EAST and WEST then it's essential to set EAST first, otherwise WEST will be ignored and the WEST will be set from EAST - width. There seems to be no way of clearing a constraint once set, and constraints are intialised from the objects bounds, so NORTH and WEST are always set to zero initially. If seems like the contraints are almost always going to be treated as overconstrained.
    Parallel constraints don't get combined, the last one specified predominates so there doesn't seem any sensible way of, for example, setting the width of a container based on the maximum of the widths of fields contained.
    There seems to be no use of the springiness of Spring objects. They are merely treated as min, pref and max values. Logically stretchiness should be used to distribute space, and to cope with springs in parallel. It doesn't appear any of that stuff is done.

  • Right Align the Currency values in ALV report

    Hi Friends,
    I have developed a report and displayed the output using the ALV. I have columns for currency values in the output table.
    The fields for currency values are character fields. The values in the table for display, is properly right aligned (default for currency values). But in the output, the currency values are left aligned.
    Since I need blank lines in the output table after each entry, I have used the character fields in the output table so that I can clear them and append it to get the blank line.
    Please suggest me to get the currency values right aligned.
    Thanks in advance.

    try with this field in field catalog.
             just(1)        type c,        " (R)ight (L)eft (C)ent.
    for the currency field add this field too in field catalog. it will work.

  • Table numbers in a column to Right alignment

    Hi All,
    I have a table like the below.
    Age (Years)
    1985
    1998
    2007
    1–4
    52
    35
    29
    5–14
    26
    20
    15
    15–24
    102
    82
    80
    25–44
    167
    161
    144
    45–64
    875
    680
    661
    65–74
    2,848
    2,495
    2,059
    75–84
    6,399
    5,703
    5,164
    Over 85
    15,224
    15,111
    12,947
    I want to decimal align the 2nd,3rd,4th column using javascript.
    Paginators are manullay using tab stops and adjusting the "Align to Decimal Tab"
    But I want to do it in javascript
    Help me...

    Hi, Maheshwara:
      Your question's a bit confusing, because your example does not show any decimal points! Perhaps it would be good for you to show a screenshot from InDesign with Hidden Characters enabled and the Tab ruler visible so we can see what is going on.
    What do you want to do, though? My guess is you want to right-align the text, then go through and find the entry with the most characters to the right of a decimal point and set a decimal tab based on that entry, and apply it to the entire column. Sounds pretty easy!
    Are you stuck? What's the problem? How far have you gotten? Do you know Javascript?

  • Right alignment of Number Field in OAF Page

    Hi,
    I need to right align the column of the table which is of number type in OAF page. I have extended the VO of that page to add new columns. After VO extension i added the column to the page via personalization and gave the reference of view attribute name as per Extened VO. I have set the following properties for that column
    Item Sytle- Message Style Text
    Data Type- Number
    Nowrap=false
    Vertical Alignment=Middle
    View Attribute = Prior (same as Extended VO's column)
    View Instance = XXPayEmpAccrualActionInfoVO
    I need to set the value of this newly added column right align which is currently set as left align by default.
    I have tried the following links from OTN
    Re: Q: How to format number using personalization?
    Right align number field
    but while controller extension i m getting the following error-
    Message not found. Application: FND, Message Name: FND_VIEWOBJECT_NOT_FOUND. Tokens: VONAME = XXPayEmpAccrualActionInfoVO; APPLICATION_MODULE = oracle.apps.pay.selfservice.payslip.US.server.PayPayslipAM;
    The extended controller code is -
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OATableBean tableBean = (OATableBean)webBean.findIndexedChildRecursive("PayPayslip4Ss");
    tableBean.queryData(pageContext, true);
    tableBean.prepareForRendering(pageContext);
    DataObjectList aColFormat01 = tableBean.getColumnFormats() ;
    oracle.cabo.ui.data.DictionaryData ColFormat01 =(oracle.cabo.ui.data.DictionaryData)aColFormat01.getItem(pageContext.findChildIndex(tableBean, "Prior"));
    ColFormat01.put(COLUMN_DATA_FORMAT_KEY,NUMBER_FORMAT);
    Please can anyone provide me some pointer here..this is really urgent.
    Thanks in advance
    Renu
    Edited by: Renu Gupta on Jun 14, 2010 5:15 AM

    Hi Renu,
    Use the following code:
    OAMessageStyledTextBean origContSumBean = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("<FieldName>");
    if(origContSumBean!=null) {
    origContSumBean.setAttributeValue(CURRENCY_CODE,new OADataBoundValueViewObject(origContSumBean,"CurrencyCode"));
    Here CurrencyCode should be a view attribute in the VO associated to the items in the region.
    Regards
    Sumit

  • How can I right-align a table header?

    Does anyone know a way to right-align a table header?
    For example, in the table below I want the word 'Price' to be right-aligned. I could set the table's 'header renderer' to be a right-aligned DefaultTableCellRenderer, but then the header would look like a cell, not a header. Why can't swing be simple, like table.getColumn(1).setAlignment(Column.RIGHT) ????
    public class TestTableHeader {
         public static void main(String[] args) throws Exception {
              JFrame frame = new JFrame("Test");
              Object[][] rowData = new Object[][] { { "General Electric", "$100.60" },
                        { "IBM", "$5.20" }, { "Wal-mart", "$17.00" } };
              JTable table = new JTable(rowData, new Object[] { "Name", "Price" });
              DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
              renderer.setHorizontalAlignment(DefaultTableCellRenderer.RIGHT);
              table.getColumnModel().getColumn(1).setCellRenderer(renderer);
              frame.getContentPane().add(new JScrollPane(table));
              frame.setSize(400, 300);
              frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              frame.setVisible(true);
    }

    I modified your code an came up with a solution to the problem.
    import java.awt.Component;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableCellRenderer;
    public class TestTableHeader {     
         public static void main(String[] args) throws Exception {
              JFrame frame = new JFrame("Test");
              Object[][] rowData = new Object[][] {
                        { "General Electric", "$100.60" }, { "IBM", "$5.20" },
                        { "Wal-mart", "$17.00" } };
              JTable table = new JTable(rowData, new Object[] { "Name", "Price" });
              RightAlignRender right = new TestTableHeader().new RightAlignRender();
              table.getColumnModel().getColumn(0).setHeaderRenderer(right);
              table.getColumnModel().getColumn(1).setHeaderRenderer(right);
              frame.getContentPane().add(new JScrollPane(table));
              frame.setSize(400, 300);
              frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              frame.setVisible(true);
         public class RightAlignRender extends DefaultTableCellRenderer {
              public Component getTableCellRendererComponent(JTable table,
                        Object arg1, boolean arg2, boolean arg3, int arg4, int column) {
                   Component toReturn = table.getTableHeader().getDefaultRenderer().getTableCellRendererComponent(table,
                             arg1, arg2, arg3, arg4, column);
                   switch (column) {
                   case 0:
                        ((JLabel) toReturn).setHorizontalAlignment(DefaultTableCellRenderer.CENTER);
                        break;
                   case 1:
                        ((JLabel) toReturn).setHorizontalAlignment(DefaultTableCellRenderer.RIGHT);
                        break;
                   return toReturn;
    }

  • Is it possible to use tabs to right align text in Muse, as you can in InDesign?

    Can I use tabs to right align text in Muse, as you can in InDesign?
    I have a beauty treatment followed by a price and I want to right align the price, keeping the treatment on the left of the text box.
    Thank you!

    For what would typically be a two column tab stop layout, I'd generally use inline text frames and the Wrap panel.
    Put the price in it's own text frame. Then cut and paste the text frame BEFORE the item name so it's an inline text frame within the text frame containing the descriptions.Using the Wrap panel set it to float to the right. Then select it and set the right offset so it floats outside the right side of the original text frame.
    Start with this.
    Cut and paste the text frame at the start of the item paragraph.
    Choose the third icon in the Wrap panel to cause the item to float to the right of the text frame.
    Turn off the lock for the 4 wrap offset values.
    Adjust the right offset to a negative value so the item is outside the text frame to the right (to wherever you want it).
    Repeat the same steps above for the other items.
    Note that once it's set up this way you can freely edit the descriptions or change the width of the original text frame and the prices will adjust accordingly. This will also result in things lining up in the browser even if the text layout engine of a specific browser line breaks the text differently.
    This approach is tedious, but the end result will continue to line up as you make changes in Design view and will line up in every browser/OS/device.
    Someday Muse will support tables, which would be the more natural way to achieve this style of layout on the web. Until then, inline items with wrap is usually the best approach for this type of two column layout.

  • Issue with right aligning of Character Styles in my TOC

    Hello all!
    I'm working on my very first book project and I have been reading soooo many threads on here for the past hour, but i either just don't get it, or i didn't find what i needed still, so i already apologize in case this very question has been answered before ...
    ok, so ... i am building my TOC and have set up the corresponding TOC styles to the paragraph styles used throughout the book.
    what i want is for the page number to appear before the entry. so for the page number i have set up it's own TOC page number character style.
    NOW
    the page number appears left aligned. I have checked the character styles palette and there i can't set a tab for the page number to appear right aligned ...
    how do i get this page number to be right aligned? and THEN, how do i specify the distance between the page number and the entry? there is "tab character"mentioned on the TOC dialogue box to specify the distance between page number and entry, but then do i have to go in manually every time something changes? that can't be it? i have seen in the paragraphy styles palette there is a tab section ... tried to input the tabs so the number would appear right aligned and the distance to the entry, but nothing happened, then the number is stuck right on the entry once the TOC is generated ...
    does this make any sense?
    will attach a screenshot to try to clarify the issue ...
    hope you can help me out.
    thanks a lot in advance!
    cheers
    sta-cy

    sta-cy wrote:
    sorry to have bugged you.
    Seriously, if we didn't enjoy this stuff we wouln't be here. It's not like we even get T-shirts. :-P
    An awful lot of what I know and am able to pass on comes from having spent waaaaay to much time here reading about odd problems and trying to figure out ways to solve them. I'd never seen a requst like yours until the other day, but then up pops Joel with a similar story, and what do you know, this may not be such a strange thing to want at all. Hopefully your question, and the work we put into trying to find an answer, has not only helped you, but some other users who come along next week or next year.
    Everybody starts someplace and at some point in time. There's no shame in being a beginner, and less in asking for help when you need it, especially after you put in the effort you did on your own to try to find a solution. It's also true that some folks are more design oriented and others more process oriented, and that's just the way it is. This forum has many, many, followers who are expert in different areas of InDesign (even the engineers who write the program are not experts in all the various parts) and are here to share what they know as volunteers. You are always welcome here, especially when the question is as intersting as this one.

  • Problem with formatting text in textobjects with right aligned tabulators

    Post Author: Jens Kluesener
    CA Forum: General
    HiI want to print out some values in a line. So I put a Textobject in the Report with some right aligned tabulators (left aligned tabulators working fine). Then I insert a formula. In this formula i do this:"1"chr(9)"2"chr(9)"3"chr(9)"4"chr(9)"5"chr(9)"6"chr(9)"7"Look:            Many ThanksJens

    I think i found why.
    There was no problem with TextField.
    There was a problem with Array. "CityArea"
    So each time I executed script it added new string in Array. And that is because i got like:
    TextField
    City 1
    City 2
    City 1
    City 2
    Running this script is Ok:
    for (var i1:int = 0; i1 < CityArea.length; i1++)
      _CityAreaString1 += "<P ALIGN='LEFT'><FONT FACE='Verdana' SIZE='32' COLOR='#ffffff'>        "+CityArea[i1]+"</FONT></P>";
      _CityAreaString1 += "<P ALIGN='LEFT'><FONT FACE='Verdana' SIZE='5' COLOR='#ffffff'><BR></FONT></P>";
    But outside of this for loop there is another for loop for adding Cities in CityArray.
    I fixed it by adding empty array at the start of function
    function myFunc():void
    CityArea = [ ]; // Empty array fixed this issue
    // LOOP FOR ADDING SHOPS IN CITY AREA
    for (var j:int = 0; j < _Shops; j++)
    CityArea.push(_Shop);
    // FOR LOOP TO ADDING SHOPS IN STRING
    for (var i1:int = 0; i1 < CityArea.length; i1++)
      _CityAreaString1 += "<P ALIGN='LEFT'><FONT FACE='Verdana' SIZE='32' COLOR='#ffffff'>        "+CityArea[i1]+"</FONT></P>";
      _CityAreaString1 += "<P ALIGN='LEFT'><FONT FACE='Verdana' SIZE='5' COLOR='#ffffff'><BR></FONT></P>";
    Thank you for your help kglad

  • Need Number fields to be right aligned in ADF table.

    Hi All,
    I have af:outputtext in the column of ADF read only table and view attribute which is associated to this field is fetching numbers (type is Number). But by default in my page data (numbers) is displaying with left aligned.
    But my requirement is to display numbers to be right aligned. I tried by setting Horizontal property to 'right' (text-align = right), also tried by seeting Styledclass property to AFFieldNumberMarker / AFFieldNumber css properties. But still numbers are displaying with left aligned.
    Please tell me how to fix this issue?
    Thanks,
    Sadanand

    Hi,
    try attribute align="right" in af:column....
    Regards,
    Suganth.G

Maybe you are looking for