Minor error correction and some bugs, alongside with modify offers quality of life...
[RRRRHHHH_Code] / ruralHouses / src / gui / HouseFeaturesGUI.java
index 414ff07..ecc44ab 100644 (file)
@@ -60,7 +60,7 @@ public class HouseFeaturesGUI extends JFrame {
         * Create the frame.
         */
 
-       public HouseFeaturesGUI(RuralHouse RH, Date FirstDay, Date LastDay) {
+       public HouseFeaturesGUI(RuralHouse RH, final Date FirstDay, final Date LastDay) {
                this.rh = RH;
                this.getContentPane().setLayout(null);
                setBounds(100, 100, 500, 583);
@@ -159,7 +159,7 @@ public class HouseFeaturesGUI extends JFrame {
                scrollPane.setBounds(40, 311, 376, 183);
                contentPane.add(scrollPane);
 
-               JTable table = new JTable() {
+               table = new JTable() {
                        private static final long serialVersionUID = 1L;
 
                        public boolean isCellEditable(int row, int column) {
@@ -226,13 +226,11 @@ public class HouseFeaturesGUI extends JFrame {
                                Date firstDay = (Date) table.getModel().getValueAt(row, 1);
                                Date lastDay = (Date) table.getModel().getValueAt(row, 2);
                                if (FirstDay != null && LastDay != null) {
-                                       if (FirstDay.before(firstDay) || FirstDay.equals(firstDay)
-                                                       && LastDay.after(lastDay)
-                                                       || LastDay.equals(lastDay)) {
-                                               setBackground(Color.GREEN);
+                                       if (LastDay.before(lastDay)  ||  FirstDay.after(firstDay)) {
+                                               setBackground(Color.RED);
                                                setForeground(Color.BLACK);
                                        } else {
-                                               setBackground(Color.RED);
+                                               setBackground(Color.GREEN);
                                                setForeground(Color.BLACK);
                                        }
                                }