Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
(EOD).Software topics.pdf
Скачиваний:
18
Добавлен:
23.08.2013
Размер:
1.55 Mб
Скачать

page 84

Components, and all objects in the hierarchy, can use the following functions. Dimension Size() - returns width and height

Rectangle bounds() - return x, y, width, and height values void enable() - sets a component to accept user input void disable() - turns off user input to a component

void show() - makes a component visible

void paint(Graphics g) - a function called to redraw a component void repaint() - requests that a component be redrawn

void update(Graphics g) - a level above a call to paint, might allow other function to be added

boolean mouseEnter(Event e, int x, int y) - called when the mouse has entered a component

boolean mouseExit(Event e, intx, int y) - called when the mouse leaves a component boolean mouseMove(Event e, int x, int y) - reports a move inside a component with no

buttons pressed

boolean mouseDrag(Event e, int x, int y) - called when a mouse button is held down, and the pointer dragged inside a component

boolean keyDown(Event e, int key) - reports a keyboard event inside the component boolean handleEvent(Event e) - The normal event handler for component events. Dimension preferredSize() - returns the idea component size

Dimension minimumSize() - returns the smallest size that a component can be.

The container class also has a variety of associated functions (as well as its children)

void add(Component) - add a component

void add(String name, Component) - a component is added, with a name as well. void setLayout(Layout Manager) - this automatically positions components

9.4 REFERENCES/BIBLIOGRAPHY

vanHoff, A., Shaio, S., Starbuck, O., Hooked on Java, Addison Wesley Developers Press, 1996

Соседние файлы в предмете Электротехника