java - Simple Basketball using Graphics -
i'm thinking on how draw circle ball, because whenever used paint frame turn blank white space. there way can combine graphics or paint jlabels? i've searched internet cannot find answer hope can 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(); } }
Comments
Post a Comment