I'm using scene builder and Intellij to create a javafx application. My issue is that when trying to add an action event to my buttons it says "cannot resolve symbol" and intellij suggests that I create the method in my controller class, but its already there.
This is my first time working with javafx but from all the examples and information I can find, I cant seem to find what my problem is.
Here is the relevant code from my fxml file where I create the button with the on action event listener:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.effect.BoxBlur?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.Region?>
<AnchorPane id="Main Page" fx:id="MainPage" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="691.0" prefWidth="1202.0" style="-fx-background-color: #3d4956;" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Controller">
<children>
<!-- Buttons on main pane-->
<Button fx:id="NewTabButton" layoutX="136.0" layoutY="67.0" mnemonicParsing="false" onAction="#newTab" prefHeight="50.0" prefWidth="120.0" style="-fx-background-color: #ffa31a;" text="New Tab" textAlignment="CENTER" />
<Button fx:id="AddItemButton" layoutX="436.0" layoutY="67.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="120.0" style="-fx-background-color: #00ff80;" text="Add Item" textAlignment="CENTER" />
<Button fx:id="EditTabButton" layoutX="707.0" layoutY="67.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="120.0" style="-fx-background-color: #ffa31a;" text="Edit Tab" textAlignment="CENTER" />
<Button fx:id="ResolveTabButton" layoutX="1015.0" layoutY="67.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="120.0" style="-fx-background-color: #ff5c33;" text="Resolve Tab" textAlignment="CENTER" />
And the relevant code from my controller is here(I had it output hello world temporary in an attempt of trying anything to make it work):
package sample;
import java.awt.event.ActionEvent;
public class Controller {
public void newTab(ActionEvent actionEvent) {
System.out.println("Hello world");
}
}