/**
* @(#)MyClock.java
*
* MyClock application
*
* @author kevin
* @version 1.00 2007/4/4
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.Date.*;
import java.util.*;
import javax.swing.JPanel.*;
public class MyClock{
public static void showClock()
{
Date now = new Date();
int h = now.getHours();
int m = now.getMinutes();
int s = now.getSeconds();
JPanel present= new JPanel(new FlowLayout());
present.add(present, h);
present.add(present, m);
present.add(present, s);
present.setFont(new Font("sansserif", Font.PLAIN, 48));
present.setBorder(BorderFactory.createEmptyBorder());
present.setVisible(true); // see it
// JPanel thePanel = new JPanel();
// thePanel.add("hi", thePanel);
// thePanel.setVisible(true);
// System.out.println(present);
}// showClock
public static void run(){
int i=0;
while (i++ <3){
System.out.println("here 2...");
showClock();
}
}
public static void main(String[] args) {
run();
showClock();
System.out.println("here 3...");
}
}
--
Sometimes I'm in a good mood.
Sometimes I'm in a bad mood.
When all my moods have cum to pass
i hope they bury me upside down
so the world can kiss me porcelain,
white, Irish bottom.
|
|
0
|
|
|
|
Reply
|
llloyd
|
4/9/2007 10:01:08 PM |
|
llloyd wood wrote:
> /**
> * @(#)MyClock.java
> *
> * MyClock application
> *
> * @author kevin
> * @version 1.00 2007/4/4
> */
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
> import javax.swing.event.*;
> import java.util.Date.*;
> import java.util.*;
> import javax.swing.JPanel.*;
>
> public class MyClock{
>
> public static void showClock()
> {
>
> Date now = new Date();
> int h = now.getHours();
> int m = now.getMinutes();
> int s = now.getSeconds();
>
> JPanel present= new JPanel(new FlowLayout());
> present.add(present, h);
> present.add(present, m);
> present.add(present, s);
> present.setFont(new Font("sansserif", Font.PLAIN, 48));
> present.setBorder(BorderFactory.createEmptyBorder());
> present.setVisible(true); // see it
>
>
>
>
>
> // JPanel thePanel = new JPanel();
> // thePanel.add("hi", thePanel);
> // thePanel.setVisible(true);
> // System.out.println(present);
>
>
> }// showClock
>
> public static void run(){
> int i=0;
> while (i++ <3){
> System.out.println("here 2...");
> showClock();
> }
> }
>
>
>
> public static void main(String[] args) {
>
> run();
> showClock();
>
> System.out.println("here 3...");
> }
>
> }
llloyd:
You've got a lot of problems there llloyd, not the least of which you
have no frame to show your clock in. I think you need to spend some
quality time with a Java book or the Java Tutorial.
http://java.sun.com/docs/books/tutorial/index.html
If you can't wait to get started, try making a JFrame and add a JLabel
to it that has your time information on it. Then post that code here
and we'll help you out.
--
Knute Johnson
email s/nospam/knute/
|
|
0
|
|
|
|
Reply
|
Knute
|
4/9/2007 10:43:31 PM
|
|
llloyd wood <comprehensivecenter> wrote in
news:B46dnU0jxYs_KofbnZ2dnUVZ_uygnZ2d@comcast.com:
[Java code without an explanation or question snipped]
Please:
1. use the English language, not txt msg, IM, or leet-speak in your postings.
2. explain more precisely what you need help with, or ask a specific
question.
Cheers!
--
---------------------------------------------------------------------
Greg R. Broderick gregb+usenet200704@blackholio.dyndns.org
A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------
|
|
0
|
|
|
|
Reply
|
Greg
|
4/10/2007 4:11:27 PM
|
|
Greg R. Broderick wrote:
> 1. use the English language, not txt msg, IM, or leet-speak in your postings.
Greg:
What's leet-speak?
Thanks,
--
Knute Johnson
email s/nospam/knute/
|
|
0
|
|
|
|
Reply
|
Knute
|
4/10/2007 6:12:15 PM
|
|
"Knute Johnson" <nospam@rabbitbrush.frazmtn.com> wrote in message
news:4sQSh.437250$BK1.373029@newsfe13.lga...
>
> What's leet-speak?
See http://en.wikipedia.org/wiki/Leet_speak
- Oliver
|
|
0
|
|
|
|
Reply
|
Oliver
|
4/10/2007 7:01:10 PM
|
|
Oliver Wong wrote:
> "Knute Johnson" <nospam@rabbitbrush.frazmtn.com> wrote in message
> news:4sQSh.437250$BK1.373029@newsfe13.lga...
>> What's leet-speak?
>
> See http://en.wikipedia.org/wiki/Leet_speak
>
> - Oliver
>
I love the internet but I can't tell you how disappointed I am to
discover that I'm not 1337!
--
Knute Johnson
email s/nospam/knute/
|
|
0
|
|
|
|
Reply
|
Knute
|
4/10/2007 8:25:15 PM
|
|
llloyd wood wrote:
> /**
> * @(#)MyClock.java
> *
> * MyClock application
> *
> * @author kevin
> * @version 1.00 2007/4/4
> */
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
> import javax.swing.event.*;
> import java.util.Date.*;
> import java.util.*;
> import javax.swing.JPanel.*;
>
> public class MyClock{
>
> public static void showClock()
> {
>
> Date now = new Date();
> int h = now.getHours();
> int m = now.getMinutes();
> int s = now.getSeconds();
>
> JPanel present= new JPanel(new FlowLayout());
> present.add(present, h);
> present.add(present, m);
> present.add(present, s);
> present.setFont(new Font("sansserif", Font.PLAIN, 48));
> present.setBorder(BorderFactory.createEmptyBorder());
> present.setVisible(true); // see it
>
>
>
>
>
> // JPanel thePanel = new JPanel();
> // thePanel.add("hi", thePanel);
> // thePanel.setVisible(true);
> // System.out.println(present);
>
>
> }// showClock
>
> public static void run(){
> int i=0;
> while (i++ <3){
> System.out.println("here 2...");
> showClock();
> }
> }
>
>
>
> public static void main(String[] args) {
>
> run();
> showClock();
>
> System.out.println("here 3...");
> }
>
> }... i mean this:
/**
* @(#)MyClock.java
*
* MyClock application
*
* @author kevin
* @version 1.00 2007/4/4
*/
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.Date.*;
import java.util.*;
import javax.swing.JPanel.*;
import java.awt.geom.*;
class MyClock extends JPanel{
private static void out(String s) {
System.out.println(s);
}
private static void out(int s) {
System.out.println(s);
}
public static void seeClock(){
JPanel panel = new JPanel();
Date now = new Date();
String StringDate = now.toString();
System.out.println(StringDate);
out(now.getHours());
out(now.getMinutes());
out(now.getSeconds());
panel.setBackground(Color.yellow);
panel.setSize(300, 300);
panel.setVisible(true);
panel.setFont(new Font("sansserif", Font.PLAIN, 48));
panel.setBorder(BorderFactory.createCompoundBorder());
panel.setVisible(true); // see it
} // seeClock
//public static void run(){
// int i=0;
// while (i++ <3){
// System.out.println("here 2...");
// seeClock();
// }
//}
public static void main (String args[]){
// run();
seeClock();
out("here 3...");
// out('hi');
}
}
--
Sometimes I'm in a good mood.
Sometimes I'm in a bad mood.
When all my moods have cum to pass
i hope they bury me upside down
so the world can kiss me porcelain,
white, Irish bottom.
|
|
0
|
|
|
|
Reply
|
llloyd
|
4/13/2007 3:35:12 AM
|
|
llloyd wood wrote:
>/**
> * @(#)MyClock.java
...OK
What help do you require?
- There are deprecated methods used.
- As Knute mentioned, the app. will need a frame
(java.awt.Frame, or more likely a javax.swing.JFrame),
window, dialog or JOptionPane to act as a 'root'
component in which to display it.
- The class extends JPanel, but that makes little
sense when the 'seeClock()' method declares and
instantiates a second JPanel. I suggest you delete
the second panel and the call to setVisible(true), change
the name of the method to 'constructClock()', add a
constructor that calls 'constructClock()', then add an
instance of MyClock to the root component as
mentioned above.
For more specific help, I would need more specific
questions.
BTW - did you work through the tutorial that somebody
linked to (might have been Knute, but I cannot quite
recall).
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-setup/200704/1
|
|
0
|
|
|
|
Reply
|
Andrew
|
4/13/2007 4:53:26 AM
|
|
llloyd wood wrote:
> llloyd wood wrote:
>> /**
>> * @(#)MyClock.java
>> *
>> * MyClock application
>> *
>> * @author kevin
>> * @version 1.00 2007/4/4
>> */
>> import java.awt.*;
>> import java.awt.event.*;
>> import javax.swing.*;
>> import javax.swing.event.*;
>> import java.util.Date.*;
>> import java.util.*;
>> import javax.swing.JPanel.*;
>>
>> public class MyClock{
>>
>> public static void showClock()
>> {
>>
>> Date now = new Date();
>> int h = now.getHours();
>> int m = now.getMinutes();
>> int s = now.getSeconds();
>>
>> JPanel present= new JPanel(new FlowLayout());
>> present.add(present, h);
>> present.add(present, m);
>> present.add(present, s);
>> present.setFont(new Font("sansserif", Font.PLAIN, 48));
>> present.setBorder(BorderFactory.createEmptyBorder());
>> present.setVisible(true); // see it
>>
>>
>>
>>
>>
>> // JPanel thePanel = new JPanel();
>> // thePanel.add("hi", thePanel);
>> // thePanel.setVisible(true);
>> // System.out.println(present);
>>
>>
>> }// showClock
>>
>> public static void run(){
>> int i=0;
>> while (i++ <3){
>> System.out.println("here 2...");
>> showClock();
>> }
>> }
>>
>>
>>
>> public static void main(String[] args) {
>>
>> run();
>> showClock();
>>
>> System.out.println("here 3...");
>> }
>>
>> }... i mean this:
>
>
> /**
> * @(#)MyClock.java
> *
> * MyClock application
> *
> * @author kevin
> * @version 1.00 2007/4/4
> */
>
> import java.awt.event.*;
> import java.awt.*;
> import javax.swing.*;
> import javax.swing.event.*;
> import java.util.Date.*;
> import java.util.*;
> import javax.swing.JPanel.*;
> import java.awt.geom.*;
>
>
>
>
> class MyClock extends JPanel{
>
> private static void out(String s) {
> System.out.println(s);
> }
>
> private static void out(int s) {
> System.out.println(s);
> }
> public static void seeClock(){
>
> JPanel panel = new JPanel();
> Date now = new Date();
> String StringDate = now.toString();
> System.out.println(StringDate);
> out(now.getHours());
> out(now.getMinutes());
> out(now.getSeconds());
> panel.setBackground(Color.yellow);
> panel.setSize(300, 300);
> panel.setVisible(true);
>
> panel.setFont(new Font("sansserif", Font.PLAIN, 48));
> panel.setBorder(BorderFactory.createCompoundBorder());
> panel.setVisible(true); // see it
>
>
> } // seeClock
>
>
> //public static void run(){
> // int i=0;
> // while (i++ <3){
> // System.out.println("here 2...");
> // seeClock();
> // }
> //}
> public static void main (String args[]){
> // run();
> seeClock();
> out("here 3...");
> // out('hi');
> }
> }
>
.... hows this:
/**
* @(#)MyClock.java
*
* MyClock application
*
* @author kevin
* @version 1.00 2007/4/4
*/
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.util.*;
import java.util.Date.*;
import javax.swing.JPanel.*;
import java.awt.geom.*;
class MyClock extends JPanel
{
private static void out(String s) {
System.out.print(s);
}
private static void out(Date d) {
System.out.println(d);
}
private static void out(int i) {
System.out.println(i);
}
public static void drawTime(Date d){
out(d);
}
public void paintTime (String g){
// (g, 10, 10);
}
//public void paintTime (Graphics g){
// g.drawString(g, 10, 10);
//}
public static void main (String[] args){
// run();
Thread t;
t = new Thread();
t.start();
int i = 0;
while(i++ <= 10){
Date now = new Date();
int h = now.getHours();
int m = now.getMinutes();
int s = now.getSeconds();
JPanel panel = new JPanel();
panel.setForeground(Color.yellow);
panel.setVisible(true);
out(now);
try{
t.sleep(1000);
}catch (InterruptedException e){
// never gets here
}
}
// seeClock
out("here 3...");
}
}
--
Sometimes I'm in a good mood.
Sometimes I'm in a bad mood.
When all my moods have cum to pass
i hope they bury me upside down
so the world can kiss me porcelain,
white, Irish bottom.
|
|
0
|
|
|
|
Reply
|
llloyd
|
4/15/2007 10:00:59 PM
|
|
Andrew Thompson wrote:
> llloyd wood wrote:
>
>> /**
>> * @(#)MyClock.java
>
> ..OK
>
> What help do you require?
>
> - There are deprecated methods used.
> - As Knute mentioned, the app. will need a frame
> (java.awt.Frame, or more likely a javax.swing.JFrame),
> window, dialog or JOptionPane to act as a 'root'
> component in which to display it.
> - The class extends JPanel, but that makes little
> sense when the 'seeClock()' method declares and
> instantiates a second JPanel. I suggest you delete
> the second panel and the call to setVisible(true), change
> the name of the method to 'constructClock()', add a
> constructor that calls 'constructClock()', then add an
> instance of MyClock to the root component as
> mentioned above.
>
> For more specific help, I would need more specific
> questions.
>
> BTW - did you work through the tutorial that somebody
> linked to (might have been Knute, but I cannot quite
> recall).
>
.... this one works but it is text only. how do i get it in the box???
k
/**
* @(#)MyClock.java
*
* MyClock application
*
* @author kevin
* @version 1.00 2007/4/4
*/
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.util.*;
import java.util.Date.*;
import javax.swing.JPanel.*;
import java.awt.geom.*;
class MyClock extends JPanel
{
private static void out(String s) {
System.out.print(s);
}
private static void out(Date d) {
System.out.println(d);
}
private static void out(int i) {
System.out.println(i);
}
public static void drawTime(Date d){
out(d);
}
public void paintTime (String g){
// (g, 10, 10);
}
//public void paintTime (Graphics g){
// g.drawString(g, 10, 10);
//}
public static void main (String[] args){
// run();
Thread t;
t = new Thread();
t.start();
int i = 0;
while(i++ <= 10){
Date now = new Date();
int h = now.getHours();
int m = now.getMinutes();
int s = now.getSeconds();
JPanel panel = new JPanel();
panel.setForeground(Color.yellow);
panel.setVisible(true);
out(now);
try{
t.sleep(1000);
}catch (InterruptedException e){
// never gets here
}
}
// seeClock
out("here 3...");
}
}
--
Sometimes I'm in a good mood.
Sometimes I'm in a bad mood.
When all my moods have cum to pass
i hope they bury me upside down
so the world can kiss me porcelain,
white, Irish bottom.
|
|
0
|
|
|
|
Reply
|
llloyd
|
4/15/2007 10:06:19 PM
|
|
llloyd wood wrote:
...
>... this one works but it is text only. how do i get it in the box???
I could tell you, but the form of my answer would depend
on why you are doing this. So, why are you doing this?
Are you ..
a) Learning Java for fun?
b) Trying to complete a college assignment?
c) Just want a litle clock?
d) Some other reason?
(Note also, that one question mark is always enough.)
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-setup/200704/1
|
|
0
|
|
|
|
Reply
|
Andrew
|
4/16/2007 12:33:31 AM
|
|
On Apr 16, 12:06 am, llloyd wood <comprehensivecenter> wrote:
[junk deleted]
Would you lazy moron stop posting the same useless code again and
again? Go away and do your own homework.
|
|
0
|
|
|
|
Reply
|
a24900
|
4/16/2007 5:45:19 AM
|
|
|
11 Replies
138 Views
(page loaded in 0.139 seconds)
Similiar Articles: comp.lang.java.help - page 20could i pls get sum hlp w/this??? 11 88 (4/9/2007 10:01:08 PM) /** * @(#)MyClock.java * * MyClock application * * @author kevin * @version 1.00 2007/4/4 ... GARCH(1,1) MLE Question - comp.soft-sys.matlab... c + d*y(t-1) + e(t), h(t) = w+a*e(t)^2 + b*h(t)^2, We got the log-likelihood function with is: sum(-0.5*ln(2pi)) -sum(0.5 ... 107.3 [This is an exercise to help ... image processing - comp.soft-sys.matlabscan the image with a 3x3 or 5x5 mask. sum and average of 9 pixels in each ... it is salt & pepper noise on image, could you please help me on how to do the filter for mean ... Could you explain pass by value-result problem?? - comp ...void p(int x,int y) { int sum ... How to get integer value for register contents ? - comp.lang ... Could some Verilog guru please help ? Portfolio optimization using minimum-variance (fmincon) - comp ...Hi, Could anyone please help me with this portfolio optimization problem: how is it possible to write the function Min. w'*H*w, where H is a covarian... Splitting text file on page-break - comp.lang.awkCould someone please help. The end goal is to read in the file, search for the string, and only print out the page(s) containing the searchstring. Please help Explicit integral could not be found - comp.soft-sys ...Please help Explicit integral could not be found - comp.soft-sys ... But every time I ran it says Warning: Explicit integral could not be found.... ... some features that ... nonLinearSVM thru quadprog - comp.soft-sys.matlab... epsilon)); if length(usvindex) > 0 b0 = (1/length(usvindex))*sum(D ... function quadprog to qp, I am facing trouble in > running the code.Could anyone please help. Plot a "structure with time" - comp.soft-sys.matlabHi together, Could you please help me with this: How can I plot a "structure with time"? ... plot time values - comp.soft-sys.matlab... signal > Y=Y5+Y10; %linear sum of ... Error help, please - comp.unix.solarisOracle 10gR1 Memory Problem - Please help - comp.databases.oracle ... You can use oracle support for 600 errors. When you say 10g r1 production server that ... Need to learn how to hook midi keyboard up to new sound card ...Need to learn how to hook midi keyboard up to new sound card - midi plays, no connection - hlp pls!! Follow sum of series in matlab - comp.soft-sys.matlabCan somebody help me to solve in matlab following ... 8220;symsum” code First of all, please do ... array elements - comp.soft-sys.matlab Get minimum of the sum ... please,please!!! .....matlab wave generating - comp.soft-sys ...Please, please I need help I need to give this coursework by Monday and I'm stuck ... how you can obtain terms in the series for several values of n and them sum ... BufferedReader vs NIO Buffer - comp.lang.java.programmer ...Hi, Could someone pls tell me why is the NIO buffering faster ... To sum up: -- You can go to thousands of threads ... CPU scheduling and SRTF Algorithm, help - comp.lang ... Date Range Calculation - comp.databases.filemakerLooking for some help please FileMaker6 on Mac. I have a database of invoices ... Then get the 'Sum' of the realted amount to get the good total. Remi-Noel Menegaux ... Sumdog - Free math games - SumdogSave as many endangered animals as you can. Remove blocks to get them safely to the ... Help Frequently asked questions Check your browser Classroom resources How to purchase Get Sum Dim Sum - CLOSED - Rosedale - Austin, TX... and I don't have to make the trek to Houston to get decent dim sum. Just one thing, Yelp -- could you *please ... Help. FAQ; Advertise; Content Guidelines; Contact Yelp; Business ... 7/26/2012 3:24:54 AM
|