It is not clear how much volume you plan to use. Did you mean by class (therefore, all instances of JPanel correspond to the new drawing scheme), or do you mean all components in the container (for example, everything in the frame)?
There are opportunities to do this depending on the component class, the place where you can connect is Look and Feel and based on the component instance, either the paintComponent () method, or if you need to replace the standard appearance of an existing component, where you cannot overwrite this method because you have no control over it by providing your own user interface (see Component.setUI) after the component has been created.
With the exception of rewriting paintComponent, the approach is not easy to implement. For most applications, a simple approach is the best :)
source share