AWT
- When you invoke repaint() for a Component, the AWT package calls update() for the Component, which in invokes paint() in its default behavior.
- What does the following line of code do?
TextField defines a constructor that takes the number of columns, as shown in the example. TextField objects can have their text updated at any time, including long after they're created.
- Which LayoutManager arranges components left to right, then top to bottom, centering each row as it moves to the next? FlowLayout
- A component can be resized horizontally, but not vertically, when it is placed in which region of a BorderLayout? North and South only can resize a component horizontally, to the width of the Container
- How can you place three Components along the bottom of a Container? Set the Container's LayoutManager to be a BorderLayout; add each Component to a different Container that uses a FlowLayout, and then add that Container to the "South" of the first Container.
- How would you make the background color red for a Panel referenced by the variable p? "p.setBackground(Color.red);"
- What does the following code do? drawArc(50, 40, 20, 20, 90, 180); The four parameters are the left, top, width, height, start angle (0 is the 3:00 position), and the arc angle (the arc ends at start angle plus the arc angle), drawn counter-clockwise.
- What does the following code do (if anything)?
The drawLine() method takes four parameters: the starting point and the ending point of the line to draw.
- What Graphics methods will draw the outline of a square? You can use drawRect() to draw a rectangle outline given its upper left point and width and height, and drawPolygon() to draw each of the four points of the square, plus an end point that is the same as the first point.
- What method from Java 1.0.2 can you use to remove a Component from a user interface display? The hide() method is more-or-less the opposite of show() and removes a Component from the display.
- Returning a value of false in Java 1.0.2 from an event handler: Returning false indicates that method did not handle the event, which means AWT passes the event up the container hierarchy looking for someone who does want to handle it.
- If you’d like to change the size of a Component, you can use the Java 1.1-specific method: setSize() is specific to Java 1.1
- The setForeground() and setBackground() methods are defined in class: Component
Comments
Post a Comment