From: <moj...@us...> - 2003-07-12 21:45:06
|
Update of /cvsroot/ordweb/uop/pos407/poulh/week2 In directory sc8-pr-cvs1:/tmp/cvs-serv11220/pos407/poulh/week2 Added Files: .nbattrs JApplet.html JSmileFace.class JSmileFace.html JSmileFace.java Log Message: init --- NEW FILE: .nbattrs --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE attributes PUBLIC "-//NetBeans//DTD DefaultAttributes 1.0//EN" "http://www.netbeans.org/dtds/attributes-1_0.dtd"> <attributes version="1.0"> <fileobject name="JSmileFace.java"> <attr name="class_dependency_javax.swing.JApplet" stringvalue="JSmileFace"/> <attr name="class_dependency_java.awt.event.ActionListener" stringvalue="JSmileFace"/> <attr name="NetBeansAttrDebuggerType" serialvalue="aced00057372001e6f72672e6f70656e6964652e53657276696365547970652448616e646c6564612acc871b81080300024c0009636c6173734e616d657400124c6a6176612f6c616e672f537472696e673b4c00046e616d6571007e000178707400104170706c657420446562756767696e6774002e6f72672e6e65746265616e732e6d6f64756c65732e6170706c65742e4170706c657444656275676765725479706578"/> <attr name="NetBeansAttrExecutor" serialvalue="aced00057372001e6f72672e6f70656e6964652e53657276696365547970652448616e646c6564612acc871b81080300024c0009636c6173734e616d657400124c6a6176612f6c616e672f537472696e673b4c00046e616d6571007e000178707400104170706c657420457865637574696f6e74002a6f72672e6e65746265616e732e6d6f64756c65732e6170706c65742e4170706c65744578656375746f7278"/> </fileobject> </attributes> --- NEW FILE: JApplet.html --- <HTML> <HEAD> <TITLE>Applet HTML Page</TITLE> </HEAD> <BODY> <H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3> <P> <APPLET code="JApplet.class" width=350 height=200></APPLET> </P> <HR WIDTH="100%"><FONT SIZE=-1><I>Generated by NetBeans IDE</I></FONT> </BODY> </HTML> --- NEW FILE: JSmileFace.class --- (This appears to be a binary file; contents omitted.) --- NEW FILE: JSmileFace.html --- <HTML> <HEAD> <TITLE>Applet HTML Page</TITLE> </HEAD> <BODY> <H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3> <P> <APPLET code="JSmileFace.class" width=350 height=200></APPLET> </P> <HR WIDTH="100%"><FONT SIZE=-1><I>Generated by NetBeans IDE</I></FONT> </BODY> </HTML> --- NEW FILE: JSmileFace.java --- /* * filename: JSmileFace.java * author: poul hoecherl * version: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ordweb/uop/pos407/poulh/JSmileFace.java * notes: */ import java.awt.*; import javax.swing.*; import java.awt.event.*; public class JSmileFace extends javax.swing.JApplet implements ActionListener { //JPanel pnl = new ; JButton cmdFrown; int arcAngle = 180; /** Creates a new instance of JSmileFace */ public JSmileFace() { } Font bigFont = new Font("Arial", Font.BOLD + Font.ITALIC, 20); public void init () { this.setBackground(new Color (255,255, 255)); this.getContentPane().setLayout(new FlowLayout()); this.getContentPane().add(cmdFrown = new JButton("Frown")); cmdFrown.setBackground(new Color(0,0,0,0)); cmdFrown.addActionListener(this); } /** * Paints the container. This forwards the paint to any lightweight * components that are children of this container. If this method is * reimplemented, super.paint(g) should be called so that lightweight * components are properly rendered. If a child component is entirely * clipped by the current clipping setting in g, paint() will not be * forwarded to that child. * * @param g the specified Graphics window * @see Component#update(Graphics) * */ public void paint (Graphics g) { g.setFont(bigFont); g.setColor(new Color(255, 0, 0)); g.setColor(new Color(0, 255, 0)); g.drawLine(15, 40, 125, 40); g.setColor(new Color(165, 165, 0)); g.fillOval(15, 50, 110, 50); g.setColor(new Color(255, 0, 0)); g.drawArc(45, 60, 50, 25, 180, 180); // for smile //g.drawArc(45,60,50,25,180,-180); for a frown cmdFrown.paint(g); } /** Invoked when an action occurs. * */ public void actionPerformed(ActionEvent e) { if (e.getSource() == cmdFrown) { arcAngle = 180 * -1 ; // toggle the module-level arcAngle this.paint(this.getGraphics()); } } } |