Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

ITT: EXPERT JAVA PROGRAMMERS

Name: Anonymous 2009-02-10 9:52


import java.util.GregorianCalendar;

/**
 * A class created to handle the user's query request and facilitate the collection of
 * bits of information (day, month, year, hour, minute) to a {@link GregorianCalendar} date.
 *
 */
public class SearchCriteria
{
   int startDate;
  
   int startMonth;
  
   int startYear;
  
   int startHour;
  
   int startMin;
   
   int endDate;
    
   int endMonth;
  
   int endYear;
  
   int endHour;
  
   int endMin;
  

   public SearchCriteria(int startDate, int startMonth, int startYear,
                           int startHour, int startMin, int endDate, int endMonth,
                           int endYear, int endHour, int endMin)
   {
      this.startDate = startDate;
      this.startMonth = startMonth;
      this.startYear = startYear;
      this.startHour = startHour;
      this.startMin = startMin;
      this.endDate = endDate;
      this.endMonth = endMonth;
      this.endYear = endYear;
      this.endHour = endHour;
      this.endMin = endMin;
   }

   public GregorianCalendar getStart()
   {
      GregorianCalendar cal = new GregorianCalendar();
      cal.set(startYear, startMonth, startDate, startHour, startMin);
      return cal;
   }
   public GregorianCalendar getEnd()
   {
      GregorianCalendar cal = new GregorianCalendar();
      cal.set(endYear, endMonth, endDate, endHour, endMin);
      return cal;
   }
}


SOME CODE CHANGED TO PROTECT THE GUILTY

Name: Anonymous 2009-02-11 3:48


   public void actionPerformed(ActionEvent e)
   {
// Generic file dialogue stuff was here
      if(e.getActionCommand().compareTo("removepreview") == 0)
      {
          if(e.getSource().getClass().getName().compareTo("javax.swing.JButton") == 0)
          {
              JButton button = (JButton)e.getSource();
              if(button.getParent().getParent().getClass().getName().compareTo("gui.Preview") == 0)
              {
                 
                  Preview view = (Preview)button.getParent().getParent();
                  this.removePreview(view.getPreviewLabel());
              }
             
          }
      }
   }

// How does I seperate model and view?
   public void updatePrevies(Vector<String> updatedPreviews)
   {
      for(int i = 0; i < this.getComponentCount(); i++)
      {
         // check to see if its label corresponds to a label in the list
         for(int j = 0; j < updatedPreviews.size(); j++)
         {
            if(this.getComponent(i).getClass().getName().compareTo("gui.Preview") == 0)
            {
               if(((gui.Preview)this.getComponent(i)).getPreviewLabel().compareTo(updatedPreviews.elementAt(j)) == 0)
               {
((gui.Preview)this.getComponent(i)).updatePreview();
               }
            }
         }
      }  
   }


There was also a similar method to the one above but for removing previews. And a few other classes use the whole "this.getClass().getName().compareTo("gui.Preview") == 0" type things (lol actionListeners ONLY) and a completely pointless and worse reimplementation of date pretty printing. The rest of the application is pretty boring badly written java, with lots of hand made gridbag layouts.

However, this application is separated between a backend/frontend and the backend is surprisingly well written.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List