I want to use the new controlsFX controls that I have downloaded from the controlsfx-8.40.10 file on the official website and installed it in SceneBuilder although some controls do not appear as thePopOver
I have also downloaded the repository and opened it in netbeans as a new project:
Next I have opened the sub project 'controlsfx' and I have copied the 'Source Packages' to my particular project:
My project is a miniprogram that just displays a controlFX called CustomTextField
:
package pruebacontrolsfx;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import org.controlsfx.control.textfield.CustomTextField;
public class PruebaControlsFX extends Application {
@Override
public void start(Stage primaryStage) {
CustomTextField customField = new CustomTextField();
customField.setPromptText("Introduce texto");
StackPane root = new StackPane();
root.getChildren().add(customField); // genera un error ¿por qué?
Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
But when I run it I get an error just when I add the control CustomTextField
to a containerStackPane
What am I doing wrong?
One option may be to add the
.jar
to your project, go to the official page http://controlsfx.bitbucket.org/Download the current version
Simply unzip the file which will contain several .jars, the one we need is
controlsfx-{version}.jar
In your project, open the Libraries folder, right click and select the option
Add JAR/Folder
By doing this procedure, you can now add the
import
:and get your project up and running: