/ Published in: Java
Using Date function and get a system clock me and my friend are editing this code last update was also working, I just followed the text book and made it. new one will be his professor preferring that way.
Expand |
Embed | Plain Text
//import javax.swing.JFrame; import javax.swing.JComponent; import java.util.*; import java.awt.*; import java.awt.geom.Ellipse2D; /** main function */ { private double xpos; private double ypos; private double width; private double height; public ellipse(float x, float y, float w, float h){ xpos = x; ypos = x; width = x; height = x; } { //super.paintComponent(g2); g2.fill(circle); g2.drawString(" "+now,270,450); } { this.painting(g2, xpos, ypos, width, height); } } /** time.java */ /** Write a program that uses a timer to print the current time once a second Hint : The following coe prints the current time : Data naw = new Date(); System.out.println(now); The Data class is in the java util package. */ import javax.swing.JFrame; { { //viewer t = new viewer(); ellipse t = new ellipse(30, 40, 300, 100); frame.setSize(500,500); frame.setTitle("*** Blablabla ***"); frame.add(t); frame.setVisible(true); } }
You need to login to post a comment.
