Hello,

So I'm thinking of creating a few programs that don't use the provided components like the Button class. Basically I want to create components like a button, text field... etc, but with their own look and feel to them. I tried overriding methods of existing components and I tried doing it from Component. Either way, something went wrong.

Basically my question is what is the right way of creating a component?
-How do I properly have the components redrawn every time an event happens (mouse over, mouse press, keyboard, etc)?
-If the component is not a square shape (like a circle), how do I avoid gray in the areas not drawn?
-What methods do I need to create / override when dealing with drawing?
-There are so many draw methods (paint, print, update, etc), what does each call/ do and how do they interact with each other?

Another thing I want to do is create an applet with animation and components on top. My idea is to have separate double buffers for each, so they can be independent of each other when drawing. What methods deal with components above and in what way?

So far what I've understood is that it's a good idea to separate the drawing, UI and data from each other.

After trying to understand the code, I'm even more confused. There's static classes which I don't understand and methods inside method calls.... which makes no sense.....

Where can I find the source code to JButton..... ?

Well I figured out some of the issues, the only problem I'm having now is how to draw the components/background behind the button from the button component.

This article has been dead for over six months. Start a new discussion instead.