csc2700lect15A

csc2700lect15A - int getWidth() int getx() int gety() int...

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

View Full Document Right Arrow Icon
CSc 2700: Lecture # 15 Part 1 Component and JComponent October 21, 2008 1 Introduction The hierarchy of Figure 1 shows that most Swing components inherit from Component and JComponent. JFrame extends Component and Container but not JComponent. Figure 1: Swing Classes Derive from Component 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
As a subclass of Component, each Swing component inherits a multitude of methods deFned in Component, including: void setSize(int width, int height) void setLocation(int x, int y) void setBounds(int x, int y, int width, int height) void setEnabled(boolean x) void setVisible(boolean x) void setName(String s) void setFont(Font f) void setBackground(Color c) void setForeground(Color c) void resize(int width, int height) void repaint() int getHeight()
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: int getWidth() int getx() int gety() int getName() Color getBackground() Color getForeground() boolean isEnabled() boolean isVisible() 2 All components also inherit Component add(Component c) , and void setlayout(LayoutManager layoutManager) from Container. A button is certainly one of the most commonly utilized Components. We have already used buttons in several layout applications, we will begin our discussion of Swing components with JButton. Like every class that extends Component and Container, JButton inherits the methods of these two super classes. We will discuss JButton in our next lecture. (See further details on these classes in the Java API.) 3...
View Full Document

Page1 / 3

csc2700lect15A - int getWidth() int getx() int gety() int...

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

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