prelab 8 - expects 2 int parameters. button1.setSize(2, 5);...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab #8 Pre-lab Name _Matthew Cook 1. Write a class header for a public class named Gui. The Gui class must be a child class of a class named JFrame. Public class Gui extends JFrame 2. Go to the Java API and look up JButton. What is its parent class? AbstractButton 3. Instantiate a JButton object using the constructor that expects a String. JButton button1 = _____new JButton(String text);____ 4. Your button1 can run a method called setSize even though that method is not in the JButton class. What class is the setSize method inherited from? (Go to the Java API. Look at the JButton class. Scroll down past the method summary section.) Component 5. Tell your button1 to run its setSize method. Use the setSize method that
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: expects 2 int parameters. button1.setSize(2, 5); 6. Tell your button1 to run its getText method. Store the return in a variable of appropriate type. String one = ___Jbutton.getText();___ 7. Instantiate a Color object using the constructor that expects 3 int parameters. Color myFavorite = ___IndexColorModel(122, 355, 100);___ 8. Tell your button1 to run its setBackground method using the Color object from above. button1.setBackground; 9. Instantiate a JPanel object using the default constructor. JPanel peterPanel = ____perterPanel();_________ 10. Instantiate a JTextField object using the default constructor. JTextField box = ___________new JTextField();________...
View Full Document

This note was uploaded on 10/19/2010 for the course CS 161 taught by Professor Wallace during the Fall '08 term at Oregon State.

Page1 / 2

prelab 8 - expects 2 int parameters. button1.setSize(2, 5);...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online