0

After I do a resizing at a JFrame, is there any method that returns the difference between the old and new size, i.e (dx,dy) ?

If not, is there a way to get this info?

(dx,dy) - Image

1 Answers1

1

You need to know what the size was before the frame was resized, then you could use a ComponentListener to detect when the frame's size was changed. The trick here is knowning when the "size" has changed to a fixed point from which taking a measure is worthwhile. Once the frame has "settled" you would simply need to calculate the difference from the "last resize" to now

Start by having a look at How to Write a Component Listener

Conceptually, you want to do something like this or something like this

Community
  • 1
  • 1
MadProgrammer
  • 343,457
  • 22
  • 230
  • 366