1
나는 케플러와 버전 자바 FX 2를 사용하고 내가 성공하지 않고 툴팁을 정의하려고 : 그것은 작동하지 않습니다CSS로 툴팁을 사용자 정의하는 방법은 무엇입니까?
.tooltip{
-fx-background-color: linear-gradient(blue,lightskyblue);
-fx-background-radius: 5;
}
.page-corner {
-fx-shape: " ";
}
. 아이디어가 있습니까?
업데이트 : 여기
mcve :
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
public class MainApp extends Application {
@Override
public void start(Stage stage) {
AnchorPane root;
try {
root = FXMLLoader.load(getClass().getResource("Sample.fxml"));
Scene scene = new Scene(root, 600, 400);
stage.setTitle("FXML Welcome");
stage.setScene(scene);
stage.show();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String[] args) {
Application.launch(MainApp.class, args);
}
}
Sample.fxml 파일 :
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import javafx.scene.image.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.effect.*?>
<?import javafx.scene.*?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" stylesheets="MCVE/application.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.Sample">
<children>
<TextField layoutX="66.0" layoutY="49.0">
<tooltip>
<Tooltip text="tooltip message" />
</tooltip>
</TextField>
</children>
</AnchorPane>
컨트롤러 :
public class Sample {
//controller
}
application.css 파일 :
.tooltip{
-fx-background-color: linear-gradient(blue,lightskyblue);
-fx-background-radius: 5.0;
}
.page-corner {
-fx-shape: " ";
}
합니다. [MCVE] (http://stackoverflow.com/help/mcve) (즉, css 파일을 사용하는 완전한 실행 가능 예제)를 게시 할 수 있습니까? –