Hi,
This program has the information I need it to have but instead of going down in a column it goes straight across. Can someone show me where to get the formatting for this kind of code? I tried different things to no avail. Thank you for this and all the other help I have received here at Daniweb.
Thank you,
Lynn Ortiz
public class GUI extends JFrame {
private String productName;
private int itemNumber;
private int unitsInStock;
private double pricePerUnit;
private double productValue ;
private double inventoryValue ;
private NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US); //NumberFormatter
protected JList list;
public GUI() {
super("Swing List with Tab Renenderer");
setSize(500, 240);
}
public GUI ( String productName, int itemNumber,
int unitsInStock, double pricePerUnit){
Printer [] myPrinters = new Printer[5];
}
public static void main (String []args){
Printer [] myPrinters = new Printer[5];
Printer epson = new Epson("Epson","A09514", 1, 2, 99.99);
Printer hp = new Printer("HP", 2, 3, 149.99);
Printer brother = new Printer("Brother", 3, 2, 199.99);
Printer kodak = new Printer("Kodak", 4, 2, 89.99);
Printer canon = new Printer("Canon", 5, 3, 129.99);
DefaultListModel model = new DefaultListModel();
JList list = new JList(model);
Printer[] items = {epson,hp,brother,kodak,canon };
for (int i=0; i<items.length; i++) {
model.add(i, items[i]);
}
JFrame window = new JFrame ();
window.add(list ); JTextArea area = new JTextArea();
area.setLineWrap(true);
area.setWrapStyleWord(true);
area.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
window.setSize( 800, 500 );
window.setVisible( true );
window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}
/**
* @return the productName
*/
public String getProductName() {
return productName;
}
public void setProdName(String productName) {
this.productName = productName;
}
/**
* @return the itemNumber
*/
public int getItemNumber() {
return itemNumber;
}
/**
* @param itemNumber the itemNumber to set
*/
public void setItemNumber(int itemNumber) {
this.itemNumber = itemNumber;
}
/**
* @return the unitsInStock
*/
public int getUnitsInStock() {
return unitsInStock;
}
/**
* @param unitsInStock the unitsInStock to set
*/
public void setUnitsInStock(int unitsInStock) {
this.unitsInStock = unitsInStock;
}
/**
* @return the pricePerUnit
*/
public double getPricePerUnit() {
return pricePerUnit;
}
/**
* @param pricePerUnit the pricePerUnit to set
*/
public void setPricePerUnit(double pricePerUnit) {
this.pricePerUnit = pricePerUnit;
}
}