Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Customer java program( Whats wrong with my code?)

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Customer java program( Whats wrong with my code?)

    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);
    }
    }



    public class Customer {
    private String custName;
    private String contactPerson;
    private String contactPhone;
    private String shipToStreet;
    private String shipToCity;
    private String shipToState;
    private String shipToZip;

    }


    public String getCustName() {
    return custName;
    }

    public void setCustName(String custName) {
    this.custName = custName;
    }

    public String getContactPerson() {
    return contactPerson;
    }

    public void setContactPerson(String contactPerson) {
    this.contactPerson = contactPerson;
    }

    public String getContactPhone() {
    return contactPhone;
    }

    public void setContactPhone(String contactPhone) {
    this.contactPhone = contactPhone;
    }

    public String getShipToStreet() {
    return shipToStreet;
    }

    public void setShipToStreet(String shipToStreet) {
    this.shipToStreet = shipToStreet;
    }

    public String getShipToCity() {
    return shipToCity;
    }
    public void setShipToCity(String shipToCity) {
    this.shipToCity = shipToCity;
    }

    public String getShipToState() {
    return shipToState;
    }
    public void setShipToState(String shipToState) {
    this.shipToState = shipToState;
    }

    public String getShipToZip() {
    return shipToZip;
    }

    public void setShipToZip(String shipToZip) {
    this.shipToZip = shipToZip;
    }

    public Customer(String name, String person, String phone, String street, String city, String state, String zip){
    this.setCustName(name);
    this.setContactPerson(person);
    this.setContactPhone(phone);
    this.setShipToStreet(street);
    this.setShipToCity(city);
    this.setShipToState(state);
    this.setShipToZip(zip);
    }
    }
    public class CustApp {

    /**
    * @param args
    */

    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);


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    3,390
    My Mood
    Mellow
    Thanks
    83
    Thanked 471 Times in 462 Posts

    Default Re: Customer java program( Whats wrong with my code?)

    Please learn to post code correctly here and how to post topics that get help here.

Similar Threads

  1. Simple sorting program, can't figure out whats wrong with my code
    By USC CSCE in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 29th, 2012, 07:38 AM
  2. Whats wrong with my java code? I really need help!
    By matthewpipie in forum What's Wrong With My Code?
    Replies: 18
    Last Post: February 18th, 2012, 06:05 PM
  3. whats wrong with my program??
    By jrodriguo in forum What's Wrong With My Code?
    Replies: 4
    Last Post: May 11th, 2010, 06:16 AM
  4. i'm new to java. whats is wrong in this code?
    By igorek83 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 30th, 2009, 07:38 PM