| | |
error message
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2005
Posts: 14
Reputation:
Solved Threads: 0
me agian lol
I posted on here over a week ago about a java assignment.. thanks to those who offered help i really appreciate it even tho it wasnt much help to me at the time
... i am ashamed to say, that even with all the great advice, i still didnt understand
i have been pointed in the right direction by a very helpful lab tutor, but we only get an hour a week and in my case its not enough, i'm still struggling :eek: oh and i bought big java... but its so ummm BIG lol
i have spent many hours (40+ i kid u not) trying to get this thing done and i only have until monday to get it working so i hope u will be kind enough to help
firstly my program is supposed to get the time from the user via a text area.. it should then convert to military time and paint a sad face for night and a happy face for day..
my questions....
the biggest problem i have at the mo, is that my applet is not initialising and i have no idea why..
where do i put the code that coverts the time?
how do i get the input to display?
have i done anything else wrong? (so far)
as u can see i have tried many things... and this is my third draft.. :rolleyes:
I posted on here over a week ago about a java assignment.. thanks to those who offered help i really appreciate it even tho it wasnt much help to me at the time
... i am ashamed to say, that even with all the great advice, i still didnt understandi have been pointed in the right direction by a very helpful lab tutor, but we only get an hour a week and in my case its not enough, i'm still struggling :eek: oh and i bought big java... but its so ummm BIG lol
i have spent many hours (40+ i kid u not) trying to get this thing done and i only have until monday to get it working so i hope u will be kind enough to help
firstly my program is supposed to get the time from the user via a text area.. it should then convert to military time and paint a sad face for night and a happy face for day..
my questions....
the biggest problem i have at the mo, is that my applet is not initialising and i have no idea why..
where do i put the code that coverts the time?
how do i get the input to display?
have i done anything else wrong? (so far)
as u can see i have tried many things... and this is my third draft.. :rolleyes:
Java Syntax (Toggle Plain Text)
import java.applet.*; //Applet Class import java.awt.*; //All the classes import java.awt.event.*; import java.util.*; public class MilitaryTime1 extends Applet implements ActionListener { int hrs, mins, secs; String am, pm; Label promptTime; TextField timeIn; Label promptAmPm; //Remind user to enter am or pm TextField inputAmPm; //StringTokenizer inputTime; public void init() { setSize(600,400); promptTime = new Label("Input current time"); timeIn = new TextField(7); promptAmPm=new Label("Enter am or pm?"); inputAmPm = new TextField(2); add(promptTime); add(timeIn); add(promptAmPm); add(inputAmPm); timeIn.addActionListener(this); inputAmPm.addActionListener(this); StringTokenizer timeIn = new StringTokenizer(" ,\t\n"); String hrs = timeIn.nextToken(); String mins = timeIn.nextToken(); String secs = timeIn.nextToken();; // String valInputAmPm; // valInputAmPm=inputAmPm.getText(); // hrs = Integer.parseInt(); // mins = Integer.parseInt(mins.getText()); // secs = Integer.parseInt(secs.getText()); } public void paint(Graphics graf) { if (inputAmPm.getText() == am) { graf.setColor(Color.yellow); graf.fillOval(0,0,200,200); graf.setColor(Color.black); graf.fillOval(50,50,25,25); graf.fillOval(125,50,25,25); graf.drawArc(75,125,50,50,180,180); } else { graf.setColor(Color.yellow); graf.fillOval(0,0,200,200); graf.setColor(Color.black); graf.fillOval(50,50,25,25); graf.fillOval(125,50,25,25); graf.drawArc(75,125,50,50,360,180); } } public void actionPerformed (ActionEvent ev) { Object source = ev.getSource(); { // String valInputAmPm; // valInputAmPm=inputAmPm.getText(); if (timeIn.getText() == am) { System.out.println("The time in military format is: " + hrs + ":" + mins + ":" + secs); //st = new StringTokenizer(inputTime.getText() " ,.:"); //String hrs = inputTime.nextToken(); //String mins = inputTime.nextToken(); //String secs = inputTime.nextToken(); //System.out.println(hrs +":"+ mins +":"+ secs); //inputHrs.setText(""); //inputMins.setText(""); //inputSecs.setText(""); //repaint(); } else { // System.out.println(hrs + 12)":"+ mins +":"+ secs); } } } }
![]() |
Similar Threads
- Toshiba IDE1 error message (Windows NT / 2000 / XP)
- MERGED: Hardware/Driver Problems-Error Message (Windows 95 / 98 / Me)
- Strange blank WinXP Login error message ... (Windows NT / 2000 / XP)
- wupdater.exe error message (Web Browsers)
- Please help with DLL error message! (Windows NT / 2000 / XP)
Other Threads in the Java Forum
- Previous Thread: Dasher in java
- Next Thread: Help linking a applet button to a text box
| Thread Tools | Search this Thread |
android api applet application array arrays automation awt bidirectional binary birt bluetooth busy_handler(null) calculator chat class classes client code columns component constructor database designadrawingapplicationusingjavajslider draw eclipse editor error errors event eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia link linux list loop map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle parsing plazmic print problem program programming project recursion scanner screen server set sharepoint size smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads time tree unlimited utility webservices windows






