Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
GTEFP/MyPanel.java~
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
45 lines (43 sloc)
1.39 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import javax.swing.*; | |
//import javax.swing.event.*; | |
//import java.awt.Color; | |
//import java.awt.event.*; | |
public class MyPanel extends javax.swing.JPanel{ | |
private truck _truck; | |
private trailer _trailer; | |
private truck _truck2; | |
private trailer _trailer2; | |
private colorPicker _cp; | |
private ColorButton _cb; | |
private javax.swing.ButtonGroup _Group; | |
public MyPanel(){ | |
super(); | |
_cp = new colorPicker(this); | |
_trailer = new trailer(_cp,this); | |
_truck = new truck(_cp,_trailer,this,100,100); | |
this.addMouseListener(_trailer); | |
this.addMouseListener(_truck); | |
_trailer2 = new trailer(_cp,this); | |
_truck2 = new truck(_cp,_trailer2,this,300,100); | |
this.addMouseListener(_trailer2); | |
this.addMouseListener(_truck2); | |
this.setBackground(new java.awt.Color(42,42,42)); | |
javax.swing.JPanel buttonPanel; | |
buttonPanel = new javax.swing.JPanel(); | |
_cb = new ColorButton(new java.awt.Color(0,0,0),_cp,_Group,true); | |
buttonPanel.add(_cb); | |
this.add(buttonPanel); | |
//MyMouseListener myMouseListener = new MyMouseListener(this); | |
this.repaint(); | |
} | |
public void paintComponent (java.awt.Graphics aBrush){ | |
super.paintComponent(aBrush); | |
java.awt.Graphics2D betterBrush = (java.awt.Graphics2D) aBrush; | |
betterBrush.setColor(new java.awt.Color(0,0,0)); | |
_truck.paint(betterBrush); | |
_trailer.paint(betterBrush); | |
_truck2.paint(betterBrush); | |
_trailer2.paint(betterBrush); | |
_cp.paint(aBrush); | |
} | |
} |