BoxLayout sizing accross the box

I find the behaviour of BoxLayout in the "cross" direction (i.e. side to side for a vertical box, vertical for a horizontal box) confusing.
For example I've just put together a veritcal box with three buttons whose natural sizes differ, with glue between them. I'd expect that the buttons would be stretched horizontally to the width of the widest, but they're just left justified. Even if I copy the preferred size from the widest button to the others it has no effect. Think I'll have to switch to a SpringLayout to give me the degree of control I need.
How can I force these widths to match in a BoxLayout? I've done a lot of fumbling about with this.

boxlayout respects maximumSize, and, at least in 1.5.0_05, it seems to set
everything to their maximumSize. the logic seems strange.
import javax.swing.*;
import java.awt.*;
class Testing
  public void buildGUI()
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p,BoxLayout.Y_AXIS));
    JButton b1 = new JButton("OK");
    JButton b2 = new JButton("OKOKOK");
    JButton b3 = new JButton("OKOKOKOKOKOK");
    b1.setMaximumSize(b3.getPreferredSize());
    b2.setMaximumSize(b3.getPreferredSize());
    p.add(b1);p.add(b2);p.add(b3);
    JFrame f = new JFrame();
    f.getContentPane().add(p);
    //f.pack();
    f.setSize(600,400);
    f.setLocationRelativeTo(null);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
  public static void main(String[] args)
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        new Testing().buildGUI();
}

Similar Messages

  • Why is the Box width different in different browsers?

    I am coding a page for someone and their page is on my test area at the moment.
    I know it's a company but I am not advertising it or anything here.
    www.tdrd.karoo.net
    Now I am looking at the callback input form here...
    When browsed in firefox the boxes you fill in stay within the boundries of the blue box.
    However when using Chrome and IE I get the input boxes breaking outside the boundries.
    I am using CSS to set these widths so why are they misbehaving?
    Thank you in advance.
    Terry

    This should help:
    Box Sizing | CSS-Tricks

  • Use msiexec to remotely install an .msi file accross the network

    I'm trying to install an .msi file via group policy but am not having any success. How can I install an .msi file onto computers accross the network using the msiexec command instead of psexec? I'm using this scriptwith psiexec below to no avail,
    I'm running the script as domain admin and the everyone, domain users and domain computer security groups all have ntfs full control permissions to the share folder and co-owner permissions
    to the share. I can also install the package manually and reach the share from the computer using
    \\servername\share
    C:\Users\hrice>psexec \\10.1.20.164 -u abc\admin -p password!! msiexec /i "\\abc-fs\comp
    any\IT\Shared\Adobe Flash Player\install_flash_player_11_active_x.msi\install_flash_play
    er_active_x.msi" /qn
    PsExec v1.98 - Execute processes remotely
    Copyright (C) 2001-2010 Mark Russinovich
    Sysinternals - www.sysinternals.com
    T h i s   i n s t a l l a t i o n   p a c k a g e   c o u l d   n o t   b e   o p e n e d
    .     V e r i f y   t h a t   t h e   p a c k a g e   e x i s t s   a n d   t h a t   y o
    u   c a n   a c c e s s   i t ,   o r   c o n t a c t   t h e   a p p l i c a t i o n   v
    e n d o r   t o   v e r i f y   t h a t   t h i s   i s   a   v a l i d   W i n d o w s
    I n s t a l l e r   p a c k a g e .
     msiexec exited on 10.1.20.164 with error code 1619.

    Doesn't matter, you wanted to use group policy to assign the MSI over the network anyways, right.  
    http://technet.microsoft.com/en-us/library/cc757024%28v=ws.10%29.aspx
    http://support.microsoft.com/kb/816102
    http://www.ehow.com/how_7571432_remotely-install-msi.html
    * 1 - Click the Windows "Start" button and type "gpedit.msc" and press "Enter." This is the shortcut command to open the group policy editor.
    * 2 - Double-click the "Computer Configuration" icon to expand some options. Click "Software Settings." Right-click "Software Configuration" and select "New Package" to open a "New Package" wizard.
    * 3 - Click the "Open" button and point to the location of your MSI file. This can be on a network drive, or on the network server. Click "Open" to save the location.
    * 4 - Click the "Assigned" option and click "OK." The "Assigned" option assigns it to network users. You can disable the package in the future by editing the group policy properties and removing this check box.
    * 5 - Click "OK" to save your package. The new package is shown in the details pane and it takes effect the next time your users log in to the network.
    Don't forget to mark your posts as answered so they drop off the unanswered post filter. If I've helped you and you want to show your gratitude, just click that green thingy.

  • ESOA and Out of the Box services doubts

    Hi,
    I am reading about PI 7.1 and going through eSOA architecture. What I understand is, The eSOA says that we have some out of the box services avalable from SD, for example creating a sales order. This can be exposed as a web service from R3. When this available as a web service, and if the calling application is capable of calling web services, where is the need for PI? Why do we need to use PI for SOAP to SOAP communication?
    How inside out and outside in approaches are different in eSOA architecture as far as PI and R3 are considered? Can some one clear my doubts?

    no, no, just hints and personnal opinion
    eSOA is SOA from sap marketing point of view. It was ESA, but nobody undertood, so, they changed the name to eSOA. Don't mind about the name, it is all about to have services well organized (someone could use "orchestrated") supporting business processes. Different than having function modules published for remote use
    Well, developers has almost nothing to do with soa (but they want it We want (as developers) to make soa, but it does not work. This initiative (as sap really got in its soa name) need to be from enterprise level, and probably do not apply to mid-sized companies, only to the big ones.
    Software architects will be probably disapointed (at least untill PI7.0 that we have here) and start to build their own components and their own soa strategy - very hard working.
    I didn't find any of called "out of the box" sap services that really match our requirements, but found many bapis and standard functinos that do that. So, most of our services are based on using many different standard functions to provide a complete service, using sometimes ccBPM, sometimes abap proxies, sometimes soap to soap, sometimes RFC, even depending on requirements, but all of them centralized at PI to help on the governance of all those services.
    Did you tried to go through ES Workplace and its forum? I think is a good starting point. You can get an user id to try the services there and make some experiences.
    reagards.
    roberti

  • My safari is not working. Every time i click on it says to reopen or dont reopen. i press reopen i gives me this long screen and it says reopen or press okay. when i press ok it closes the box and doesnt open. when i press reopen the long screen stay

    . Every time i click on it says to reopen or dont reopen. i press reopen i gives me this long screen and it says reopen or press okay. when i press ok it closes the box and doesnt open. when i press reopen the long screen and stays like that.

    If Safari crashes on launch and you don't have another web browser, you should be able to launch Safari by starting up in safe mode.
    You may have installed the "Genieo" or "InstallMac" ad-injection malware. Follow the instructions on this Apple Support page to remove it.
    Back up all data before making any changes.
    Besides the files listed in the linked support article, you may also need to remove this file in the same way:
    ~/Library/LaunchAgents/com.genieo.completer.ltvbit.plist
    If there are other items with a name that includes "Genieo" or "genieo" alongside any of those you find, remove them as well.
    One of the steps in the article is to remove malicious Safari extensions. Do the equivalent in the Chrome and Firefox browsers, if you use either of those.
    After removing the malware, remember to reset your home page in all the web browsers affected, if it was changed.
    If you don't find any of the files or extensions listed, or if removing them doesn't stop the ad injection, then you may have one of the other kinds of adware covered by the support article. Follow the rest of the instructions in the article.
    Make sure you don't repeat the mistake that led you to install the malware. Chances are you got it from an Internet cesspit such as "Softonic" or "CNET Download." Never visit either of those sites again. You might also have downloaded it from an ad in a page on some other site. The ad would probably have included a large green button labeled "Download" or "Download Now" in white letters. The button is designed to confuse people who intend to download something else on the same page. If you ever download a file that isn't obviously what you expected, delete it immediately.
    In the Security & Privacy pane of System Preferences, select the General tab. The radio button marked Anywhere  should not be selected. If it is, click the lock icon to unlock the settings, then select one of the other buttons. After that, don't ignore a warning that you are about to run or install an application from an unknown developer.
    Still in System Preferences, open the App Store or Software Update pane and check the box marked
              Install system data files and security updates (OS X 10.10 or later)
    or
              Download updates automatically (OS X 10.9 or earlier)
    if it's not already checked.

  • In the year view, why is iCal coloring the boxes?

    In the year view, why is iCal coloring the boxes and what does each color mean and how do we change it?  It makes no sense or has any rhymn or reason according to what is in my calendar.

    By default it is colored by the number of entries for each day. From white for no entries through yellow to orange and then red for the most entries.
    Hope this helps.

  • Using Adobe Photoshop CS2 version 9 and have updated it, but when stacking photos, it comes up with PSD, whereas I want Jpeg, and I change the format to Jpeg and the box then comes up with cannot save as there is a program error. Be very grateful for help

    Using Adobe Photoshop CS2 version 9 and have updated it, but when stacking photos, it comes up with PSD, whereas I want Jpeg, and I change the format to Jpeg and the box then comes up with cannot save as there is a program error. Be very grateful for help with this, please.

    jpg does not support Layers.
    Just to make sure, what exactly do you mean by "stacking photos" and what do you want to achieve thereby?

  • HI Team, Recently One week back I bought a new iphone 5 from India. They have given me a used mobile which has a different IMEI number when compared to the IMEI number present on the box. Please let me know how to proceed further

    HI Team, Recently One week back I bought a new iphone 5 from India. They have given me a used mobile which has a different IMEI number when compared to the IMEI number present on the box. Please let me know how to proceed further

    When you went back to the place where you purchased this phone, & asked them, what did they say?
    No one here can help you with this, nor can/will Apple. You need to take this up with whoever you purchased this phone from.

  • Is the latest update to the 6th gen nano a software download or does it come with the new watch faces and larger icons out of the box

    Apple shows the new 6th gen nano with the new selection of watch faces and lager icons etc as per new update, but stores still have the 6th gen nano with just 3 watch faces and smaller icons etc. Is the newer spec just a software update that i do after purchase or does it come updated out of the box?
    Thx

    It should come out of the box with the new 1.2 update, but if it doesn't you can simply connect it to iTunes, download, and install the update from there.
    B-rock

  • Why is the backup encrypted when i didn't even check the box in itunes

    I downloaded the latest version of itunes, sync my iphone and then upgrade the software to ios 5.
    But when i try to restore my backups after the upgrade. It prompted for a password.
    My backup file states complete and encrypted when i didn't check the box for encryption.
    Any idea what is the default password for it?
    Has anyone encounter this situation before and any solutions available?
    I need to access a lot of important contacts in the backup

    Passos713 wrote:
    ...I didn't even receive them??.?.?.?.?.?.?.?.?..?.?.?.?
    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • Can i return my mac if i threw the box away

    can i return/upgrade my mac if i threw the box away

    See this link about returns. It says that before returning any product(s) to Apple please check that you have used all packaging that was originally supplied. So I guess the answer to your question is no.
    Hope this helps!

  • Ive got a Mac Pro bought seconf hand, It doesn't allow me to update as the username is blocked to the previous owner, it appears off and can't change it, the box goes directly to password. I have changed the computer username and password but the problem

    Ive got a Mac Pro 2010, bought second hand through eBay. When it comes to update the software, the username is blocked to the previous owner. It appears off and the box goes directly to password. I have tried to reset then to log in in apple store with my login but didn't help. I would appreciate any tips to sort it out
    Thanks fellas

    That machine did not ship with Mountain Lion (Mac OS X 10.8), so that means the copy of Mountain Lion on the machine was purchased by the former owner and is non-transferable. It is permanently linked to his/her Apple ID, so you cannot update or reinstall it.
    What you need to do (which the seller should have done for you) is reinstall the original system that that machine came with. I believe that would be Snow Leopard (Mac OS X 10.6). What you need to do is reinstall that system from the original disks. If the seller did not provide those disks, you can call Apple and get them replaced for a small shipping and handling fee.
    For more info, see:
    http://www.thesafemac.com/how-to-prepare-your-mac-for-sale/

  • I had to change my apple ID and password.  When I want to update my aps. on my I phone 4S I get a box that says I need to sign in to I tunes.  It has my old apple ID and I can't find any way on my phone to change the address it has in the box.  Help!!

    Because of a nasty virus on my computer I had to change my apple ID and password.  When I went to update my apps. on my I phone 4s the box said I need to sign in to I tunes.  The ID it had in the box was my old apple ID and I can't remember the password.  I can't find any where in my phone settings that will let me change my I tunes ID although I have a new apple ID and password that I used to get on this site but I can't change it on my phone.  Please help.
    Thanks

    ChrisJ4203,
    Thank you for the help.  Every app on my phone was downloaded using my old I-tunes ID.  I just hope that they will re-download under my new ID because I still can't change it on my phone.  In order to change to the new ID it says I have to sign out from the old ID and change to the new one.  My problem is that I don't remember my password to be able to sign out from my old ID.  Then the phone says it can change my password through e-mail and I  agree but I never get an e-mail at my old address or the new one.
    BHuyett

  • I want to sign in using apple id password and altho i have changed my email address on the settings, the old one comes up on the box on the ipad when trying to update all the apps.  so putting password in no longer works, as its the address. how fix ?

    Signing in using the apple id password to update and purchase stuff thru apple store, gives the old email and am unable to get into the apps store, etc...to change, update and purchase stuff.   when using password it won't work, as the email is wrong, yet in the box doesn't appear a place to change the email. would have thought as it changed, days ago - it would change to the updated email.
    how do i access the stuff ? thanks

    How did you fix this??

  • Need Advice: New Intel Mac Mini Still In The Box

    Hi!
    Okay.. I know... I have several posts going here as I have several issues I am trying to solve rather simultaneously. Thanks for being patient with me.
    I have my old 1.25 Ghz PowerPC Mac Mini running 10.4.11 and all was well and happy. Then Security Update 2007-009 happened and all went to ....well... you know and, yes, it was bad! Went to Apple, got it running of sorts as they re-installed the OS, but they used an old version of OS X. (10.4.7. Can you believe that?) This caused other problems. It continues to have all sorts of difficulties, as I have had to get applications to re-recognize that the computer is back up to 10.4.11. Currently, I am struggling with trying to get iTunes to access it's music folders on the external hard drives. Realized that I hadn't even gotten around to figuring out whether or not some of my other applications work, like some of the games and third party, etc.
    The thing is I got a new Intel Mac Mini for Christmas and it's still in the box because as I suspected I need to get my old mac perfect again before I can even think about migrating stuff over to the new Mac. But.. here's the thing... it's starting to look pretty much like 2008 will come and go before I can get the old Mac ready enough to take the new Mac out of the box. This really is rather silly!
    Now... I can't get the old Mac to see the music and it made me think. I have all of my iTunes music and iPhoto backed up on an external hard drive (I used Apple's "Back-up" software to do it) and in addition to this two complete copies of the iTunes music and iPhoto photos albums on two separate external hard drives. Should I just forget using migration assistant? Can I get my music and my photo albums into the new mac directly from the external hard drives?
    Or...can I use "back up" to restore the music and photos into the new Mac?
    I am starting to think that the best way to get my new Mac running is not risk it by attaching it to my old Mac. What do you think?
    Thank you so much for any advice or experiences you can give. -Charlotte

    I know that I am vacillating back and forth as to what to do. Thanks so much for being patient with me. All of your advice is really appreciated and I am at least closing in on deciding on my strategy. Probably will follow your first response advice, especially considering that some of the third party apps may not have updates to handle Leopard quite yet. Anyway... it's a good strategy since everything is on the externals anyway.
    You can say that fine.
    Ha ha ha.... yes, I've been messing around with computers since my parents bought our first Apple computer back in 1979. Just like you, I've never had a serious problem with any of the computers and we've had them all, running all sorts of things from the Original Apple and Apple IIc (which my parents still have and it still runs!) to the Commodore and all the Windows permeations and then on to the Macs running Jaguar, Panther and Tiger, probably because we've always been careful with the machines and what we install in them and how we update them. I have always kept my computers on UPS' and un-plug them when storms brew outside. As it is I am still using my eight year old Windows 98 computer, (for games mostly) and it still runs quicker than most peoples windows pcs and it's only a 740 Megahertz.
    I haven't had to re-install anything, especially on this lovely little Mac Mini until now and wouldn't have in this situation, had I known more. I had taken the little Mac Mini in for a Procare "Tune-Up," only four days before the big up-date disaster. Not sure what they did to my mac in the tune-up but the guy gave me back the machine assuring me that the computer was perfect with no problems in answer to my asking "were they sure?" Even after the Genius Bar techs at the Apple Store re-installed the OS to fix the big problems it seems that no one ever thought to run verify disk. Had the Genius Bar techs at the time of the tune-up done this, or at least told me to do this, the last security update would not have wrecked so much havoc. It was only after I got the machine back from Apple that second time that I found that the directory had been corrupted when I ran disk verify. Actually it is amazing that I have had this little Mac Mini for so long and so not have had any problems on it that I would be able to go so long without having to know this really pretty important aspect of keeping one's mac in good running shape. I had been running maintenance scripts and permissions verify and repair and thought that was all there was to it. Silly! You know... that really is a testimony of how nice these little machines are.
    Anyway... experience is a good teacher and I have learned so much it's actually been great! This stuff is pretty interesting.
    Now... on to Leopard!
    Thanks so much and you have a great New Year! -Charlotte

Maybe you are looking for

  • Pls help me to create SO using BDC for multiple line items (VA01)

    Hi all, My requirement is to create SO for multiple line items in ECC6.0 My recording for VA01 is like this. start-of-selection. perform open_group. perform bdc_dynpro      using 'SAPMV45A' '0101'. perform bdc_field       using 'BDC_CURSOR'          

  • Maximum Number of records -Internal Table

    Hi Members, How many records can an Internal table Hold? I want extract about 2,000,000 records in a report. Regards Prasad

  • What happens after reformatting the computer ? ( windows XP )

    Hello everyone, after a nearly two years of running, my winxp installation needs a cleanup so i'm planning on formatting the hard drive and installing xp So i wanted to know what to do in order to backup the iTunes/iPhone sync i'm guessing there's a

  • What exactly does Restore do?

    Forgive me if this has been covered before, but I did search and didn't find my specific answers. I synced my bookmarks with my Safari browser on my PC. All is good, except that the sync also copied the default bookmark folders "bookmark bar" and "bo

  • Peculiar behaviour of a query !!!

    Hi Have a peculiar issue with one of my user - A query is executed at the db level is hung from 1.30 PM IST to 4.30 PM IST and the same query executes in seconds post 4.30 PM IST. +"An application is down daily during early hours EST and its up autom