Help! Program runs but dies up halfway through!
HELP!
Help! My program runs, but dies after it starts running.
I am attaching my assignment and my programs. This is due tomorrow night and I am trying to get it done today since I have other assignments to do. Any help anyone can offer would be great.
The program compiles, it succesffuly calls the other parts, but the applet blows up after it runs the first dialog box.
Assignment*********************************************************
Wie's Tea Shop asks you to write an Inventory control program to keep track of the boxes of tea they serve to customers. The program will allow the user to enter the name of the tea, the number of boxes on hand, and the number of boxes used during a one-day period. The output will display the input data and the number of boxes remaining. Use dialog boxes for program input and output. The program names are InventoryControl, InventorySold, and UseInventorySold. The InventorySold class extends InventoryControl and prompts for the quantity of tea boxes sold.
//This is InventoryControl and it part 1 of the program
import javax.swing.*;
import javax.swing.JOptionPane;
public class InventoryControl
public static String teaType;
public InventoryControl()
teaType = JOptionPane.showInputDialog(null, "Please Enter the type of Tea used today:", "Tea Type");
public static String getTeaType()
return teaType;
//This is InventorySold and is Part 2 of the program
import javax.swing.*;
import javax.swing.JOptionPane;
public class InventorySold extends InventoryControl
public static String teaSold;
// public static int TSN;
public InventorySold()
//teaSold = JOptionPane.showInputDialog(null, "Enter the number of " + teaType + " boxes sold today");
teaSold = JOptionPane.showInputDialog(null, "Enter the number of BLAH boxes sold today");
// TSN = Integer.parseInt(teaSold);
public static String getTeaSold()
return teaSold;
//This is UseInventorySold and is Part 3 of the program
import javax.swing.JOptionPane;
import java.lang.*;
import java.util.*;
public class UseInventorySold extends InventoryControl
//String teaOnHand;
public static void main(String [] args)
String teaOnHand;
JOptionPane.showMessageDialog(null, "Welcome to Wei's Tea Shop" + "\nTea Inventory Program", "Wei's Tea Shop", JOptionPane.INFORMATION_MESSAGE);
InventoryControl TT = new InventoryControl();
InventorySold TS = new InventorySold();
// String teaType = getTeaType();
// int teaSold = getTeaSold();
teaOnHand = JOptionPane.showInputDialog(null, "Enter the number of " TT "boxes currently in stock"); int TeaOHN = Integer.parseInt(teaOnHand);
JOptionPane.showMessageDialog(null,"Today you used " + TS + "boxes of " + TT + "." + "\nThere are currently " + TeaOHN + " boxes of " + TT + " left", "Wei's Tea Shop", JOptionPane.INFORMATION_MESSAGE);
//System.exit(0);
This is what it does....
after the user clicks okay on the first user input dialog box the the applet window says "Start: applet not initialized" at the bottom and the IDE debugger says ...
java.lang.ClassCastException
at sun.applet.AppletPanel.createApplet(AppletPanel.java:617)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:546)
at sun.applet.AppletPanel.run(AppletPanel.java:298)
at java.lang.Thread.run(Thread.java:534)
Similar Messages
-
Onboard program calls the "Load constant to variable.vi" in first block. Same call is made in labview code just before the run program block. the variable in the onboard program ALWAYS defalts to (0). WHY???
Hello,
Thank you for contacting National Instruments.
My guess is that the variable is being overwritten by the first call (Load Constant to Variable VI) of the onboard program. The order of operations for the second VI appears to be the following:
1) Load Constant to Variable (variable 1 = 10000)
2) Run the onboard program
3) Onboard program calls Load Constant to Variable (variable 1 = 0)
Any value that the first step of the onboard program loads (step 3 above) will overwrite the value loaded just before the onboard program runs (step 1 above).
I have attached an image of the block diagrams for both VIs I used for testing. The first VI loads an initial value into variable 1, starts program storage, loads position, loads veloci
ty from variable 1, loads acceleration and deceleration, starts motion, then ends storage. The second program simply loads a new value into the variable then runs the stored program. As the variable value in the second program is modified, the velocity changes appropriately. I tested this with a PCI-7344 in LabVIEW 7.1 with NI-Motion 6.1.3.
Hopefully this will help you track down the source of the problem.
Best Regards,
Jesse D.
Applications Engineer
National Instruments
Attachments:
OnboardTestImage.JPG 36 KB -
Any ideas as to why the applications do not open in a window?
Is an external display connected and turned off? If not, open Mission Control. Do you see the window(s) in any other spaces?
-
I am trying to troubleshoot an iTunes problem, which may be related to the resources issue that has been previously identified.
My problem is that once iTunes has been running for more than half a day or so, when I play music the program "skips" through the song, playing snippets a fraction of a second long. A 4 minute song will be done in a few seconds. The program then skips to the next song and this repeats. Rebooting solves the problems for a few hours, then it reoccurs. Other symptoms include iTunes not responding quickly, especially to closing it.
As per TS4123, I tried to rune the Autoruns program to see if I had a conflict. I launched the program and a DOS box opens and runs some command line items, but nothing else happens. I don't see a Windows box like I should.
Help on either problem?
I am running Win4, 64bit, on an HP desktop. I have updated video and audio drivers.You should run the windows based file AUTORUNS.exe instead.
-
My I pod wont eject it says it has a program running but I cant find the prograhm
My Ipod wont eject it says that there is a program funning on it but I cant find any
Hello Brenda,
Try doing a hard reset of the iPod with it still connected. To do this, press and hold both the Select (Center) and Menu buttons together long enough for the Apple logo to appear. Then try ejecting it once again to see if that helps.
If the problem is still there, make sure your AV software is not configured to scan your iPod's HD.
B-rock -
Looping a streaming flv movie, but loop to halfway through flv
Hello,
I've managed to loop my progressively streaming flv with both the following approaches (both gained from these forums - so thank you very much!)
Giving my FLV an instance name of "vid" and then adding this to an Action layer:
var vidList : Object = new Object();
vidList.complete = function() {
vid.play();
vid.addEventListener ("complete",vidList);
stop();
Or simply attaching the following to the FLV itself:
on (complete){
this.autoRewind=true;
this.play();
However, what I really want to do is have it loop back to a point, say, 5 seconds into the flv. I've tried gotoAndPlay instead of just play, but of course the swf only has the one frame so I don't think frame numbers are the way forward? I've been seeing "cuepoints" and "NetStream" coming up in various searches I've done - is that the way forward? They both seem quite complicated for something that I've almost solved using either of the above.
Any ideas?
Thanks,
TimIf it's scripted to be initially paused, you can simply
position it in
the score to be off stage, insert a key frame at the frame
were position
moves to display location. -
Safari not opening properly - sticks halfway through loading
Hi there,
My Safari window on my iMac keeps opening but then the pages won't load fully - for eg, the start page comes up with the apple homepage which starts highlighting blue as if it were opening but then sticks halfway through this process.
Firefox is working fine though.
Help!Please read this whole message before doing anything.
This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
Step 1
The purpose of this step is to determine whether the problem is localized to your user account.
Enable guest logins and log in as Guest. For instructions, launch the System Preferences application, select Help from the menu bar, and enter “Set up a guest account” (without the quotes) in the search box.
While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
Test while logged in as Guest. Same problem(s)?
After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
Note: If you’ve activated “Find My Mac” or FileVault in Mac OS X 10.7 or later, then you can’t enable the Guest account. Create a new account in which to test, and delete it, including its home folder, after testing.
Step 2
The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login.
Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. The instructions provided by Apple are as follows:
Be sure your Mac is shut down.
Press the power button.
Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
Note: If FileVault is enabled under Mac OS X 10.7 or later, you can’t boot in safe mode.
Test while in safe mode. Same problem(s)?
After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of steps 1 and 2. -
Program Compiles, but Exception in thread "main" error is thrown
Hello everybody,
I am getting the following error when I try to run my program. It compiles fine, but a Exception in thread "main" error is given when I try to run the program. This is the full error:
Exception in thread "main" java.lang.Error: Do not use KonnectHelpdeskFrame.add(
) use KonnectHelpdeskFrame.getContentPane().add() instead
at javax.swing.JFrame.createRootPaneException(JFrame.java:446)
at javax.swing.JFrame.addImpl(JFrame.java:472)
at java.awt.Container.add(Container.java:298)
at KonnectHelpdesk.main(KonnectHelpdesk.java:15)
Press any key to continue . . .The code that I beleive contributes to the error is below. I'm not sure what is causing the problem, so any help will be greatly appreciated. Thanks.
class VoiceMailEntryDialog extends JDialog
public VoiceMailEntryDialog(JFrame owner)
super(owner, "New Voicemail Entry", true);
Container contentPane = getContentPane();
GridBagLayout layout = new GridBagLayout();
contentPane.setLayout(layout);
JLabel numberLabel = new JLabel("Phone Number: ");
JLabel dayCalledLabel = new JLabel("Day Customer Called: ");
JLabel timeCalledLabel = new JLabel("Time Customer Called: ");
JLabel firstNameLabel = new JLabel("First Name: ");
JLabel lastNameLabel = new JLabel("Last Name: ");
JLabel messageLabel = new JLabel("Message: ");
JTextField phoneNumber = new JTextField(20);
JTextField firstName = new JTextField(20);
JTextField lastName = new JTextField(30);
JTextArea message = new JTextArea(8, 30);
message.setLineWrap(true);
message.setBorder(BorderFactory.createEtchedBorder());
JComboBox dayCalled = new JComboBox(new String[]
"Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday"
JComboBox timeCalled = new JComboBox(new String[]
"9:30am - 9:59am", "10:00am - 10:59am", "11:00am - 11:59am", "12:00pm - 12:59pm",
"1:00pm - 1:59pm", "2:00pm - 2:59pm", "3:00pm - 3:59pm", "4:00pm - 4:59pm",
"5:00pm - 5:59pm", "6:00pm - 6:59pm", "7:00pm - 7:59pm", "8:00pm - 8:59pm",
"9:00pm - 9:59pm", "10:00pm - 9:29am"
ActionListener noMsgListener = new NoMessageChecked();
JCheckBox noMessageCheckbox = new JCheckBox("Left no message");
noMessageCheckbox.addActionListener(noMsgListener);
JButton ok = new JButton("OK");
ok.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent evt)
setVisible(false);
JButton cancel = new JButton("Cancel");
cancel.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent evt)
setVisible(false);
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
constraints.weightx = 0;
constraints.weighty = 0;
add(numberLabel, constraints, 0, 0, 1, 1);
add(dayCalledLabel, constraints, 0, 2, 1, 1);
add(timeCalledLabel, constraints, 0, 4, 1, 1);
setSize(400, 700);
public void add(Component c, GridBagConstraints constraints, int x, int y, int w, int h)
constraints.gridx = x;
constraints.gridy = y;
constraints.gridwidth = w;
constraints.gridheight = h;
getContentPane().add(c, constraints);
private class NoMessageChecked implements ActionListener
public void actionPerformed(ActionEvent event)
}atmguy,
Thanks. It turns out the the line that was causing the problem was in the error message. I guess it helps to pay attention. You are correct in what the line says and changing it made the program run, but caused some other minor problems that I'll work out later. Thanks again for you help.
jerryrika -
TS1424 song cuts off halfway through?
I downloaded the album "Homes" from Jon & Roy and two songs show the time length of the song, but stop playing halfway through and skip right away to the next song. Is anyone else having this problem with this album, or another album and know where to go for help? Thanks!
Hello stephen9478
All you would need to do is delete the song from your iTunes library and then go to the iTunes Store and look in the Purchased section to download any previous purchased content. Check out the article below for more information about any previous purchases.
Download past purchases
http://support.apple.com/kb/HT2519
Regards,
-Norm G. -
GoLive running but wont appear on screen problem
I have a weird problem running Adobe GoLive (version 8) on Windows 7 - the program runs but wont appear on screen. I don't get this issue with any other
program and until this happened a few days ago the program worked fine on Windows 7.
When it's started, the 'title box' with logo and version number etc appears on screen and the icon appears on the taskbar, but no program appears on
screen. It doesn't matter how many times I click on this, it wont appear on screen. If I hit Alt-Ctrl-Del and bring up Task Manager I can see it's
running in the Applications tab and I can also see it's process running on the processes tab too.
I thought maybe it had gone 'off screen' so I used all the Windows 7 tips on how to bring progs back on screen but nothing works. Interestingly, when I hover
over it's icon on the taskbar, and hold shift whilst clicking it to try to bring up the old-style maximise and minimise options, nothing appears -
although this works with every other application.
I use two screens, so I tried changing the display to use just one - makes no difference.
I then uninstalled GoLive, rebooted and installed it again - makes no difference.
Any idea why this would happen?Make a temporary, backup copy (if you don't already have a backup copy) of the library and try the following:
1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
User/Home()/Library/ Preferences folder.
2 - delete iPhoto's cache file, Cache.db, that is located in your
User/Home()/Library/Caches/com.apple.iPhoto folder.
Click to view full size
3 - launch iPhoto and try again.
NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding down the Option key when launching iPhoto. You'll also have to reset the iPhoto's various preferences.
NOTE: In Lion and Mountain Lion the Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and hit the Enter button - 10.7: Un-hide the User Library folder.
OT -
I can't download the new version of iTunes. Halfway through the installation a pop up window appears saying, "There is a problem with this Windows installer package. A program run as a part of a set up did not finish as expected. Contact your support personnel or package vendor.
Got exact same problem, was told to delete all old apple, quick time and bonjoir from computer then it would work. I use a programme called malware bytes and this takes everthing out of your computer right down to the roots but unfortunately I still have same problem
-
i recently tried to remove widows7 on my macbook air using bootcamp and halfway through it grayed out .The windows 7 is removed but i cant free up the 62gig partition the windows was occupying on my 121gig ssd harddrive please help
You may have to see about using the Recovery HD partition to attempt to erase and restore useful function of the capacity lost to the former Windows installation.
And you may have to backup your contents outside the computer to do it. Disk Utility on the Mac OS X historically has not been able to touch a BootCamp created partition; so if BootCamp cannot remove it, then you have to see how to do the equivalent of a reformat of the entire drive (less Recovery partition?) then reinstall your OS X. Maybe from internet recovery, then get your applications, etc from the Mac App store, etc.
A complete system clone of your OS X on an external HDD would be another method to restore after reformat, of the portion you want whole again, not necessarily the space where Recovery may live.
There may be (an)other way(s).
Perhaps someone with recent experience
in this matter can reply & discuss options.
With my antiques, they almost know what I want before I tell them.
Hopefully yours will after you talk to it awhile.
Good luck & happy computing! -
Hi all,I have just purchased new iphone but have difficulty in completing the itunes download with message : problem with Windows installer package. A program run as part of the setup did not finish as expected.
Would appreciate help...its driving me up the wall!!Perhaps let's first try updating your Apple Software Update.
Launch Apple Software Update ("Start > All Programs > Apple Software Update"). Does it launch and offer you a newer version of Apple Software Update? If so, choose to install just that update to Apple Software Update. (Deselect any other software offered at the same time.)
If the ASU update goes through okay, try another iTunes install. Does it go through without the errors this time? -
Firefox will not open. I get the firefox is already running but not responding window... I have tried rebooting with no help. I have tried to end the process via cntrl+shift+esc and nothing firefox is listed to end. I have tried find the app data via the run icon in the start up window, I have no run icon on this system (Acer with windows vista(?)
== This happened ==
Every time Firefox opened
== The computer was hard shut down and did a improper shut down scan when it was restarted ==
== User Agent ==
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; FunWebProducts; GTB6.5; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729)I am having a similar problem. Running Xp.
Latest revision of firefox.
After using firefox for a while if I exit, parent.lock is locked and i have to reboot to reload firefox.
I have killed all firefox applications from task manager (usually there are none). and I have tried 3 different "file unlock" programs including unlocker to no avail.
I also recently installed a program that shows -all- open files, and parent.lock is not listed, and thus not closable/unlockable from there. -
Program runs in win 7-64 Pro BUT will not run in win 7 home or vista.
Program runs in win 7-64 Pro BUT will not run in win 7 home or vista.
I'm testing 32bit software that will run in 7-64 Pro but will not in win 7 home premium or vista.
The 7-64 Pro machine is NOT running the program in XP mode although is is being run as admin. The 7 home premium and vista beta testers have tried every work around/mode, admin mode, and anti-virus exception. I've run process explorer & WinMerge to evaluate
the differences between os operations & dlls loaded but am unable to find the OS issue.
Currently 2-win7-64 machines, 1 vista machine and 1 win 7 machine had no issues with the program as it started up and ran immediately.
After 3 beta's 30 hours of testing & 50 of my own, I believe I've narrowed the issue down to the win 7 home premium and vista os's.
Can anyone here suggest other ways to further narrow it down so as to provide functionality on all 3 os's?You must provide the exact name and version of the software for anyone to attempt to answer your question. Primarily the functionality of any software is entirely dependent on what platforms the publisher intended the software to run on.
If you are the programmer you need to go to the Microsoft Developer Network forums for assistance:
http://msdn.microsoft.com/en-US/#fbid=Xt631zR1D90.
This is an End Users' Peer-to-Peer forum that does not address programming from any perspective.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
Maybe you are looking for
-
My Iphone 4 is not working please help
my phone wont turn on at all i tried everything holding the home and the turn on buttton at the same time and also tried to charge it but it wont do anything its just blank!!!! PLEASE HELP ME!!!!!
-
How to delete an "Available Download" from iTunes Store account?
Greetings, I've downloaded various "free TV episodes" to my MacBook Pro from the iTunes Store, watched them, and deleted them. The problem is that the next time I start up iTunes on my MacBook, iTunes automatically goes to the iTunes Store and begin
-
Our company is currently using iCal of scheduling. It has been working great, however, an IT guy came in to update our server and now the calendar won't show any of the created iCloud calendars at the side, it won't sync on many of our phones and com
-
Ios6 & iPhone 4 tethering and bluetoothproblems
Updated MacBook Pro and now iPhone 4 won't tether or Bluetooth. Tried resetting phone and updating iTunes but no results. Also tried a friends iPhone with same results. Anybody have any suggestions? Tinkered with all settings I could find
-
Hello all - Surprisingly I couldn't find this in searches on the forum, so looking for input. I've got an external monitor hooked up via firewire through an HDV deck. There's the expected sound delay (about 5 frames), but how do I get rid of it? Can