I am trying to create a frame by creating a class called CustApp. In the main method, I am trying to write code in the main method that will create a Customer object, assign to variable c. I am then to use setters to assign the following values in the Customer object ajectssociated with variable c:
Kindness Foods, 1 Milkof St., Human, ME 03234, Joe Samaritan, 555-3333
Finally, I am to create a CustFrame object and pass c, assign to cf.
This is what I have:
public class CustApp { public CustApp(Customer c) { // TODO Auto-generated constructor stub } public static void main(String[] args) { Customer c = new Customer(); c.setCustName("Kindness Foods"); c.setShipToStreet("1 Miko St"); c.setShipToCity("Human"); c.setShipToState("ME"); c.setShipToZip("03234"); c.setContactPerson("Joe Samaritan"); c.setContactPhone("555-3333"); CustFrame cf = new CustFrame(c); } }
I keep getting the same frame I got before with different labels saying something else from an earlier class. Can anyone see anything obvious, because I have fiddled with this forever....
--- Update ---
Oh, here is CustFrame by the way:
import java.awt.Frame; import java.awt.Label; public class CustFrame extends Frame { public CustFrame(Customer cust) { // this.setSize(300, 282); // this.setLayout(null); // this.setVisible(true); Label custNameLbl = new Label(); this.setSize(300, 282); this.setLayout(null); custNameLbl.setBounds(62, 65, 176, 23); custNameLbl.setText("test text"); this.add(custNameLbl); this.setVisible(true); Label shipToLbl1 = new Label(); this.setSize(300, 282); this.setLayout(null); shipToLbl1.setBounds(62, 120, 176, 23); shipToLbl1.setText("test text"); this.add(shipToLbl1); this.setVisible(true); Label shipToLbl2 = new Label(); this.setSize(300, 282); this.setLayout(null); shipToLbl2.setBounds(62, 175, 176, 23); shipToLbl2.setText("test text"); this.add(shipToLbl2); this.setVisible(true); Label contactInfo = new Label(); this.setSize(300, 282); this.setLayout(null); contactInfo.setBounds(62, 230, 176, 23); contactInfo.setText("test text"); this.add(contactInfo); this.setVisible(true); // custNameLbl.setText(cust.getCustName()); // shipToLbl1.setText(cust.getShipToStreet()); // shipToLbl2.setText(cust.getShipToCity()); // contactInfo.setText(cust.getContactPerson()); } public static void main(String[] args) { Customer cust = new Customer(); CustFrame Customer = new CustFrame(cust); } }