Posts

Showing posts with the label javafx-2

How to use method from other Class

How to use method from other Class I have a simple question for prof and hard for me :-) I have tableView in 3 differ classes and I have 2 methods which should be initialized every time when App is started. Is is possible to create that 2 methods without Class declaration /make it static and use it like in initialization. Example below. public class Subscriber { private StringProperty number; private StringProperty addr; public Subscriber() { this(null, null); } .... } This is example of my class which use Subscriber FirstClass(){ @FXML private void initialize() { tableView.getSelectionModel().setCellSelectionEnabled(true); tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); numberCol.setCellValueFactory( cellData -> cellData.getValue().numberProperty()); addrCol.setCellValueFactory( cellData -> cellData.getValue().addrProperty()); } And that method I use in each of this and other 2 classes to get possibil...

java.lang.IllegalArgumentException: Children: duplicate children added: parent = VBox@872be7

java.lang.IllegalArgumentException: Children: duplicate children added: parent = VBox@872be7 Am trying to read some values from MySQL database and display it in a Menu in JavaFX. My code is below. Previously I used Buttons instead of Menu. It worked fine, but I don't felt better with Buttons, so I decided to use Menu. I got the exception mentioned in the heading when I Ran this code. private VBox userSelection() throws ClassNotFoundException, SQLException { VBox vb1 = new VBox(); vb1.setPadding(new Insets(40, 150, 20, 200)); vb1.setSpacing(20); MenuBar menuBar = new MenuBar(); Menu menuFile1 = new Menu("CHOOSE YOUR ACCOUNT"); menuFile1.setStyle("-fx-border-color: green; -fx-font-size: 14pt; " + "-fx-font-family: Comic Sans MS; -fx-padding: 1 10 1 1"); Text scenetitle2 = new Text("Choose Your Account"); scenetitle2.setFont(Font.font("Tahoma", FontWeight.BOLD, 20)); scenetitle2.setUnderl...