Detecting Dynamic Resizing of a window in real time

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Detecting Dynamic Resizing of a window in real time

  1. #1
    Join Date
    Apr 2006

    Detecting Dynamic Resizing of a window in real time

    Is there some kind of a window listener with a method that can return the size of a jframe constantly during runtime so if a resize happens you can manipulate other things in the program accordingly. I have a simple program with circles bouncing around and i want to make it so if i resize the jframe (while viewing it with jcreators applet viewer) that i can resize the boundaries of where the circles can bounce to. - Sorry if thats confusing.

    Thanks -

  2. #2
    Join Date
    Feb 2006
    Cologne - Germany
    yes there is. you will have to add a componentlistener to your frame:

    	new ComponentListener(){
    		public void componentResized(ComponentEvent e){
    			System.out.println("*FRAME: component resized");
    			Dimension size = frame.getSize();
    		public void componentMoved(ComponentEvent e) {
    			System.out.println("*FRAME: component moved");
    			Point location = frame.getLocation();
    		public void componentHidden(ComponentEvent e) {}
    		public void componentShown(ComponentEvent e) {}
    this will enable you to trace: resizing, moving, hiding and showing of your frame.

  3. #3
    Join Date
    Apr 2006
    Thanks a lot, I appreciate your help. Worked perfect.

Similar Threads

  1. query tuning
    By dhaya in forum Database
    Replies: 11
    Last Post: 08-25-2003, 05:24 PM
  2. Replies: 3
    Last Post: 08-02-2002, 12:11 PM
  3. Real time data-binding
    By Andrew Ball in forum ASP.NET
    Replies: 0
    Last Post: 10-25-2001, 01:51 AM
  4. Real time updates
    By lilbit29831 in forum Web
    Replies: 1
    Last Post: 10-05-2001, 09:18 AM
  5. Disabling MDI Form window resizing
    By John Nelson in forum VB Classic
    Replies: 0
    Last Post: 08-22-2000, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center