Window resizing and repaint()

hiya all. I was wondering what specifically was called when resizing a JFrame. Im assuming that repaint() is called as when i resize my JFrame the paintComponant method is run, but is there anything else? The reason i am asking is that i have an application that the user area changes size while in use, hence the scrollBars also changing to reflect the new size of the JPanel inside. This works when resizing the window, but when paintComponant is called via repaint() nothing happens (to the scrollbars), I have included the setPreferredSize(..) method at the end of my paintComponant() method, which sets the new size for the panel. Im sure its something simple but if anyone could help me out it would solve an irritating problem!
Thanks
Dori

Swing related questions should be posted in the Swing forum.
If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
http://homepage1.nifty.com/algafield/sscce.html
Don't forget to use the "Code Formatting Tags", so the posted code retains its original formatting.
http://forum.java.sun.com/help.jspa?sec=formatting

Similar Messages

  • WINDOW-RESIZED and WINDOW-ACTIVATED

    The WHEN-WINDOW-RESIZED and WHEN-WINDOW-ACTIVATED
    triggers seem to be conflicting - when both of them
    should fire (focus is on one window but go on to
    resize another one), the WHEN-WINDOW-RESIZED trigger
    doesn't fire.
    Any solution or tricky workaround? Thanks in advance.

    Please, anyone?

  • Disable window resizing and lock them?

    Is it possible through a prefernce or maybe an application to disable window resizing and lock their positions. I let my friends and family use my computer and they always move stuff around and resize everything. It really annoys me and I hate having to adjust everything to the way I like which I have spent hours setting up so they can just destory in a matter of seconds. I know I can setup a guest account but I don't have the memory or processing power for it since I usually have about 3-5 applications always open. I would also I like to steer clear from that route if possible. Thanks for any help on my issue! I did try searching to no avail however if this is already been discussed I appologize and a link to the discussion would be appreicated.
    1.42Ghz G4 Mac Mini   Mac OS X (10.4.8)   ATI Raedon 9200, 256MB ram, Model number: A1103

    The setting up and use of a guest account will not affect the memory or processing power but will use some of the hard disk space depending on how much stuff you allow your guest user(s) to save.
    You can easily set your favourite apps to load when you login again by clicking and holding on the app icon in the your Dock before you setup the new account - a pop menu appears. The advantage of having a separate account is that if you set it up as a non-administrator account the guests would not be able to screw up things too much, where as at present they could cause havoc.
    chris

  • Difference between manual resize and repaint, invalidate, validate etc etc?

    Using Jdk 1.5 and under windows XP I am drawing directly in a JPanel.
    And thus creating a drawing of my own when the system calls:
    public void paintComponent(Graphics g) {
    Graphics2D g2 = (Graphics2D)g;
    Line2D lineInArrow =
    new Line2D.Double(. . . );
    g2.draw(lineInArrow);
    Ellipse2D ellipse = new Ellipse2D.Double(. . . );
    g2.draw(ellipse);
    The program of course has much more detail but that is the essence of it.
    Now, it turns out that my drawings sometimes become rather messed up and needs to be redrawn so I have tried calling. repaint(), invalidate(), validate(), paintImmediately() in many different combinations and several times.
    As the system is a more complex than just a JPanel - the JPanel is
    contained in a JScrollPane for instance and all is set in a JDialog - I have also tried calling the different parts with these methods and in many different combinations.
    Even calling the parts repeatedly from another Thread so that the methods get called every second or so does not help.
    NOTHING HAPPENS to the messed up drawing
    UNLES I DO A MANUAL RESIZE of the window. Then the drawing becomes OK!!!
    Yes, you guessed right, I have also tried resizing from the program
    by calls such as:
    Dimension currentSize = this.getSize();
    this.setSize(100, 100);
    this.setSize(currentSize);
    repaint();
    The window flickers - gets smaller and then gets back to its original size.
    But the drawing, if messed up, is still messed up in exactly the same way.
    SO WHAT IS HAPPENING WHEN I DO A MANUAL RESIZE BUT NEVER HAPPENS WHEN I DO ANY OF THE ABOVE?
    And, can I somehow initiate this - whatever it is - by programming rather than by a manual resizing of the window??

    With messed up I simply mean that it is not properly redrawn.
    For example a rectangle that should have been drawn is not shown - not drawn. Or a String is not drawn in its proper place.
    But when I do a manual resize (using the mouse) things are drawn correctly. Sometimes I have to do more than one resize to get everything drawn correctly.
    I might also add that I have tried some other more or less weird strategis to get this "manual resize like painting" activated such as:
    Calling the paintComponent method directly:
    Graphics g = this.mainDrawPanel.getGraphics();
    mainDrawPanel.paintComponent(g);
    Trying to make the system understand that something DO have changed:
    JButton aDummyButton = new JButton("Hi there - did you see me??");
    mainDrawPanel.add(aDummyButton);
    this.repaint();
    mainDrawPanel.remove(aDummyButton);
    this.repaint();
    Nothing makes anything happen - except the manual resize of the window.
    So what is so special about a manual resize of a window? What actually goes on when this happens? - That does NOT happen in all the other attempts?

  • Window resizing and how to keep the window at that size.

    Having trouble with the applications window not staying the same size after I resize it. I know that dragging the corner will resize as well as the green button, but after I close it, it reverts back the small window and not to the resized window after I have done the above. Went to an apple store and no one there knew how to fix it or maybe I didn't explain myself very well.

    I assume you're opening the Applications folder in a separate window through an alias or a Dock icon... if so, just open it, move and resize it the way you want, then immediately close it again. That should do the trick.

  • Mavericks and MacMini - after sleep mode windows resized and glued to left upper corner

    Hi!
    I have MacMini and HDMI monitor. When I go to bed, I use sleep mode and off monitor using power button (I don't like standby light). When I woke up, I press on my touchpad to wake up my MacMini, after that I stand up and turning on monitor. All works fine, until I installed Mavericks. Now, after turning on, all windows changed size to very small and glued to left upper corner. I can't resize or move window. Only shutdown app can help. But, I can't shutdown Finder, I need reboot MacMini. It's very annoying.
    As I understand, this problem appear, when I wake up MacMini before turning monitor on. When I turned on monitor and after that woke up MacMini, windows don't change his sizes.
    What can I do to solve this problem?

    This issue is driving me insane. I lock my computer a couple of times a day as I go to meeting and what not. Everytime either Outlook or VMWare or Chrome will be screwed up when I awake it from sleep. I have to kill the app and start it back up again or I can't get it out of its weird "docked" mode. Basically the application window will be nearly off the screen. I can move it on the screen but the caption will be off screen still and I will not be able to size the window at all. It really messes VMWare's mind up when this happens.
    I wanted Mavericks as it was supposed to fix multiple monitor issues but it has made it worse. Very sorry I upgraded. I hope they fix it in the next bug patch. I just cuss at the stupid thing when I wake it.
    MacBook Pro 16g of memory with external 24" monitor via HDMI -> DVI connector. Laptop is primary monitor on the left, external monitor is on the right. Mavericks is in the doghouse just below both of them.

  • Window resizing and Photobooth won't save pictures at all.

    My windows are only 4 inches tall how do I get them to normal size? iMAC 10.6.8  

    Hello SRHeimes,
    I'd recommend restarting the iPhone, if you haven't done so already. If restarting the phone hasn't got you on your way to sending pictures again, we've an article that provides further helpful information.
    If you still can't send or receive MMS messages
    To send and receive MMS messages on your iPhone, verify that your wireless carrier supports MMS2.
    Ensure that MMS Messaging is turned on in Settings > Messages.
    Verify that your phone is able to access cellular data.
    Some carriers allow you to edit your APN (Access Point Name), which may prevent MMS from working.
    If you are roaming outside your calling area, make sure you have Data Roaming turned on in Settings > General > Cellular to send or receive MMS content.
    While on a phone call, you will be unable to send or receive MMS messages when using an EDGE, GPRS, or any CDMA cellular data network. After the phone call ends, you will receive any incoming messages. If you tried to send an MMS message, you may need to send it again.
    If the issue persists and your wireless carrier has confirmed that your wireless account is provisioned2 for MMS, restore the iPhone.
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Cheers,
    Allen

  • What is Live Window Resizing in Numbers or Excel?

    The reviews of Mac Word 2008 say it, like Numbers, will still now allow live window resizing in Excel 2008 (like it did not in Office 2004), although it will in Word. Stupid question- exactly what is live window resizing and what are the implications in using Excel 2008 or Numbers?

    In the Windows version of word you can very easily. I have lots of docs that have large numbers of tables using excel. It is a lot easier to click insert, then it opens up a new spreadsheet in the document to create the table (kind of like in pages where you can add a table directly in the word processor page, then do all the math in your table there. The alternative of having to create a spreadsheet outside in Excel and then import it in takes lots of extra steps when you are using lots of tables in a report.
    The huge flaw in Word 2004 for Mac is that although you can pull down Insert, then Object, then a blank spreadsheet directly in the document and add to it, you cannot then easily resize it in the document and see easily how it will look and where you want to place, whereas in Office WIndows you easily can. I can see where the ability to use tables (which can do all the math) in a pages document directly would be superior to Word Mac.

  • Safari prevents JavaScript window resize?

    Hello,
    I'm working to integrate some streaming video into an intranet site via popup windows. It seems that Safari is not responding to the JavaScript self.resizeTo or self.moveTo methods when we attempt to put the streaming media player into fullscreen mode.
    For additional context:
    Tthe expansion to fullscreen is initiated by clicking on a button in a Flash media application, but there is a defined JavaScript event handler that will subsequently call the self.resizeTo and self.moveTo methods on the browser window. This is not working in Safari, though it works in IE and Firefox.
    If there are considerations or caveats that relate to JavaScript and the manipulation of window size/placement, I would greatly appreciate any information.
    I found this link (http://lists.evolt.org/archive/Week-of-Mon-20050228/170191.html) that may be relevant to this discussion, but I haven't seen it validated.
    Thank you in advance.
    Regards,
    Benson
    Macbook Pro   Mac OS X (10.4.7)  

    After some testing, it appears that my problem does not exist with basic JavaScript window resizing and movement. In test scenarios, when javascript commands are placed in anchor tags, clicking the links will result in appropriate window movement and resizing. The issue seems to be the fact that the window resizing is not directly user initiated (at least not by clicking on an HTML link).
    Are there any features of Safari that would prevent Flash-driven events from successfully triggering JavaScript actions?

  • Scrolling and windows resizing

    Is there a way to turn off the feature where if you scroll up or down with your mouse positioned over a windows title bar it resizes the window. This "feature" works with both a standard mouse using a scrollwheel and also when using a touchpad with two finger scrolling.

    The only third party program that I use which modifies the mouse is Sizeup and I have rigorously gone through its setting to determine if it was causing this behaviour. Also the behavior persists even when I shut down sizeup so I don't think it is the cause.
    edit:
    I would also add that this behaviour only appeared after I upgraded to 10.8. While I do have a lot of third party programs running and alot of them were updated when mountain lion was released so it is theoretically possible that this is behaviour is comeing from an external source I have no idea why any of the other programs I have running would affect window resizing.

  • Adobe camera raw window won't resize and can't reach buttons

    When I open an image from bridge into adobe camera raw 6.1 (Photoshop CS5) on my laptop, the camera raw window fills all of the screen (top to bottom) and the buttons at the bottom of the window are below the task bar. Thus I can't open the image in photoshop except by hitting the enter key. I can't reach the open, etc buttons. The window won't resize and there are no icon/buttons in the right upper corner to go to/from full screen. When I hit the icon in the top right hand menu bar in ACR (to go to full screen size) the window then fills the whole width of the screen in addition to the height, but no matter what I do I can't get the height of the window to shrink, so that I can access the icons at the bottom of the screen. What am I missing? Thanks

    Don't worry about turning aero off just yet.
    There are two key first questions:
    What is your screen resolution (width in pixels x height in pixels)?  Right-click on desktop, choose Screen Resolution.
    What setting have you chosen for the display size (Smaller, Medium, Larger) in the Display dialog?  Right-click on desktop, choose Personalize, then Display.
    -Noel

  • How can I resize and reposition the Date Created window for All windows?

    When setting view options for a finder window set to list view, I cannot get column resizing or positioning to hold. When making those changes, the option for "All Windows" automatically shifts to "This window only" and it then does not hold.
    How can I resize and reposition the Date Created column for All WIndows?

    Hi Harmz,
    Try dragging this file to the Îesktop & reboot...
    /Users/YourUserName/Library/Preferences/com.apple.finder.plist

  • Windows 7 Windows explorer and IE 8 resize perporty

    Hi ALL
    I got a problem that when I open the windows explorer/ IE8 in small size monitor like 15"  and then I log on the same  windows on another size monitor like 19". The Windows explorer / IE8 will keep the small size of windows.
    is it the property of Windows? If so, can it be any disable this functions.
    Best regards and thanks
    Cyril

    Hi Cyril,
    Maffiow provides a good suggestion. You may check the properties of the short cut first.
    In addition, as I know, you can force Internet Explorer (Windows Explorer) to launch in a custom size window is to close all IE (Windows Explorer) windows except the current one; then, resize and re-position the last window opened where you want it, and
    exit Internet Explorer.
    Now re-open Internet Explorer (Windows Explorer), and it should have automatically saved the last window size and position; keep in mind that if you have multiple IE (Windows Explorer)windows opened, the last one's size and position will be remembered.
    With Normal it will open up the same size as it was when it was last closed down.
    If the IE still opens in small window, here's the registry keys that would need to be edited, according to what I found:
    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
     -->delete the "Window_Placement" subkey
    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Document Window\Maximized
     -->change the value of this key to "Yes"
    please backup Registry first.
    How to back up and restore the registry in Windows
    http://support.microsoft.com/kb/322756
    Hope it helps.
    Regards,
    Blair Deng
    Blair Deng
    TechNet Community Support

  • Make text areas and textfields streach as window resizes

    im using the border layout for most of my panels. how do i make text areas and textfields stretch as the window resizes?

    Components placed in BorderLayout.CENTER will resize as the window resizes.
    You will likely need to have nested JPanels, with different layouts, to create the ultimate layout of all your components in a frame, especially for non-trivial applications.
    If you need specific help with layouts, you'll have to post an SSCCE.

  • How do I delete a Windows partition and resize the MAC HD partition to orig

    How do I delete a Windows partition and resize the MAC HD partition to original? I am new to Mac and created a very large Windows partition and need to delete it and get back. To make matters worse, I do not have a drive configured for Time Machine.
    Okay, I'm stupid and jumped the gun. but can anyone help this poor fool?
    Richard

    Okay, after lots of Google-ing, I finally decided to follow the ru - WAEFRTFI - and found the answer in the Boot Camp Installation Setup pdf on p. 22.
    Richard

Maybe you are looking for