I'm thinking on how to draw a circle as a ball, because whenever I used paint my frame always turn into a blank white space. Is there any way that I can combine Graphics or paint with those JLabels? I've searched the internet but I cannot find any answer so hope you can help me.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class BasketBall extends JFrame implements ActionListener
{
JButton shootButton = new JButton("SHOOT");
JButton drbblButton = new JButton("DRIBBLE");
JButton holdButton = new JButton("HOLD");
JButton exitButton = new JButton("EXIT");
JLabel court = new JLabel(new ImageIcon("bcourt.jpg"));
public BasketBall()
{
Container c =getContentPane();
setLayout(null);
c.add(shootButton);
c.add(drbblButton);
c.add(holdButton);
c.add(exitButton);
c.add(court);
shootButton.setBounds(0,0,120,125);
drbblButton.setBounds(0,125,120,125);
holdButton.setBounds(0,250,120,125);
exitButton.setBounds(0,375,120,86);
court.setBounds(120,0,380,500);
setTitle("BasketBall");
c.setBackground(Color.black);
setSize(500,500);
setVisible(true);
}
//public void paint (Graphics g)
{
}
public void actionPerformed(ActionEvent e)
{
}
public static void main(String args[])
{
BasketBall ball = new BasketBall();
}
}