JTextArea horizontal alignment

I want to control the alignment of text in a JTextArea control (alignment left, center or right). I assume that I need to make a custom renderer of some description to be able to draw the text in the appropriate alignment,
but if this is the case, I cannot work out how to setup the components.
I appreciate that the JTextPane provides for setting of paragraph alignment attributes, but in my situation I need to use the JTextArea (the user needs to be able to turn line wrap on and off at run time so I need to make use of the JTextArea lineWrap facility).
Is there any way that I can get the JTextArea to support the horizontal alignment??
Any assistance would be greatly appreciated,
regards, Sean

I just realised that using a JTextPane would be acceptable as long as I could allow the user to turn on and off the line wrapping behaviour of the JTextPane. Does anybody know how to achieve that?
Thanks, Sean

Similar Messages

  • Cell horizontal alignment

    Hi,
    does someone know how to set the horizontal alignment of a cell ???
    Thanks, Fred.

    A JTable object provides a TableCellRenderer object for each of its column. It usually takes it from the TableColumn object provided by its own TableColumnModel, if available, or otherwise provides a DefaultTableCellRenderer object. This default cell renderer is basically a JLabel formatted according to the type of value it has to display.
    You can write your own cell renderer, e.g. a JLabel that you format as you wish, and set it as the default cell renderer for the table using the setDefaultRenderer method.
    Or you can overwrite the getCellRenderer method of the table and have it return the appropriate cell renderer for a column.
    Or you can write your own TableColumnModel and have it used by the table.
    The chosen solution depends on what you really need to do. Hope it helps.

  • Control horizontal alignment of table cell?

    Is it possible to control the horizontal alignment of text within a table cell using some form of xsl:attribute code? I wasn't able to find any alignment attributes supported in the user guide and was hoping there was a way to manage it- the problem is that I don't know ahead of time which cells need to be left justified and which ones need to be centered.
    Thanks,
    Kevin

    I've tried the following in the
    advanced properties but with no success.
    <?if:number(EMPID)>6?>
    <xsl:attribute
    xdofo:ctx="block" name="text-align">center
    </xsl:attribute>
    <?end if?>
    Change the attribute to the following and the formatting works.
    <?if:number(EMPID)>6?>
    <xsl:attribute
    xdofo:ctx="block" name="background-color">red
    </xsl:attribute>
    <?end if?>
    I'm previewing in PDF.
    If anyone has any ideas they would be greatly appreciated.
    Thankyou
    John.

  • Horizontal alignment for Text of Header Region

    Hi,
    The content of Text property for a header Region appears left aligned by default.
    Is it possible to set horizontal Alignment = Middle(of the Page)For the Item Type, Header I do not see any property called Horizontal Alignment in the Property Inspector.
    Thanks,
    Gowtam.

    Header component does not expose any property to align the text.
    Can you check whether, the following layout helps.
    TableLayout (Horizontal Alignment - center)
    |
    -- RowLayout (Horizontal Alignment - center)
    |
    --- CellFormat (Horizontal Alignment - center)
    |
    ---- Header

  • Custom Table Cell Renderer Unable To Set Horizontal Alignment

    Hello,
    I have a problem that I'm at my wit's end with, and I was hoping for some help.
    I need to render the cells in my table differently (alignment, colors, etc) depending on the row AND the column, not just the column. I've got this working just fine, except for changing the cell's horizontal alignment won't work.
    I have a CustomCellRenderer that extends DefaultTableCellRenderer and overrides the getTableCellRendererComponent() method, setting the foreground/background colors and horizontal alignment of the cell based on the cell's value.
    I have a CustomTable that extends JTable and overrides the getCellRenderer(int row, int column) method to return a private instance of this CustomCellRenderer.
    This works fine for foreground/background colors, but my calls to setHorizontalAlignment() in the getTableCellRendererComponent() seem to have no effect, every cell is always displayed LEFT aligned! It's almost like the cell's alignment is determined by something else than the table.getCellRenderer(row,column).getTableCellRendererComponent() method.
    I've also tried setting the renderer for every existing TableColumn in the TableModel to this custom renderer, as well as overriding the table's getDefaultColumn() method to return this custom renderer as well for any Class parameter, with no success.
    No matter what I've tried, I can customize the cell however I want, EXCEPT for the horizontal alignment!!!
    Any ideas???
    Here's the core custom classes that I'm using:
    class CustomTable extends JTable {
    private CustomRenderer customRenderer = new CustomRenderer();
    public CustomTable() {
    super();
    public TableCellRenderer getCellRenderer(int row, int column) {
    return customRenderer;
    } // end class CustomTable
    class CustomRenderer extends DefaultTableCellRenderer {
    public CustomRenderer() {
    super();
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    if (row % 2 == 0) {
    setForeground(Color.red);
    setHorizontalAlignment(RIGHT);
    } else {
    setForeground(Color.blue);
    setHorizontalAlignment(LEFT);
    return this;
    } // end class CustomRenderer
    Even worse, I've gotten this to work fine in a trivial example I made to try and re-create the problem. But for some reason, this same thing is just not working for horizontal alignment in my actual project?!?
    Anyone have any ideas how the cell's horizontal alignment set in the getTableCellRendererComponent() method is being ignored or overwritten before the cell is being displayed???
    Thanks, any help is appreciated,
    -Alex Blume

    Ok, so I've looked into their source and I think I know where and what the trouble is. The JTable.java has a method called:
    3658> public TableCellRenderer getCellRenderer(int row, int column) {
    3659> TableColumn tableColumn = getColumnModel().getColumn(column);
    3660> TableCellRenderer renderer = tableColumn.getCellRenderer();
    3661> if (renderer == null) {
    3662> renderer = getDefaultRenderer(getColumnClass(column));
    3663> }
    3664> return renderer;
    3665> }
    starting at line 3658 of their source code. It retrieves the TableCellRenderer on line 3660 by calling the tableColumn's getCellRenderer method. This is found in the TableColumn.java class:
    421> public TableCellRenderer getCellRenderer() {
    422> return cellRenderer;
    423> }
    See the problem? Only ONE cell Renderer. It's referring to a variable found at line 140 which is of type TableCellRenderer ... well actually it's created as a DefaultTableCellRenderer at some point since TableCellRenderer is an interface.
    Basically the fix is this:
    In the TableColumn.java file, a collection (Vector, LinkedList, whatever) needs to keep track of each cell's renderer. This will solve the solution. Of course this will be something that you or I can make.
    What's funny is the contradiction in documentation between JTable's and TableColumn's getCellRenderer() method. First, if we look at TableColumn's documentation it states:
    "Returns the TableCellRenderer used by the JTable to draw values for this column."
    Based on that first statement, the getCellRenderer() method in TableColumn is doing its job exactly. No lies, no contradictions in what it does.
    However, that method is called up inside of the JTable's getCellRenderer() method which says a completely different thing which is:
    "Returns an appropriate renderer for the cell specified by this row and column."
    Now we have a problem. For the cell specified. It appears that the rush to push this out blinded some developer who either:
    1) mis-interpreted what the JTable getCellRenderer() method was supposed to do and inadvertently added a feature or;
    2) was in a 2 a.m. blitz, wired on Pepsi and adrenalin and wrote the bug in.
    Either way, I'm really hoping that they'll fix this because it will take care of at least 2 bugs. Btw, anyone interested in posting a subclass to solve this problem (subclass of TableColumn) is more than welcome. I've spent much too much time on this and my project is already behind so I can't really afford any more time on this.
    later,
    a.

  • Adaptive Layout - Portlet horizontal alignment

    Is it possible to create an Adaptive Layout with horizontal alignment of portlets in a column?
    Attempting to create a layout with column1 above column 2 and column3 along right side of page.

    I apologize for the late response.
    I was not able to switch the alignment. I moved on to another approach due to limited time.
    Adaptive layouts are a composite of the base portal css styles and adaptive layout styles. It is difficult without a tool that is able to pull all the components into a single view based upon references. (Now that would be a useful tool.... anyone listening). The most useful tool i have found so far is Dreamweaver, it allows you to create custom tag libraries for limited design help.
    I welcome any input on a tool that can handle the tag libraries.
    I will update this thread if I make any discoveries.

  • Horizontal align center in table-cell

    Hello,
    I'm having a problem getting to horizontally align a div (schilderij) in another div (schilderijholder).
    This schilderij div has a height and width of 480px and has display: table-cell. The content of this div is an image, with different sizes on every page (there are multiple pages, it is some sort of photogallery). The images are nicely centered, horizontally and vertically, inside this div.
    The containing div (schilderijholder), has a width of 100% of it's containing block, which has a variable size
    The problem is, I cant get the schilderij div horizontally centered in the schilderijholder div.
    Here's the simplified code. If you need the whole code, I can post that too.
        <div class="leftWrapper" style="clear: none; float: left; width: 68%; height: 100%;">
        <div class="content" style="margin: 40 10 50 30;">
          <div id="schilderijholder" style="text-align: center; width: 100%; height: 100%;">
              <div id="schilderij" style=" height: 480px; width: 480px; text-align: center; vertical-align: middle; display: table-cell;">
                <img src="../Assets/Schilderijen/normal/01.jpg" width="399" height="480" align="center" />
                </div>
              </div>
            <div id="pageControl">
            <span class="left">
              <a href="schilderijen2.html"></a> </span>
              <span class="right">
              <a href="02.html">Volgende</a>
                </span>
              </div>
          </div>
         </div>
    What I've tried:
         - "margin: 0 auto;" on the schilderij div
         - "position: relative;" on the schilderijholder div and "position: absolute; left: 50%; margin-left: -240px;" on the schilderij div
    But these both don't work.
    Does anybody know a solution for this, or maybe has something to put me on the right way?
    Thanks in advance!

    Let's fix your code first:
    <div class="leftWrapper" style="float: left; width: 68%; height: 100%;">
        <div class="content" style="margin: 40px 10px 50px 30px;">
          <div id="schilderijholder" style="text-align: center; width: 100%; height: 100%;">
              <div id="schilderij" style=" height: 480px; width: 480px; text-align: center; vertical-align: middle; display: table-cell;">
                <img src="../Assets/Schilderijen/normal/01.jpg" width="399" height="480" align="center" />
                </div>
              </div>
            <div id="pageControl">
            <span class="left">
              <a href="schilderijen2.html"></a> </span>
              <span class="right">
              <a href="02.html">Volgende</a>
                </span>
              </div>
          </div>
         </div>
    Why do you need the div#schilderij at all?  Seems unnecessary to me.
    Then you would need the display:table-cell on the parent to this div, not on the div#schilderij, which has basically the same dimensions as the image.  But I think this is all too complicated.  Why not just this?
    <div class="leftWrapper" style="float: left; width: 68%;">
        <div class="content" style="margin: 40px 10px 50px 30px;">
          <div id="schilderijholder" style="text-align: center;">
                <img src="../Assets/Schilderijen/normal/01.jpg" width="399" height="480" align="center" />
                </div>
              </div>
            <div id="pageControl">
            <span class="left">
              <a href="schilderijen2.html"></a> </span>
              <span class="right">
              <a href="02.html">Volgende</a>
                </span>
              </div>
          </div>
         </div>

  • How do you float and image or text so that it remains centered for a given browser window size (horizontally aligned).

    Is it possible to float images horizontally in muse (horizontally aligned) such that an image or text remains in the center of a browser window regardless of its dimensions. The pin feature is capable of accomplishing this but it has the unwanted effect of, well, pinning it. There must be a way other than manually changing the code outside of muse after each change.
    Thanks,

    Hmm, tried it and its not working as intended. I created a text box the width of the page, typed some text and center justified it. When I adjust the size of the browser window it of course remains centre justified but it doesn't stay in the center of the scree as the window width changes. Did I not understand the 100% width part correctly?
    To be clear, I understand how to do this is CSS but there must be some way to do it in muse so you don't have to manually go back and edit the html after each upload.

  • Button created among region items cannot be horizontally aligned

    If I create a button amongst region items, and say new line = NO and new field = YES, it creates the button in its own table cell. However there is no apparent interface to horizontally (or vertically for that matter) align the button within the cell.
    If I create any other region item, or a button in a region position, I can see the alignment options which work as expected.
    Am I missing something here?

    A workaround here is to add the item as post element text on the previous item in sequence. But then the item is "lost" when looking at the page edit screen, and common editing features are not available.
    I see no logical reason why a button created amongst region items should not have all the operations permitted on it as do the regular region items.

  • Horizontal Alignment of JList

    Hi,
    Can someone tell me how to set a JList so that it is aligned in the center (horizontally) of a JPanel with a BorderLayout?
    I am doing the following, but it does not seem to have any affect and the list is aligned on the left....
    currentList = new JList(currentListModel);
    currentList.setAlignmentX(JList.CENTER_ALIGNMENT);
    statusPane.add(currentList, BorderLayout.CENTER);
    Thanks in advance.

    not sure this is what you're after, but worth a look
    import javax.swing.*;
    import java.awt.*;
    class TestGUI extends JFrame
      public static void main(String args[])
        new TestGUI();
      public TestGUI()
        super("TestGUI");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(300,400);
        Container frame = getContentPane();
        DefaultListModel listModel = new DefaultListModel();
        JList jl = new JList(listModel);
        JPanel jp = new JPanel(new BorderLayout());
        JPanel upper = new JPanel();
        upper.setPreferredSize(new Dimension(frame.getWidth(),50));
        JPanel lower = new JPanel();
        lower.setPreferredSize(new Dimension(frame.getWidth(),50));
        jp.add(upper,BorderLayout.NORTH);
        jp.add(jl,BorderLayout.CENTER);
        jp.add(lower,BorderLayout.SOUTH);
        frame.add(jp);
        setContentPane(frame);
        setVisible(true);
    }

  • Af:panelgroup horizontal alignment

    Hello,
    I have two af:panelbox components in one af:paneolgroup (layout horizontal) container.
    The epxectation is both panelbox should display nearby each other. For e.g. one panelbox on the left and another panel box on the right. Think of them as an open book on the table.
    The issue is: the header for second panelbox(on the right) displays after leaving some margin at the top and starts diplaying in the center-right corner of af:panelgroup layout container. No matter what I do but, header for both panelbox simply will not display side by side.
    Below is the code snippet. Please help.
    <af:panelGroup layout="horizontal"
    inlineStyle="width:38.5%; text-align:left;" >
    <af:panelBox text="Insight"
    width="280px" background="light"
    inlineStyle="vertical-align:bottom; "
    binding="#{ShowApanel.panelBox1}" id="panelBox1">
    <af:panelGroup layout="vertical">
    <af:goLink styleClass="link" text="- Agents of Change" destination="C:\COEXSYS\home\Coexsys\public_html\Company_Information.html"
    inlineStyle="font-size:smaller;text-decoration:none;font-family:Arial;margin:2.0%"/>
    <af:objectSeparator> </af:objectSeparator>
    <af:goLink styleClass="link" text="- Enterprise Applications - A turning point" destination="C:\COEXSYS\home\Coexsys\public_html\Company_Information.html"
    inlineStyle="font-size:small;text-decoration:none;font-family:Arial;margin:2.0%"/>
    <af:objectSeparator> </af:objectSeparator>
    <af:goLink styleClass="link" text="- Outsourcing - A fundamental Shift" destination="C:\COEXSYS\home\Coexsys\public_html\Company_Information.html"
    inlineStyle="font-size:small;text-decoration:none;font-family:Arial;margin:2.0%"/>
    <af:objectSeparator> </af:objectSeparator>
    <af:goLink styleClass="link" text="- Enterprise Applications - A turning point" destination="C:\COEXSYS\home\Coexsys\public_html\Company_Information.html"
    inlineStyle="font-size:small;text-decoration:none;font-family:Arial;margin:2.0%"/>
    <af:objectSeparator> </af:objectSeparator>
    <af:goLink styleClass="link" text="- Rich Internet - Power of desktop on the web" destination="C:\COEXSYS\home\Coexsys\public_html\Company_Information.html"
    inlineStyle="font-size:small;text-decoration:none;font-family:Arial;margin:2.0%"/>
    <af:objectSeparator> </af:objectSeparator>
    <af:goLink styleClass="link" text="- Horizontal organizations - A lasting trend" destination="C:\COEXSYS\home\Coexsys\public_html\Company_Information.html"
    inlineStyle="font-size:small;text-decoration:none;font-family:Arial;margin:2.0%"/>
    <af:objectSeparator> </af:objectSeparator>
    <af:goLink styleClass="link" text="- The Chaos" destination="C:\COEXSYS\home\Coexsys\public_html\Company_Information.html"
    inlineStyle="font-size:small; text-decoration:none; font-family:Arial; margin:2.0%;"/>
    <af:objectSeparator> </af:objectSeparator>
    <af:goLink styleClass="link" text="More.." destination="C:\COEXSYS\home\Coexsys\public_html\Company_Information.html"
    inlineStyle="font-size:small; text-decoration:none; text-align:right;margin:10px;"/>
    </af:panelGroup>
    </af:panelBox>
    <af:panelBox id="tree" text="Industries" inlineStyle="width:216px;marign:-20px;">
    </af:panelBox>
    </af:panelGroup>
    </af:document>
    Thanks,
    Ruchir

    Hi!
    I don't know if this helps but I use
    afh:tableLayout
    afh:rowLayout
    afh:cellFormat
    afh:cellFormat
    for such purposes. This way you get some kind of HTML table with rows and cells in which you then put other components. In afh:cellFormat you have Halign and Valign properties which you set to suite your purpose. For Example try setting Valign to 'top'. You can also set margin and padding properties to 0.
    HTH
    BB

  • Set Horizontal Alignment on JLabel - wrong implementation?

    Hi again.
    I am studying by myself, and my last resort is to show you my unfinished code. This is supposed to move the alignment of the JLabel at the top of the window depending on the ComboBox choice. I did not implement the other ItemListeners yet because I can't make the first one work. I know I have an error somewhere... anyway thanks in advance for your time.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DemoJLabel extends JFrame {
        private ImageIcon icon = new ImageIcon("image/grapes.gif");
        private JLabel jlblGrape = new JLabel("Grapes", icon, SwingConstants.CENTER);
        private String[] horizontalAlign = {"LEFT", "CENTER", "RIGHT",
            "LEADING", "TRAILING"
        private String[] verticalAlign = {"TOP", "CENTER", "BOTTOM"};
        private String[] horizontalTP = {"LEFT", "CENTER", "RIGHT", "LEADING",
            "TRAILING"
        private String[] verticalTP = {"TOP", "CENTER", "BOTTOM"};
        private JComboBox jcboHA = new JComboBox(horizontalAlign);
        private JComboBox jcboVA = new JComboBox(verticalAlign);
        private JComboBox jcboHT = new JComboBox(horizontalTP);
        private JComboBox jcboVT = new JComboBox(verticalTP);
        public DemoJLabel() {
            JPanel p1 = new JPanel();
            p1.setLayout(new FlowLayout());
            p1.setBorder(BorderFactory.createLineBorder(Color.BLACK));
            p1.add(jlblGrape);
            JPanel p2 = new JPanel();
            p2.setLayout(new GridLayout(2, 1));
            p2.add(new JLabel("Horizontal"));
            p2.add(new JLabel("Vertical"));
            JPanel p3 = new JPanel();
            p3.setLayout(new GridLayout(2, 1));
            p3.add(jcboHA);
            p3.add(jcboVA);
            JPanel p4 = new JPanel();
            p4.setLayout(new BorderLayout());
            p4.setBorder(BorderFactory.createTitledBorder("Alignment"));
            p4.add(p2, BorderLayout.WEST);
            p4.add(p3, BorderLayout.EAST);
            JPanel p5 = new JPanel();
            p5.setLayout(new GridLayout(2, 1));
            p5.add(new JLabel("Horizontal"));
            p5.add(new JLabel("Vertical"));
            JPanel p6 = new JPanel();
            p6.setLayout(new GridLayout(2, 1));
            p6.add(jcboHT);
            p6.add(jcboVT);
            JPanel p7 = new JPanel();
            p7.setLayout(new BorderLayout());
            p7.setBorder(BorderFactory.createTitledBorder("Text Position"));
            p7.add(p5, BorderLayout.WEST);
            p7.add(p6, BorderLayout.EAST);
            JPanel p8 = new JPanel();
            p8.setLayout(new GridLayout());
            p8.add(p4);
            p8.add(p7);
            setLayout(new GridLayout(2, 1));
            add(p1);
            add(p8);
            jcboHA.addItemListener(new ItemListener() {
                public void itemStateChanged(ItemEvent e) {
                    //For debugging
                    System.out.println(jcboHA.getSelectedItem());
                    String choice = jcboHA.getSelectedItem().toString();
                    if (choice.equals("LEFT")) {
                        jlblGrape.setHorizontalAlignment(JLabel.LEFT);
                    } else if (choice.equals("CENTER")) {
                        jlblGrape.setHorizontalAlignment(JLabel.CENTER);
                    } else if (choice.equals("RIGHT")) {
                        jlblGrape.setHorizontalAlignment(JLabel.RIGHT);
                    } else if (choice.equals("LEADING")) {
                        jlblGrape.setHorizontalAlignment(JLabel.LEADING);
                    } else {
                        jlblGrape.setHorizontalAlignment(JLabel.TRAILING);
        // Other ItemListeners for the other combo boxes
        public static void main(String[] args) {
            DemoJLabel frame = new DemoJLabel();
            frame.setTitle("Demonstrating JLabel");
            frame.setSize(400, 350);
            frame.setLocationRelativeTo(null);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
    }

    *@petes1234*
    Thanks! I didn't think about declaring p1 so that it could be changed.
    * with assistance from petes1234
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DemoJLabel extends JFrame
        //** make the label's panel visible to the whole class
        private JPanel p1;
        private ImageIcon icon = new ImageIcon("image/grapes.gif");
        private JLabel jlblGrape = new JLabel("Grapes", icon, SwingConstants.CENTER);
        private String[] horizontalAlign =
        { "LEFT", "CENTER", "RIGHT", "LEADING", "TRAILING" };
        private String[] verticalAlign =
        { "TOP", "CENTER", "BOTTOM" };
        private String[] horizontalTP =
        { "LEFT", "CENTER", "RIGHT", "LEADING", "TRAILING" };
        private String[] verticalTP =
        { "TOP", "CENTER", "BOTTOM" };
        private JComboBox jcboHA = new JComboBox(horizontalAlign);
        private JComboBox jcboVA = new JComboBox(verticalAlign);
        private JComboBox jcboHT = new JComboBox(horizontalTP);
        private JComboBox jcboVT = new JComboBox(verticalTP);
        public DemoJLabel()
            //** make label bigger so we can see it
            //** the text moving around inside of it
            int labelSize = 160;
            jlblGrape.setPreferredSize(new Dimension(2 * labelSize, labelSize - 15));
            //** give it a border so we can see its bounds
            jlblGrape.setBorder(BorderFactory.createLineBorder(Color.blue));
            p1 = new JPanel();
            p1.setLayout(new FlowLayout());
            p1.setBorder(BorderFactory.createLineBorder(Color.BLACK));
            p1.add(jlblGrape);
            JPanel p2 = new JPanel();
            p2.setLayout(new GridLayout(2, 1));
            p2.add(new JLabel("Horizontal"));
            p2.add(new JLabel("Vertical"));
            JPanel p3 = new JPanel();
            p3.setLayout(new GridLayout(2, 1));
            p3.add(jcboHA);
            p3.add(jcboVA);
            JPanel p4 = new JPanel();
            p4.setLayout(new BorderLayout());
            p4.setBorder(BorderFactory.createTitledBorder("Alignment"));
            p4.add(p2, BorderLayout.WEST);
            p4.add(p3, BorderLayout.EAST);
            JPanel p5 = new JPanel();
            p5.setLayout(new GridLayout(2, 1));
            p5.add(new JLabel("Horizontal"));
            p5.add(new JLabel("Vertical"));
            JPanel p6 = new JPanel();
            p6.setLayout(new GridLayout(2, 1));
            p6.add(jcboHT);
            p6.add(jcboVT);
            JPanel p7 = new JPanel();
            p7.setLayout(new BorderLayout());
            p7.setBorder(BorderFactory.createTitledBorder("Text Position"));
            p7.add(p5, BorderLayout.WEST);
            p7.add(p6, BorderLayout.EAST);
            JPanel p8 = new JPanel();
            p8.setLayout(new GridLayout());
            p8.add(p4);
            p8.add(p7);
            setLayout(new GridLayout(2, 1));
            add(p1);
            add(p8);
            jcboHA.addItemListener(new ItemListener()
                public void itemStateChanged(ItemEvent e)
                    String choice = jcboHA.getSelectedItem().toString();
                    if (choice.equals("LEFT"))
                        jlblGrape.setHorizontalAlignment(JLabel.LEFT);
                    else if (choice.equals("CENTER"))
                        jlblGrape.setHorizontalAlignment(JLabel.CENTER);
                    else if (choice.equals("RIGHT"))
                        jlblGrape.setHorizontalAlignment(JLabel.RIGHT);
                    else if (choice.equals("LEADING"))
                        jlblGrape.setHorizontalAlignment(JLabel.LEADING);
                    else
                        jlblGrape.setHorizontalAlignment(JLabel.TRAILING);
                    //** revalidate the panel after making changes
                    p1.revalidate();
            jcboVA.addItemListener(new ItemListener()
                public void itemStateChanged(ItemEvent e)
                    String choice = jcboVA.getSelectedItem().toString();
                    if (choice.equals("TOP"))
                        jlblGrape.setVerticalAlignment(JLabel.TOP);
                    else if (choice.equals("CENTER"))
                        jlblGrape.setVerticalAlignment(JLabel.CENTER);
                    else
                        jlblGrape.setVerticalAlignment(JLabel.BOTTOM);
                    //** revalidate the panel after making changes
                    p1.revalidate();
            jcboHT.addItemListener(new ItemListener()
                public void itemStateChanged(ItemEvent e)
                    String choice = jcboHT.getSelectedItem().toString();
                    if (choice.equals("LEFT"))
                        jlblGrape.setHorizontalTextPosition(JLabel.LEFT);
                    else if (choice.equals("CENTER"))
                        jlblGrape.setHorizontalTextPosition(JLabel.CENTER);
                    else if (choice.equals("RIGHT"))
                        jlblGrape.setHorizontalTextPosition(JLabel.RIGHT);
                    else if (choice.equals("LEADING"))
                        jlblGrape.setHorizontalTextPosition(JLabel.LEADING);
                    else
                        jlblGrape.setHorizontalTextPosition(JLabel.TRAILING);
                    //** revalidate the panel after making changes
                    p1.revalidate();
             jcboVT.addItemListener(new ItemListener()
                public void itemStateChanged(ItemEvent e)
                    String choice = jcboVT.getSelectedItem().toString();
                    if (choice.equals("TOP"))
                        jlblGrape.setVerticalTextPosition(JLabel.TOP);
                    else if (choice.equals("CENTER"))
                        jlblGrape.setVerticalTextPosition(JLabel.CENTER);
                    else
                        jlblGrape.setVerticalTextPosition(JLabel.BOTTOM);
                    //** revalidate the panel after making changes
                    p1.revalidate();
        public static void main(String[] args)
            DemoJLabel frame = new DemoJLabel();
            frame.setTitle("Demonstrating JLabel");
            frame.setSize(400, 350);
            frame.setLocationRelativeTo(null);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
    }Edited by: carlshark on Dec 18, 2007 4:30 AM
    Removed unnecessary debugging code

  • Thumbnails: horizontal alignment?

    Hi there!
    I'm trying to arrange the thumbnails of a folder horizontally and the subfolders vertically.
    Currently, I'm using the ConsumerThumbnailExplorer.
    Note:
    The vertical alignment of the subfolders already succeeded by setting "Grid Ordering Mode" of the ConsumerThumbnailGridRenderer to "rowmajor".
    Thanks in advance!
    Dennis

    I found out that the problem lied in the "second level" flavor I used.
    Unfortunately, it seems like it's impossible to influence the second level resources.
    Or are there appropriate means?
    I could use it on several ocassions...
    Dennis

  • Applescript - trying to horizontally align all the text in a text frame

    I've tried the following snippet along with several others:
    tell application "Adobe InDesign CS5.5"
              tell the active document
                        set Text_Frame to the text frame "PH"
                        tell Text_Frame
                                  set theLines to every line
                                  if (theTextPos = "B") then
                                            tell theLines to set justification to left align
                                  else
                                            tell theLines to set justification to center align
                                  end if
                        end tell
              end tell
    end tell
    Throws errors about setting classes.
    ie
    error "Can’t set «class paln» of {\"MISSOULA COMMUNITY PHYSICIANS
    \", \"CENTER NO. 2
    \", \"CONDOMINIUM ASSOCIATION
    \", \"2827 FORT MISSOULA ROAD
    \", \"MISSOULA, MT 59804
    \"} to «constant mAOHcent»." number -10006 from «class paln» of {"MISSOULA COMMUNITY PHYSICIANS
    ", "CENTER NO. 2
    ", "CONDOMINIUM ASSOCIATION
    ", "2827 FORT MISSOULA ROAD
    ", "MISSOULA, MT 59804
    All I'm trying to do is center the text in a text frame if a condition is met, else left align it if another condition is met.
    Any suggestions woudl be appreciated.

    Don't get the lines first:
                                  if (theTextPos = "B") then
                                            set justification of every line to left align
                                  else
                                            set justification of every line to center align
                                  end if

  • Horizontal Alignment Issue

    I'm in my fifth day with Muse, and I must say that for a designer like me, Muse is pretty awesome! My congrats to the Muse team.
    The problem I'm having has to do with one of 7 pages (containing a detailed contact form) that jogs itself a few pixels to the left when you choose that page from the menu. The site is set to center horizontally. Nothing on the page extends beyond the Master page, either right or left. All the other pages register perfectly with one another. This "jog" happens on this page only in both browser preview and when uploaded to business catalyst.
    I've tried playing around with footer designations, and pinning things. But ... removing the footer designation from my form causes the page size to expand downward vertically in an unacceptable way. Pinning the email form seems to work in preview, but not when the site is uploaded.
    I suspect the real issue is with the detailed contact form itself: I've learned so far to religiously keep everything I don't want to extend beyond the default page size WITHIN the master page size. (I'm working with 1366x786). Unfortunately, after adjusting the detailed form to fit my design, the form itself has become 984 tall (taller than my Master page), and there appears to be NO WAY to adjust all that "blank space" below the visible and functional portion of the redesigned form. Unfortunately, the form's Width and Height input fields are greyed out. I suspect that this vertically enlarged form space is what is causing my problem with left-jogging that page.
    1. Is there any way to adjust the extended-and-unneeded form size to fit within my Master page, other than creating the form all over again?
    2. Is this enlarged form area a detailed contact form BUG?
    Thanks for any help.

    Hello,
    Could you please select the form and under states, check diffrent states  i.e "Submit in Progress, Submit Success and Submit Error".
    Select the different states and check if you find something at the bottom of the form which is placed at a distance causing the form to stretch and creating the blank space?
    If you are not able to find anything there, please send your .muse file to us to investigate? Please email it to [email protected] If your file is greater than 20mb you can use something like Adobe SendNow or SendThisFile.
    Please do not forget to mention link to this forum in your e-mail so that we can identify the file.
    Thanks & Regards,
    Sachin

Maybe you are looking for