?
Solved

Applet Question : Have an applet and want to print out calculations

Posted on 2003-03-13
6
Medium Priority
?
151 Views
Last Modified: 2010-03-31
Hello,
I was wondering if anyone could answer me this question. I have an applet that works out a calculation based on what the user chooses from a Choice() box. So , say , for example i have
if(choice.getSelectedIndex() == 1)
{
     a = (b - (c * a))
}
else if(choice.getSelectedIndex() == 2)
{
     b = b * b
}

and so on.
How do I print this out to a seperate frame. ?
I already have a seperate frame already but it is just printing out a or b but not the results.



0
Comment
Question by:confuddled
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:pronane
ID: 8129948
where have you declared a or b?  have you declared them so that wherever you print them to the frame they can be seen so that if a calculation has been made it will be seen by all that are using/need a or b? also try printing out a or b to the console after the calculation has been made to make sure they are changing.
0
 

Author Comment

by:confuddled
ID: 8129997
a and b are global variables.
the calculation are defintely changing. I 've checked that using appletviewer. What I asked is not too clear. I'll rephrase this question.

I have the following variables

int Lap;
     double Distance, LengthOfPit, totalRaceDistance, FuelPerLap, currentLap, FrontWing, RearWing, DriveT, StopG, distanceLeft, lapsLeft, AmountToFuel, stop1, stop2, stop3, FuelRig,EngineCapacity, safetyLap, yLap, rLap;

and have this following also

else if(ie.getSource().equals((Object)track)) //if the track was selected
{
switch (track.getSelectedIndex())
{
     case 0:
       //Melbourne
     Lap = 58;
     Distance = 5.303;
     LengthOfPit = 16.0;
     totalRaceDistance = Lap * Distance;
     currentLap = Clap.getSelectedIndex() + 1;
     if (currentLap<=0 || currentLap>58)
     {
     currentLap = 0;
     }
        distanceLeft = (totalRaceDistance - (currentLap * Distance));
     lapsLeft = distanceLeft / Distance;
     AmountToFuel = FuelPerLap * lapsLeft;
     break;

        etc....................................

I then have this what i want to print out

       stop 1 = ((AmountToFuel / FuelRig) + LengthOfPit)

Now what i want to do is print stop1 in a seperate frame. I have no problem creating this frame but i do have a problem printing stop1 to the frame. I hope that cleared it up.

     
0
 
LVL 8

Accepted Solution

by:
Exceter earned 300 total points
ID: 8130054
Have you tried something like,

Label l = new Label( stop.toString() );

frame1.getContentPane().add( l )

Exceter
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:confuddled
ID: 8130194
that's about it
thanks
0
 

Author Comment

by:confuddled
ID: 8130197
that's about it
thanks
0
 
LVL 8

Expert Comment

by:Exceter
ID: 8136656
You are most welcome.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question