开发者

Resizing svg in a panel in java

开发者 https://www.devze.com 2023-03-20 13:01 出处:网络
I have a svg file in a panel and it is displayed. The problem occurs when i try to change the size of it (svg). I tried setSize, setPreferredSizeand resize but none work. I noticed that when i try to

I have a svg file in a panel and it is displayed. The problem occurs when i try to change the size of it (svg). I tried setSize, setPreferredSize and resize but none work. I noticed that when i try to resize it resizes but then goes back to it's previous size. Can someone help me, please?

svg.setPreferredSize(new Dimension(700,700));
svg.setSize(new Dimension(700,700));
this.add(svg, BorderLayout.NORTH);
thi开发者_如何学Gos.setSize(1000, 1000);

My class extends JPanel. I'm using batik.


I added svg to JSVGScrollPane. Now it works fine, resizes well and i have scrollbars when svg is bigger. It took me day and a half of experimenting with JPanels, JScrollPanes, but this is the best solution. [:

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号