Trying to do something very strange with layouts and painting components

I'm trying to do something very strange with changing the layout of a container, then painting it to a bufferedImage and changing it back again so nothing has changed. However, I am unable to get the image i want of this container in a new layout. Consider it a preview function of the different layouts. Anyway. I've tried everything i know about swing and have come up empty. There is probably a better way to do what i am trying to do, i just don't know how.
If someone could have a look perhaps and help me out i would be much appreciative.
Here is a self contained small demo of my conundrum.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;
// what is should do is when you click on the button "click me" it should place a image on the panel of the buttons in a
// horizontal fashion. Instead it shows the size that the image should be, but there is no image.
public class ChangeLayoutAndPaint
     private static JPanel panel;
     private static JLabel label;
     public static void main(String[] args)
          // the panel spread out vertically
          panel = new JPanel();
          panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
          // the buttons in the panel
          JButton b1, b2, b3;
          panel.add(b1 = new JButton("One"));
          panel.add(b2 = new JButton("Two"));
          panel.add(b3 = new JButton("Three"));
          b1.setEnabled(false);
          b2.setEnabled(false);
          b3.setEnabled(false);
          // the label with a border around it to show size in a temp panel with flowlayout to not stuff around
          // with the actual size we want.
          JPanel thingy = new JPanel();
          label = new JLabel();
          label.setBorder(new LineBorder(Color.black));
          thingy.add(label);
          // the button to make things go
          JButton button = new JButton("click me");
          button.addActionListener(new ActionListener(){
               public void actionPerformed(ActionEvent e)
                    //change layout
                    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
                    panel.doLayout();
                    //get image
                    BufferedImage image = new BufferedImage(panel.getPreferredSize().width, panel.getPreferredSize().height, BufferedImage.TYPE_INT_ARGB);
                    Graphics2D g = image.createGraphics();
                    panel.paintComponents(g);
                    g.dispose();
                    //set icon of jlabel
                    label.setIcon(new ImageIcon(image));
                    //change back
                    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
                    panel.doLayout();
          // the frame
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setSize(400,200);
          frame.setLocation(100,100);
          frame.getContentPane().add(panel, BorderLayout.NORTH);
          frame.getContentPane().add(thingy, BorderLayout.CENTER);
          frame.getContentPane().add(button, BorderLayout.SOUTH);
          frame.setVisible(true);
}

Looks like you didn't read the API for Container#doLayout().
Causes this container to lay out its components. Most programs should not call this method directly, but should invoke the validate method instead.
There's also a concurrency issue here in that the panel's components may be painted to the image before revalidation completes. And your GUI, like any Swing GUI, should be constructed and shown on the EDT.
Try this for size -- it could be better, but I've made the minimum possible changes in your code:import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.border.LineBorder;
public class ChangeLayoutAndPaint {
  private static JPanel panel;
  private static JLabel label;
  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        // the panel spread out vertically
        panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
        // the buttons in the panel
        JButton b1, b2, b3;
        panel.add(b1 = new JButton("One"));
        panel.add(b2 = new JButton("Two"));
        panel.add(b3 = new JButton("Three"));
        b1.setEnabled(false);
        b2.setEnabled(false);
        b3.setEnabled(false);
        // the label with a border around it to show size in a temp panel with flowlayout to not stuff around
        // with the actual size we want.
        JPanel thingy = new JPanel();
        label = new JLabel();
        // label.setBorder(new LineBorder(Color.black));
        thingy.add(label);
        // the button to make things go
        JButton button = new JButton("click me");
        button.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            //change layout
            panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
            //panel.doLayout();
            panel.revalidate();
            SwingUtilities.invokeLater(new Runnable() {
              @Override
              public void run() {
                //get image
                BufferedImage image = new BufferedImage(panel.getPreferredSize().width,
                    panel.getPreferredSize().height, BufferedImage.TYPE_INT_ARGB);
                Graphics2D g = image.createGraphics();
                panel.paintComponents(g);
                g.dispose();
                //set icon of jlabel
                label.setIcon(new ImageIcon(image));
                //change back
                panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
                //panel.doLayout();
                panel.revalidate();
        // the frame
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(400, 200);
        frame.setLocation(100, 100);
        frame.getContentPane().add(panel, BorderLayout.NORTH);
        frame.getContentPane().add(thingy, BorderLayout.CENTER);
        frame.getContentPane().add(button, BorderLayout.SOUTH);
        frame.setVisible(true);
}db
edit I prefer this:import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import javax.swing.*;
public class LayoutAndPaint {
  JPanel panel;
  JLabel label;
  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        new LayoutAndPaint().makeUI();
  public void makeUI() {
    JButton one = new JButton("One");
    JButton two = new JButton("Two");
    JButton three = new JButton("Three");
    one.setEnabled(false);
    two.setEnabled(false);
    three.setEnabled(false);
    panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(one);
    panel.add(two);
    panel.add(three);
    label = new JLabel();
    JButton button = new JButton("Click");
    button.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        layoutAndPaint();
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(400, 400);
    frame.add(panel, BorderLayout.NORTH);
    frame.add(label, BorderLayout.CENTER);
    frame.add(button, BorderLayout.SOUTH);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  private void layoutAndPaint() {
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    panel.revalidate();
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        BufferedImage image = new BufferedImage(panel.getPreferredSize().width,
            panel.getPreferredSize().height, BufferedImage.TYPE_INT_ARGB);
        Graphics g = image.createGraphics();
        panel.paintComponents(g);
        g.dispose();
        label.setIcon(new ImageIcon(image));
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
        panel.revalidate();
}db
Edited by: DarrylBurke

Similar Messages

  • Is there something very wrong with Lion and Fcp x or what?

    I have just spent a very frustrating two weeks editing a one hour fifteen minute project on FCP X with Lion as the operating system. Every edit session has been plagued with crashes. My mac is a 21.2 inch, with an I7 processor and 12gig of ram which I bought the middle of this year. I had set my computer up with two partitions, one with Lion and the other with Snow leopard. This morning, in an effort to improve the terrible instability of FCP X under Lion I decided to try it under Snow Leopard......What an unbelievable difference.....I've been editing for the last three hours now throwing all kinds of clips and effects and so forth at the timeline and have not experienced one crash. What is going on here? How can Lion and FCP X be so incompatible?

    dpcam1 wrote:
    I have just spent a very frustrating two weeks editing a one hour fifteen minute project on FCP X with Lion as the operating system.
    You don't mention whether this one hour and fifteen minutes long project consisted of just one FCP X project when you experienced problems with FCP X and Lion?
    You also don't mention how long the project was that you edited successfully with Snow Leopard. If, as I suspect, this was a very short 'test' project, that would make sense. FCP X does not cope well with long projects.
    I use Lion exclusively but I keep my projects to a maximum of 30 minutes (preferably no more than 20 mins). If the total programme is longer, I make create several FCP X projects - each being a 'chapter' of the main programme. When finished, I make compound clips of all the 'chapters' then I paste them into a new (full length) project.
    I'm not pretending FCP X is perfect, but for me at least, it's very workable as long as you understand it's weaknesses. I have 16 GB RAM and since I upgraded from the 8 GB I had previously, it's made a huge difference.
    If you are getting crashes, there is some conflict on the OS. Create a new (admin) user account on your system and use FCP X from there - if it runs a lot better, there's a conflict and a clean install would be recommended.
    Other ways to improve performance:
    Create optimised media.
    Hide Waveforms at all times when you don't need them (both in Browser and Storyline / Timeline). They take up a lot of processor power.
    Create folders in the Project library and put any projects you are not working on currently, in there. (Twirl it closed to hide them).
    Move your Projects and Events to an external HD (make sure it's formatted OS Extended - with journaled on or off) and run from there.
    Andy

  • TS2446 Hello, I'm Bethany and I'm having trouble with my apple ID I tried to buy something from he app store and they assed me some questions and anyway i have locked my account and don't know how to unlock any help with be very helpful thanks.

    Hello, I'm Bethany and I'm having trouble with my apple ID I tried to buy something from he app store and they assed me some questions and anyway i have locked my account and don't know how to unlock any help with be very helpful thanks.

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • TS1538 Hi technical support Team of  Apple  I am sorry but this time  I am very disappointed with IPhone and  IOS 7.1, actually I have IPhone 5,5S both and I was trying to Restore  my Phone for sell Because I want to by IPhone 64 Gold but unfortunately   

    Hi technical support Team of Apple  I am sorry but this time  I am very disappointed with IPhone and  IOS 7.1, actually I have IPhone 5,5S both and I was trying to Restore  my Phone for sell Because I want to by IPhone 64 Gold but unfortunately    both phone stuck on recovery mode with error 1, and 3
    I got Error 3 on IPhone 5 and error 1 In IPhone 5s , I did lot of try as I can my level best , like Update iTunes, stop all security, change cable even change computer format my laptop and install everything fresh in window   I did try to with Mac of my friend,
    Change Internet connections try with DFU mode, Make DFU file Also with redsnow   everything I did
    Whatever on internet information like go to  cmd and run as administrator  to make change hosts file
    Like ipconfig/flushdns everything  everything  what I can….  but I dint get good results and  good information about this error
    Somebody told me this is hardware problem, I make change my battery and charging connector too.
    I don’t know what to do next.. because  I don’t leave any experiment on my stuck phone..
    Note : one  is big issue that apple support team  is also and giving good answer
    I am in Saudi Arabia so I don’t  have any nearest store of Apple.. even Saudi Is Big Consumer of IPhone
    Its Really Bad its big Loss of Money I can’t afford more , Now will not Buy Any IPhone  in future if I don’t get solution..
    Thank You..

    What the **** is this taht you will not provide any service due to just a bit jailbreak..
    we are not much tecnical person.. and mostly consumer dont have good idea about Jailbreak. make your device  much better secure from hacker and jailbreak please we cant afford much money please give me any solution i ll not do jailbreak again please  

  • I'm trying to download vm Fusion 5 so I can run Windows 7 on my new iMac. But I am very inexperienced with computers and was wondering if anyone could help walk me through the process.

    I'm trying to download vm Fusion 5 so I can run Windows 7 on my new iMac. But I am very inexperienced with computers and was wondering if anyone could help walk me through the process.

    post in the vmware forum or call vmware customer support.

  • I have a comment.  I am very upset with Photoshop and all your tutorials regarding the quick select tool.  I have watched many tutorials and read instructions until I am blue in the face.  This tool does not work.  It is all over the place and all of your

    I have a comment.  I am very upset with Photoshop and all your tutorials regarding the quick select tool.  I have watched many tutorials and read instructions until I am blue in the face.  This tool does not work.  It is all over the place and all of your tutorials make it look so simple.  How can you advertise this as a viable tool when it just doesn't work?

    It is all over the place and all of your tutorials make it look so simple.
    This is a user to user Forum, so you are not really addressing Adobe here, even though some Adobe employees thankfully have been dropping by.
    How can you advertise this as a viable tool when it just doesn't work?
    Concluding something does not work because you fail at using it is not necessarily always justified.
    The Quick Selection Tool certainly has limitations, but your post seems to be more about venting than trouble-shooting – otherwise you might have posted an image where you failed to get an expected result.

  • I bought my i pod touch from us but i live in india .i have been using this from many days fr just a few days before something went wrong with it and the date and time has changed what do i do?

    i bought my i pod touch from us but i live in india .i have been using this from many days fr just a few days before something went wrong with it and the date and time has changed what do i do?

    Have you went to Settings>General Time&Date and correct the time.  Make sure the time zone is correct too.  Also go to Settings>General>Inernational and make sure the Gergorian calender is selected.

  • HT1848 I'm trying to sync my ipad mini with itunes and i get an error message '' there is no free space on your ipad mini''..... any ideas on how to empty some space on ipad mini manually? currently i run on 6.0.2

    I'm trying to sync my ipad mini with itunes and i get an error message '' there is no free space on your ipad mini''..... any ideas on how to empty some space on ipad mini manually? currently i run on 6.0.2

    iOS device backups are stored in your iTunes library.
    Move your iTunes library to an external drive.

  • Trying to make a purchase online with Skype and is telling me to contact you guys

    Trying to make a purchase online with Skype and is telling me to contact you guys

    We are fellow users here on these forums - if you are getting a message to contact iTunes Support then you can do so via this link and ask them for help : http://www.apple.com/support/itunes/contact/ , then click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • How do I sync Google contacts.I've tried opening Address Book, clicking "sync with Google"  and clicking onSync icon. But no luck

    How do I sync Google contacts.I've tried opening Address Book, clicking "sync with Google"  and clicking Sync icon. But no luck

    just enable iCloud sync and then configure, setup and then disable it. Re-setup Google and it will work

  • Found something very strange about Memory Bandwidth

    Okay ever since I posted my 3.2Ghz overclock thread i've been doing some testing...
    rolling back to 3Ghz from 3,2Ghz gives me 100% stability with prime95, which isn't that weird, BUT!
    When I boot with a FSB of 250 (3Ghz) DDR400 (200Mhz) (4:5 divider) in the BIOS and run a memory bandwidth test in SiSoft Sandra I get a memory score of
    ~4800Mb/s
    Which isn't that strange... A good score..
    When I boot with a FSB of 267 (3,2Ghz) DDR427 (213,5Mhz) (4:5 divider) in the BIOS and run a memory bandwidth test in SiSoftware Sandra I get a memory score os
    ~5150Mb/s
    Which isn't eithat that strange, a resonable gain considering the few extra Mhz I pumped out of the DDR (running at 2,5-3-3-6).
    But here comes the really really strange part...
    I boot with a FSB of 267 (3,2Ghz) into windows..
    I change the FSB to 250 (3Ghz) with CoreCenter or ClockGen..
    DDR goes back to 200Mhz (DDR400) (this all confirmed with Z-CPU)
    I run a memory Bandwidth test in SiSoftware Sandra (restarted the program, not just running another one on top) and I get a memory score of...
    ....~5150Mb/s
    I get similar scores running other benchmarks (in this case Aquamark3) that would suggest that there is a much greater performance loss in setting the BIOS FSB to 250Mhz rather than setting it to 367Mhz then lowering it in windows.
    Does anyone have any idea why this happends?
    I am really interested in peoples theories
    Neo2-LS 1.8
    P4 2,4C @ 3Ghz | 1Ghz FSB
    2x256M Dual DDR400 @ 2,5-3-3-6-8 200Mhz
    Radeon 9500PRO
    Antec TruePower 430W

    the 367 in the end is a typo, ment to say 267... ~1050Mhz FSB - 3,2Ghz for a 2,4C
    Quote
    Originally posted by goalie20
    Maybe I'm not reading your post carefully enough-(its been along day)but on the final configuaration what are your memory timings? Also did you mean to say setting timings to 267 as opposed to 367?
    My DDR timings are listed at the end of my post.. The same timings are used when i'm running at 3Ghz and 3,2Ghz. 2.5-3-3-6
    At 3Ghz with a DDR Speed of 333 I get 400Mhz (200Mhz per module) running FSB 250 (from 200)
    Quote
    Originally posted by REILLY875
    I am confused to... When you say 367MHZ do you mean memory speed at a 5:4 ratio?..Sean REILLY875
    Yes i'm running at a 5:4 ratio.. 367 is a typo, I ment to say 267 and I ment the FSB not the memory..
    Quote
    Originally posted by NovJoe
    What is your DRAM speed set as in BIOS?
    What does your DDR Clock in BIOS shows?
    Check with CPUZ and see what Freq x 2 is your RAM running at?
    The DRAM Speed is left at 4:5 (333) and the speed is 427Mhz when booting to 3,2Ghz (FSB 267)
    The DRAM Speed is left at 4:5 (333) and the speed is 400Mhz when booting to 3Ghz (FSB 250)
    READ THIS CAREFULLY
    Okay, to put this simply...
    Overclock in BIOS to 3Ghz with a DDR Ratio of 5:4
    BIOS FSB: 250
    BIOS DDR: 400
    Sandra Memory Bandwidth Benchmark Score: ~4800Mb/s
    Overclock in BIOS to 3,2Ghz with a DDR Ratio of 5:4
    BIOS FSB: 267
    BIOS DDR: 427
    CPU Speed: 3,2Ghz
    Sandra Memory Bandwidth Benchmark Score: ~5150Mb/s
    So far nothing strange, okay?
    -This is where it gets tricky...-
    Overclock in BIOS to 3,2Ghz with a DDR Ratio of 5:4
    BIOS FSB: 267
    BIOS DDR: 427
    CPU Speed: 3,2Ghz
    In Windows I change the FSB back to 250.
    FSB: 250
    DDR: 400
    CPU Speed: 3Ghz
    Sandra Memory Bandwidth Benchmark Score: ~5150Mb/s
    To cut this short...
    I get more memory bandwidth when booting to 3,2Ghz than 3Ghz even though when i'm in windows I change back to 3Ghz from 3,2Ghz.¨
    Any more questions? =)
    This is really easy if you just read it all closely and if I don't make any more typos :D

  • Problem with layout and spry menu in IE

    My navigation bar looks fine in Foxfire and Safari, but is all messed up in IE.
    here is a link to the page:
    http://vacationlandphotography.com/tls/header.html
    here is my code:
    <html>
    <head>
    <title>The Landing School</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <!-- ImageReady Styles (header.psd) -->
    <style type="text/css">
    <!--
    body {
        text-align:center;
        background-color: #000000;
    #wrapper {
        margin: 0 auto;
        width: 1000;
        text-align:left;
    #Table_01 {
        margin: 0 auto;
        left:0px;
        top:0px;
        width:1000px;
        height:133px;
    #header-01 {
        position:relative;
        left:0px;
        top:0px;
        width:1000px;
        height:102px;
    #header-02 {
        position:relative;
        left:0px;
        top:0px;
        width:720px;
        height:30px;
    #header-03 {
        position:relative;
        left:697px;
        top:-31px;
        width:141px;
        height:31px;
    #header-04 {
        position:relative;
        left:838px;
        top:-61px;
        width:29px;
        height:31px;
    #header-05 {
        position:relative;
        left:867px;
        top:-92px;
        width:30px;
        height:31px;
    #header-06 {
        position:relative;
        left:897px;
        top:-123px;
        width:31px;
        height:31px;
    #header-07 {
        position:relative;
        left:928px;
        top:-154px;
        width:27px;
        height:31px;
    #header-08 {
        position:relative;
        left:955px;
        top:-185px;
        width:45px;
        height:31px;
    -->
    </style>
    <!-- End ImageReady Styles -->
    <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css">
    </head>
    <body style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;">
    <div id="wrapper">
    <!-- ImageReady Slices (header.psd) -->
    <div id="Table_01">
        <div id="header-01">
            <img src="images/header_01.gif" width="1000" height="102" alt="">  </div>
        <div id="header-02">
          <ul id="MenuBar1" class="MenuBarHorizontal">
            <li><a class="MenuBarItemSubmenu" href="#">Wooden Boat Building</a>
                <ul>
                  <li><a href="#">Overview </a></li>
                  <li><a href="#">Career Options</a></li>
                  <li><a href="#">Alumni Profile</a></li>
                  <li><a href="#">Syllabus</a></li>
                  <li><a href="#">Admission</a></li>
              </ul>
            </li>
            <li><a href="#" class="MenuBarItemSubmenu">Composite Boat Building</a>
              <ul>
                <li><a href="#">Overview</a></li>
                <li><a href="#">Career Options</a></li>
                <li><a href="#">Alumni Profile</a></li>
                <li><a href="#">Syllabus</a></li>
                <li><a href="#">Admission</a></li>
              </ul>
            </li>
            <li><a class="MenuBarItemSubmenu MenuBarItemSubmenu" href="#">Yacht Design</a>
              <ul>
                <li><a href="#">Overview</a></li>
                <li><a href="#">Career Options</a></li>
                <li><a href="#">Alumni Profile</a></li>
                <li><a href="#">Syllabus</a></li>
                <li><a href="#">Admission</a></li>
              </ul>
            </li>
            <li><a href="#" class="MenuBarItemSubmenu">Marine Systems</a>
              <ul>
                <li><a href="#">Overview</a></li>
                <li><a href="#">Career Options</a></li>
                <li><a href="#">Alumni Profile</a></li>
                <li><a href="#">Syllabus</a></li>
                <li><a href="#">Admission</a></li>
              </ul>
            </li>
            <li><a href="#" class="MenuBarItemSubmenu">Overview</a>
              <ul>
                <li><a href="#">Mission</a></li>
                <li><a href="#">Location</a></li>
                <li><a href="#">Associate’s Degree</a></li>
                <li><a href="#">Tuition and Financial Aid</a></li>
                <li><a href="#">Admission</a></li>
                <li><a href="#">Faculty</a></li>
              </ul>
            </li>
          </ul>
      </div>
    <div id="header-03">
            <img src="images/header_03.gif" width="141" height="31" alt="">  </div>
    <div id="header-04">
        <a href="https://www.facebook.com/pages/The-Landing-School/81582557331?ref=ts" target="_top"><img src="images/header_04.gif" alt="" width="29" height="31" border="0"></a>    </div>
    <div id="header-05">
            <a href="http://twitter.com/#!/landingschool" target="_top"><img src="images/header_05.gif" alt="" width="30" height="31" border="0"></a>    </div>
    <div id="header-06">
            <a href="http://www.youtube.com/user/TheLandingSchool" target="_top"><img src="images/header_06.gif" alt="" width="31" height="31" border="0"></a>    </div>
    <div id="header-07">
            <a href="http://landingschool.blogspot.com/" target="_top"><img src="images/header_07.gif" alt="" width="27" height="31" border="0"></a>    </div>
    <div id="header-08">
            <img src="images/header_08.gif" width="45" height="31" alt="">
        </div>
    </div>
    <!-- End ImageReady Slices -->
    </div>
    <script type="text/javascript">
    <!--
    var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
    //-->
    </script>
    </body>
    </html>
    here is my CSS:
    @charset "UTF-8";
    /* SpryMenuBarHorizontal.css - Revision: Spry Preview Release 1.4 */
    /* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */
    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: none;
        width: 700;
        font-family: Arial;
        color: #FFFFFF;
        border: thin none #000000;
        height: auto;
    /* 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: 1000;
        background-color: #FFFFFF;
        font-family: Arial, Helvetica, sans-serif;
        color: #000000;
    /* 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: 11px;
        text-align: center;
        cursor: crosshair;
        width: 138px;
        float: left;
        height: 29px;
        background-color: #FFFFFF;
        border: 1px solid #000000;
        font-family: Arial;
        color: #FFFFFF;
        word-spacing: -0.1em;
        letter-spacing: normal;
    /* 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%;
        font: Arial;
        z-index: 1020;
        cursor: default;
        width: 8.2em;
        position: relative;
        left: -500em;
        background-color: #999999;
    /* 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
        left: auto;
    /* Menu item containers are same fixed width as parent */
    ul.MenuBarHorizontal ul li
        width: 8.2em;
    /* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */
    ul.MenuBarHorizontal ul ul
        position: absolute;
        margin: -5% 0 0 125%;
    /* 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: auto;
        top: 0;
    DESIGN INFORMATION: describes color scheme, borders, fonts
    /* Submenu containers have borders on all sides */
    ul.MenuBarHorizontal ul
        border: 0px solid #CCC;
    /* Menu items are a light gray block with padding and no text decoration */
    ul.MenuBarHorizontal a
        display: block;
        cursor: pointer;
        font: Arial;
        background-color: #999;
        padding: 0.5em 0.75em;
        color: #333;
        text-decoration: none;
    /* Menu items that have mouse over or focus have a blue background and white text */
    ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus
        background-color: #003366;
        color: #FFFFFF;
        border: 0px;
    /* 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
        background-color: #003366;
        color: #FFFFFF;
    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-image: none;
        background-repeat: no-repeat;
        background-position: 95% 50%;
        background-color: #FFFFFF;
        color: #000000;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 11px;
    /* 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-image: url(SpryMenuBarRight.gif);
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* 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-image: url(SpryMenuBarDownHover.gif);
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* 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-image: url(SpryMenuBarRightHover.gif);
        background-repeat: no-repeat;
        background-position: 95% 50%;
    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
        background: #FFF;
    thank you!
    Tote Road

    Your first difficulty is outlined here in the W3C Validation tool: http://validator.w3.org/check?uri=http%3A%2F%2Fvacationlandphotography.com%2Ftls%2Fheader. html&charset=%28detect+automatically%29&doctype=Inline&group=0
    Without a doctype declaration, the browsers don't know what to do with your code. Some apparently guess well. Internet Explorer, not so much.
    After you've fixed your page up by copying this
    <!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" />
    in place of this:
    <html>
    <head>
    either things will be improved or there will be something else cropping up. I opt for the former, myself!
    Beth

  • Page palette appears to be very strange in Indesign (and don't know how to fix it)

    So one day, my Page Palette just went cuckoo in Indesign.The bottom area, where you can normally delete, add, or shows you how many pages there are, or the very lower right scretch corner are all missing. I've tried to go to Palette options and see it is a "View" issue, but nothing seems to bring those functions back.
    This could either be something Very simple and I am an idiot, or it is something alot more major, which I am praying it's not.
    Thanks, any insights is great apperciated!!

    Replace your preferences. This link is for CS4, and it looks like you have CS2, but the information is basically the same. Read the whole page.
    Adobe InDesign CS4 * Setting preferences

  • Sudden strangeness with mouse and keyboard

    I know this is a commonly talked about topic but I feel my case may be a bit different. I have the same jittery mouse problem as well as the display not turning on like everybody. Strangely though, I've had no problems at all since I went to 10.5.2. I think I went two weeks without restarting. All of a sudden though, it went haywire. I've had to restart three times today, after a clean streak of two weeks. If it keeps up I'm going to go crazy. Anybody know any newer fixes or details on this?
    For the record I tried the whole turning the AirPort off trick and the mouse jumping was even worse than normal, so it's not that.

    Having issues as well with the pointer. It jumps, stutters, jitters. Whatever you want to call it. I have tried a wired Mighty Mouse and just bought a wireless Mighty Mouse this weekend. Still having issues. I have even tried to use just the trackpad with no mouse, same problem. Tried repairing disk permissions with disk utility. The only thing that seems to work is a restart...for a while. I was having wake-from-sleep issues before 10.5.2, then everything seemed to work fine for a few weeks. Now the jitters.
    Any ideas?

  • Problem with layout and changing content

    Hi, I`m new to Swing and I have a problem with layout.
    I want to make a menu using JButtons so that depending on which button you click you`ll get different content in the window. And first of all I don`t know how to center the buttons.
    I have a JFrame called GameWindow that has a JPanel field called content. My idea was to create a JPanel with buttons and then using ActionListeners change the JPanel held in 'content'.
    Here`s the code:
    public class GameWindow extends JFrame{     
         private static final long serialVersionUID = 1L;
         private JPanel content;
         private Player player;
         public GameWindow(){          
              super("Dawn Crystal");
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
              setSize((int)screenSize.getWidth(), (int)screenSize.getHeight());
              setExtendedState(MAXIMIZED_BOTH);
         public void mainMenu(){
              content = new MainMenu(this);
              Dimension dim = content.getSize();
              setLayout(null);                    
              Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
              int x = (int)((screen.getWidth() - dim.getWidth()) / 2);
              int y = (int)((screen.getHeight() - dim.getHeight()) / 2);
              int dimX = (int)dim.getWidth();
              int dimY = (int)dim.getHeight();          
              content.setBounds(x, y, 120, 120);          
              getContentPane().add(content);          
              setVisible(true);
         public void adventureScreen(){
              //so far empty
         public void createNewPlayer(){
              content.setVisible(false);
              content = new NewPlayerCreationWindow();
              getContentPane().add(content);          
              content.setVisible(true);
              //setVisible(true);
         public void setPlayer(Player p){ player=p; }
    public class MainMenu extends JPanel{     
         private static final long serialVersionUID = 1L;     
         private JPanel mainMenuButtons;
         private JButton newGame;
         private JButton loadGame;
         private JButton options;
         private JButton exit;
         public MainMenu(GameWindow par){
              mainMenuButtons = new JPanel();     
              //create buttons
              newGame = new JButton("NEW GAME");
              loadGame = new JButton("LOAD GAME");
              options = new JButton("OPTIONS");
              exit = new JButton("EXIT");
              //create action listeners
              newGame.addActionListener(new NewGameListener());
              exit.addActionListener(new ExitListener(par));     
              //add buttons to panel
              mainMenuButtons.setLayout( new GridLayout(4,1));
              mainMenuButtons.add(newGame);
              mainMenuButtons.add(loadGame);
              mainMenuButtons.add(options);
              mainMenuButtons.add(exit);     
              add(mainMenuButtons);          
    }When it displays the buttons are at the top of the frame rather than in the center - I thought that was how the default layout would behave. So that`s my first question - how to center it.
    Secondly I have NewPlayerCreationWindow written but when I call createNewPlayer() I get an empty frame - what am I doing wrong?
    Finally I`d like to ask how can I make the frame appear as maximized when the application is started? The setExtendedState(MAXIMIZED_BOTH); doesn`t help actually because the window`s height is too big and a part of window is hidden under the system bar. I want to have it maximized regardless of screen resolution.

    Use a [url http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html]Card Layout.

Maybe you are looking for

  • 865PE Neo2-PFISR failure

    Hello, This is my first post here so I would write down my system configuration at first: my MSI mobo: 865PE Neo2-PFISR (with BIOS update to V3.A since 21/01/2005) CPU: Intel Pentium 4 HT 2.8E SL79K RAM: 2GB Kingston 400MHz DDR (4 x KVR400X64C3A/512)

  • How to download a file from server?

    Hi everyone, I need to download a file from my server to client machine. I got a sample code from ur forum and I modified it slightly. //Snippet of code: public void doGet(HttpServletRequest req, HttpServletResponse res)throws      ServletException,

  • X230T camera does not work under windows 8

    Hi! Is your camera working under Windows 8? Mine is not. It used to work some time ago, but even then the driver was instable. Now, since a few weeks, it seems not to work at all anymore. Reinstalling the driver does not help. This may ba a hardware

  • Reset of playcount/ratings upon connection to PC

    I have noticed the exact same problem as described in this post: http://discussions.apple.com/thread.jspa?threadID=1887496 Whenever I connect to a PC, for charging purposes, my playcounts are reset. I have an iPod Classic 80GB. I will admit that I on

  • Add header row to cross-tab

    Is it possible and how? Thank you!