Blame view
src/main/kotlin/application/controller/MenuBarController.kt
989 Bytes
b350f9dfe import vessels an... |
1 |
package application.controller |
b350f9dfe import vessels an... |
2 3 4 5 |
import application.model.createVesselCollection import application.model.observableMessages import javafx.event.EventHandler import javafx.fxml.FXML |
b350f9dfe import vessels an... |
6 |
import javafx.fxml.Initializable |
b350f9dfe import vessels an... |
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import javafx.scene.control.MenuBar import javafx.scene.control.MenuItem import javafx.stage.FileChooser import java.net.URL import java.util.* class MenuBarController : Initializable { @FXML var menuBar: MenuBar = MenuBar() @FXML var import: MenuItem = MenuItem() override fun initialize(location: URL?, resources: ResourceBundle?) { import.onAction = EventHandler { val fileChooser = FileChooser() fileChooser.title = "Choose a file to import" val window = menuBar.scene.window val file = fileChooser.showOpenDialog(window) val vessels = createVesselCollection(file) observableMessages.vessels.clear() observableMessages.vessels = vessels } } } |