import java.util.ArrayList;
import javax.swing.*;
import java.awt.event.*;
import java.text.DecimalFormat;
public class MyRealEstateOffice extends JFrame {
ArrayList<House> listings = new ArrayList<House>();
JPanel panel = new JPanel();
JLabel lblBeds = new JLabel("# Beds: ");
JLabel lblBaths = new JLabel("# Baths: ");
JLabel lblSqFeet = new JLabel("Square Feet: ");
JLabel lblPrice = new JLabel ("Asking Price: ");
JLabel lblOwner = new JLabel("Owner's Name: ");
JLabel lblPhone = new JLabel("Owner's Phone: ");
JLabel lblLot = new JLabel("Lot size: ");
JLabel lblAddress = new JLabel("Address: ");
JCheckBox checkFence = new JCheckBox("Fence:");
JTextField txtBeds = new JTextField(20);
JTextField txtBaths = new JTextField(20);
JTextField txtSqFeet = new JTextField(20);
JTextField txtPrice = new JTextField (20);
JTextField txtOwner = new JTextField(20);
JTextField txtPhone = new JTextField(20);
JTextField txtLot = new JTextField(20);
JTextField txtAddress = new JTextField(20);
JButton addListings = new JButton("Add to listings");
addListings.addActionListener(new Listener1());
JButton showListings = new JButton("Show listings");
JButton saveListings = new JButton("Save listings");
public MyRealEstateOffice() {
setTitle("Steve's Real Estate Office");
setSize(500,400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
build();
add(panel);
setVisible(true);
}
public void build() {
panel.setLayout(null);
int x = 12, y = 0, yh=18, ys=24,w=120;
lblBeds.setBounds(x,y += ys,w,yh);
lblBaths.setBounds(x,y += ys,w,yh);
lblSqFeet.setBounds(x,y += ys,w,yh);
lblPrice.setBounds(x,y += ys,w,yh);
lblOwner.setBounds(x,y += ys,w,yh);
lblPhone.setBounds(x,y += ys,w,yh);
lblLot.setBounds(x,y += ys,w,yh);
lblAddress.setBounds(x,y += ys,w,yh);
x = 140;
y = 0;
w = 240;
txtBeds.setBounds(x,y += ys,w,yh);
txtBaths.setBounds(x,y += ys,w,yh);
txtSqFeet.setBounds(x,y += ys,w,yh);
txtPrice.setBounds(x,y += ys,w,yh);
txtOwner.setBounds(x,y += ys,w,yh);
txtPhone.setBounds(x,y += ys,w,yh);
txtLot.setBounds(x,y += ys,w,yh);
txtAddress.setBounds(x,y += ys,w,yh);
x=400;
y=70;
checkFence.setBounds(x,y += ys,w,yh);
x=10;
y=220;
w=150;
addListings.setBounds(x,y += ys,w,yh);
x=170;
y=220;
w=150;
showListings.setBounds(x,y += ys,w,yh);
x=330;
y=220;
w=150;
saveListings.setBounds(x,y += ys,w,yh);
panel.add(txtBeds);
panel.add(txtBaths);
panel.add(txtSqFeet);
panel.add(txtPrice);
panel.add(txtOwner);
panel.add(txtPhone);
panel.add(txtLot);
panel.add(txtAddress);
panel.add(lblBeds);
panel.add(lblBaths);
panel.add(lblSqFeet);
panel.add(lblPrice);
panel.add(lblOwner);
panel.add(lblPhone);
panel.add(lblLot);
panel.add(lblAddress);
panel.add(checkFence);
panel.add(addListings);
panel.add(showListings);
panel.add(saveListings);
}
private class Listener1 implements ActionListener {
public void actionPerformed(ActionEvent e){
String t = "";
}
}
public static void main(String[] args) {
MyRealEstateOffice mre = new MyRealEstateOffice();
}
}