Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Java Basics
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 21st, 2008, 08:13 AM
Registered User
 
Join Date: Aug 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default vector quick question please help about font

umm i have to display the receipt in a box... and we have to display the value of what was ordered and, i cant seem to change the font and the spacing of the displayed ordered list...

umm how can i change the font size, style and the spacing in the receipt?

thanks :)

here's the code:

Quote:
quote://Vector for the order list
    public Vector getOrderListToPrint(double cashAmount)
    {
        Vector orderVector = new Vector();

        orderVector.addElement("STARBUCKS COFFEE");
        orderVector.addElement("OPD BY : Rustan Coffee Corp");
        orderVector.addElement("G/F Torre Lorenzo Bldg.");
        orderVector.addElement("Taft Ave. corner Vito Cruz St.");
        orderVector.addElement("Manila");
        orderVector.addElement("TIN: 005-215-077-021 VAT");
        orderVector.addElement("S/N: 41-GG849");
        orderVector.addElement("MIN: 060053275");
        orderVector.addElement(" ------------------------------------------------------------------------------------------- ");
        orderVector.addElement("O.R. #: 00682529");


        for (Iterator it = custOrders.iterator(); it.hasNext();){
            orderVector.addElement(it.next()+"\n");
        }

        double vatSales = subTotal * 0.12;
        orderVector.addElement("VAT SALES(12%) "+ formatDigit(vatSales));
        double subTotalTemp = subTotal + vatSales;
        orderVector.addElement("SUBTOTAL "+ formatDigit(subTotalTemp));

        //will write if cashAMount > 0 from the total operation.
        if ( cashAmount > 0 ){
            orderVector.addElement("CASH "+ formatDigit(cashAmount));
            double change = cashAmount - subTotalTemp;
            orderVector.addElement("CHANGE "+ formatDigit(change));
        }
        orderVector.addElement("THIS IS AN OFFICIAL RECEIPT");
        orderVector.addElement("ENJOY YOUR COFFEE...");

        return orderVector;
    }


 
Old August 21st, 2008, 01:32 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Since you don't show how the vector is used (and, by the way, using a vector is a horrible idea...it should be a class with clearly defined propertied, but let's ignore that), how can we guess?

All you have there is (essentially) an array of strings. No place in that code do you actually even attempt to put the strings into a web page or report or whatever it is you are going to do.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick Question! arcadium Java GUI 1 August 5th, 2008 02:16 AM
another quick question andyhague XSLT 2 March 21st, 2006 12:13 PM
quick question treasacrowe Classic ASP Databases 2 August 30th, 2004 08:27 AM
Quick Question Ben Horne Forum and Wrox.com Feedback 1 March 22nd, 2004 03:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.