This action will force synchronization from ldh123/TestUI, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
package ui;import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;import de.jensd.fx.glyphs.octicons.OctIcon;import de.jensd.fx.glyphs.weathericons.WeatherIcon;import javafx.application.Application;import javafx.scene.Scene;import javafx.scene.canvas.Canvas;import javafx.scene.canvas.GraphicsContext;import javafx.scene.control.Button;import javafx.scene.control.Label;import javafx.scene.layout.HBox;import javafx.scene.layout.StackPane;import javafx.scene.layout.VBox;import javafx.stage.Popup;import javafx.stage.Stage;import ldh.common.testui.component.IconPane;import java.awt.*;/*** Created by ldh on 2018年4月18日.*/public class IconTest3 extends Application{@Overridepublic void start(Stage primaryStage) throws Exception {VBox vbox = new VBox();Popup popup = new Popup();IconPane iconPane = new IconPane(FontAwesomeIcon.class, MaterialDesignIcon.class, OctIcon.class, WeatherIcon.class);Canvas canvas = new Canvas();Button b1 = new Button("show");b1.setOnAction(e->{StackPane stackPane = new StackPane();stackPane.setPrefSize(800, 600);stackPane.getChildren().add(iconPane);stackPane.setStyle("-fx-background-color: whitesmoke");popup.getContent().add(stackPane);popup.show(primaryStage.getScene().getWindow(), 200, 200);});vbox.getChildren().addAll(b1, canvas);Scene scene = new Scene(vbox, 800, 600);primaryStage.setScene(scene);primaryStage.show();Font f = new Font("宋体", Font.BOLD, 12);FontMetrics fm = sun.font.FontDesignMetrics.getMetrics(f);// 高度System.out.println(fm.getHeight());// 单个字符宽度System.out.println(fm.charWidth('A'));// 整个字符串的宽度System.out.println(fm.stringWidth("宋A"));}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。