javafx-8

Remove blue frame from JavaFX input field

老子叫甜甜 提交于 2020-01-12 07:48:06
问题 Is there a way to remove the blue frame from input filed? 回答1: The blue border you are showing is the focus border. To remove it entirely, use something like textField.setStyle("-fx-focus-color: -fx-control-inner-background ; -fx-faint-focus-color: -fx-control-inner-background ;"); or in an external css file .text-field { -fx-focus-color: -fx-control-inner-background ; -fx-faint-focus-color: -fx-control-inner-background ; } To make it the same as the unfocused text field, use .text-field

ListView with custom content in JavaFX

匆匆过客 提交于 2020-01-12 05:44:06
问题 How i can make custom ListView with JavaFx for my app. I need HBox with image and 2 Labels for each line listView. 回答1: You need to provide a custom CellFactory via ListView.setCellFactory(...) Working example public class CustomListView extends Application { private static class CustomThing { private String name; private int price; public String getName() { return name; } public int getPrice() { return price; } public CustomThing(String name, int price) { super(); this.name = name; this

JavaFX's task seem to consume exceptions. Is it a bug or a feature?

依然范特西╮ 提交于 2020-01-11 17:40:02
问题 Consider this code: Thread.setDefaultUncaughtExceptionHandler((Thread t, Throwable e) -> { System.out.println("An exception occurred!"); }); // set the exception handler for the JavaFX application thread Thread.currentThread().setUncaughtExceptionHandler((Thread t, Throwable e) -> { System.out.println("An exception occurred!"); }); Task<?> task = new Task() { @Override public Void call() throws Exception { throw new RuntimeException("foobar"); }; }; new Thread(task).start(); If we run the

Javafx TabPane with multiple rows of tabs

谁说胖子不能爱 提交于 2020-01-11 07:44:08
问题 I'd like to use a (JavaFX) TabPane to display the content of 20 different tabs. This works fine with the standard TabPane, however, when the pane hits a certain amount of tabs, a button / ComboBox can be clicked to click on one of the tabs not seen. I'm designing a feature that will be used on a touchscreen, so this is not ideal. I think it'd be more intuitive to have two separate rows of tabs. How can I add two rows of tabs to a TabPane, or, what can be done to achieve a similar effect?

JavaFX resize canvas in fxml

女生的网名这么多〃 提交于 2020-01-11 06:47:46
问题 I'm trying to resize a canvas in Javafx. I am using scene builder and fxml. So far, when the user clicks on the canvas the canvas turns black, and when I resize the screen and click on the canvas only the original size of the canvas turns black (canvas is not being resized). I'm not sure how to solve this. Any ideas or solutions would help alot. Code: Controller: public class MainFXMLController implements Initializable { @FXML private Canvas mainCanvas; @FXML public GraphicsContext gc; public

Using fx:id as CSS id in FXML

拈花ヽ惹草 提交于 2020-01-11 04:59:25
问题 It seems that in FXML if you don't specify a ID (CSS) then the fx:id value is used by default. My previous understanding was the two were completely disjoint, ID for CSS and only CSS. fx:id for @FXML bindings in the controller. This can be demonstrated with a small test - three buttons, first with ID, second with FX:ID, third with both types of ID. <VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http:/

Resize JavaFX tab when double click

久未见 提交于 2020-01-10 05:19:05
问题 I have this simple example with JavaFX tabs: public class test extends Application { private BorderPane root; // Navigation Utilization private ActionTabs actiontabs; @Override public void start(Stage primaryStage) { // Set Main Window Label primaryStage.setTitle("Desktop Client"); Image iv = new Image(getClass().getResource("/images/internet-icon.png").toExternalForm()); primaryStage.getIcons().add(iv); root = new BorderPane(); root.setLeft(getLeftHBox(primaryStage, root)); Scene scene = new

JAVAFX ListView chatting

我怕爱的太早我们不能终老 提交于 2020-01-09 12:05:22
问题 I need to insert values in list view in one by one like chatting. now my code is @FXML private ListView<String> messageList; private ObservableList<String> messages = FXCollections.observableArrayList(); messageList.setItems(messages); 回答1: This may be similar to what you are asking. Main: import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class ChatApp extends Application { @Override

JAVAFX ListView chatting

醉酒当歌 提交于 2020-01-09 12:04:59
问题 I need to insert values in list view in one by one like chatting. now my code is @FXML private ListView<String> messageList; private ObservableList<String> messages = FXCollections.observableArrayList(); messageList.setItems(messages); 回答1: This may be similar to what you are asking. Main: import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class ChatApp extends Application { @Override

JAVAFX ListView chatting

末鹿安然 提交于 2020-01-09 12:04:44
问题 I need to insert values in list view in one by one like chatting. now my code is @FXML private ListView<String> messageList; private ObservableList<String> messages = FXCollections.observableArrayList(); messageList.setItems(messages); 回答1: This may be similar to what you are asking. Main: import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class ChatApp extends Application { @Override