-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRentable.java
138 lines (113 loc) · 3.2 KB
/
Rentable.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package com.company;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.io.Serializable;
/**
* <p>
* This is a superclass for home/room.java and this will have almost
* every parameter that subclasses will use as protected it crates
* objects as rentable places
*<br>
* @param -
* @return -
* @see "home.java,room.java"
* @author
*/
public class Rentable extends JFrame implements Serializable {
protected String key;
protected int price;
protected String owner;
protected boolean parking;
protected boolean wifi;
protected int size1;
protected boolean available;
protected boolean shortRent;
protected boolean longRent;
protected int rentDays;
protected boolean rented;
protected String rentName;
private Label labelkey;
private Label labelprice;
private Label labelpark;
private Label labelwifi;
private Label labelsize;
/**
* <p>
* This is choose which of the rentable objects is room and which home
* and after that it send it to the correct subclass to print the info
*<br>
* @param value
* @return -
* @see "home.java,room.java"
* @author
*/
public void display(Rentable value) {
this.shortRent= value.shortRent;
if(shortRent==true) {
Room it1= new Room();
it1.display(value);
}
else
{
Home it2= new Home();
it2.display(value);
}
}
public String getKey()
{
return this.key;
}
public int getPrice()
{
return this.price;
}
public int getSize1()
{
return this.size1;
}
public String getPark()
{
if(this.parking==true)
return "yes";
else
return "no";
}
public String getWifi()
{
if(this.wifi==true)
return "yes";
else
return "no";
}
public void showGui ()
{
setSize(500, 500);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//setLocationRelativeTo(null);
//setResizable(false);
setTitle("Rentals");
setLocationRelativeTo(null);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setResizable(true);
JPanel panel1 = new JPanel();
TitledBorder border = BorderFactory.createTitledBorder(" ");
//panel1.setVerticalTextPosition(JPanel.BOTTOM);
panel1.setBorder(border);
GridLayout layout = new GridLayout(10, 10, 10, 10);
//panel1.setLayout(layout);
labelkey=new Label(key);
labelprice=new Label(String.valueOf(price));
labelsize=new Label(String.valueOf(size1));
labelpark=new Label(String.valueOf(parking));
labelwifi=new Label(String.valueOf(wifi));
panel1.add(labelkey);
panel1.add(labelprice);
panel1.add(labelsize);
panel1.add(labelpark);
panel1.add(labelwifi);
FlowLayout aLayout = new FlowLayout();
setLayout(aLayout);
setVisible(true);
}
}