Post overriding the paint method of the components in java
问题 In java awt or swing when you want to change painting of some component you usually have to override the method paint(Graphics g) (in awt) or paintComponent(Graphics g) (in swing). This is usually (maybe allways - I'm not sure) done when you are creating the component for example: JPanel jPanel = new JPanel() { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; //... my implementation of paint, some transfromations, rotation, etc }