Slow pack() problem; is there a workaround? (was 'Odd delay on first pack()

I've run into a rather perplexing problem with pack(). When I pack() a visible frame after re-sizing a panel within it, pack takes over FIVE seconds, compared to one second to create the gui in the first place, including a pack(). Subsequent resize-repack calls are very fast. Here's a test program that illustrates the problem:
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Test implements ActionListener {   
    boolean isOpen;
    Dimension prefD;
    JFrame f;
    JPanel pan1;
    long tm; /* All times in milliseconds. */
    public Test() {
        elapsedTime();
        f = new JFrame();      
            // The main panel
        JPanel pan = new JPanel();
        pan.setLayout(new BoxLayout(pan,BoxLayout.Y_AXIS));                       
        f.getContentPane().add(pan);               
            // Add the button in a panel
        JButton b = new JButton("b");
        b.addActionListener(this);
        pan.add(b);
            // Add a label in another panel
        pan1 = new JPanel();
        pan1.setLayout(new BoxLayout(pan1,BoxLayout.Y_AXIS));
        pan.add(pan1);
        pan1.add(new JLabel("This is pan 1"));
        isOpen = true;
        f.pack();
        prefD =  new Dimension(pan1.getPreferredSize()); // Save this size
        f.setVisible(true);
        System.out.println("Time elapsed in initially creating the gui: "
                           + elapsedTime());
    public void actionPerformed(ActionEvent e) {
        if ( isOpen ) {  // Hide the second panel       
            elapsedTime();
            pan1.setPreferredSize(new Dimension(prefD.width,0));          
            pan1.setSize(new Dimension(prefD.width,0));                      
            System.out.println("Time to resize the panel: " + elapsedTime());           
            f.pack();
            System.out.println("Time to pack(): " + elapsedTime()); 
            isOpen = false;
        else { // Show the lower panel
            elapsedTime();
            pan1.setSize(prefD);
            pan1.setPreferredSize(prefD);
            System.out.println("Time to resize the panel: " + elapsedTime());      
            f.pack();
            System.out.println("Time to pack(): " + elapsedTime()); 
            isOpen = true;
    long elapsedTime() {
        long cur = System.currentTimeMillis();
        long elapsed = cur - tm;
        tm = cur;
        return(elapsed);
    public static void main(String[] argv) {
        new Test();
}When I run this test, the times from hitting the button six times are:
Time elapsed in initially creating the gui: 1260
Time to resize the panel: 0
Time to pack(): 5004
Time to resize the panel: 0
Time to pack(): 3
Time to resize the panel: 1
Time to pack(): 3
Time to resize the panel: 0
Time to pack(): 3
Time to resize the panel: 0
Time to pack(): 3
Time to resize the panel: 0
Time to pack(): 3If I set the frame invisible before the pack and visible again after, the time delay disappears, but of course this is not an adequate solution.
I'd appreciate an suggestion for a workaround, or any ideas about what the problem is. I'm pretty much stuck.
Thanks,
bw

OS: Linux, SuSE 8.0, kernel 2.4.18-4GB
JDK: I've tried this with two versions of 1.4.1
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
and
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build Blackdown-1.4.1-beta)
Java HotSpot(TM) Client VM (build Blackdown-1.4.1-beta, mixed mode)
moi@bearblue:/usr/local
These yield the same problem (of course they are closely related).
It turns out that the problem does NOT occur with an old 1.3.1 version:
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1)
Classic VM (build 1.3.1, J2RE 1.3.1 IBM build cxia32131-20020410 (JIT enabled: jitc))

Similar Messages

  • Is anyone facing the similar problem of visible lag while opening app with 3G data on? It seems apple has made 5s slow to improve iphone 4 performance.5s was very smooth on 7.0.6 even with 3G data on. Is this a bug? Is apple going to fix this soon?

    Is anyone facing the similar problem of visible lag while opening app with 3G data on? It seems apple has made 5s slow to improve iphone 4 performance.5s was very smooth on 7.0.6 even with 3G data on. Is this a bug? Is apple going to fix this soon?

    I have same Problem. I tried all options - Reset All Settings, Erase Content & reset all settings, Upgrated to IOS8.1, Restore using iTune. But problem persists.
    When I turn Cellular Data or Wifi ON, then there is a lag while opening the Apps. But If I turn Data/Wifi off, phone becomes super fast. I have checked with my friends. They are not facing this issue. Not sure if Apple know this.

  • I downloaded IOS6 earlier today and my 4S has died twice, it has gone from 45 to 32% in the last 5 minutes and i have icloud, internet, all apps closed with nothing running at all!! There is a serious problem with ios6, my phone was hot at charging time.

    I downloaded IOS6 earlier today and my 4S has died twice, it has gone from 45 to 32% in the last 5 minutes and i have icloud, internet, all apps closed with nothing running at all!! There is a serious problem with ios6, my phone was working hot at chargering time. Apple need to address this asap!!!!

    Hi Suzy Q,
    I can send and receive calls.
    I get "messaging stopped" when doing a lot of texts.
    Texts come up "ghosted" meaning they have the text on the bottom and a transparent one overlaid  on top. they then become one. But I get the ghosting most of the time when I go into a message from a contact to send a text.
    When I go to call logs or text logs, the numbers come up first, and then then the names pop up randomly, meaning not in order down the page, until they are all shown. lots of lag time.
    It runs slow.
    I have 5 apps on here. I should be able to have a  lot of apps on here, and play music, and have files, and...and....and.
    I can get online but doing a Google search, when the page with the choices comes up, it is blurred and I have to tap on the screen for it to become clear and readable.
    When online and scrolling, it hitches sometimes/lags/gets stuck then unstuck
    I get VZWAVS has stopped. (not sure if those are the right letters)
    The status bar that is supposed to be gray with the new update, goes back and forth between green--the old os--to gray. And I have found no continuity with when I get green or when I get gray.
    I get a black screen on occasion.
    sometimes the proximity sensor doesn't work.
    sometimes when I have my bluetooth on and have "hands free mode" on, I get the a text message read through the headset and also through the handset.
    I soft reboot often--turn it off wait a bit and

  • Hello, I have a Mac computer with NVIDIA 750M dedicated graphics card and monitor EIZO but the problem was there when I was working with Windows and Acer monitor. When I open a file from Camera Raw in PS this is smaller than the screen so I double-click w

    Hello, I have a Mac computer with NVIDIA 750M dedicated graphics card and monitor EIZO but the problem was there when I was working with Windows and Acer monitor. When I open a file from Camera Raw in PS this is smaller than the screen so I double-click with the tool "hand" to fit on the screen, but the picture loses sharpness and becomes blurry. If you magnify the image even only slightly with the tool "zoom" the picture comes back clear. In Camera Raw instead is always sharp. I solve the problem by turning off the graphics card in PS but often use plugin that need the graphics card otherwise the processing time is much longer. I ask for help.
    Thanks.

    Hello, I have a Mac computer with NVIDIA 750M dedicated graphics card and monitor EIZO but the problem was there when I was working with Windows and Acer monitor. When I open a file from Camera Raw in PS this is smaller than the screen so I double-click with the tool "hand" to fit on the screen, but the picture loses sharpness and becomes blurry. If you magnify the image even only slightly with the tool "zoom" the picture comes back clear. In Camera Raw instead is always sharp. I solve the problem by turning off the graphics card in PS but often use plugin that need the graphics card otherwise the processing time is much longer. I ask for help.
    Thanks.

  • HT1338 I need to bulk upload to Auctiva (auction software) but Java was disabled on my computer. I have 10.5.8 so does this mean that I can't use Java? If not, then is there a workaround to be able to use the bulk uploader from Auctiva?

    I need to bulk upload images from iPhoto to Auctiva (auction software) that will then be posted to eBay; however Java was disabled on my computer some time ago due to "known issues."  I have 10.5.8 so does this mean that I can't use Java? If not, then is there a workaround to be able to use the bulk uploader from Auctiva? As it stands now, I have to upload photos individually which is super time consuming.

    You can re-enable it for special purposes, opposite of disabling it...
    Disable Java in your Browser settings, not JavaScript.
    http://support.apple.com/kb/HT5241?viewlocale=en_US
    http://support.google.com/chrome/bin/answer.py?hl=en-GB&answer=142064
    http://support.mozilla.org/en-US/kb/How%20to%20turn%20off%20Java%20applets

  • Thank you for approving my feed iTunes . The only problem is, there is no art work, even though artwork was submitted correct sizes and formats were used. Why is this and how can the problem be rectified?

    Thank you for approving my feed iTunes . The only problem is, there is no art work, even though artwork was submitted correct sizes and formats were used. Why is this and how can the problem be rectified?

    Thanks for getting back. Hadn't got round to re uploading the amended feed. I just did it now.
    The only thing is, Feed Validator doesn't like it because of the picture size, and a couple of other things, it reeds the following:
    Sorry
    This feed does not validate.
    line 22, column 14: width must be between 1 and 144: 1400 [help] <width>1400</width>
                  ^
    line 23, column 15: height must be between 1 and 400: 1400 [help] <height>1400</height>
                   ^
    line 25, column 21: XML parsing error: <unknown>:25:21: not well-formed (invalid token) [help]
    <itunes:image href=http://www.whiteberg.com/Wdotfontitunes2.png" />
                         ^
    In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendations.
    Your feed appears to be encoded as "utf-8", but your server is reporting "US-ASCII" [help]
    line 4, column 114: Self reference doesn't match document location [help]... dcast.xml" type="application/rss+xml" />
                                                 ^

  • I am a windows XP user and I recently upgraded to I tunes 10 and everything on my computer slowed down to a snail pace..  Any other problems out there like this???  I did everything that D528 said to do and it still runs like a snail

    I am a windows XP user and I recently upgraded to itunes 10 and everything on my computer slowed to a snail pace.  Any other problems out there
    like this??   I did everything that D528 said to do and still runs very slow.. Please help.  How can I go to an older vertion of itunes..  It worked before???

    I am a windows XP user and I recently upgraded to itunes 10 and everything on my computer slowed to a snail pace.  Any other problems out there
    like this??   I did everything that D528 said to do and still runs very slow.. Please help.  How can I go to an older vertion of itunes..  It worked before???

  • I am a windows XP user and I recently upgraded to I tunes 10 and everything on my computer slowed down to a snail pace..  Any other problems out there like this???  Any help would be appreciated

    I am a windows XP user and I downloaded I tunes 10 and my computer slowed down to a snail pace..  Any other problems out there??   Any help would be appreciated..

    I am a windows XP user and I downloaded I tunes 10 and my computer slowed down to a snail pace..  Any other problems out there??   Any help would be appreciated..

  • Hi! I tried to instal whatsapp thro istore and it displayed the terms and conditions page. But the problem is there is no save or agree button. I am stuck in this page. I need help. This is a iphone5. This was after I upgraded to ios7

    Hi! I tried to instal whatsapp thro istore and it displayed the terms and conditions page. But the problem is there is no save or agree button. I am stuck in this page. I need help. This is a iphone5. This was after I upgraded to ios7.

    It is hardly Apple's fault that Epson can't/won't update their driver, but at least Epson suggest that you use the Gutenprint driver, which in any case is far better that what Epson offer.
    You can get it here:
    http://gimp-print.sourceforge.net/
    You can download the latest version from here:
    http://sourceforge.net/projects/gimp-print/
    Have you downloaded the recent Apple update to Epson drivers?
    http://support.apple.com/kb/DL1398

  • Is there a workaround??

    i installed weblogic 5.1 under e:\program files\weblogic
    ejbc won't work because of the space in the directory name (according to
    known issues document)
    the EJB Deployer tool won't work even though it says my ejb is compliant
    (i think this might be due to the space in the home dir for weblogic
    also)
    is there a workaround for deploying my ejb?
    thx

    This was fixed in one of the latest service packs.
    Pls upgrade to the latest SP and re-post if the problem is still there.
    http://www.weblogic.com/docs51/classdocs/README2.html#9902
    Kumar
    Brian Martino wrote:
    i installed weblogic 5.1 under e:\program files\weblogic
    ejbc won't work because of the space in the directory name (according to
    known issues document)
    the EJB Deployer tool won't work even though it says my ejb is compliant
    (i think this might be due to the space in the home dir for weblogic
    also)
    is there a workaround for deploying my ejb?
    thx

  • MS Word 2010 product not compatible with Mozilla? Is there a workaround?

    I just purchased MS Office Home and Student 2010. I got an error message that says I do not have a compatible operating system. Is there a workaround if I only use Mozilla Firefox?

    This is apparently not a Firefox related problem. The MS Office 10 setup program doesn't see your computer as having a compatible version of Windows. If you are running Windows XP, you need to have service pack 3 installed. If you are running Vista, you need at least service pack 1. Here is the URL for a support document that may be helpful: http://support.microsoft.com/kb/2267642

  • 10.2 crashes when I try to convert old libraries for use in the new software. Is there a workaround for this? Or will i have to continue using the previous version to complete older projects?

    Final Cut Pro X 10.2 crashes when I try to convert old libraries for use in the new software. Is there a workaround for this? Or will I have to continue using the previous version to complete older projects? the only foreseeable solution is to begin any new projects on 10.2 or importing footage on 10.2 and starting form scratch--which is something i definitely don't want to do or have time to do. ANY advice, thoughts, or opinions would be greatly appreciated! Thank you!
    Running 10.10.3 // MacBook Pro (Retina, 15-inch, Early 2013) // 2.4 GHz Intel Core i7 // 8 GB 1600 MHz DDR3

    Exactly the same problem with me.
    Some other threads advice to remove fonts, clean the caches, remove add ins but nothing works consistenty, for some it looks like it works, for me it failed.
    What I did not try yet, was to move the Render files out of the malicious library to trash.

  • When I try to export from iMovie '11 I get repeated messages that the project is too big. Why? Is there a workaround? (I have already cut a 40-minute movie into three chunks...)

    When I try to export from iMovie '11 I get repeated messages that the project is too big. Why? Is there a workaround? (I have already cut a 40-minute movie into three chunks... the first exported to iDVD ok, but the next one of 15 minutes balked for the same reason -- too long...)

    I wish I had a mac :-P 
    Sadly, this is Windows machine so I dont have a non-iOS version of iMovie.  I have 2 ideas left.  The first is xfering the project to my iPhone 4 and trying to export it there (if that works, awesome but geez apple the iPad 2 is way more powerful than the iphone 4.. youd think I wouldnt even have to attempt this).  The 2nd idea is to start at the end of my movie and delete clips and sounds backwards, trying to export each time to find whatever clip is causing the issue (when the movie was 5 minutes it mixed no probem, so I only need to go that far).
    Wish me luck? 
    Also, is anyone else besides me and the 5 dudes in the other threads having this issue??  Speak up, guys - Apple cant a fix a problem they dont know about.

  • Is there any workaround for Bug 6644652 ?

    Hi
    This issue is documented in DBAppTables GTC Connector at Known issues:
    "Bug 6644652
    Reconciliation of account deletion is not supported. In other words, if a record is
    deleted from the target database, then this deletion is not reconciled into Oracle
    Identity Manager"
    Is there any workaround that can be used ?
    Thank You in advanced,
    Ionut

    EHLO!
    Today I ALMOST finalized my delete-recon (is for AD objects, but I think it may work in many contexts). As the pals said, you have to use the createDeleteReconciliationEvent method from the operations API.
    I had a big problem: I spent a day looking for a NullPointerException that was raised just when this method is called. I realized that there is not a problem itself, the exception was raised because I was launching from the Eclipse project! So, instead of develop all the stuff and then pass it to OIM, I had to maje the jar, put it into the ScheduleTask folder, and execute it with the Task Scheduler from the Design Console, or from the Admin Console.
    For a brief:
    1) make a class that extends com.thortech.xl.scheduler.tasks.SchedulerBaseTask
    2) implement the execute() method
    3) for creating the operator, you can call (tcReconciliationOperationsIntf)getUtility("Thor.API.Operations.tcReconciliationOperationsIntf") (getUility is inherited from SchedulerBaseTask)
    4) Make some Map object, with key/value pairs. Keys have to be the same as they appear in the Reconciliation Fields of the Resource Object, and at least you have to put the required ones. Call the method, the first parameter is a String with the RO ("Xellerate User", "AD User", "Exchange", etc).
    For example, you can make something like this:
                   HashMap hm = new HashMap();
                   hm.put("User ID", "drldap");
                   hm.put("objectGUID", "12345679");
                   try {
                        reconOps.createDeleteReconciliationEvent("AD User", hm);
                   catch(Exception e) {
                        e.printStackTrace(System.out);
    Hope it was helpful. Enjoy!
    DrLDAP!

  • Em bug - is there a workaround?

    Hi
    I'm using Dreamweaver CS3 for Windows.
    On the Insert + Text toolbar, there is an "I" button and an
    "em" button; but
    *both* buttons insert <em> tags!! The only way I have
    found to insert <i>
    tags is by working in the code window and typing the tags
    manually, which
    rather defeats the object of using a wysiwyg editor. Is there
    any workaround
    for this bug?
    The same applies to the so-called "b" button on the toolbar,
    which inserts a
    <strong> tag instead of a <b> tag.
    The point being that <em> and <strong should only
    ever be used for emphasis,
    as they cause screen readers to change their tone of voice;
    they should
    never be used for purely presentational purposes, so this bug
    is quite a
    serious one.
    Dave

    Thanks Thierry, that's very helpful. You seem to be backing
    up and
    reinforcing my statement that Adobe's default setting for
    Dreamweaver is a
    very bad one, and that it encourages exactly the sort of bad
    practice that
    has so far prevented screen reader manufacturers from
    supporting em and
    strong properly.
    In the meantime, I've implemented Danilo's workaround, so
    that my site at
    least can use those tags as they were intended to be used.
    Dave
    "Thierry" <[email protected]> wrote in message
    news:[email protected]...
    | "Dave Rado" <[email protected]> wrote in
    message
    | news:[email protected]...
    | > Hi Thierry
    | >
    | > "Thierry" <[email protected]> wrote in message
    | > news:[email protected]...
    | >
    | > | HTML elements have a semantic purpose and that's
    what they should be
    | > used
    | > | for. For their meaning defined by the W3C.
    | >
    | > I guess, but in this specific instance I don't really
    see the purpose of
    | > it.
    | > As I say, I had *thought* that its purpose was to
    allow screen readers
    to
    | > distinguish between purely presentational
    italicisation and bolding, and
    | > text intended to be emphasised or read more loudly.
    |
    | But that's a problem with screen-readers (SR) vendors, not
    with the
    elements
    | per se.
    | As a side note, may be vendors chose not to "support"
    em/strong because
    they
    | found that too many documents on the web were using these
    elements poorly
    | (for the wrong reason). Imagine a SR user landing on a page
    where someone
    | has used both to "style" (in bold/italic) most of the text
    on his page
    | (there are still a lot of these out there).
    | May be that's also why support for Definition Lists is
    poor, because they
    | are (were) not very common in documents.
    |
    | > | Note that the default styles sheet of most visual
    browsers will style
    | > these
    | > | elements to carry this meaning. Screen-readers are
    not the only UAs
    out
    | > | there to benefit from semantic mark-up.
    | >
    | > Now you've lost me. Are you saying that in my browser
    I should be able
    to
    | > tell the difference on screen and without looking at
    the source between
    | > text
    | > marked up with <b> and with <strong>, and
    between text marked with <i>
    and
    | > with <em>? Because I can't.
    |
    | You're right, I was talking about HTML elements in general,
    not the 4 you
    | mention in this thread. But again, this "default styling"
    is a vendor's
    | choice and we could imagine that visual browsers would
    render these
    | differently (not the "i" and "b", but the "em" and
    "strong") depending on
    | "lang". As "we" associate emphasis with boldness and
    italic, but it may be
    | different in another "culture" (see Internationalization
    and
    localization).
    | In any case, if we write markup using the proper
    vocabulary/grammar we can
    | only hope that some UA will take advantage of it (I believe
    decent SEs do
    | that already).
    |
    |
    | --
    | Thierry
    | Articles and Tutorials:
    http://www.TJKDesign.com/go/?0
    | --
    | Keep your markup *clean* with these DW extensions and
    scripts:
    |
    http://www.divahtml.com/products/scripts_dreamweaver_extensions.php
    |
    |

Maybe you are looking for

  • Nokia Phones - Windows 8.1, Firmware and Future

    Lots of posts about Windows phones and the Windows Phone 8.1 update and firmware update(s) that are not happening for Verizon customers.    The talk on the net is Verizon has discontinued the Lumia Icon, so I called Verizon to find out.   The rep. I

  • OpenScript Load Testinf - Download File

    Hi guys! I was recording load test script which ends with file download. My problem is that file isn't actually download while playing this script in OpenScript. Do you know how to make it work? With regards, PsmakR

  • Discoverer desktop via Citrix

    I have tried in environment test Oracle Discoverer Client via Citrix terminal server on machine with only one processor and everything was OK. In environment production Oracle Discoverer runs on machine with two processors (in hiperthread are 4 proce

  • Difference in amount in sales order and billing for one line item

    Hi experts, User created one sales order with three line items say line item10, line item20 Line item 30.Line item 10 value is 5024.26 EUR in sales order. He did delivery for three line item and invoiced. But the problem is that the line item 10 valu

  • Federated warehouse

    Hi Experts, I have been able to build a warehouse with data from operational system so we can report on. We are just using ROLAP (all tables - no MOLAP yet - but I would like to use AW at some point. I am using Microstrategy as reporting tool. Now I