Align components in HtmlPanelGrid or HtmlPanelGroup

Hi,
I am just sturted in JSF. I need to create a static table with 2 columns. Second column contains image.
I use htmlpanelgrid to create the table. How can I align image in second column to the right?
Thanks for any help.

JSF<h:panelGrid columns="2" columnClasses="none, right" />CSS.none {
.right {
    text-align: right;
}

Similar Messages

  • Help me to align components in a JTextPane

    Help me pls to align a radio button and a text in a textPane. Using my
    code (bellow) I have a strange effect (radioButton is bellow text msg)
    Document doc = textPane.getDocument();
    JTextPane textPane = new JTextPane();
    insertRadioButton(textPane, "1");
    insertText(textPane,"I want to be at the same level");
    thanks for any ideea
    serj
    I have two functions:
    void insertRadioButton(JTextPane textPane, String s) {
    Style def = StyleContext.getDefaultStyleContext().
    getStyle(StyleContext.DEFAULT_STYLE);
    Style regular = textPane.addStyle("regular", def);
    Style style = textPane.addStyle("checkBox", regular);
    StyleConstants.setAlignment(style, StyleConstants.ALIGN_JUSTIFIED);
    StyleConstants.setComponent(style, new JRadioButton(s));
    try {
    doc.insertString(doc.getLength(), " ", style);
    } catch (BadLocationException e) {
    and
    void insertText(JTextPane textPane, String s) {
    Style def = StyleContext.getDefaultStyleContext().
    getStyle(StyleContext.DEFAULT_STYLE);
    Style style = textPane.addStyle("regular", def);
    StyleConstants.setFontFamily(def, "SansSerif");
    StyleConstants.setAlignment(style, StyleConstants.ALIGN_JUSTIFIED);
    try {
    doc.insertString(doc.getLength(), s, style);
    } catch (Exception e) {

    JPanel uses FlowLayout as its default LayoutManager. You can change the alignment using one of the constructors.
    Or, you could take a look at the tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/layout/box.html]How to Use BoxLayout. I believe you could try setting the alignment on the two components.

  • Align Components how a panel Form Layout

    hi,
    I have the panel form layout with components, fine perfect, but...
    when I want to put a LOV such an output the text
    the center together the alignment of the components is lost i have the picture :)
    http://img100.imageshack.us/img100/7164/perfectoif.png
    but i want put the output text join component , example:
    http://img525.imageshack.us/img525/4543/asiquiero.png
    the logic solution, i group component with panel group layout but the form i see:
    http://img97.imageshack.us/img97/1096/erroryd.png
    Any idea?? i use jdev 11.1.1.2
    Joaquin
    Edited by: ADFboy on 03-may-2010 10:54
    Edited by: ADFboy on 03-may-2010 11:43

                  <af:panelFormLayout id="pfl1" labelAlignment="start"
                                      maxColumns="2" rows="1">
                    <af:panelGroupLayout id="pgl2" layout="horizontal"
                                         valign="bottom" halign="start"
                                         inlineStyle="text-align:left;">
                      <af:inputListOfValues label="ghdghd ghdghdf"
                                            popupTitle="Search and Result Dialog"
                                            id="ilov2"/>
                      <af:outputText value="outputText2" id="ot2"/>
                    </af:panelGroupLayout>
                    <af:inputListOfValues label="Label 1 fgs d"
                                          popupTitle="Search and Result Dialog"
                                          id="ilov1"/>
                    <af:inputListOfValues label="Label 2"
                                          popupTitle="Search and Result Dialog"
                                          id="ilov4"/>
                    <af:panelGroupLayout id="pgl1" layout="horizontal">
                      <af:inputListOfValues label="dghd ghdhd"
                                            popupTitle="Search and Result Dialog"
                                            id="ilov3"/>
                      <af:outputText value="outputText3" id="ot1"/>
                    </af:panelGroupLayout>
                    <af:inputListOfValues label="Label 3"
                                          popupTitle="Search and Result Dialog"
                                          id="ilov5"/>
                    <af:inputListOfValues label="Label 4"
                                          popupTitle="Search and Result Dialog"
                                          id="ilov6"/>
                    <af:inputListOfValues label="Label 5"
                                          popupTitle="Search and Result Dialog"
                                          id="ilov7"/>
                    <af:inputListOfValues label="Label 6"
                                          popupTitle="Search and Result Dialog"
                                          id="ilov8"/>
                  </af:panelFormLayout>

  • 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.

  • Centering table cell content in panel grid

    How can I center the content of the cells in a table grid so it would end up something like this:
    <table>
    <tr>
    <td align="center">

    You can do that using stylesheet. You can look at the
    repeater demo example for ideas. The corresponding
    stylesheet class is components/web/stylesheet.css .
    Hope this helps.
    -JayashriI think we need more powerfull layout oriented components.
    XAML, XUL, ADF all of them have powerfull layout components library.
    Maybe it's time start working in this direction.
    I'm sure that JSF must provide in near future more powerfull layout related components library, no doubt here!
    After that it will be possible to remove from styles classes and jsp code everything that was used for layout.
    Layout components will take care about align components, preferred size and etc.
    We need minimize number of style classes.
    That possible if you will make them more universal.
    But no way to make universal style classes with layout related attributes inside them.
    Take a look on simple layout case:
    <s:row align="opposite" styleClass="footerPage">
         <h:outputText value="#{bundle.copyright}"/>
         <h:outputText value="#{bundle.terms}"/>
    </s:row>
    public class RowRenderer extends HtmlBasicRenderer {
    public RowRenderer() {
    super();
    public boolean getRendersChildren() {
    return true;
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
    if (!component.isRendered())
    return;
    ResponseWriter writer = context.getResponseWriter();
    writer.startElement("div", component);
    writeIdAttributeIfNecessary(context, writer, component);
    String styleClass = (String) component.getAttributes().get("styleClass");
    if (styleClass != null) {
    writer.writeAttribute("class", styleClass, "styleClass");
    Util.renderPassThruAttributes(writer, component);
    public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
    if (!component.isRendered())
    return;
    Iterator kids = null;
    String style = null;
    int i = 0;
    String align = (String) component.getAttributes().get("align");
    if (align == null) align = "start";
    if (null != (kids = getChildren(component))) {
    while (kids.hasNext()) {
    UIComponent child = (UIComponent) kids.next();
    if (!child.isRendered())continue;
    style = (String) child.getAttributes().get("style");
    style = (style != null) ? style + ";" : "";
    if ( (align == "start") || (align == "left"))
    style += "float: left;";
    else
    if ( (align == "end") || (align == "right"))
    style += "float: right;";
    else
    if (align == "opposite") {
    if ((i % 2) == 0)
    style += "float: left;";
    else
    style += "float: right;";
    child.getAttributes().put("style", style);
    encodeRecursive(context, child);
    i++;
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    if (context == null || component == null) {
    throw new NullPointerException(Util.getExceptionMessageString(
    Util.NULL_PARAMETERS_ERROR_MESSAGE_ID));
    if (!component.isRendered())
    return;
    ResponseWriter writer = context.getResponseWriter();
    writer.endElement("div");
    It's good idea in many layout situations to use tableless layout.
    Row component just simple demonstration how it work.
    There are some problems with implementation and using tableless layout
    but at least in some cases it's good choise.
    I'm ready to provide plenty suggestions in area of creating and using layout components.
    Just don't know if you have interest to discuss that matter.
    Vladimir

  • Color in the text box

    hi friends,
    i am working on oracle forms 6i. I am having a text box with multiline. I used to display the values of 3 text boxes in to a single text box ( text box with multiline ). The values of the text boxes must be in different font color, so that it will be differentiated between them.
    text = multiline text
    text = text1 + text2 + text3 ( text1, text2, text3 must be in different color)
    please help.

    Hello,
    It is not possible to set different colors in the same text item.
    All you can do is to create sevreal text items, set them border bevel property to none, arrange them (arrange -> align components -> Horizontal : left, vertical : stacked)
    Then draw a rectangular shape arround and set it's border bevel property to inset.
    Then, you have 3 different items, but visually, you think there is just one.
    Francois

  • Layout: multiple rows of different lengths

    Ok for one im kinda new to java so all this swing stuff is still in a limited understanding for me. I am doing quite well with it, but i am trying to have a set of buttons, 50 in fact. There are like 10 rows. Now the problem is that the first 3 rows are different lengths such as:
    x is a button
    x x x x x
    x x x x x x x
    x x x x
    x x x x x x x x x
    x x x x x x x x x
    x x x x x x x x x
    x x x x x x x x x
    x x x x x x x x x
    x x x x x x x x x
    sorry about the horrible illustration, what im trying to say is that the first row has lets say 5 buttons, then the second row has 6 then the 3rd has 4 and then the remaining ones have 5. How would i come about this. I have tried using multiple jpanels like in the code below, but only the last one is being displayed, how would i do this?
    If you need more info post that you need it.
    Thanks
    CODE:
    JPanel pane1 = new JPanel(new GridLayout(0, 1));
    pane1.setBorder(BorderFactory.createEmptyBorder(30, 30, 10, 30));
              JPanel pane2 = new JPanel(new GridLayout(0, 5));
    pane2.setBorder(BorderFactory.createEmptyBorder(30, 30, 10, 30));
              JPanel pane3 = new JPanel(new GridLayout(0, 6));
    pane3.setBorder(BorderFactory.createEmptyBorder(30, 30, 10, 30));
              JPanel pane4 = new JPanel(new GridLayout(0, 4));
    pane4.setBorder(BorderFactory.createEmptyBorder(30, 30, 10, 30));
              JPanel pane5 = new JPanel(new GridLayout(0, 5));
    pane5.setBorder(BorderFactory.createEmptyBorder(30, 30, 10, 30));
              JTextArea displayBox = new JTextArea("Hello");
              pane1.add(displayBox);
              JButton[] buttons = new JButton[50];
              for (int x=0; x < 50; x++)
                   buttons[x] = new JButton(normKeys[x]);
                   if (x <= 4)
                        pane2.add(buttons[x]);
                   else if (x <= 10)
                        pane3.add(buttons[x]);
                   else if (x <= 14)
                        pane4.add(buttons[x]);
                   else
                        pane5.add(buttons[x]);
              frame.getContentPane().add(pane1, BorderLayout.CENTER);
              frame.getContentPane().add(pane2, BorderLayout.CENTER);
              frame.getContentPane().add(pane3, BorderLayout.CENTER);
              frame.getContentPane().add(pane4, BorderLayout.CENTER);
              frame.getContentPane().add(pane5, BorderLayout.CENTER);
              frame.pack();
              frame.setVisible(true);

    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizontally, without requiring that the components be of the same size. Each GridBagLayout object maintains a dynamic, rectangular grid of cells, with each component occupying one or more cells, called its display area.

  • Designing Swing Applications - Layout

    When using JDeveloper to design a Swing application (not ADF Swing) is it possible to;
    1. when viewing the design of a frame for example, is it possible to display a grid so that you can align components correctly?
    2. when you have selected a layout from the properties editor for the panel you are working on, is it possible to display the grid lines of that layout so that you can clearly see what component/group of components are in each of the areas? Similar to when using Macromedia Dreamweaver and dragging components into a table where you can see which cell each component is currently within...
    3. add additional swing layouts to JDeveloper so that they can be used within the properties editor? i.e. tablelayout or design grid layout for example
    4. has anyone come across any guides/tutorials on using JDeveloper to design Swing based applications visually by dragging and dropping components from the palette?
    Thanks in advance for your help/advice
    David

    David - I had alot of those questions when I developed a Swing application. While I won't answer your question directly, take a look at this demo.
    http://www.oracle.com/technology/products/jdev/tips/muench/screencasts/simplejgoodies/binding_demo.html?_template=/ocom/ocom_item_templates/print
    The FormLayout as part of JGoodies managed makes the layout a lot easier - still a few things you have to get used to but it managed most of the hard stuff for your.
    Let me know if that helps
    Regards
    Grant

  • Distance between columns

    Hi all,
    I know we have a property called distance between records to maintain distance between records, what property i have to set to maintain a distance between columns.....

    I use the following method often:
    Once you have all columns displayed on your canvas, select all of them, then use the pulldown menu: Layout, Align components. Set "Align To" to "each other", set "Vertically" to "None", and "Horizontally" to "distribute", then click ok.
    (In Forms 6i, the pull-down is Arrange, Align Objects.)

  • Getting size of children

    Hi,
    I have a panel with a BoxLayout to which I need to add a variable amount of "sub-panels". The thing is that I need to know the actual height of these panels, because the heigth will depend on the number of "sub-panels" I add. I've tried with every method I found on each "sub-panel" for example getSize(), getBounds(), getX()... and everyone return 0 values.
    How can I get their actual sizes???
    thanks in advance.

    Hi,
    The thing is that I have a scroll pane and I want to align components in the row header with the panels in the viewport, so I need to know the height of the panels in the viewport. The problem is that if I use a BoxLayout (which fits my graphical needs) in the viewport, the sizes of the panels are changed by the layout manager, and this sizes differ from the preferred size. Now I decided no to use a BoxLayout but instead use a null layout (since I'm using a scroll pane this won't affect resizing the window).
    Anyway if you know how to do this, please explain.
    Thanks

  • Why it should be so hard?

    Why every time I want to align components to the middle it never woks or takes a couple of days (or more) to get it? Here is a simplified code:
    <mx:VBox textAlign="center" width="50%" height="100%"
    paddingTop="10" paddingBottom="0" horizontalGap="0" horizontalAlign="center">
    <mx:Form width="100%" backgroundColor="#D2D3CF" borderStyle="solid" height="50%" textAlign="center">
    <mx:FormHeading label="Preview Law Label"/>
    </mx:Form>
    where formheading is not positioned to the middle. It is shown more to the right. There are outer containers as well, but I cannot remove everything every time it's not working. I need to know the mechanics. Can someone educate me please?
    Thanks

    if you want to see the label in the middle of the browser window??
    set VBox width="100%".
    if this is not you are looking, please let me know.
    Thanks

  • IFD to XDP convertion Span tags issue...

    Hi,
    When we convert the IFD (Adobe output designer-5.6) to XDP through Adobe livecycle ES, some unicode special characters included to the XDP file between <span> tags.
    like, <span style="xfa-spacerun:yes">ô </span>
    It results, special characters printed on form.
    Let us know, how to rectify the issue.
    Regards,
    Sasi

    Hi Frank,
    Thanks for your answer. Only been using ADF for a month now so a lot to be learned!
    I am styling using CSS and skins (very confusing how ADF does this but thats another matter all together) but concerning my query on how to centrally vertical and horizontally align components within a button. How would I achieve this desired effect if the use of 2 span tags is not allowed/suggested in ADF. The af:outputText tag doesn't seem to implement span tags as I would have thought.
    Any help would be very appreciated as searching the internet it would seem the use of the 2 classes on span tags is the best cross browser solution.

  • Top aligning HtmlDataTable components in a HtmlPanelGrid

    I need a recommended solution for this scenario.
    I have three h:dataTable components in a h:panelGrid as follows:
    <h:panelGrid columns="3">
                    <h:dataTable value="#{fooBean1.myList}" var="list">
                               <h:outputText value="list.bar"/>
                    </h:dataTable>
                    <h:dataTable value="#{fooBean2.myList}" var="list">
                              <h:outputText value="list.bar"/>
                   </h:dataTable>
                   <h:dataTable value="#{fooBean3.myList}" var="list">
                              <h:outputText value="list.bar"/>
                   </h:dataTable>
    </h:panelGrid>There can obviously be different number of rows in each h:dataTable which means the height of each h:dataTable may be different than the others.
    How can I ensure that the three h:dataTable components are always vertically aligned to top?
    Note that the header for the graphic in the template.xhtml for each xhtml has valign style settings so a global setting like this will not work (i.e.
    it will top align the dataTables but the header graphic is now mis-aligned.):
    <head>
        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />
        <title>Repair Card</title>
        <style>
         html,body,table { height:100%; margin:auto;}
         table,td,tr,thead,tfoot,tbody,th,tf { vertical-align:top; padding-bottom: 10px; }
        .rich-panel {height: 100%;}
        .panel1 { width: 30%; text-align: center; font-size: 12px;}
        .panel2 { width: 30%; text-align: center; font-size: 12px;}
         .panel3 { width: 30%; text-align: center; font-size: 12px;}
    </style>   
    </head>Is it possible to specify the styles using the style or styleClass attribute for the h:panelGrid?

    This worked! thx.
    <head>                  
                       <style>
                       div.divTop TD {vertical-align:top;}                    
                        </style>   
                   </head>      
                   <div class="divTop">
                              <h:panelGrid columns="3" border="1" width="100%">
                                  <h:dataTable value="#{foo1}" var="name">
                                       <h:column>
                                            <h:outputText value="#{name}"/>
                                       </h:column>
                                  </h:dataTable>
                                  <h:dataTable value="#{foo2}" var="name">
                                       <h:column>
                                            <h:outputText value="#{name}"/>
                                       </h:column>
                                  </h:dataTable>
                                  <h:dataTable value="#{foo3}" var="name">
                                       <h:column>
                                            <h:outputText value="#{name}"/>
                                       </h:column>
                                  </h:dataTable>          
                             </h:panelGrid>
                   </div>Edited by: asookazian on Mar 6, 2009 2:28 PM

  • Aligning group of components in a panel grid

    I have a panelGrid that has two columns. The first is a table and the second is a groupPanel.
    I want the components in the groupPanel to be left justified but even using css styles such as the following the groupPanel is always centered.
    .alignTopLeft {
      vertical-align: top;
      text-align: left;
    }I have also tried the following:
    .alignTopLeft {
      vertical-align: top;
      text-align: left;
        position: relative;
        top: 1px;
        left: 1px;
    }I notice that their does not seem to be a horizontal-align attribute which would make more sense to me. I also suspect that the above styles do not work because I am dealing with a group of components instead of a single component (such as a text field).
    In order to get the look I want I have had to resort to using a layout panel set to 'grid' and hand placing my sub elements. I keep on thinking I am missing something and that their is a better way to do this.
    Granted this is based on my experience with Swing which has rich set of layout managers...
    If anyone has a better solution please let me know. (And remember that a sample is always welcome)

    Some more information.
    I also tried using the following setting:
    .alignTopLeft {
      vertical-align: top;
      float: left;
    }While this placed the component in the desired location it had an unfortunate side effect. When I set the text area to have some value (in my back bean) the value did not show up in the text area but instead appeared to overlap the left most component on row of the panelGrid.
    So far the only way I have been able to get this to appear the way I would like is to use a panelLayout with a grid (fixed) layout.
    I hope that future versions of Woodstock will have better layout managers. Coming from Swing it is very frustrating to have to use tricks like this.

  • Alignment of the components inside tab in JTabbedPane

    I want to align the components inside the tab in tabbedpane.
    I have three tabs in the tabbed pane For each tab I added the components on the panel and added the panel as a tab.
    But as the number of components on each tab are not same the components inside the tab doesn't get aligned properly.
    The components gets aligned in the center and I want to align them at top. How can I do that?
    Please help..

    How does
    the number of components on each tab are not samerelates to
    the components inside the tab doesn't get aligned properly. The components gets aligned in the center and I want to align them at top??

Maybe you are looking for

  • To find the time required by the process chain to complete

    Hi Experts, I am calulating the average time required by the process chain to compete. Is there any way to find the time required by the process chain to complete.. Thanks in advance. Regards, Ashwin

  • Move notes from one iphone to a different account

    Recently I changed my wife's iPhone from my ID to her own, so we can keep our data separate, but this deleted her Notes from her phone, I still have her Notes on my phone; how do I move them to her iPhone without deleting data when changing the iClou

  • App store give me foreign apps

    When I try to browse in the app store, all I can see is foreign apps. The text when I click on the app's name isnt English, I can only assume the rest of the app isn't either. Is there a way to set the app store to show me only English apps? There's

  • SAP HR or SAP SRM or SAP BI  expert advice

    Dear SAP experts Greetings! My profile -> SAP technical consultant which includes :- 1.  5 years of experience in sap abap in R/3 core modules 2  With  ABAP webdynpro experience 3. Done one ABAP HR support project and having good understanding to PA

  • Unable to create PDF conversion file

    I'm trying to convert to PDF a PPT presentation with my Adobe Acrobat 9 Pro which I already installed some years back.  I never had any problems with it just of late.  It stopped being able to convert and so I uninstalled the program and installed it