Welcome to Computer Programming

GUI Assignments

Do 4 of 6 (plus at least 1 advanced)

 

1

Create a gui called Average with 3 textboxes and a button. The first 2 boxes will be for two scores, the last will be there average. When they hit the button there average will appear in the average textbox

starter code



Advanced

Average with 2 textboxes and a button One textbox will be their grade and one will be their average (which you calculate). Each time they hit the button, it will update their average with that grade. so if they put in 50, and hit the button, average would be 50. If they then put in 100, hit button, average would be 75. If they then put in 60, and hit button, it would average to 70. )


 

2.

Create a gui called ConvertUnits where there will be 2 textfields and a button that will convert from inches to centimeters. When they put in inches, it will convert it to centimeters. 1 inch is 2.54 centimeters

starter code

  • fields are called inchesField and centimetersField

Advanced:

 If they put in inches, it will convert to centimeters. If they put in cm it will convert to inches. So it will work either direction.


 

3.

Create a gui called findBiggest with 3 textfields, a button, and a label. The user will put in 3 numbers and it will say which is the highest.

starter code

  • fields are called num1Field, num2Field, num3Field
  • output label is outputLabel

Advanced:

It will put the numbers in order in the original boxes when they hit the button


 

4.

Create a gui called Counting that will have a textfield and a button. The textfield will start at 0. Everytime they hit the button the number will go up by one.

starter code

  • fields are called numberField

Advanced:

Have a reset button


 

5.

Create a gui called NextNum that will have a textarea and a button and each time the button is pressed another line is added to the textarea (myTextArea.append("sdfsdf\n"); //where \n is for new line). The line will say "This is line 1" then "This is line 2")

starter code

  • fields are called nextNumTextArea and nextNumButton

 

6.

Have a GUI application with a textfield and 2 buttons - which will say hide or show which will hide the word or show the word. (you might want to use setVisible(true or false) for the textfield [for more textfield methods]

starter code

  • fields are called wordButton1, wordButton2 and wordField1

 


 

Advanced.

7. Create a gui called PSAccount with 3 textboxes and a button. The first two text boxes will be for first name and then last name. When they hit the submit button, the three textbox will then create a Portland Schools account (which is the first 5 of last name and then the first letter of first name).

8. Create a gui called DrawCircle that will have a textfield and a button. The textfield will take in how large a circle you will draw and the button will be called draw and it will draw that circle. Advanced, instead of a textfield for size, use a slider. Also use a dropdown for color. to access graphics to draw you can say: Graphics g=getGraphics(); now you can say g.drawLine(.... or anything to g