Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.ImageIcon;
- import javax.swing.JButton;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- public class P3Panel extends JPanel {
- JButton button1 = new JButton("PITCH");
- Baseball myball = new Baseball();
- ImageIcon baseballimage = new ImageIcon("./src/baseball.jpg");
- JLabel picture = new JLabel(baseballimage);
- JLabel hits = new JLabel("Hits: " + myball.getHitcount());
- JLabel fouls = new JLabel("Fouls: " + myball.getFoulcount());
- JLabel strikes = new JLabel("Strikes: " + myball.getStrikecount());
- public P3Panel(){
- add(picture);
- add(hits);
- add(fouls);
- add(strikes);
- add(button1);
- button1.addActionListener(new CustomActionListener());
- }
- private class CustomActionListener implements ActionListener
- {
- @Override
- public void actionPerformed(ActionEvent arg0)
- {
- myball.hitcount();
- }
- }
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement