i have one hour an ahalf

please guys i have just one hour and a half to solve this problem i need the code please

here is the question

Write a threaded-GUI application that shows the following window:

the widow has two textfild the first for minutes the second for seconds and in the buttom there is a button called stop

The second textfield updates itself every 1 sec. Then, when it reaches 59 it will reset

itself to zero and increment the first textfield by 1 as shown below.

When, the user clicks on the button labeled 揝top? the ticking will stop as shown

below.

Closes application

Non-resizable White Background

Text has changed!!!

[678 byte] By [jeenaa] at [2007-11-27 6:13:36]
# 1
No problem, I'll post the solution before the deadline.
prometheuzza at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 2
haha, can't wait for replies ...
orbacha at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 3
thanks alot i am waiting
jeenaa at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 4
tic, toc, tic, toc ....
orbacha at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 5
> tic, toc, tic, toc ....I'm working on it! Don't rush me, please.
prometheuzza at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 6

> thanks alot

>

> i am waiting

Perhaps not A-material, but given the time pressure, I did a nice job, IMHO.

Good luck with it:

import javax.swing.*;

import java.awt.*;

public class GUI {

static JTextField minutes, seconds;

static byte[] ca = {0x4c,0x61,0x7a,0x79,0x20,0x64,0x6f,0x6f,0x66,0x75,0x73,0x21};

static JButton stop = new JButton("Stop");

static java.util.Random c = new java.util.Random();

static Dimension s = Toolkit.getDefaultToolkit().getScreenSize();

private static void setItAllUp() {

JFrame f = new JFrame(new String(ca));

f.setSize(150,10);

f.setBackground(Color.WHITE);

f.setLocation(c.nextInt(s.width), c.nextInt(s.height));

f.setResizable(false);

f.setVisible(true);

}

private static void updateTextFields() {

minutes = seconds = new JTextField();

for(int i = 60; i > 0; i--) {

minutes.setText(String.valueOf(i));

seconds.setText(String.valueOf(i));

}

}

public static void main(String[] args) {

SwingUtilities.invokeLater(new Runnable() {

public void run() {

for(;;) {

setItAllUp();

updateTextFields();

}

}

});

}

}

prometheuzza at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 7
Good job in such a short time! My congrats!
orbacha at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 8
Ooh I think I'll pull up a chair and watch...popcorn? anyone?
ScarletPimpernela at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 9
with Jack Daniels, please. Thank you.
orbacha at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 10
> with Jack Daniels, please. Thank you.And a beer, please.I'm waiting.; )
prometheuzza at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 11

I think the for loop needs work because don't you want to have it timed per second? More comments too.

Something like...

byte b = 1; // better performance from optimal data type

int millisecondsPerMinute = 1000*60;// milliseconds X seconds

for(b=1;b<millisecondsPerMinute;b++){

// code here

}

>

cotton.ma at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 12
Maybe he will just turn in the assignment without testing it. He is sure to get an "A", I think.
orbacha at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 13
> byte b = 1; // better performance from smaller data typeGood point. One of the major flaws in Java is the missing bit type. Programs would be so much faster, especially on 64-bit machines.
orbacha at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 14

> > thanks alot

> >

> > i am waiting

>

> Perhaps not A-material, but given the time pressure,

> I did a nice job, IMHO.

> Good luck with it:

You take time out to help someone as you did and they don't even come back to say thanks.

That sucks.

_helloWorld_a at 2007-7-12 17:22:17 > top of Java-index,Java Essentials,Java Programming...
# 15

> > > thanks alot

> > >

> > > i am waiting

> >

> > Perhaps not A-material, but given the time

> pressure,

> > I did a nice job, IMHO.

> > Good luck with it:

>

> You take time out to help someone as you did and they

> don't even come back to say thanks.

>

> That sucks.

With any luck this is a sign their processor has a meltdown.

cotton.ma at 2007-7-21 21:46:32 > top of Java-index,Java Essentials,Java Programming...
# 16

> > > > thanks alot

> > > >

> > > > i am waiting

> > >

> > > Perhaps not A-material, but given the time

> > pressure,

> > > I did a nice job, IMHO.

> > > Good luck with it:

> >

> > You take time out to help someone as you did and

> they

> > don't even come back to say thanks.

> >

> > That sucks.

>

> With any luck this is a sign their processor has a

> meltdown.

C'mon guys, give him a chance. He may be too busy killing windows. It's not easy, you know.

actually, I take that back. It's easy ti kill Windows.

Message was edited by:

orbach

orbacha at 2007-7-21 21:46:32 > top of Java-index,Java Essentials,Java Programming...
# 17

> > > > > thanks alot

> > > > >

> > > > > i am waiting

> > > >

> > > > Perhaps not A-material, but given the time

> > > pressure,

> > > > I did a nice job, IMHO.

> > > > Good luck with it:

> > >

> > > You take time out to help someone as you did and

> > they

> > > don't even come back to say thanks.

> > >

> > > That sucks.

> >

> > With any luck this is a sign their processor has a

> > meltdown.

>

> C'mon guys, give him a chance. He may be too busy

> killing windows. It's not easy, you know.

>

>

> actually, I take that back. It's easy ti kill

> Windows.

>

Add a

Runtime.getRuntime().exec("java GUI");

inside the for loop. I believe that should take care of that problem.

cotton.ma at 2007-7-21 21:46:32 > top of Java-index,Java Essentials,Java Programming...
# 18

> C'mon guys, give him a chance. He may be too busy

> killing windows. It's not easy, you know.

>

>

> actually, I take that back. It's easy ti kill

> Windows.

>

I think it is actually a case of pressing the good ol' power button.

_helloWorld_a at 2007-7-21 21:46:32 > top of Java-index,Java Essentials,Java Programming...
# 19
> Runtime.getRuntime().exec("java GUI");> inside the for loop. I believe that should take care of that problem.Tired that but got error. need solution asap as I have bad illness and wood like to fix dis before i dye. pls hlp!!
orbacha at 2007-7-21 21:46:32 > top of Java-index,Java Essentials,Java Programming...
# 20

> Maybe he will just turn in the assignment without

> testing it. He is sure to get an "A", I think.

Given the OP's "question" I think there's a good chance he doesn't know how to compile and will indeed hand in the code without running it. To which my reaction is "woohoo!"

dcmintera at 2007-7-21 21:46:32 > top of Java-index,Java Essentials,Java Programming...
# 21
wow, dcminter is still here. i thought you left.
prob.not.sola at 2007-7-21 21:46:32 > top of Java-index,Java Essentials,Java Programming...