Day 7

Objectives:

GUI classes I:

  • Components (Widgets),
  • Event Handling,
  • Thread basics

Lab assignment:

  • #1: As you know, there are five message dialog types in JOptionPane:

And the fifth one is with no icon: JOptionPane.PLAIN_MESSAGE

Write an application that will show 5 different messages (no input, 5 types: error message, question message, information message, warning message and plain message). Use the welcome.java example from lecture slides.

You should end up with just one file.


  • #2: Write an application that finds the maximum and the minimum value of the three integers entered by user.

Your application should use GUI, should check whether the user entered the expected type value (integer, not string, not floating-point number).

You can use this sketch: MinMax.java and you can use Lab assignment 4 from Day 1.

You should end up with just one file, say MinMax.java.



  • #4: Consider the project that displays the following window (the source code is taken from the book and slightly modified):

files: LabelFrame.java, LabelTest.java, happy_daisy_mw.gif, earth-bullet.png (put two pictures into the folder bin, not src)

To do:

  • run the project
  • look carefully through the code and comments
  • change the project to display "Seven Wonders of the Middle Ages". Use 7 pictures provided below and put short labels to them. It is up to you where you put the label, but make sure that everything looks well. Make sure that you adjust the size of window.

Catacombs of Kom el Shoqafa: KOM_EL_SHOQAFA_CATACOMBS.jpg

Colosseum: Colosseum_in_Rome.jpg

Great Wall of China: The_Great_Wall_of_China.jpg

Hagia Sophia: Hagia_Sophia.jpg

Leaning Tower of Pisa: The_Leaning_Tower_of_Pisa.jpeg

Porcelain Tower of Nanjing: Porcelain_Tower_of_Nanjing.jpg

Stonehenge: Stonehenge-Green_.jpg

all pictures are taken from Wikipedia: Wonders_of_the_World

You should end up with two .java files and use 7 pictures.


  • #5 (to be finished later)

Develop at application with GUI that will be calculating volume of a cylinder in cubic centimeters (see Day 2, practice exercise 2 and feel free to use the program you worked on).

1) Start with the layout. Plan the entry field, plan the buttons layout. Feel free to use this picture (to make it more appealing to the user):

a snapshot of an application

Lecture materials: