I'm a new user of ControlsFX and I have an issue that I don't understand:
My code:
Dialogs.create()
.owner(mainStage)
.title("Information Dialog")
.masthead("Test masthead")
.message("Test message")
.showInformation();
And I obtain an exception:
Exception in thread "JavaFX Application Thread" java.util.MissingResourceException: Can't find bundle for base name impl.org.controlsfx.dialog.resources.oxygen.dialog-resources, locale fr_FR
Does anybody have an idea why this happens?
Thank you.
Did you download the right JAR ? Aka this: ControlsFX-8.0.6
Because I'm made this simplest program with the JAR I specified and I got no errors:
import javafx.application.Application;
import javafx.stage.Stage;
import org.controlsfx.dialog.Dialogs;
public class Test extends Application {
#Override
public void start(Stage primaryStage) {
Dialogs.create()
.owner(primaryStage)
.title("Information Dialog")
.masthead("Test masthead")
.message("Test message")
.showInformation();
}
/**
* #param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
Please also consider to raise your question in the official group support here : http://groups.controlsfx.org , you'll likely have more answers.
Related
I am trying to import javafx (.jar) files into a maven project. I have made a project with Netbeans (Java with Ant -> Java Application) and want to use the same code in Netbeans (Java with Maven -> Java Application). With Ant, I can easily import and use the (.jar) files, but this seems to be a blocked functionality with Maven.
Any solution to this?
I have looked up on several posts and guides online with no luck.
NOTE: Implementing .jar files within maven have been solved. The code does not work though.
Current Error: "Exception running application com.mycompany.ep_game_ref.Game Command execution failed."
package com.mycompany.ep_game_ref;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.image.Image;
import javafx.stage.Stage;
public class Game extends Application
{
public static String[] args;
public static Stage primarystage;
public static ObservableList<Items.Item> items = FXCollections.observableArrayList();
public static MainCentral startGame = new MainCentral();
public static Room.Introduction intro = new Room.Introduction();
public static Settings.Difficulty SETTINGS = new Settings.Difficulty();
public static Player player = new Player();
#Override
public void start(Stage stage)
{
this.primarystage = stage;
this.primarystage.setScene(new Scenes.Welcome().setWelcomeScene());
this.primarystage.getIcons().add(new Image("images/aq_logo.png"));
this.primarystage.setResizable(false);
this.primarystage.show();
}
public static void main(String[] args) {
Application.launch();
}
}
You can use JavaFX in a different way:
File>New Project>Maven>JavaFX Application.
Have been trying to set up JavaFX with Eclipse on Ubuntu. The code doesn't have an issue importing the javafx classes anymore (this took a LONG time to get working), but when running some simple test code, Eclipse can't seem to find the main class even when I right click on the file directly and run as Java Application.
package mainpackage;
import javafx.application.Application;
import javafx.stage.Stage;
public class Main extends Application {
#Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Window");
primaryStage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
Error: Could not find or load main class mainpackage.Main
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
I'm trying to build a small user interface using JavaFX, But I'm getting an error like this:
Error: Could not find or load main class myApp Caused by:
java.lang.NoClassDefFoundError: javafx/application/Application
This is my code:
and im using jdk 12.0.2
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class myApp extends Application{
public static void main(String[] args) {
Phonebook mybook = new Phonebook();
launch(args);
}
#Override
public void start(Stage primaryStage) throws Exception {
Group group = new Group();
Scene scene = new Scene(group, 600, 300);
scene.setFill(Color.GRAY);
primaryStage.setTitle("Phone Book");
primaryStage.setScene(scene);
primaryStage.show();
}
This is the Libraries and jdk I'm using:
Image1
I think JavaFX is not a part of the JDK > 9 any more. (Your version is 12.x.x)
Probably this could help you:
https://openjfx.io/openjfx-docs/#install-javafx
(Assuming you are using Maven) If this does not help, try to clean and build your Application.
Sometimes Maven does not recognize newly added dependencies.
I am making a Xposed Module that would allow users to modify the message displayed on the lock screen when Wrong pattern, pin or password is entered.
I am following this tutorial.
After digging into the android source code on GitHub, I found out the method that displays the message on the lock screen, that was onPatternChecked() in the class com.android.keyguard.KeyguardPatternView.java. The method uses the kg_wrong_pattern string resource which has the value Wrong Pattern when wrong pattern is drawn.
This is how my class looks like:-
package com.batrashubham.customlockscreenerrormessage;
import android.content.res.XResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_InitPackageResources;
/**
* Created by shubham on 19/7/16.
*/
public class CustomErrorMessage implements IXposedHookInitPackageResources,IXposedHookZygoteInit {
#Override
public void initZygote(StartupParam startupParam) throws Throwable {
XResources.setSystemWideReplacement("android","bool","config_unplugTurnsOnScreen",false);
}
#Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
if(!resparam.packageName.equals("com.android.keyguard")){
return;
}
XposedBridge.log("I just got into your lock screen");
resparam.res.setReplacement("com.android.keyguard", "string", "kg_wrong_pattern", "Nice try.!!");
}
}
The module is showing up in the Xposed Installer app and is successful activated, but still the original message is showing up on the lock screen when I draw a wrong pattern.
I am currently testing it on Android 6.0.1 (CyanogenMod 13).
What am I doing wrong?
import javafx.application.*;
import javafx.scene.*;
import javafx.stage.*;
import javafx.scene.layout.*;
public class LoanCalculator extends Application
{
public void start(Stage myStage)
{
myStage.setTitle("Loan Calculator");
FlowPlane rootNode = new FlowPane();
Scene myScene = new Scene( rootNode, 300, 200 );
myStage.setScene( myScene);
myStage.show();
}
public static void main( String [] args)
{
launch(args);
}
}
This code pops up with multiply errors when I try running it with Eclipse. I apologize if it is an obvious error. I am new to coding, I found this piece of code in my book and I wanted to test it out.
Thanks Guys
Maybe is ir just a typo? In your code it reads: FlowPlane instead of FlowPane.
Java FX is supported by JDK starting from JDK 7 update 6.
Updated my JDK 7 update 5 to JDK 8, executed your code, it worked like a magic.
Also correct the FlowPlane to FlowPane as suggested below by Kornel.