Why can't the bloody window get the right size?

I have a huge problem with graphical components... and I doubt that I'm alone with it. This concerns how to get the bloody windows to be laid out with the correct size. Java never wants to have the window sized as I set it. It's always different, and the size changes when I change platform. If I set the size for a JFrame in a Windows-environment, and then run the program on a Solaris environment, the window has a completely different size. Even when I switch from the CDE desktop to KDE or Gnome, every new environment presents a new way of laying out my application's windows, with different sizes.
Now, I have tried to get rid of the problem through various tricks... obviously the setBounds(x,x,x,x) method is a complete fake... that's when most problems occur. So I tried with the pack() method together with setting the preferred size of my components. That works better, but it's not even near to make me satisfied. The windows don't change dramatically with platform change, but a few pixels here and there.
It drives me crazy! I shouldn't be this hard to set the size of a normal bloody window! I can't believe that I still haven't figured out a failproof way of sizing my windows.. (I'm using the null layout, so I need to have exactly the correct size at all times)
If anyone has reached enlightenment on this topic, please contact me before I end up in some mental institution. ([email protected])
Please?
/Erik (from Sweden)

it's as simple as this. I want the space used to lay out components to be the same on all platforms.
I could just as well explain what I mean with "the space used to lay out components" too. if you set a Frame or JFrame to "undecorated", the only thing showing is that space... simple enough. but with frame decorations, such as title bar, window borders (used to resize windows)... it's not as simple, because these decorations differ on all platforms. even between windows-versions... windows XP has a far larger title-bar than windows 2000 (and earlier windows).
so what I need to do is to make my program to lay out the window, so that the area used to lay out components is the samt, independent of the decorations used on the particular system you're working with.
I think it should be clear enough now...
but I also have to tell you that I feel I'm as close to a solution as one could possibly be. because I took a peek in the bugs database and saw that there is a bug concerning the window size and position on KDE under linux, which is the platform I'm testing this on (apart from windows 2000/XP) so I might have solved the problem, just that java itself is buggy :)
I don't know, but I'm going to test it on different environments in Solaris this week... CDE, GNOME, KDE... such.
I used the setSize() method together with getInsets() to get the sizes of the decorations... but that method has to be called for after the JFrame is set visible ( show() ) so I have to resize the window after it is set visible and then hide() and show() it again... strange... but it might work now.

Similar Messages

  • Why can't my Lumia phone get the yahoo mail messag...

    Hi,
    just bought myself a Lumia 920 and configured my yahoo mail account. Unfortunately it seems that the Lumia only polls every 15min(at best) but my N8 gets the same mail instantly.
    Am I doing something wrong or is this just another "Lumia feature"?

    Strange, thought that it would. Perhaps there are some settings within your Yahoo Mail account when you check it on a PC? Maybe something in there. if there isn't any other settings on the phone, then only thing you can do is check on PC as i said, or leave feature suggestion over at http://windowsphone.uservoice.com

  • Why can't I switch windows in the Window menu?

    I just upgraded to Firefox 34 on my Powerbook (OSX 10.6.8). All of the sudden, the Window menu won't allow me to switch between Firefox windows; underneath the rule under Zoom, there's nothing there, even though I have multiple Firefox windows open. This is extremely inconvenient. Is this a new problem with 34, or...?

    (I meant Macbook Pro; sorry, I can't edit my post.)

  • Why can't Verizon answer when the G3 will get the Lolipop update?

    When I had my Nokia Icon, I had to wait months and month and months to get the official 8.1 non-buggy official update. I asked Verizon monthly when I would get this update to have the same experience all their customers with OLDER phones were having. They NEVER had an answer. I cannot explain how ****** off I was because the sales rep that sold it to me explained it would be one of the first phones to get 8.1. Now, I have left the WP environment because of the sour experience, and I see that I have a phone again that is out of date. I understand it was just released, so it's different. Why can't Verizon step up to the plate and answer? Why cant they man it up to make the transition faster? Feels like the pretty just ignore everyone and tell them to **** off since we already give them money.

    @CitizenDigital, the answer can probably boil down to this.  There is a team of people that have to review this update when it arrives at the corporate office. Once the "paperwork" has been reviewed, the files need to be reviewed, then the update needs to be tested, then an entire rollout plan needs to be put in place.  The people in charge of officially releasing the update to the public are probably waiting on the group of technical engineers to give the thumbs up by some email or morning meeting.  Until they do, "Verizon" wont know when the update will be ready.  All they hear from the tech boys is Hold On, We're testing.  I work in a similar industry so I see how the ball rolls in situations like this.

  • Most of the time I get The Connection Was Reset. Can someone tell me why this happens?

    When I click on Firefox or when browsing or going from one site to the other I get "The connection was reset" then have to click on Try Again.
    Can someone tell me why this is happening?
    Thank you.
    THE CONNECTION WAS RESET again this morning. I even get this message when I click on the Firefox Icon to get on the net. When for example I download something then it returns me to their site I get The Connection Was Reset. When I uninstall a program and it sends to to their site in order to answer as to why I am uninstalling their program then I get The Connection Was Reset.
    Every time this happens I have to click on Try Again and find this to be annoying.
    This does not happen once or twice a week, it happen ALL THE TIME.
    This morning I went to Safe Mode and followed the instructions on INTERRUPTED OR RESET CONNECTION which tells us what to do but this did not work either.
    Would be great if someone was able to let me know what to do in order to prevent this message appearing all the time.

    Do not know how to delete this reply. I replied instead of editing my question. I have edited the above now.

  • HT3986 Can anyone help me to get the Tack pad drivers for windows 7 on mAcBook Air..

    Can anyone help me to get the Tack pad drivers for windows 7 on mAcBook Air..

    If you've created the Windows 7 Drivers CD/USB drive, using Boot Camp Assistant in OSX, the drivers should be on there. My MacBook Pro (2010) touchpad works fine with those drivers installed, and I think it's identical to the Air's.
    http://support.apple.com/kb/HT4407 for info on how to create this drive.

  • Hello. I appreciate your help. I am in FCP7 and trying to do Boris Vector Shape effect. When I try to pull the  vector shape square from the view window to the Superimpose, I get the message: insufficient content for edit. Why?

    Hello. I appreciate your help. I am in FCP7 and trying to do Boris Vector Shape effect. When I try to pull the  vector shape square from the view window to the Superimpose, I get the message: insufficient content for edit. Why? I did this effect before and everything worked well. Thank you for your help.

    Make sure that you have no active I/O markers on the Timeline (use Option X keys to clear them).

  • How can i stop user to get the same screen while entering same T code

    hi experts,
    how can i stop user to get the same screen while entering same T code (_Means i want user enter same t code but got different different screen how it is possible.)_
    i want to know how can we set a authorization is such a manner ...
    Through different different login id user got different different screen while entering same T-code.
    for example if there is two functional login id mum & noida...
    then user login through that and
    enter any same functional tcode (for getting purchase order)
    but get different different window...so how come it is possible.....
    plz explain in brief
    thanks in advance...plz do reply as soon as possible

    For a custom transaction this is easy, you need to ask your developers to be able to direct users to different screens based on the results of an authorisation check.  You could have an auth field e.g. ZSCREEN which is checked in the program & decides what screen the user has access to.
    For standard transactions, unless already coded, I would forget it & do what is recommended by Subramaniam and create transaction variants as required.  Assign each variant to a custom t-code and users access it that way.
    What I am interested is is why do you want to do this?

  • Why can't I view some of the photos in iphoto

    I used to be able to see all my photos in iphoto. now a lot of them are just a gray square. Why can't I see them? Any help will be greatly appreciated.

    The ! turns up when iPhoto loses the connection between the thumbnail in the iPhoto Window and the file it represents.
    What version of iPhoto?
    Download iPhoto Library Manager and use its rebuild function. (In Library Manager it's the FIle -> Rebuild command)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  

  • In Firefox can not see the Downloads window, in the jump in the boot to be seen - the download speed Downloaded much and now can not see how to fix it?

    in Firefox can not see the Downloads window, in the jump in the boot to be seen - the download speed
    Downloaded much and now can not see how to fix it?

    I hate the new downloads-in-a-tab scheme. This was an unnecessary change in my book (if it aint broke, don't "fix it").
    So in order to get it back, I performed the about:config browser.download.useToolkitUI change, but now all I get is a blank download window that pops up every time I download something.
    Is there something else that I need to do? I've checked the change and it was saved, but it didn't resolve my issue as much as it just caused me a new issue.

  • Why can't I add text in the signature panel in firefox?

    why can't I add text in the signature panel in firefox?  I have adobe acrobat pro XI.  I can open a pdf in acrobat pro and am able to add text to a pdf, but when I open a pdf in firefox, the "add text" option is not available.

    When you install Acrobat XI you are also installing Reader for use in the browser. Reader is "sandboxed", or as it says in the Preferences, it is in "Protected Mode". Acrobat does not understand the concept of running in sandboxed memory (sandbox is a security feature to prevent the bad guy from exploiting a memory error and getting into a memory address where they can do damage to your computer) so to help protect Acrobat users the same way Reader users are protected we just install Reader along with Acrobat, but it is only used in the browser (part of this is because the bad guys use web sites as their primary method of distributing corrupted PDF files that can cause problems).
    That said, because you are in Reader the file needs to be Reader Enabled prior to being posted to the web site (or opened in the browser). Once the file is Reader Enabled you should be able to add the text annotations.
    Steve

  • Outlook window getting the keyboard focus instead of user created Form Window during Outlook Startup

    This MAPILogonComplete method involves creating a Form Window to show "What's New" of a certain Addin version (DisplayWhatsNewDialog() in the code):
    private void _outlook_MAPILogonComplete() {
    _logger.Info("_outlook_MAPILogonComplete");
    try
    if (_timerForm != null)
    _timerForm.Timer.Stop();
    _timerForm.Timer.Dispose();
    catch (Exception ex2)
    _logger.Error(ex2.Message, ex2);
    try
    if (Globals.BJNSettings.showWhatsNew)
    Globals.BJNSettings.showWhatsNew = false;
    UIHelper.DisplayWhatsNewDialog(false);
    Ol.Inspector insp = null;
    if (_inspectors.Count > 0)
    for (int i = _inspectors.Count; i >= 1; i--)
    insp = _inspectors[i];
    WrapInspector(insp);
    insp = null;
    Ol.Explorer expl = null;
    if (_explorers.Count > 0)
    for (int i = _explorers.Count; i >= 1; i--)
    expl = _explorers[i];
    WrapExplorer(expl);
    expl = null;
    GetAddinsList();
    Thread logSystemInfoThread = new Thread(new ThreadStart(LogSystemInformation));
    logSystemInfoThread.TrySetApartmentState(ApartmentState.STA);
    logSystemInfoThread.IsBackground = true;
    logSystemInfoThread.Start();
    try
    Ol.NameSpace ns = _outlook.GetNamespace("MAPI");
    _calFolder = ns.GetDefaultFolder(Ol.OlDefaultFolders.olFolderCalendar) as Ol.Folder;
    _calFolder.BeforeItemMove += new Ol.MAPIFolderEvents_12_BeforeItemMoveEventHandler(_calFolder_BeforeItemMove);
    _delFolder = ns.GetDefaultFolder(Ol.OlDefaultFolders.olFolderDeletedItems) as Ol.Folder;
    Marshal.ReleaseComObject(ns);
    ns = null;
    catch (Exception ex)
    _logger.Error(ex.Message, ex);
    UIHelper.WriteDoNotDisableKeyToRegistry();
    Globals.AppointmentsToProcess = new List<string>();
    _timerForm.ProcessTimer.Interval = 3000;
    _timerForm.ProcessTimer.Start();
    catch (Exception ex)
    _logger.Error(ex.Message, ex);
    DisplayWhatsNewDialog() has this signature:
    public static void DisplayWhatsNewDialog(bool modal)
    try
    string defaultWhatsNewFile = Globals.BJN_APP_BASE_DIRECTORY + "WhatsNew.txt";
    string localISOLanguageName = Languages.GetTwoLetterISOLanguageName();
    string localizedWhatsNewFile = Languages.GetInstalledLocalizedFilePath(localISOLanguageName, "WhatsNew.txt");
    if (String.IsNullOrEmpty(localizedWhatsNewFile))
    localizedWhatsNewFile = defaultWhatsNewFile;
    if (File.Exists(localizedWhatsNewFile))
    BJNWhatsNew whatsNew = new BJNWhatsNew(localizedWhatsNewFile);
    if (modal)
    whatsNew.ShowDialog();
    whatsNew.Dispose();
    else
    whatsNew.TopMost = true;
    whatsNew.Show();
    whatsNew = null;
    catch (Exception ex)
    _logger.Error(ex.Message, ex);
    The problem is if the Window is made modal, it blocks the Outlook to launch and also goes back of the Outlook loading window (Whats New window will not be having keyboard focus). And if the Window is made non-modal (passing false to DisplayWhatsNewDialog()),
    Outlook launches properly and What's New window comes at the top but will not be having keyboard focus; instead the launched Outlook window will be having the keyboard focus. May anyone please suggest a way to make the What's New window to be always having
    the keyboard focus? Structure of form window class BJNWhatsNew is given below:
    public partial class BJNWhatsNew : Form
    private static ILog _logger = LogManager.GetLogger(typeof(BJNWhatsNew));
    public BJNWhatsNew(string whatsNewTextFileName)
    InitializeComponent();
    InitLabels();
    InitEventHandlers();
    InitWhatsNew(whatsNewTextFileName);
    private void InitLabels()
    try
    this.Text = Properties.Resources.bjn_version_info_caption;
    this.buttonClose.Text = Properties.Resources.ok_hotkey;
    this.labelBJNAddin.Text = Properties.Resources.bjn_version_ol_addin;
    this.labelVersion.Text = String.Format(Properties.Resources.version_format, Assembly.GetExecutingAssembly().GetName().Version.ToString(3));
    Assembly assembly = Assembly.GetExecutingAssembly();
    FileInfo fileInfo = new FileInfo(assembly.Location);
    DateTime buildDate = fileInfo.LastWriteTime;
    string formatString = "d MMM, yyyy";
    this.labelReleaseDate.Text = String.Format(Properties.Resources.bjn_version_release_date, buildDate.ToString(formatString));
    catch (Exception ex)
    _logger.Error(ex.Message, ex);
    private void InitEventHandlers()
    this.buttonClose.Click += new EventHandler(buttonClose_Click);
    private void InitWhatsNew(string whatsNewTextFileName)
    try
    if (File.Exists(whatsNewTextFileName))
    StreamReader sr = new StreamReader(whatsNewTextFileName);
    string whatsNew = sr.ReadToEnd();
    sr.Close();
    this.richTextBox1.Text = whatsNew;
    this.richTextBox1.SelectionLength = 0;
    this.buttonClose.Select();
    this.buttonClose.Focus();
    catch (Exception ex)
    _logger.Error(ex.Message, ex);
    void buttonClose_Click(object sender, EventArgs e)
    this.Close();

    Hello Prasad,
    The ShowDialog method will block the current thread. If you want to continue working with Outlook objects you need to use the Show method instead. The key fact is that both methods (Show and ShowDialog) accepts an instance of the IWin32Window interface
    which allows to specify the parent window handle. Specifying the parent window handle (Outlook Explorer window) to the Show method you can make your window shown on top of Outlook all the time.
    To get the HWND of an Outlook explorer  object (e.g. Application.ActiveExplorer), cast it to IOleWindow and call IOleWindow.GetWindow(). Also you may find the
    How to get the IWin32Window for Outlook
    article helpful.

  • HT1349 I am trying to download the new version of itunes and it is stating that it has an invalid signature and the downloan has been removed.  How can I download it or get the signature?

    I am trying to download the new version of itunes and it is stating that it has an invalid signature and the downloan has been removed.  How can I download it or get the signature?

    Try the following user tip:
    Troubleshooting issues with iTunes for Windows updates

  • I can't use Photobooth - when I open the app, I get the message: "Photo Booth couldn't save your photos - Photo Both encountered an error when trying to save your photos. You photos cannot be saved at this time."

    I can't use Photobooth - when I open the app, I get the message: "Photo Booth couldn't save your photos - Photo Both encountered an error when trying to save your photos. You photos cannot be saved at this time."
    i tried adding user macintosh hd/users/your_user/pictures/"photo booth"  but still photo booth is not working and even images in photo booth cant be deleted they keep coming back

    Back up all data.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    I've tested these instructions only with the Safari web browser. If you use another browser, they may not work as described.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box markedAllow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
    Triple-click anywhere in the following line on this page to select it:
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -R $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). I've tested these instructions only with the Safari web browser. If you use  another browser, you may have to press the return key after pasting.
    You'll be prompted for your login password. Nothing will be displayed when you type it. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command may take a few minutes to run, or perhaps longer if you have literally millions of files in your home folder. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2 (optional)
    Take this step only if you have trouble with Step 1 or if it doesn't solve the problem.
    Boot into Recovery. When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • Why can't I copy and paste the music from my iPhone on iTunes 11 to a folder in my Music Library?

    Why can't I copy and paste the music from my iPhone on iTunes 11 to a folder in my Music Library? I want to have a copy of the music on iTunes so when I update to a newer version of iOS I don't lose my music. And no I didn't buy this music off iTunes and neither will I use iTunes Match.

    There has never been a function to copy anything from an iPhone and paste it to a computer.
    All of your media should be in iTunes already.
    If it is not and was purchased from iTunes, right click on the device and select Transfer Purchases.
    If the media is not in iTunes and was not purchased from iTunes, how did you get it on the device in the first place?

Maybe you are looking for

  • Vendor Debit Balance

    Dear All I have a Vendor who has a Debit Balance. How can I show that Vendor' s Debit Balance Separately in Balance Sheet. Currently it is being adjusted with the Balances of other Vendors and it is being shown under Sundry Creditors. Please advice..

  • ABAP WEBDYNPRO Application Administrative DATA URL HOST & PORT empty/blank

    My ABAP Webdynpro applications do not display the preview layout in SE80 just white page - no errors ANYWHERE. Also in SE80 the properties on the application look like: https://:/sap/bc/webdynpro/sap/z_rep_text.  Don't know why https, but I think if

  • JNI on VMS 8.3

    Hi, Can i use JNI on VMS 8.3? if so where can i get the jvm Thanks.

  • CS 5.5 Upgrade query

    Hi If I have a copy of CS5 and upgrade with an upgrade copy of 5.5, can I deactivate my original CS5 and install on a different computer? thanks

  • DV6-6165TX

    CAN ANY ONE TELL ME THE ACTUAL PRICE OF DV6-6165TX MOTHERBOARD?