Update of /cvsroot/ordweb/uop/pos407/wayneh/week2
In directory sc8-pr-cvs1:/tmp/cvs-serv27937/pos407/wayneh/week2
Added Files:
JSmileFace.java JSmileFace2.java
Log Message:
init
--- NEW FILE: JSmileFace.java ---
import java.awt.*;
import javax.swing.*;
/*
* @author Wayne Hernandez
*/
public class JSmileFace extends JApplet {
public void init () {
this.setBackground(new Color (0, 0, 50));
}
public void paint (Graphics g) {
g.setColor(new Color(255, 255, 0));
g.fillOval(25, 70, 120, 70); /*x, y (upper left), width, height */
g.setColor(new Color(0, 128, 128));
g.drawArc(55, 80, 60, 30, 180, 180); /*x, y, width, height, begin, angle */
}
}
--- NEW FILE: JSmileFace2.java ---
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/*
* @author Wayne Hernandez
*/
public class JSmileFace2 extends JApplet implements ActionListener
{
JButton pressButton = new JButton("Press");
public void init () {
this.setBackground(new Color (0, 0, 50));
Container con = getContentPane();
con.setLayout(new FlowLayout() );
con.add(pressButton);
pressButton.addActionListener(this);
pressButton.repaint();
}
public void paint (Graphics g) {
g.setColor(new Color(255, 255, 0));
g.fillOval(25, 70, 120, 70); /*x, y (upper left), width, height */
g.setColor(new Color(0, 128, 128));
g.drawArc(55, 80, 60, 30, 180, 180); /*x, y, width, height, begin, angle */
pressButton.repaint();
}
public void actionPerformed(ActionEvent e)
{
Object source = e.getSource();
if (source == pressButton)
{
Graphics g = getGraphics();
g.setColor(new Color(255, 255, 0));
g.fillOval(25, 70, 120, 70); /*x, y (upper left), width, height */
g.setColor(new Color(0, 128, 128));
g.drawArc(55, 100, 60, 30, 180, -180); /*x, y, width, height, begin, angle */
}
}
}
|