31 lines
779 B
Java
31 lines
779 B
Java
package labwork9;
|
|
|
|
/**
|
|
* The App class represents an application that uses a GUIFactory to create a set of GUI elements.
|
|
*/
|
|
public class App {
|
|
private Button button;
|
|
private Canvas canvas;
|
|
private TextField textField;
|
|
|
|
/**
|
|
* Constructs an App using the provided GUIFactory to create GUI elements.
|
|
*
|
|
* @param guiFactory the GUIFactory to create GUI elements
|
|
*/
|
|
public App(GUIFactory guiFactory) {
|
|
this.button = guiFactory.createButton();
|
|
this.canvas = guiFactory.createCanvas();
|
|
this.textField = guiFactory.createTextField();
|
|
}
|
|
|
|
/**
|
|
* Renders the GUI elements created by the App.
|
|
*/
|
|
public void render() {
|
|
button.render();
|
|
canvas.render();
|
|
textField.render();
|
|
}
|
|
}
|