User talk:ShrekWazowski/sandbox

This is good code for java Sponge bob he is good and made by 3 people 1 did nothing because he was like vaping into a bag or something

/* * 2d project for Spongebob * * October */

import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import javax.swing.*;

public class SpongeBob extends JFrame {

private boolean smiling = true; private int x,y; private int width, height; public SpongeBob { super("Program 1: Spongey Bubble"); x = 150; y = 69; width = 200; height = 230; setSize(new Dimension(500,500)); setResizable(false); setBackground(Color.cyan); setDefaultCloseOperation(this.EXIT_ON_CLOSE); setVisible(true); repaint; }   public void draw(Graphics2D g2) {      g2.drawLine (1000, 10000, 1000, 500); }    public boolean isSmiling {        return smiling; }

public void smile {        smiling = true; repaint; }   public void frown {        smiling = false; repaint; }

public void setPosition(int newX, int newY) {        x = newX; y = newY; repaint; }   public void setDimensions(int newWidth, int newHeight) {       width = newWidth; height = newHeight; repaint; }   public void output {       if(isSmiling) System.out.println("SpongeBob is smiling."); else System.out.println("SpongeBob is frowning."); System.out.println("Width = " + width + ", Height = " + height); System.out.println("(X,Y) location = (" + x + "," + y +")"); }   public void paint(Graphics g)    { g.setColor(Color.yellow); g.fillRect(x,y,width,height); g.setColor(Color.white); g.fillOval(x + (int)(0.2*width),y + (int)(0.2*height),                (int)(0.2*width), (int)(0.2*width)); g.fillOval(x + (int)(0.6*width),y + (int)(0.2*height),                (int)(0.2*width), (int)(0.2*width)); g.setColor(Color.cyan); g.fillOval(x + (int)(0.2325*width),y + (int)(0.2*height+0.0325*width),                (int)(0.125*width), (int)(0.125*width)); g.fillOval(x + (int)(0.6325*width),y + (int)(0.2*height+0.0325*width),                (int)(0.125*width), (int)(0.125*width)); g.setColor(Color.black); g.fillOval(x + (int)(0.2500*width),y + (int)(0.25*height+0.0050*width),                (int)(0.07*width), (int)(0.07*width)); g.fillOval(x + (int)(0.6500*width),y + (int)(0.25*height+0.0050*width),                (int)(0.07*width), (int)(0.07*width)); g.setColor(Color.red); g.fillOval(x + (int)(0.1700*width),y + (int)(0.6*height+0.0050*width),                (int)(0.05*width), (int)(0.05*width)); g.fillOval(x + (int)(0.7900*width),y + (int)(0.6*height+0.0050*width),                (int)(0.05*width), (int)(0.05*width)); g.setColor(Color.black); if(smiling) g.drawArc(x+(int)(0.2*width),y+(int)(0.5*height),                    (int)(0.6*width), (int)(0.3*height), 0, -180); else g.drawArc(x+(int)(0.2*width),y+(int)(0.5*height),                    (int)(0.6*width), (int)(0.3*height), 0, 180); } }