Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将原点从组件的左上角移动到中下角?我一直在玩 AffineTransform 类无法让它工作?
您将需要您尝试绘制的组件的高度和宽度。假设您在该paint(Graphics g)方法中,最简单的方法是:
paint(Graphics g)
paint(Graphics g){ Graphics2D g2 = (Graphics2D)g; g2.translate( component.getWidth()/2.0, component.getHeight()/2.0); //... }