Change color of JComponent after paintComponent has finished
问题 I am testing one small widget class that extends JComponent the constructor for the widget contains one vector and sets PreferredSize of the component, then there is the paintComponent: public void paintComponent(Graphics g){ g.setColor(Color.RED); g.drawString("this is text one", 10, 10); //here I draw some shapes based on the //vector size and integers } } the component is drawn correctly and after that i call some other methods in main, when the methods finish their jobs i call widget