Hi All,

Im still finding it hard to understand Paint method, Almost all websites i had gone thru, they are showing examples of how to use it in an applet. I just cant understand on how to use it in a GUI application by extending Jframe object.

Here is one example, i want to create an oval shape Button to use it in my program.

Im starting my program in this way,

package painttest;

import Javax.swing.*;
import Java.awt.*

public class PaintTest extends JFrame {

private JButton oval;
private static final int HEIGHT = 400;
private static final int WIDTH = 400;

public  PaintTest(){

Container conInterior = super.getContentPane();
conInterior.setLayout(new GridLayout(1,1));
oval = new JButton("OvalButton");

public static void main(String[] args) {
// TODO code application logic here

 PaintTest reference = new PaintTest();

Now i understand that i will get Frame window with Rectangular button named oval.
My questions are
1. how do i use paint method in my program to make the button look like Oval Shape.
2. To change the shape of buttons is also one of the uses of Paint method, am i right?

Please advise.

This question has already been answered. Start a new discussion instead.