Bouassoul badar
Bouassoul badar

Reputation: 1

Java - Get difference between old and new size of JFrame

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

Upvotes: 0

Views: 88

Answers (1)

MadProgrammer
MadProgrammer

Reputation: 347314

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

Upvotes: 1

Related Questions