Notes
Notes - notes.io |
import java.awt.Frame;
import java.awt.*;
import java.awt.geom.GeneralPath;
import javax.swing.JFrame;
public class Card extends JFrame {
public static final double halfPI = Math.PI / 2;
/**
* @param args the command line arguments
*/
public void blahblah(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
// TODO code application logic here
Card blah = new Card();
blah.setSize(1000,1000);
blah.setVisible(true);
}
public double circleX(int sides, int angle) {
double coeff = (double)angle/(double)sides;
return Math.cos(2*coeff*Math.PI-halfPI);
}
public double circleY(int sides, int angle) {
double coeff = (double)angle/(double)sides;
return Math.sin(2*coeff*Math.PI-halfPI);
}
public void drawStar(Graphics g, Color c, int sides, int x, int y, int w, int h) {
Color colorSave = g.getColor();
g.setColor(c);
for(int i = 0; i < sides; i++) {
int x1 = (int)(circleX(sides,i) * (double)(w)) + x;
int y1 = (int)(circleY(sides,i) * (double)(h)) + y;
int x2 = (int)(circleX(sides,(i+2)%sides) * (double)(w)) + x;
int y2 = (int)(circleY(sides,(i+2)%sides) * (double)(h)) + y;
g.drawLine(x1,y1,x2,y2);
}
}
public void paint(Graphics g) {
//tree
Graphics2D g2d = (Graphics2D)g;
GeneralPath gp = new GeneralPath();
g2d.setStroke (new BasicStroke (1.0f));
gp.moveTo(400, 300);
gp.lineTo(350, 400);
gp.lineTo(370,400);
gp.lineTo(300, 500);
gp.lineTo(340,500);
gp.lineTo(250, 600);
gp.lineTo(310,600);
gp.lineTo(200, 700);
gp.lineTo(280,700);
gp.moveTo(400, 300);
gp.lineTo(450,400);
gp.lineTo(430,400);
gp.lineTo(500,500);
gp.lineTo(460,500);
gp.lineTo(550,600);
gp.lineTo(490,600);
gp.lineTo(600,700);
gp.lineTo(280,700);
g2d.setColor(Color.green);
g2d.draw(gp);
//star
drawStar(g,Color.yellow,6,400,280,30,30);
//base
Graphics2D g2d2 = (Graphics2D)g;
GeneralPath gp2 = new GeneralPath();
gp2.moveTo(350,700);
gp2.lineTo(350,780);
gp2.lineTo(450,780);
gp2.lineTo(450,700);
g2d2.setColor(Color.BLACK);
g2d2.draw(gp2);
//decors
Graphics2D g2d3 = (Graphics2D)g;
int x,y,i;
g2d3.setColor(Color.orange);
g2d3.drawOval(340, 400, 20, 20);
g2d3.drawOval(390, 400, 20, 20);
g2d3.drawOval(440, 400, 20, 20);
x=240;
y=500;
for(i=0;i<15;i++){
if(i<5){
if(i%2==0){
g2d3.setColor(Color.orange);
}
else{
g2d3.setColor(Color.blue);
}
x=x+50;
g2d3.drawOval(x, y, 20, 20);
}
if(5==i){
y=y+100;
x=190;
}
if(i>=5 && i<15){
if(i%2!=0){
g2d3.setColor(Color.orange);
}
else{
g2d3.setColor(Color.blue);
}
x=x+50;
g2d3.drawOval(x, y, 20, 20);
}
if(i==10){
y=y+100;
x=140;
}
if(i>=10 && i<15){
if(i%2==0){
g2d3.setColor(Color.orange);
}
else{
g2d3.setColor(Color.blue);
}
x=x+50;
g2d3.drawOval(x, y, 20, 20);
}
}
//greetings
Graphics2D g2d4 = (Graphics2D)g;
g2d4.drawString("Merry Christmas and Happy New Year", 290, 240);
}
}
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team