Java assignment as jQuery

Question 4. (30 POINTS): In this question, you are required to demonstrate GUI based programming skills together with event handling. Write a Java program to display an unfilled square and a combo box to select from three different color options as Red, Green, Blue. When Red is selected, the square should be filled with Red, when Green is selected, the square needs to be filled with Green, and when Blue is selected the square should be filled with blue.

HTML

<select id="derp">
  <option value="red">Red</option>
  <option value="green">Green</option>
  <option value="blue">Blue</option>
  <option value="yellow">yellow</option>
</select>
<h1>Thin clients are the future</h1>

JavaScript

$('#derp').change(function() {
  var color = $('select#derp option:selected').val();
  $('body').css('background-color', color);
});