WholePanel.java - Assignment 7 Name Punit Denani StudentID...

This preview shows page 1 - 2 out of 4 pages.

// Assignment #: 7 // Name: Punit Denani // StudentID: 1210836234 // Lecture: MWF 10:30 // Arizona State University CSE205 // Description: This creates a panel and the canvas class. this adds the functionality to the buttons in the panel and also creates a // line and adds it to the line list so that it can be accessed later by undo buttons import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.ArrayList; public class WholePanel extends JPanel { private Color currentColor; private CanvasPanel canvas; private JPanel leftPanel; private JButton undo,erase; private ArrayList lineList,tempList; private JRadioButton jrbR, jrbG, jrbB, jrbBl, jrbO; private int x1,x2,y1,y2,currx,curry; private boolean x = false; public WholePanel() { //default color to draw is black currentColor = Color.black; lineList = new ArrayList(); tempList = new ArrayList(); erase = new JButton("Erase"); undo = new JButton ("Undo"); //sets the panel with all the components leftPanel = new JPanel(); canvas = new CanvasPanel(); jrbR = new JRadioButton("red"); jrbG = new JRadioButton("green"); jrbB = new JRadioButton("blue"); jrbBl = new JRadioButton("black",true); jrbO = new JRadioButton("orange"); ButtonGroup group = new ButtonGroup(); group.add(jrbR); group.add(jrbG); group.add(jrbB); group.add(jrbBl);

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture