Re: Scaling/Resizing 2D graphics in JPanel
- From: Judy Szikora <nospam@xxxxxxxxxxxxx>
- Date: Thu, 23 Feb 2006 16:16:00 GMT
steve_marjoribanks@xxxxxxxxxxx wrote:
Basically, I want
the graphical contents of the JPanel to resize as the JPanel is resized
so as to fill the available space.
I subclass JPanel and override JComponent's doLayout method. Then I call getWidth and getHeight to get the size of the panel.
My initial thoughts were that this could be done with a getSize()
method or similar on the JPanel and then basing the 'canvas' size
around these values and effectively recalculating the coordinates of
each line etc each time the JPanel is resized.
You shouldn't have to recalculate your coordinates, assuming you want everything to scale the same. You can just calculate a new AffineTransform based on the new size, apply it to the Graphics2D and it will scale everything for you.
--
Judy Szikora, Apprisant Technologies Inc.
http://www.apprisant.com
.
- Follow-Ups:
- Re: Scaling/Resizing 2D graphics in JPanel
- From: steve_marjoribanks@xxxxxxxxxxx
- Re: Scaling/Resizing 2D graphics in JPanel
- References:
- Scaling/Resizing 2D graphics in JPanel
- From: steve_marjoribanks@xxxxxxxxxxx
- Scaling/Resizing 2D graphics in JPanel
- Prev by Date: Re: Scaling/Resizing 2D graphics in JPanel
- Next by Date: Re: Why I can't add a JLabel object into JList/JComboBox?
- Previous by thread: Re: Scaling/Resizing 2D graphics in JPanel
- Next by thread: Re: Scaling/Resizing 2D graphics in JPanel
- Index(es):
Relevant Pages
|