Some trouble in setSize() method

I writed some code for resize jpanel's size,It work well in J2SE131,but it have some trouble in J2SE141.
Now I write one test program for test this problem.code list under this statement.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Frame1 extends JFrame {
private JPanel contentPane;
private BorderLayout borderLayout1 = new BorderLayout();
private JScrollPane jScrollPane1 = new JScrollPane();
private JPanel jPanel1 = new JPanel();
//Construct the frame
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
this.setSize(new Dimension(400, 300));
this.setTitle("Frame Title");
jPanel1.setPreferredSize(new Dimension(400, 280));
jPanel1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(MouseEvent e) {
jPanel1_mouseClicked(e);
contentPane.add(jScrollPane1, BorderLayout.CENTER);
jScrollPane1.getViewport().add(jPanel1, null);
catch(Exception e) {
e.printStackTrace();
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
void jPanel1_mouseClicked(MouseEvent e) {
System.out.println(jPanel1.getSize());
jPanel1.setSize((int)(jPanel1.getWidth()*1.2),(int)(jPanel1.getHeight()*1.2));
System.out.println(jPanel1.getSize());
System.out.println("*******");
public static void main(String[] args){
Frame1 f = new Frame1();
f.show();
compile it,and run it under J2SE131,jPanel1 can zoom in container--jScrollPane1.
but in J2SE141,it can setSize,out windows:
java.awt.Dimension[width=400,height=280]
java.awt.Dimension[width=480,height=336]
java.awt.Dimension[width=400,height=280]
java.awt.Dimension[width=480,height=336]
java.awt.Dimension[width=400,height=280]
java.awt.Dimension[width=480,height=336]
it said setSzie() work OK,but jPanel1's size recover again.
I want know why it happend,and how to make it work well in J2SE141.
Thanks a lot.
[email protected],cn

I add one statement after setSize() sttement,it can work well in J2SE141.
jPanel1.setPreferredSize(new Dimension((int)(jPanel1.getWidth()*1.2), (int)(jPanel1.getHeight()*1.2)));
It maybe get preferred size in update method(),why sun'doc not notice about this?

Similar Messages

  • Some trouble with getElementById method

    Hi
    I have an XML file just like that:
    <?xml version="1.0" encoding="UTF-8"?>
    <persons id="root">
        <firstname1 id="firstname1">John</firstname1>
        <lastname1 id="lastname1">Brown</lastname1>
        <firstname2 id="firstname2">Andrew</firstname2>
        <lastname2 id="lastname2">Clark</lastname2>
        <firstname3 id="firstname3">Sylvie</firstname3>
        <lastname3 id="lastname3">Steevens</lastname3>
        <firstname4 id="lastname3"></firstname4>
        <lastname4 id="lastname4"></lastname4>
    </persons>I enter this one into the Document by using the standard way, problem is with calling gsome etElementById method. When I put there any one id value, firstname1, or root for instance, then I get null.
    What do I do wrong?
    Regards
    Krzysztof Malinowski

    http://javaalmanac.com/egs/org.w3c.dom/GetById.html

  • OEM in 10g RAC (10.2.0.2.0) has some troubles!![ help]

    Hi, all.
    The database is 2 node RAC (10.2.0.2.0 ) on 32 bit windows 2003 EE SP1.
    The Enterprise Manager is not Grid Control.
    I created a RAC database by using DBCA, and Enterprise Manager was
    installed by default.
    Currently, It seems that the database has some troubles.
    Depending on the cases, OEM sessions go into pending status.
    Now, I stopped "DBconsole windows services" and thus emagent is not running.
    1. Does Enterprise Manager have something to do with ADDM and AWR snapshots?
    2. Are there any Enterprise Manager bugs?
    I have to make a quick report to my boss. :(
    Any help will be greatly appreciated.
    ● from emagent.trc
    2007-09-24 00:05:02 Thread-4264 WARN http: snmehl_connect: connect failed to (NMSP110:1158): 対象のコンピュータによって拒否されたため、接続できませんでした。
    (error = 10061)
    2007-09-24 00:05:02 Thread-4264 ERROR upload: FxferSend: Cannot connect to: http://NMSP110:1158/em/upload/. retStatus=-1
    2007-09-24 00:05:02 Thread-4264 ERROR upload: Failed to upload file B0003153.xml, ret = -2
    2007-09-24 00:05:03 Thread-4264 WARN http: snmehl_connect: connect failed to (NMSP110:1158): 対象のコンピュータによって拒否されたため、接続できませんでした。
    (error = 10061)
    2007-09-24 00:05:03 Thread-4264 ERROR upload: FxferSend: Cannot connect to: http://NMSP110:1158/em/upload/. retStatus=-1
    2007-09-24 00:05:03 Thread-4264 ERROR upload: Failed to upload file B0003153.xml, ret = -2
    2007-09-24 18:27:31 Thread-5180 ERROR util.files: nmeufile_getLength: Error in lfilen. Error = 0 (No error)
    ● From emos.trc
    2007-09-22 00:00:02,046 [JobWorker 1785:Thread-20] ERROR em.jobs executeCommand.159 - UpdateARUTables: Oracle MetaLink credentials are incorrect or missing. Click Patching Setup to set required parameters.
    2007-09-23 00:00:04,578 [JobWorker 1788:Thread-20] ERROR em.jobs executeCommand.159 - UpdateARUTables: Oracle MetaLink credentials are incorrect or missing. Click Patching Setup to set required parameters.
    2007-09-24 00:04:33,515 [HealthMonitor] ERROR emd.main run.270 - HealthMonitor : Found errant task : TaskRegn:ID3,Callback:class oracle.sysman.emdrep.jobs.Dispatcher,Iterative:true,Duration:300,DueTime:1190559873500
    2007-09-24 00:04:33,515 [HealthMonitor] ERROR emd.main restart.389 - HealthMonitor 2007/09/24 0:04:33 Job Dispatcher error: Job Dispatcher timed out. Job Dispatcher id=784
    2007-09-24 00:04:33,515 [CacheManager] ERROR cache.CacheManager run.519 - Exception message: sleep interrupted
    java.lang.InterruptedException: sleep interrupted
         at java.lang.Thread.sleep(Native Method)
         at oracle.sysman.emSDK.svc.cache.CacheManager$Checker.run(CacheManager.java:507)
         at java.lang.Thread.run(Thread.java:534)
    2007-09-24 00:05:15,359 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.sysman.ias.ias.IASIntegration
    2007-09-24 00:05:15,500 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.sysman.eml.target.slb.common.SLBIntegration
    2007-09-24 00:05:15,531 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.sysman.eml.ssl.intg.SSLIntegration
    2007-09-24 00:05:15,593 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.tip.oem.central.domain.ProcessConnectDomainIntg
    2007-09-24 00:05:15,593 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.tip.oem.central.instance.ProcessConnectInstanceIntg
    2007-09-24 00:05:15,593 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.webdb.admin.em.PortalIntegration
    2007-09-24 00:05:15,609 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.webdb.admin.em.SSOIntegration
    2007-09-24 00:05:15,609 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.reports.em.RepIntg
    2007-09-24 00:05:15,609 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.sysman.ocs.mntr.target.OcsEmailIntegration
    2007-09-24 00:05:15,609 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.sysman.ocs.mntr.target.OcsOidIntegration
    2007-09-24 00:05:15,609 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.sysman.ocs.mntr.target.OcsOvfIntegration
    2007-09-24 00:05:15,609 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.sysman.ocs.mntr.target.OcsWebconfIntegration
    2007-09-24 00:05:15,609 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.sysman.ocs.mntr.target.OcsWirelessIntg
    2007-09-24 00:05:15,609 [Orion Launcher] ERROR app.ContextInitializer contextInitialized.271 - Integration Class not found: oracle.sysman.ocs.mntr.target.OcsCalGrpIntegration
    2007-09-24 00:05:16,187 [JobWorker 1791:Thread-13] ERROR em.jobs executeCommand.159 - UpdateARUTables: Oracle MetaLink credentials are incorrect or missing. Click Patching Setup to set required parameters.
    2007-09-25 08:49:00,269 [CacheManager] ERROR cache.CacheManager run.519 - Exception message: sleep interrupted
    java.lang.InterruptedException: sleep interrupted
         at java.lang.Thread.sleep(Native Method)
         at oracle.sysman.emSDK.svc.cache.CacheManager$Checker.run(CacheManager.java:507)
         at java.lang.Thread.run(Thread.java:534)
    Thanks and Regards.
    Message was edited by:
    user507290

    Dear rodneyli.
    Thanks for your reply.
    My understanding is it's better to use Grid Control to manage RAC. From the >documentation, it says database console can be used as well but i haven't used it.Could you give me the html link, which explains the difference between Grid Control and DB console?
    Thanks and Regards.

  • HT201342 I am having some trouble trying to back up my notes to my iCloud account, i have tried to delete my icloud account and create a new one, but still when i back my phone up on iCloud my notes do not seem to be backed up.How can i back up by notes o

    I am having some trouble trying to back up my notes to my iCloud

    Not photos, just data synced with iCloud shown in Settings>iCloud.  If you don't have sufficient storage to back up to iCloud, back up to your computer instead using iTunes (connect you phone to your computer, open iTunes, click on the name of your phone in iTunes, go to ths Summary tab of your iTunes sync settings and click Back Up Now).  Also transfer your purchases to your iTunes library (connect your phone to your computer, open iTunes and go to File>Devices>Transfer Purchases). If you have photo stream photos older than 30 days tha you wan to save, save these to your camera roll before backing up (tap Select, tap the photos, tap the share icon -- box with upward facing arrow, then tap Save to Camera Roll).
    When setting up your new phone, when given the option choose Restore from iTunes Backup and restore the backup you made earlier.

  • I'm having some trouble transferring audio books to my iPhone.  It usually takes 3 or 4 tries to get all the parts transferred.  I didn't use to have this problem - all parts would transfer in one try.

    I'm having some trouble transferring audio books to my iPhone.  It usually takes 3 or 4 tries to get all the parts transferred.  I didn't use to have this problem - all parts would transfer in one try.

    carolinechx wrote:
    i know the description may be a little bit too confusing
    Mostly because you are not using any capital letters or paragraph returns and your post is difficult to read.

  • I have some trouble with Safari!  Everytime i google something, I expect safari to open the link i click in the same window and same tab - as it did before - but now it always opens a new tab! I'm getting really tired of that! So please help me!

    I have some trouble with Safari! 
    Everytime i google something, I expect safari to open the link i click in the same window and same tab - as it did before - but now it always opens a new tab! I'm getting really tired of that! So please help me! I want safari to open the google search link in the same window and tab! How to fix that?
    Please help me!!!
    Thank you!

    From the Safari menu bar, select
    Safari ▹ Preferences ▹ Extensions
    Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit.

  • TROUBLE WITH PAYMENT METHOD USED DIFFRENT VISA PAYMENTS STILL WONT WORK

    TROUBLE WITH PAYMENT METHOD USED DIFFRENT VISA PAYMENTS STILL WONT WORK

    This is a case for the iTunes Store Support:
    1. Go to expresslane.apple.com
    2. select 'itunes' and then 'itunes store' on the right
    3. select a topic and a subject
    4. click 'continue' and then 'email'
    5. fill out the form and explain your situation
    6. they will respond within 24 hours usually
    Good luck
    Stijn

  • I have some trouble With the graph XY, if I display a curve and try to zoom on it, it may be corrupted, or may disappeare​d.

    In fact this happens on some computers. the graph XY causes some trouble when zooming. Sometimes, when I run my main program and open the window with the graph, it has change the displayed it overflows to the edge of the windows. Or somtimes it works but if I zoom the curves disappeared, or is corrupted.
    I have this for instance on a computer with win 98 and a ATI graphic board. So I try to update all drivers but noting has changed. I try to decrease the hardware acceleration, and it seems to happen less oftenly.
    Does anybody have seen that kind of trouble ?

    > I have some trouble With the graph XY, if I display a curve and try to
    > zoom on it, it may be corrupted, or may disappeared.
    >
    I think what you are describing is not due to video driver, but rather
    to the way the graph works. The LV graph maps points to integer screen
    coordinates and draws lines be tween those point. When the numbers are
    way to large to fit on the screen, the numbers are pinned to a special
    large value. When this happenson one axis but not the other, it causes
    the slope of the line to change and potentially not cross the screen.
    If this is the same effect I'm describing, it only takes place when you
    zoom into the data by a large extent, pushing the other points about ten
    to fifteen monitors away. At this point you are no longer
    looking at
    measured data, but rather just on the interpolation of a line between
    two points. The solution if you must have one is to resample your data
    on the diagram to contain more points.
    Greg McKaskle

  • How can I install purchased Apps from my ipad to my New imac? I have some Troubles to find and install.

    Hi,
    I have some trouble to find and install
    my purchased Apps which I use on my Ipad
    since 1 Year ago.
    I also use the actually Itunes Version.
    :-) Thanks for helping.
    Edmund-sky

    File>Devices>Transfer Purchases

  • Hi! I have some troubles with my iphone 4...

    Hi! I have some troubles with my iphone 4 since a few months. Sometimes, suddenly, it pretends to discharge very fast, but when it comes to 1% I can still use it for hours. Also, when I recharge it, nothing would change at the 1%-note but the battery seems to be fully charged. The first and second time this happened, I made the mistake to turn the phone off because I thought a restart would solve the problem. But it made it worse: The Iphone wouldn't turn on again. I tried all the tricks with home + power button and also tried to connect it to itunes on my macbook, but nothing happend. When I connect the charger it shows me that the battery is empty (which isn't the case - I also tried different wires). After a few hours a little miracle occured and the **** thing turned on all by itself and pretended as if nothing happened.
    The third time this happend I didn't turn the phone off and just used it normally. I took care that the battery is always full and after a few days it was normal again.
    Now it happened again but I had no wire with me at work and the battery ran low and the phone turned off. Now I'm trying to "reanimate" it for 2 days now...nothing. The last times it took 3hours to 12 hours until it would awake but now...
    Does anyone know this problem and knows how to solve it? As I said, I already tried the "press the home button and powerbutton and both and whatever" tricks for a few times but it doesn't change anything....
    Cheers,
    Diana

    Buzz! Thank you for playing!
    You're out of luck. At least here. Discussing jailbroken devices is forbidden by the terms of service.
    It's likely the jailbreak has permanently hosed it.

  • HT201365 Hello . I have an iphone for which is currently IOS 7 updated. I have had some trouble with its batery life after IOS 7 update. I advised from the phone shop that I need to give it a factory restart and I made it. Now i have icloud activation loc

    Hello . I have an iphone for which is currently IOS 7 updated. I have had some trouble with its batery life after IOS 7 update. I advised from the phone shop that I need to give it a factory restart and I made it. Now i have icloud activation lock and I have no idea when I create an icloud account. I donr remember any related email or password. I am completely losttt
    Any help guys ? ( I am currently stuck with Nokia 2210

    Welcome to the Apple community.
    Unfortunately, unless you know the Apple ID, there is absolutely nothing that can be done, you cannot use your mobile device. You may be able to find your Apple ID at Look up your old and forgotten Apple ID

  • With the latest update, i have some trouble with youtube. Every videos that i watch are shaking. Is there something to fix it?

    With the latest update, i have some trouble with youtube. Every videos that i watch are shaking. Is there something to fix it?

    Instantly worked, found this on other thread!!
    1. System Preferences >  Flash Player > Advanced >  Delete  All
         Press the "Delete All" button
    2. Safari > Preferences > Privacy
        Press the button “ Remove All Website Data”.
    *Dont forget to restart Safari

  • Some troubles after installing SP2

    Greetings to all,
    we're experiencing some troubles after the installation of the service pack 2 for Excelsius 2008: formatting options of various components are not matching what we see on the dashboard in preview mode (for example, values in horizontal progress bars or values in list views show numbers like 123.456,78000 while the formatting option is set to 2 decimals and show thousand separator. Same strange behaviour in percentage values where you see 00% while the relative option is set to percentage, 1 decimal).
    Is there any workaround or any solution to this problem?
    It's quite annoying.
    Thanks for your help

    Hi Claudio,
    you only need to use a crossdomain file if your Xcelsius model is retrieving data from a domain different than yours.
    Error 2170 is from a security nature in adobe. Mark your files as trusted here:
    http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
    For more information refer to following document:
    http://help.sap.com/businessobject/product_guides/xcelsius2008SP3/en/Xcelsius2008SP3_user_guide_en.pdf#page=347
    Regards
    Victor

  • TS1846 I have some troubles recently with Final Cut Pro 7 and would like to remove my preferences. I can't find any "com.apple.finalcutpro.plist" file from the Preferences folder but I do have some preferences.  So, where could be the file ?

    I have some troubles recently with Final Cut Pro 7 and would like to remove my preferences. I can't find any "com.apple.finalcutpro.plist" file from the Preferences folder but I do have some preferences.  So, where could be the file ?

    Digital Rebellion has you covered: http://www.digitalrebellion.com/prefman/

  • I got some trouble:I have a(Adobe Creative Suite6 Design&Web Premium)CD

    I have cd number (ex:15x3-xxxx-xxxx-....) ,but my CD can't install my computer and got some trouble!
    where can I download the file?

    You may download from
    Download CS6 products

Maybe you are looking for