title: How can I make a JButton activate a compareTo function?
body: <p>This is a bit embarrassing. I have a compareTo function that I intend to use on a JButton, so when the user presses it they can see which is the highest ranked object. I already have a Listener class for the JButton but I don't know how to make the Listener use the compareTo function because it needs two parameters.</p>
  
  <p>This is my compareTo function:</p>
  
  <pre><code>public int compareTo(Film film1, Film film2) {
      if (film1.getFinalScore() &lt; film2.getFinalScore()) return -1;
      if (film1.getFinalScore() &gt; film2.getFinalScore()) return 1;
      return 0;
  
  }
  </code></pre>
  
  <p>And this is the actionPerformed function in the Listener class:</p>
  
  <pre><code>@Override
  public void actionPerformed(ActionEvent e) {
      this.cm.compareTo(null, null);
  
  }
  </code></pre>
  
  <p>The Auto-correct suggested to put the parameters to null to make it work, but it's obviously never as simple as the Auto-Correct suggests.</p>
  
  <p>So, how can I make the Listener perform the compareTo function using all of my objects to list them from highest to lowest?</p>
  
  <p>Thanks in advance!</p>