Fixed Width JTextArea or JTextPane with 'as-needed' height

I'm trying to solve the above problem. I want to implement a text component that will have a defined width (say 200px) but will expand in height so that all text within the component is visible. I do not want a scrollbar.
The word wrapping capabilities of the above named components get me half way there however I can't seem to pull a preferred height from them based on a set width. I've tried many combinations of setPreferredSize(), setSize() etc and I can't seem to fiqure it out.
Any hints.
(As an added bonus It'd be good to add scrollbars 'ONLY' when the height of the text component now fills the vertical height of the screen)
Thanks very much
Adam

This is perhaps not the solution for all the things you want to do, but it might be some kind of starting point (?).
import java.awt.*;
import javax.swing.*;
class Testing extends JFrame
   private final static int MAX_WIDTH = 200;
   private final static int START_HEIGHT = 200;
   private final static int TASKBAR_HEIGHT = 25;
   public Testing()
      //Layout components
      JTextArea textArea = new JTextArea();
      textArea.setColumns(5);
      textArea.setLineWrap(true);
      textArea.setWrapStyleWord(true);
      textArea.setText("Millions and millions of test text all over the goddamn place");
      JScrollPane scroll = new JScrollPane(textArea);
      scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      getContentPane().add(scroll, BorderLayout.CENTER);
      //Set appropriate operation for closing application window
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      //Start UI thread
      pack();
      //Since UI thread is started all UI modifications must now run in UI thread
      try
         //Calculate application size and determine appropriate position on screen
         SwingUtilities.invokeAndWait(new Runnable()
            public void run()
               Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
               int screenHeight = (int) (screenSize.getHeight() - TASKBAR_HEIGHT);
               int applicationHeight = START_HEIGHT;
               if (applicationHeight > screenHeight)
                  applicationHeight = screenHeight;
               setSize(MAX_WIDTH, applicationHeight);
               int windowPositionX = (int) (screenSize.getWidth() - MAX_WIDTH);
               int windowPositionY = screenHeight - applicationHeight;
               setLocation(windowPositionX, windowPositionY);
         //Make aplication visible
         SwingUtilities.invokeLater(new Runnable()
            public void run()
               setVisible(true);
      } catch (Exception e)
   public static void main(String[] args)
      new Testing();
}You have to elaborate further if you want to use "dynamic" height depending of the amount of text in the text area (instead of using the above solution with final's for widht and height).
Since you mentioned the systray the above code takes into account that you use windows and the actual height will diminish due to the task bar (note that the value of 25 px might be different on, for example, Linux with KDE and MacOS X).
You also might want to remove the "pack()" since "setSize(x, y)" is used (I only added it when I did some elabortions and I did not remove it). If you remove pack you don't have to put the remaining code in the UI thread. If you don't remove pack, you probably should merge the two "invoke" calls into one...

Similar Messages

  • Fixed width for WebPart Zones with Tableless design lost width in IE8+, works fine in IE7 SharePoint 2010

    Hi,
    I am facing a weird issue in IE8 and above browser after changing the Tables to <div> (Table less) Design for SharePoint 2010 Layouts with Custom Web part Zones.
    If no webpart is added in Zones the width is not staying. refer the above Screen shot.
    A basic HTML with fixed width Div blocks no issue in IE8+. Only SharePoint this is a issue.
    Any lights here please help.
    thanks
    Vinod

    Hi,
    We can use IE F12 developer tools to check the CSS style in this Web Part Zones.
    Using F12 Developer Tools to Debug HTML and CSS
    https://msdn.microsoft.com/en-us/library/ie/gg699337%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
    Or try to add "!important" in your custom div CSS style.
    <style type="text/css">
    #divid{
    width: 1010px !important;
    </style>
    Best Regards,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • [iPhone] [Bug] Fixed Width Fonts Aren't

    Aren't fixed width, that is. I imagine they're still fonts. =)
    Recently I've been doing some ASCII art applications on the iPhone and I've noticed that things don't render the way I expect. I threw together some quick demonstration images of boxes rendered with fixed width fonts in TextMate.app and then on the iPhone simulator to show the difference. Although I used TextMate.app, similar results were found using TextEdit.app.
    First some boxes rendered in the fixed width font Monaco 12 pt in TextMate.app
    The first is a large 6x6 box with an interior of 5x5 spaces.
    The second box uses tabs. This is not an important box really--it's expected that different apps use different lengths for tab. In fact, this box looks completely different in TextEdit.app where the tabs are much wider. Don't worry too much about box number 2.
    The next box is a 3x3 box with one space in the center, and the last box is a 4x4 box with... well, you get the idea. Note how all boxes render as squares correctly.
    Now here's an image of the same boxes rendered with Monaco 12 pt on the iPhone's UITextView:
    Some problems are immediately visible. White space has some width, but it's far too small. I'm not too concerned about the tabs (box #2) since as I said above, I expect some variance in tabs, but the rest are pretty bad, especially box #3 whose single space looks positively anorexic. I focus a lot on white space here, because it's notable, but also notice that the + is wider than either the - or | as well.
    The Monaco font on the iPhone is not fixed width.
    The situation with Courier 12pt is slightly better but still has issues:
    Courier 12 pt on TextMate.app:
    Courier 12 pt on the iPhone:
    Unlike Monaco this is almost correct. Ignore box #2 again--I don't expect tab to work out. Courier doesn't have the same issue Monaco has with most characters. |, +, and - are all taking up the same width. However, as the boxes grow larger (Boxes 3, 4, and 1), the consecutive spaces start to show more and more how they're slightly too thin. It's barely perceptible in box 3, noticeable in box 4, and impossible to miss in box 1.
    It looks like the Courier font on iPhone has a space which is too narrow to be fixed width.
    As far as other things to try: I tried this with Andale Mono and Courier New as well with similar results. Also, although I've used a UITextView here, it also happens if you render a UIWebView containing the boxes inside of <pre> tags as well as outside of <pre> tags but use   for spaces.
    Has anyone else seen this phenomenon? Is there a fix or something I'm missing? Or is this a bug?
    Thanks!

    Bump. =(

  • Fixed width file outgoing with header,detail and trailer in one map

    we have a scenario where in we have to create an output file. the file is fixed width with three different kinds of records namely header, details and trailer. if the specification of the metadata of the file is specified how will we incorporate the creation of the file in one map since the map produces only one call to UTL_FILE and writes it.
    there is a work around in a crude way where in we can define the file as a CSV and pass everything in an appanded string in one column. but i wanted to know how we can get the three logical records in one map..
    thanks
    kamal

    The problem is not with generating the records.. i mean header , detail and trailer.
    it is how we put them into a fixed width sampled file. if we look at the code generated we will see only one call being made to generate the file.

  • [svn] 4793: Fix bug SDK-17734 Path with width and height set different than path data has incorrect bounds

    Revision: 4793
    Author: [email protected]
    Date: 2009-02-02 11:20:06 -0800 (Mon, 02 Feb 2009)
    Log Message:
    Fix bug SDK-17734 Path with width and height set different than path data has incorrect bounds
    Fix: When calculating the bounds position we should take into account the implicit scaling factor actualSize/naturalSize. Also did some refactoring, getting rid of the protected method calculateTopLeft.
    QE Notes: None
    Doc Notes: None
    Bugs: SDK-17734
    Reviewer: Ryan
    tests: mustella gumbo/layout/GraphicElement
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-17734
    http://bugs.adobe.com/jira/browse/SDK-17734
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/Ellipse.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/Path.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/graphicsClasses/GraphicElement.a s

    Thank you so much for replying.
    Yes I have removed and reinstalled WMP.
    I had good results with the PD6 application installed on the default path onto the C: drive with the one exception that if the application was launched by accident and the user data path was not available, the PD6 application would blow away my custom user path registry settings. Now that I know what they are I have made a .reg file to repair my registry to my desired user data paths.
    Installing the application on the removable drive appeared to help prevent me from launching the application by accident and overwriting my registry with default user paths.
    So which is the less of the two evils?
    If the application directory is not available, windows media player still tries to launch the .msi for installing PD6.
    If I install the application to the C: drive but the user data to the removable drive, launching the PD6 application without the user data drive will still corrupt my registry settings for a user data path.
    Both these issues seem like a logical (if not easy) fix that should be done in the PD6 application and installation package. I mean really, cannot anyone tell me why windows media player is checking the PD6 application directory? Why in PD4 did we have an option control for setting the user data path from the PD4 application? Why is this option not in the PD6 application, just the installer?
    I am given a choice during installation to move the user data to another non default location. Why else would this be provided if not to accommodate my kind of request to store the user data into an alternate location other than “My Document”. Certainly Palm is not trying to force the users on how to protect and store their personal data?
    Post relates to: Centro (Verizon)

  • My iPhone is having problems and I have to send it into Apple to get a fixed but in the mean while I need a phone. Could my old env touch act as a temporary replacement with the data plan? And if so how to I activate it with going to Verizon and once I ge

    My iPhone is having problems and I have to send it into Apple to get a fixed but in the mean while I need a phone. Could my old env touch act as a temporary replacement with the data plan? And if so how to I activate it with going to Verizon and once I get my IPhone back will I be able to activate it without going to the Verizon store?!? Thanks:)

    Im sorry. Im on my ipad and i didnt read that.
    Sorry again

  • I play Zuma Blitz on FB; Ever since I upgraded to Firefox 4 I can't play the game the darn frog pauses before shooting and it's a mess; you know it's what I enjoy doing and it needs to be fixed can you help me with this??? Thanks

    Question
    I play Zuma Blitz on FB; Ever since I upgraded to Firefox 4 I can't play the game the darn frog pauses before shooting and it's a mess; you know it's what I enjoy doing and it needs to be fixed can you help me with this??? I am super frustrated ith the situationThanks

    Upgrading to firefox 5 and updating my plug-ins helped a bit. Frog is less 'sticky' now, but it's not solved the problem. Java needs to be up to speed or the frog goes into stasis....

  • Setting fixed width on columns with the Column Graph Tool

    Hi,
    I'm trying to perfect my charts a little.
    Right now the width of my columns using the Column Graph Tool seem to be dictated by how many columns I got in total. So if I only have two columns both get really wide. But if I have four, they look just nice. Is there any way to set a fixed width on columns with the Column Graph Tool?
    Thanks!

    What am I thinking.
    Select your graph double click the graph tool at the bottom of the dialog, enter the percentage you want the coulmns to be  and the percentage you want that cluster to occupy.
    Duh!

  • Issue with having to declare fixed width for my top level floated LI in horizontal menu

    Hi and thanks for taking a look at my problem:
    I am having trouble getting my sub menus to display correctly in IE.
    Originally i didn't declare a fixed width for my top level li and it displayed perfectly in all browsers except IE.
    If i don't declare a fixed width for my floated floated elements, IE treates the top level li as the same width as the ul they contain (which I don't want). So I declared a width for the ul.MenuBarHorizontal li to be 80px, which is close to the minimum width that i want to use for the top level list items. However, in actual fact, the top level list items all have individually declared widths in the classes they are assigned.
    How can i re-write the html or CSS so that the browser, mainly IE, reads the correct widths for the top level ist li??
    Here is a link to the page with the problem
    Thanks in advance if anyone can help me out.

    Hi Beth,
    thanks so much for your repsonse.
    I will take your notes and advice and see if i can apply it to the actual page i was referring to. It seems you were now looking at a completely different page with a different (albeit spry) horizontal menu.
    Again, i truly appreciate your time and advice.
    Thanks!

  • The demand of my application is that i can not replace for loop with a while loop.because i need fixed number of iterations and as far as i know fixed iterations could be only with possible with the for loop.

    the demand of my application is that i can not replace for loop with a while loop.because i need fixed number of iterations and as far as i know fixed iterations could be only with possible with the for loop.
    your recommended second option that i could add true/false case.
    this true/false case must be inside the for loop or outside the for loop?if this case is inside the for
    loop, how can i send stop command from outer while
    loop?
    more over do you have any example for this please?
    thanks"

    You can execute a fixed number of iterations using a while loop by comparing the iteration count to the number of iterations you want and wiring the output of that comparison (e.g. Less Than or Equal To) to the continue (or stop) terminal of your while loop. Which comparison you use depends on personal preference, where you wire the desired count and the interation count, and whether you're using the while loop as Continue if True or Stop if True.
    Ben gave you step-by-step instructions in response to your previous question. Look here for Ben's response.
    Ben's response looks pretty good and detailed to me. It certa
    inly deserved better than a 1-star rating.

  • Problem with printing perfomance when using a fixed width font

    Hello.
    I'm using the java.awt.print.Printable interface for printing text.
    Everything works fine when I choose a font like Serif.
    When I choose a fixed width font, like Courier, the printing becomes too slow!!!
    Any Idea?
    My code looks like that :
    private int sizeFont = 10;
    private font myFont = new Font ("Courier", Font.PLAIN, sizeFont);
    public int print(Graphics g, PageFormat pf, int indice)
    Graphics2D g2=(Graphics2D)g;
    while(myCondition){
    g2.drawString(myString,0,0);
    g2.translate(0,this.sizeFont);
    return Printable.PAGE_EXISTS;

    If it interests someone, I have found a solution :
    do not use "Courier", but "Courier New" .

  • How can I convert my web page from a fixed width layout to a fluid grid layout?

    I'm taking a web design class (I'm using Dreamweaver CS6, btw)  wherein the professor started us out building our websites in a fixed width layout but now I want to change my site into a fluid grid layout. My "site" so far is just one long page, and I've already designed it with fluid grid adjustments in mind (most things are centered  in the layout) so it shouldn't need excessive tweaking.
    Is there a way to duplicate the site folder that holds my first page, re-open a new document in fluid, then copy the code in and tweak the width parameters for the different layouts?
    Did I just answer my own question? Help - I am new at this!!
    Thanks all,
    KC

    Herbert2001 wrote:
    A bit off-topic, but Osgood: have you ever used SASS or LESS? When you are building your own grid systems it can save you a tremendous amount of time, and it's a lot of fun.
    Take the following simple example - it generates all the 23 css classes automatically for a 12 grid system. And simply changing one variable allows you to create and calculate any number of columns!
    //variables
    $desktop: 1025px;
    $large-columns: 12;
    @media only screen and (min-width: $desktop) {
         //regular grid span classes
        @for $i from 1 through $large-columns {
            .span-large-#{$i} {
                width: percentage($i/$large-columns);
         // push classes
        @for $i from 1 through (($large-columns)-1) {
            .push-large-#{$i} {
                margin-left: percentage($i/$large-columns);
    No, not explored it yet, and may never....I don't know. I don't really make much money out of web design. It's becoming more and more difficult to find the desire to learn new techniques when the opportunities aren't really there to put them into practice on as regular basis as I would like.  I've got  a very good handle on css, php, html, jQuery - I'm not sure I want to add another layer at the moment, given I'm never quite sure how long I will continue to 'bang my head against the wall' . I'm getting to the stage where I keep asking myself do I really need the problems associated with learning new stuff to the point of being comfortable with it if the financial rewards at the end don't equate to the efforts of learning it.
    I don't really enjoy web development if truth is known. I come from a Graphic Design background which I much prefer but somehow got side tracked and pushed in this direction and there's no way back now, lol. Whilst I concede Web Development is much more exciting its also 100 times more complex/difficult and the skills needed are considerably more.
    Your example looks interesting and I should think I could pick it up reasonably easily given I work with php which uses variables on a similar basis.

  • How to create a fixed-width column within an APEX 4 interactive report?

    This thread is a follow-up to {message:id=9191195}. Thanks fac586.
    Partial success: The following code provided by fac586 limits the column width of the Apex 4 interactive report column as long as the column data contains whitespace within a Firefox 3.6 browser:
    <pre class="jive-pre">
    <style type="text/css">
    th#T_DESCRIPTION {
    width: 300px;
    td[headers="T_DESCRIPTION"] {
    width: 300px;
    word-wrap: break-word;
    </style>
    </pre>
    Notes:
    1. The code above is put into the HTML header section for the page.
    2. T_DESCRIPTION is defined as VARCHAR2(2000).
    3. The code above works within the Firefox 3.6.12 browser but does not work within the Internet Explorer 7.0.5730.13 browser.
    I tried adding "float: left;":
    <pre class="jive-pre">
    <style type="text/css">
    th#T_DESCRIPTION {
    width: 300px;
    td[headers="T_DESCRIPTION"] {
    width: 300px;
    word-wrap: break-word;
    <font color="red"> float: left;</font>
    </style>
    </pre>
    Notes:
    1. "float: left;" does not require whitespace and successfully splits the column between characters in lieu of whitespace.
    2. "float: left;" shrinks the cell height and allows the page background to show through... couldn't determine how to fix this.
    3. The code above works within the Firefox 3.6.12 browser but does not work within the Internet Explorer 7.0.5730.13 browser.
    I've done some more research, but I still haven't discovered how to create a fixed-width column within an APEX 4 interactive report that displays properly within an Internet Explorer 7 browser.
    Any ideas and help will be appreciated.

    Thanks for your help with this!
    <pre class="jive-pre">
    what theme are you using?
    </pre>
    A customized version of theme 15.
    <pre class="jive-pre">
    Floating a table cell makes no sense (to me anyway).
    </pre>
    You are correct. I was just trying a different approach ... trying to think out of the box.
    <pre class="jive-pre">
    Think you'll need to create an example on apex.oracle.com with sample data
    if there are any further problems.
    </pre>
    Great suggestion! The code your provided works in the Firefox 3.6.12 browser, but still doesn't work within my Internet Explorer 7.0.5730.13 browser.
    UPDATE:
    I have recreated the problem at apex.oracle.com, you can use the following information to check it out:
    URL: http://apex.oracle.com/pls/apex/f?p=43543:100::::::
    Workspace: IR_FIXED_WIDTH_COLS
    Username: GUEST
    Password: Thx4help
    Application: 43543 - CM_RANDY_SD
    Note: Table name is TEST_DATA
    The following code provided by fac586 works in both Firefox 3.6 and IE7 using default theme "21. Scarlet" at apex.oracle.com; however, it doesn't work when I use a copy of our customized theme "101. Light Blue":
    <pre class="jive-pre">
    <style type="text/css">
    .apexir_WORKSHEET_DATA {
    th#T_DESCRIPTION {
    width: 300px;
    max-width: 300px;
    td[headers="T_DESCRIPTION"] {
    max-width: 300px;
    word-wrap: break-word;
    </style>
    <!--[if lt IE 8]>
    <style type="text/css">
    /* IE is broken */
    th#T_DESCRIPTION,
    td[headers="T_DESCRIPTION"] {
    width: 300px;
    </style>
    <![endif]-->
    </pre>
    Any idea what in the theme could be causing the fixed width column to be ignored in IE 7?
    Edited by: CM Randy SD on Dec 7, 2010 11:22 AM

  • FDM Fixed-Width Import Format & Multiple Accounts/Periods Issue

    Hi FDM experts,
    I have an issue that I wanted to reach out to you on regarding fixed-width import formats and how to cater for my current scenario for export to Hyperion Planning.
    I am working with a flat file (.txt) I need to import to FDM with the current format;
    A
    B
    C
    D
    E
    F
    G
    Z
    Year
    Channel
    Product
    Jan-MTD-Account 1
    Jan-MTD-Account 2
    Jan-YTD-Account1
    Jan-YTD-Account2
    Dec-YTD-Account2
    2013
    Channel_1
    Product_1
    1000
    2000
    1000
    2000
    10000
    These are all fixed in width so the field lengths will need to be defined in the import format. The requirement for loading to the system is only a speciifc Month YTD value for both Account1 and Account 2.
    If my chosen Month is 2013 Jan, I will only require columns F and G to be loaded. These are the issues I have identified;
    Can a fixed width import format cater for loading to multiple accounts in the same file? Or would I need a separate import format per account?
    Can a fixed width import format cater for loading to a variable Actual Month period? Or do I need 12 import formats/locations per month?
    Your help is much appreciated!
    Many thanks
    Aaron

    Hi Aaron,
    the solution you are looking for needs pivoting your source file.
    Think that FDM, by default, only accepts files with one single column for amount. You have to pivot your file based on your logic and import the pivoted file.
    For example:
    Year     Channel     Product     ... Jan-YTD-Acc1     Jan-YTD-Acc2 ...
    2013     CH1          PR1               1000                    2000
    If your POV is Jan-2013, your data imported will look like:
    Year     Channel     Produc     Account     Amount
    2013     CH1          PR1          ACC1          1000
    2013     CH1          PR1          ACC2          2000
    All this process can be automated by playing with Import Scripts.
    HTH

  • Spry menubar not working correctly in IE9 - fixed width or padding or...?

    Need help.  My spry menu bar isn't all the way to the right when in compatibility mode in IE9.  When not in compatibility mode it is even further from the right.  Is there a way to make it so that it is all the way to the right on both compatibility and non-compatibility modes.  Is there a better way than changing the padding or can I do a fixed width?  www.superedgar.com
    The spry code is below.
    LAYOUT INFORMATION: describes box model, positioning, z-order
    /* The outermost container of the Menu Bar, an auto width box with no margin or padding */
    ul.MenuBarHorizontal
    margin: 0;
    padding: 0;
    list-style-type: none;
    font-size: 100%;
    cursor: default;
    width: auto;
    font-family: Arial, Helvetica, sans-serif;
    /* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */
    ul.MenuBarActive
    z-index: 1010;
    /* Menu item containers, position children relative to this container and are a fixed width */
    ul.MenuBarHorizontal li
    margin: 0;
    padding: 0;
    list-style-type: none;
    font-size: 100%;
    position: relative;
    text-align: left;
    cursor: pointer;
    width: auto;
    float: left;
    white-space: nowrap;
    border-top-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-left-width: 1px;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
    border-top-color: #cccccc;
    border-right-color: #cccccc;
    border-bottom-color: #cccccc;
    border-left-color: #cccccc;
    background-image: url(../images/Menu%20Bars/metalsubmenubargray.gif);
    /* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
    ul.MenuBarHorizontal ul
    margin: 0%;
    padding: 0;
    list-style-type: none;
    font-size: 100%;
    z-index: 1020;
    width: auto;
    left: -1000em;
    float: none;
    white-space: nowrap;
    background-image: url(../images/Menu%20Bars/metalsubmenubargray.gif);
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
    cursor: auto;
    left: auto;
    background-image: url(../images/Menu%20Bars/metalsubmenubargray.gif);
    /* Menu item containers are same fixed width as parent */
    ul.MenuBarHorizontal ul li
    float: none;
    width: 14em;
    background-image: url(../images/Menu%20Bars/metalsubmenubargray.gif);
    /* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */
    ul.MenuBarHorizontal ul ul
    margin: -5% 0 0 95%;
    border-right-style: solid;
    border-left-style: solid;
    border-right-color: #999999;
    border-left-color: #999999;
    border-right-width: 2px;
    border-left-width: 1px;
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible
    left: 0;
    DESIGN INFORMATION: describes color scheme, borders, fonts
    /* Submenu containers have borders on all sides */
    ul.MenuBarHorizontal ul
    position: absolute;
    width: 14em;
    /* Menu items are a light gray block with padding and no text decoration */
    ul.MenuBarHorizontal a
    display: block;
    cursor: pointer;
    color: #392B68;
    text-decoration: none;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bold;
    padding-top: 8px;
    padding-right: 29px;
    padding-bottom: 7px;
    padding-left: 30px;
    /* Menu items that have mouse over or focus have a blue background and white text */
    ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus
    color: #392B68;
    background-image: url(../images/Menu%20Bars/metalsubmenubargrayhover.gif);
    /* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */
    ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible
    color: #392B68;
    width: auto;
    float: none;
    SUBMENU INDICATION: styles if there is a submenu under a given menu item
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal a.MenuBarItemSubmenu
    background-position: 95% 50%;
    color: #392B68;
    width: auto;
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal ul a.MenuBarItemSubmenu
    background-position: 95% 50%;
    color: #FCFDFF;
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal a.MenuBarItemSubmenuHover
    background-position: 95% 50%;
    width: auto;
    float: none;
    color: #392B68;
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal ul a.MenuBarItemSubmenuHover
    background-position: 95% 50%;
    color: #FCFDFF;
    width: auto;
    BROWSER HACKS: the hacks below should not be changed unless you are an expert
    /* HACK FOR IE: to make sure the sub menus show above form controls, we underlay each submenu with an iframe */
    ul.MenuBarHorizontal iframe
    position: absolute;
    z-index: 1010;
    /* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */
    @media screen, projection
    ul.MenuBarHorizontal li.MenuBarItemIE
    display: inline;
    f\loat: left;

    because of the interpretation of the different browsers, it is very difficult to get the correct outcome each time.
    In your case, I would do exactly as you have done, that is apply an auto width to the menu item and then apply a padding to fill the rest. I then centre the menubar so that the difference is equally divided betweeen left and right.
    Gramps

Maybe you are looking for

  • POST is not working in IE11, GET works.

    Hi, There is a problem while execution of POST function using XMLHttpRequest, the same code works fine in IE8, here is the code. if (window.XMLHttpRequest !== undefined) {// code for IE7+, Firefox, Chrome, Opera, Safari var httpOb=new XMLHttpRequest(

  • Cannot connect to itunes/windows help please!!!

    Hi, I have a 8gb ipod touch i brought it in australia and now im back in england, i cannot seem to connect to itunes, when i plug the cable in it makes the noise to say its connected and then the ipod camera window pops up but still doesnt connect to

  • Missing pop up menu

    When I click an option, quick selection tool for example, I don't also get the pop up for further choices such as brush size. This happens for all options.

  • Wanting to do multitrack playback in Logic Pro 8

    I have googled this topic to death and hoping someone out there maybe able to point me in the right direction. I am trying to playback my recordings as a multitrack playback. When I playback my recordings, Logic plays it out as a stereo 2 track. Mayb

  • Confirm PO updated in table before GR

    Hi All, I have program to create PO via BAPI_PO_CREATE and followed by BAPI_GOODSMVT_CREATE to do GR. When there is little PO line items, after PO created, no problem in create material document through BAPI_GOODSMVT_CREATE  but when PO line items al