java - Can you create a JPanel that is rotated? -


i wondering if there might way using java swing create rotated jpanel? i'd read other questions/answers on topic didn't understand if create 1 rotated or not. not need rotate once it's created, created tilted on x/y axis. thanks.

thanks, quite helpful!

you can't behavior default. however, extend jpanel , desired rotation behavior if little linear algebra:

  1. override paint(graphics g) method. have first paint instance of bufferedimage, use rotation matrix rotate image before drawing on underlying panel.

  2. override methods handle mouse input , apply reverse rotation coordinates passed in associated listeners. way, underlying layout manager still 'thinks' panel hasn't been rotated, you've rotated drawing , event notification things still "line up" properly.

i'll caveat of saying i've never done before, , run unexpected issues not outlined here, have 10 years of experience java swing , how i'd if had to.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -