Printing out to command window project

hi all, i have a question on this cart program i am making, i wanted to know how to output the results to the command window every time a person clicks on the "current status" of their purchase. I want it to print out like ( 5 boxes purhcased, 4 cds bought, serial number is 1234...... ) i want it to do this until the person exits out of the program.
i have pasted the code below thanks :)
(copy and paste )
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
public class TestProgram extends JFrame implements ActionListener{
JLabel column1, column2;
JLabel totalItems, totalCost;
JLabel serialNum;
JLabel electronics, autos, furnitures, cds;
JButton TrackAssets, delete;
JPanel panel;
JTextField electronicsAsset, autosAsset, furnituresAsset, cdsAsset;
JTextField serialNumber;
JTextArea items, cost;
public TestProgram()
     column1 = new JLabel("Select Items");
column2 = new JLabel("Specify Quantity");
electronics = new JLabel("Electronics");
electronicsAsset = new JTextField();
electronicsAsset.addActionListener(this);
autos = new JLabel("Autos");
autosAsset = new JTextField();
autosAsset.addActionListener(this);
furnitures = new JLabel("Furnitures");
furnituresAsset = new JTextField();
furnituresAsset.addActionListener(this);
cds = new JLabel("Compact Discs");
cdsAsset = new JTextField();
cdsAsset.addActionListener(this);
serialNum = new JLabel("Serial Number input here");
serialNumber = new JTextField();
electronicsAsset.setNextFocusableComponent(serialNumber);
totalItems = new JLabel("Total Items:");
totalCost = new JLabel("Total Cost:");
items = new JTextArea();
cost = new JTextArea();
TrackAssets = new JButton("Current Status");
TrackAssets.addActionListener(this);
delete = new JButton("Delete all");
delete.addActionListener(this);
panel = new JPanel();
panel.setLayout(new GridLayout(0,4));
panel.setBackground(Color.white);
getContentPane().add(panel);
panel.add(column1);
panel.add(column2);
panel.add(electronics);
panel.add(electronicsAsset);
panel.add(autos);
panel.add(autosAsset);
     panel.add(furnitures);
     panel.add(furnituresAsset);
     panel.add(cds);
     panel.add(cdsAsset);
panel.add(furnitures);
panel.add(furnituresAsset);
panel.add(totalItems);
panel.add(items);
panel.add(totalCost);
panel.add(cost);
panel.add(serialNum);
panel.add(serialNumber);
panel.add(delete);
panel.add(TrackAssets);
getContentPane().add(panel);
panel.add(column1);
panel.add(column2);
panel.add(electronics);
panel.add(electronicsAsset);
panel.add(autos);
panel.add(autosAsset);
     panel.add(furnitures);
     panel.add(furnituresAsset);
     panel.add(cds);
     panel.add(cdsAsset);
panel.add(furnitures);
panel.add(furnituresAsset);
panel.add(totalItems);
panel.add(items);
panel.add(totalCost);
panel.add(cost);
panel.add(serialNum);
panel.add(serialNumber);
panel.add(delete);
panel.add(TrackAssets);
if(tracker.electronics.length() > 0){
               try{
               electronicsNo = Integer.valueOf(tracker.electronics);
               tracker.itotal += electronicsNo.intValue();
               catch(java.lang.NumberFormatException e){
               electronicsAsset.setText("Invalid Value");
               else {
                    tracker.itotal += 0;
if(tracker.autos.length() > 0){
try{
autosNo = Integer.valueOf(tracker.autos);
tracker.itotal += autosNo.intValue();
catch(java.lang.NumberFormatException e){
autosAsset.setText("Invalid Value");
     else {
tracker.itotal += 0;
if(tracker.furnitures.length() > 0){
try{
furnituresNo = Integer.valueOf(tracker. furnitures);
tracker.itotal += furnituresNo.intValue();
}catch(java.lang.NumberFormatException e){
furnituresAsset.setText("Invalid Value");
     else {
tracker.itotal += 0;
if(tracker.cds.length() > 0){
try{
cdsNo = Integer.valueOf(tracker.cds);
tracker.itotal += cdsNo.intValue();
catch(java.lang.NumberFormatException e){
cdsAsset.setText("Invalid Value");
else {
tracker.itotal += 0;
serialNum = new Integer(tracker.itotal);
output = serialNum.toString();
this.items.setText(output);
tracker.icost = (tracker.itotal * 300.00);
cost = new Double(tracker.icost);
output2 = cost.toString();
this.cost.setText(output2);
if(source == delete){
serialNumber.setText("");
electronicsAsset.setText("");
autosAsset.setText("");
furnituresAsset.setText("");
cdsAsset.setText("");
serialNumber.setText("");
tracker.icost = 0;
cost = new Double(tracker.icost);
output2 = cost.toString();
this.cost.setText(output2);
tracker.itotal = 0;
serialNum = new Integer(tracker.itotal);
output = serialNum.toString();
this.items.setText(output);
public static void main( String[] args )
TestProgram frame = new TestProgram();
          frame.setTitle("Asset tracking program");
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
frame.addWindowListener(l);
frame.pack();
frame.setVisible(true);

If you want to print out to the commmend line all you need to do if put in
System.out.println(....whatever......);Add this line of code to whereever you click the button to display the users "current Status". In hte brackets is whre you put the details of what you want ot print out e.g. boxes purchaesd etc.
Chris

Similar Messages

  • PDFs print out darker in Windows Reader 9.0 than Mac Reader 9.0, also Win Reader 9.0 darker than 8.x

    Hi,
    Using Adobe Reader 8.1.2 for Mac OS X and 8.* for Windows, my PDFs printed out identically for both platforms.
    However, after I upgraded Windows Adobe Reader from 8 to 9.0.0, it prints out the PDFs significantly darker than before, whereas when I upgraded the OS X Adobe Reader from 8.1.2 to 9.0.0, the print outs did not get any darker.
    Now they are both on v9.0.0, Windows printouts are significantly darker than the OS X printouts, using the same PDF file, printer, etc.
    Any idea what's going on here? Is there some of weird gamma correction-type thing going on - although I thought that only affected monitor displays, not print outs? Or should I report it as a bug?
    The PDF I am testing is here:
    http://egalo.com/guitar-fretboard-visualisation-sheet.pdf
    I also tried printing it out from other PDF viewers - Preview.app on OS X and Foxit Reader on Windows - and they both print out normally i.e. the same as Adobe Reader 8.* for all platforms, and 9.0 for OS X - definitely not as dark as Adobe Reader 9.0.0 for Windows.
    I'm running OS X 10.5.4 and Windows XP Professional as a VM using Parallels.
    Needless to say, I want to be able to generate PDFs that have the same darkness regardless which PDF viewer or OS platform is being used to print it out.
    Thanks, Xen
    [Edited to improve clarity]

    Thanks Michael,
    The file that I have sent her has both vector and raster graphics in it, and they were apparently printing fine. It just seems to be text that's not printing correctly.

  • Help before I throw this printer out of the window!!!!!!!!!!!!!!!!!

    I have just purchased a Deskjet 2540 all in one printer - I will only ever need to print boarding passes etc. -
    this looked so good on Amazon ideal for my iPad and said how easy to set up!!! In my dreams - I have now spent 10 hours
    Trying to set this up and last night was close to cracking:-
    I am setting this by wirless. I have the password and the printer showing on my iPad.
    Each time I try and load the softwear I am told an unexpected error has occurred please try again later - I
    Have tried and tried to no avail. Apple staff have said I do not need this softwear????????
    The network test results say:-
    1 check the printer network name ssid matches your wireless router network name ssid exactly!!!!!
    2 if they do not match exactly, run the wireless setup from the printer software to configure your hp printer!!!!!
    But no where can I find how to do this and sorry I really do not understand what this means.
    Reading Amazon some people have set up in 15 min!!!!
    The cost of bringing in an expert to set this up is worth more than the printer cost!!!!!!
    Thanks for reading feel better letting of steam will defiantly be a 0 from me for the feed back to Amazon

    Hello SueJon,
    Welcome to the HP Support Forums!
    I hope this reply finds you with the printer not thrown out of the Window. Regarding the Deskjet 2540 setup to work with the iPad, I would like to help.
    There are two ways that you can print from the iPad to the 2540. The first, Wireless Direct. Wireless Direct is a network that the printer broadcasts and the iPad would connect to it. This method will leave the iPad with no other network access while connected.
    Second, and more functional, is having the printer connected to the same network that the iPad is connected too.
    In order to setup this connection, follow the steps outlined below;
    Turn Wireless Direct on from the front panel button on the printer. (number 4).
    Connect the iPad to the printer network, Settings> Network> HP-Print-2540.
    Open Safari and type this I.P address into the address bar, 192.168.223.1 and hit Enter.
    Go to Network or Wireless and then Wireless Setup Wizard.
    Select your network and enter the needed information.
    Once connected, the Wireless light should be solid, connect the iPad back to your network. To print, open a document, hit the Share button (), and if an option to print is available you will be able to select the print option.
    I hope you find this information helpful.
    JERENDS
    I work on behalf of HP
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to the left of the reply button to say “Thanks” for helping!

  • Can I print out the list of Dictation commands?

    I use dictation a lot but I can't memorise all the commands until I've learned them. The trouble is that to find out what they are, I have to go into system preferences, and from there to Accessibility, and from there a whole series of other steps before I get to the on-screen list of commands.
    By which time I've probably forgotten what I was trying to do anyway.
    Isn't there some way of printing out this list of commands?

    iTunes > Store > View my Account...
    Click on Purchase History "See All".
    Unfortunately I do not know of a way to view more than one "batch" of ten purchases at a time, and there is no way to print the list directly. Grab a screenshot and print each one is the only way I can think of.

  • OS Windows Vista Ultimate - HP LAser Jet 1000 - Firefox will not print out internet page etc...

    OS Windows Vista Ultimate - HP Laser Jet 1000 - Firefox will not print out internet page etc...
    That simple, find an page you want to print, hit the print button and zero zip zlich.
    Works just fine with IE?????

    See this: <br />
    http://kb.mozillazine.org/Problems_printing_web_pages

  • Why can't I get my printer to print out a playlist from i-tunes? It used to work but now my printer doesn't seem to receive the "print" command.

    Why can't I get my printer to print out a playlist from i-tunes? It used to work, but now the printer doesn't seem to recognize the "print" command coming from i-tunes. The printer works for other applications!

    I  finally solved this problem after toiling with it for a couple of  days.  Solution:  Once you have  burned your CD you must go back into  iTunes to your music/playlists and select the playlist you just burned  and click file; print and you will  get the mosaics that we have been  accustomed to.  I was on hold with  Apple Support when I found this  myself.  Yes......!!! Problem solved..for me anyway.  Good luck!
    Scott

  • Printing Non Modal External Window - print out additional blank page

    Hi All,
    I am printing out a content of a web dynpro view as a non modal external window with the browser print functionality.
    Even if the content of the web dynpro view is not more than the half of a page the browser print functionality prints 2 pages. The second page is a blank page.
    I tried to change the external window size in web dynpro, but it is still printing 2 pages.
    How can I set / configure the browser print functionality, so it prints only the page that contains the web dynpro view content?
    Thanks,
    Yasar

    Hi,
    I'm guessing the concurrent program is outputting text (character mode) as opposed to PDF?
    This could be a number of reasons:
    1. Printer driver issue, e.g. the number of lines printed on the page is more than is defined for the printer driver: Try reducing the "Rows" on the current program definition
    2. Printer PRT issue, extra page break could be being inserted.
    3. The "box" in the report definition containing the address could be being expanding due to the extra address line, but not enough space so it forces a new page to be printed.
    Gareth
    Blog: http://garethroberts.blogspot.com
    Web: http://www.virtuate.com

  • Output print at out of the window

    Hi All,
    I'm facing some problem when print the output. After i run the program, the output is print at out of the window.
    Could someone advise?
    Thanks,
    Alice

    If you could see the layout correctly in the print preview but it gets truncated/ prints outside the window when you actually print it then it might be the problem with the printer settings also. The printer setting defined in transaction SPAD might be one of the reasons. Check with the BASIS team what are the margin setups relevant for the printer on which you are trying to print.
    Cross check by printing on some other printer. If the results are not good, then try and check the dimensions of window in SAPscript.
    And since it is SAPscript make sure that you do a client copy after you make the changes for dimensions, incase the developement client and testing client are different.
    Regards,
    Rinkesh Doshi

  • I took out a clip from project window.

    I took out a clip from project window. I went back to the event window and when I played back it was like it skipped a frame.  the audio was fine but the vid was skipping every other frame.  any suggestions?
    imovie 11  OSX 10.8.1 imac 16 gigs ram

    Buying AppleCare, at this point, would be a waste of money. You voided your warranty when you replaced your optical drive with a hard drive. Only RAM and hard drive bay customer alterations will not affect your warrany.
    You could have, I suppose, kept the optical drive and if your computer ever needed Apple repair, have replaced the hard drive for the optical again before taking it in for service. A little bit underhanded, but some people have done it.
    You're pretty much just out of luck now...
    Sorry,
    Clinton

  • Ready to throw the printer out the window!!!!!!!

    So i've been trying to update my portfolio and im ready to throw this printer out the window and probably never buy another HP product if someone cant help me fix this problem. Everytime i go to print whether its landscape or potrait it cuts the top of my photo off.  This is a new problem, its never happened before up until now.  I have spent days trying everything, ive tried printing it off my Samsung galaxy tab S.  My desktop.  i have tried resetting the printer, updated the software, troubleshooting, aligning, everything and have gone through $100 worth of ink to get nothing out of it.  I am very angry with this product.  what the hell is wrong with **bleep** thing?????? havent even owned it for a year!!!!!!

    Hello,  In the printing App that you are using, there should be an setting option to select the Paper Type and Size. Make sure you got that settings changed to the type and size of paper you are wanting to print on. I am not sure if you are  using the inbuilt app of Samsung to print or HP's ePrint & All in One Remote app . ? HP ePrint app is used for printing using.HP All in One Remote app is used for Scanning . Click HERE to access more info on this Apps.

  • Lighter print out of photos using Photoshop Elements 10 and Windows 7?

    When I print directly from Elements 10, my photos come out much darker than when I print directly from my computer on Windows 7??
    Is there a MAIN adjustment (not each photo) in the program which lightens all print-outs?  My printer is fine.  It copies photos properly and prints out from Windows (My Pictures) properly.
    Donna in Joplin

    Donna,
    While you read up on color management (!!!), you may want to check the following:
    Reduce the brightness of your computer screen. The default setting may be sub-optimal.
    In Elements, go to Edit>color settings, and tick the option to optimize for computer screens
    In Elements, open a picture, then go to File>print. Look for "More options", go to the color management tab, and under color handling drop-down, select "printer manages colors"
    Suggest that you print from Editor, not from Organizer.
    HTH

  • Print out the contents present in Modal Window on a paper

    Hi,
    Can anyone suggest me how to take print out the contents of a HTML Modal Window.
    Any Inputs on this can be appreciated.
    Thanks
    Ram

    I tried this Finder drag method & discovered that it is very important to set the blank TextEdit document to plain text before the drag (from the format menu or with Cmd-shift-t). If you don't, TextEdit attempts to load the content of the files!
    Once I discovered this, I tried the method with Find (Cmd-F) results & it works for that, too. This means that by choosing the right combination of search location(s) & search criteria, you can extend the method to filter the list to just about any files you want, which could be very handy.
    For instance, set the "Kind" criteria to "QuickTime Movie" & location to "Computer" & you get a list of every QT movie. Or set the search location to the folder containing the movies of interest & you get all of them, including ones in subfolders. You could also use the 'date created' or other search criteria to filter the list to a specific subset of movies (or whatever).
    If you need to do this often, you could create one or more 'Smart Folders' with the criteria preloaded for each search.
    The only drawback I see for either Finder based method is the full path one. If you are getting results from just one or a few folders, Find & Replace can delete any of the path name fairly easily, but it becomes a chore if there are a lot of different ones. Some other text editor, like TexEdit Pro, that supports grep searches would be handy here, but since I'm not up to speed on grep, someone else will have to explain how to use it for this, if they want.

  • Laserjet P1005 used with Windows 7 home premium does not print out envelopes

    Laserjet P1005 used with Windows7 home premium does not print out envelops generated with Microsoft Word.The printer does envelops when used with Windows2000 Professionel or MP.Any help would be appreciated!Otto  

    Is that a HP driver or Windows driver for Windows 7? http://support.hp.com/us-en/drivers/selfservice/HP-LaserJet-P1000-Printer-series/3435674/model/3435675#Z7_3054ICK0KGTE30AQO5O3KA30R1 Is this the version you installed?

  • I have a hp deskjet 5150 and cannot get it to print out on my laptop using windows 7

    My printer had run out of ink so i had not used it for awhile it was used on my desk pc before but would not print out so i thought i would try it on my laptop.  have done everything that hp support site suggests all 10 steps and got to ask on the forum for any further help so here i am.  the print just stays in the queue.  any advice would be welcome.

    Hi,
    You might try and download the Printer Diagnostic Utility and run it. See if it helps and solves the issue for you.
    Here is the link to get the utility.
    Printer Diagnostic Utility
    Say Thanks by clicking the Kudos Star in the post that helped you. Please mark the post that solves your problem as Accepted Solution.
    I am employed by HP

  • Trying to print a book with Aperture 2.1.4, everything went well until the final step "uploading files to server" -- it's been spinning for an hour, "status" still reads 0%, "pause task" and "cancel task" buttons are grayed out in Activity window.

    everything went well until the final step "uploading files to server" -- it's been spinning for an hour, "status" still reads 0%, "pause task" and "cancel task" buttons are grayed out in Activity window. Any ideas?

    everything went well until the final step "uploading files to server" -- it's been spinning for an hour, "status" still reads 0%, "pause task" and "cancel task" buttons are grayed out in Activity window. Any ideas?

Maybe you are looking for