本文整理汇总了Java中org.controlsfx.glyphfont.GlyphFont类的典型用法代码示例。如果您正苦于以下问题:Java GlyphFont类的具体用法?Java GlyphFont怎么用?Java GlyphFont使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GlyphFont类属于org.controlsfx.glyphfont包,在下文中一共展示了GlyphFont类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
@Override
public void start(Stage stage) {
try {
mainStage = stage;
InputStream is = getClass().getResourceAsStream("fontawesome-webfont.ttf");
GlyphFont fa = new FontAwesome(is);
GlyphFontRegistry.register(fa);
Parent root = FXMLLoader.load(getClass().getResource("application.fxml"));
stage.setTitle("MobTime");
stage.getIcons().add(new Image(getClass().getResourceAsStream("icon.png")));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
openMiniTimer();
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(final WindowEvent event) {
miniTimer.close();
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: setIcon
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
private void setIcon(TreeItem<String> item, Boolean result) {
GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
StackPane pane = new StackPane();
pane.setPrefWidth(18);
if (result != null) {
if (result) {
pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.CHECK).color(Color.GREEN));
} else {
pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.EXCLAMATION).color(Color.RED));
}
} else {
pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.QUESTION).color(Color.GRAY));
}
item.setGraphic(pane);
}
示例3: updateIcon
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
/**
* This updates the text with the correct unicode value
* so that the desired icon is displayed.
*/
private void updateIcon(){
Object iconValue = getIcon();
if(iconValue != null) {
if(iconValue instanceof Character){
setTextUnicode((Character)iconValue);
}else {
GlyphFont gylphFont = GlyphFontRegistry.font(getFontFamily());
if (gylphFont != null) {
String name = iconValue.toString();
Character unicode = gylphFont.getCharacter(name);
if (unicode != null) {
setTextUnicode(unicode);
} else {
// Could not find a icon with this name
setText(name);
}
}
}
}
}
示例4: getFontAwesome
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
private GlyphFont getFontAwesome() {
if (fontAwesome == null) {
try (InputStream inputStream = UniformDesign.class.getResourceAsStream("/de/factoryfx/javafx/icon/fontawesome-webfont4_3.ttf")) {
GlyphFont font_awesome = new FontAwesome(inputStream);
GlyphFontRegistry.register(font_awesome);
fontAwesome = GlyphFontRegistry.font("FontAwesome");
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return fontAwesome;
}
示例5: makeAction
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
public static Action makeAction(String tooltip, FontAwesome.Glyph g, Consumer<ActionEvent> eventHandler) {
initJfx();
Action action = new Action("", eventHandler);
GlyphFont fontAwesome = GlyphFontRegistry.font(FontAwesome4);
action.setGraphic(fontAwesome.create(g).size(14));
action.setLongText(tooltip);
return action;
}
示例6: createErrorIcon
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
/**
* Returns an error icon (glyph created using font awesome).
*
* @return graphic node
*/
public static Node createErrorIcon() {
GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
Glyph graphic = fontAwesome.create(FontAwesome.Glyph.EXCLAMATION_TRIANGLE);
graphic.setFontSize(20.0);
graphic.setColor(Color.RED);
return graphic;
}
示例7: testInitFontAwesomeOffline
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
@Test
public void testInitFontAwesomeOffline() {
// this test may fail if already initialized due to other tests.
assertNull(IconUtils.getFontAwesome());
IconUtils.initFontAwesomeOffline();
GlyphFont font = IconUtils.getFontAwesome();
assertNotNull(font);
GlyphFont registeredFont = GlyphFontRegistry.font("FontAwesome");
assertNotNull(registeredFont);
assertEquals(font, registeredFont);
}
示例8: FolderView
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
public FolderView(){
description.setId("description"); // style id
description.setAlignment(Pos.CENTER_LEFT);
description.setPadding(new Insets(10));
GlyphFont font = GlyphFontRegistry.font("FontAwesome");
Glyph folderViewNode = font.create(FontAwesome.Glyph.FOLDER_ALT.name()).size(100);
this.addEventFilter(MouseEvent.MOUSE_CLICKED, mouseOpenHandler);
this.setCenter(folderViewNode);
this.setBottom(description);
}
示例9: SimpleCellItemView
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
public SimpleCellItemView(){
description.setId("description"); // style id
description.setAlignment(Pos.CENTER_LEFT);
description.setPadding(new Insets(10));
GlyphFont font = GlyphFontRegistry.font("FontAwesome");
Glyph folderViewNode = font.create(FontAwesome.Glyph.FILE_ALT.name()).size(100);
this.addEventFilter(MouseEvent.MOUSE_CLICKED, mouseOpenHandler);
this.setCenter(folderViewNode);
this.setBottom(description);
}
示例10: PrimaryMediaExplorerFX
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
/**
* Creates a new PrimaryMediaExplorerFX
*/
public PrimaryMediaExplorerFX(){
GlyphFont font = GlyphFontRegistry.font("FontAwesome");
homeView = font.create(FontAwesome.Glyph.HOME.name()).size(16);
// Browser View
mediaBrowserFX = new MediaBrowserFX();
this.setCenter(mediaBrowserFX);
//this.setCenter(mediaBrowserFX);
// Filter View
filterView = new ExplorerFilterFX();
// Navigation / Breadcrumb
breadCrumbBar = createNavigation();
breadCrumbModel = new BreadCrumbNavigationDecorator(breadCrumbBar, new HomeLocationBreadCrumb());
VBox topBox = new VBox();
topBox.getChildren().add(filterView);
topBox.getChildren().add(breadCrumbBar);
TitledPane filterPane = new TitledPane("Source", topBox);
this.setTop(filterPane);
}
示例11: getGlyphFont
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
@Bean
public GlyphFont getGlyphFont() {
GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
return fontAwesome;
}
示例12: init
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
public void init(Model model, GlyphFont glyphFont, Stage stage) {
this.model = model;
this.glyphFont = glyphFont;
// Apply stylesheet
rootPane.getStylesheets().add(
getClass().getResource("/ninja/mbedded/ninjaterm/resources/style.css").toExternalForm());
setupVersion();
websiteHyperlink.setOnAction(e -> loadWebpage(websiteHyperlink.getText()));
githubHyperlink.setOnAction(e -> loadWebpage(githubHyperlink.getText()));
websiteHyperlink.setGraphic(glyphFont.create(FontAwesome.Glyph.HOME));
githubHyperlink.setGraphic(glyphFont.create(FontAwesome.Glyph.GITHUB));
closeButton.setOnAction(e -> stage.close());
}
示例13: init
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
public void init(Model model, Terminal terminal, GlyphFont glyphFont) {
this.model = model;
this.terminal = terminal;
this.glyphFont = glyphFont;
//==============================================//
//============= LOG FILE PATH SETUP ============//
//==============================================//
// Bind the log file path textfield to a string in the model
logFilePathTextField.textProperty().bindBidirectional(terminal.logging.logFilePath);
browseButton.setOnAction(event -> {
openFileChooser();
});
startStopLoggingButton.setOnAction(event -> {
// Toggle the isLogging boolean in the model
if(!terminal.logging.isLogging.get()) {
terminal.logging.enableLogging();
} else {
terminal.logging.disableLogging();
}
updateLoggingTabBasedOnIsLogging();
});
// Update the button style based on the default value for isLogging in the model.
updateLoggingTabBasedOnIsLogging();
//==============================================//
//============= FILE BEHAVIOUR SETUP ===========//
//==============================================//
fileBehvaiourToggleGroupValue.add(appendFileBehaviourRadioButton, Logging.FileBehaviour.APPEND);
fileBehvaiourToggleGroupValue.add(overwriteFileBehaviourRadioButton, Logging.FileBehaviour.OVERWRITE);
Bindings.bindBidirectional(fileBehvaiourToggleGroupValue.valueProperty(), terminal.logging.selFileBehaviour);
//==============================================//
//========== WHAT ARE WE LOGGING SETUP =========//
//==============================================//
whatAreWeLoggingTGV.add(rawRxDataAsAsciiRadioButton, Logging.WhatAreWeLogging.RAW_RX_DATA_AS_ASCII);
whatAreWeLoggingTGV.add(rxPaneOutputRadioButton, Logging.WhatAreWeLogging.RX_PANE_OUTPUT);
Bindings.bindBidirectional(whatAreWeLoggingTGV.valueProperty(), terminal.logging.selWhatAreWeLogging);
}
示例14: init
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
public void init(Model model, Terminal terminal, GlyphFont glyphFont) {
this.model = model;
this.terminal = terminal;
this.glyphFont = glyphFont;
// Attach handler for "Scan" button press
reScanButton.setOnAction((actionEvent) -> {
scanButtonPressed();
});
//==============================================//
//=========== POPULATE/BIND COMBOBOXES =========//
//==============================================//
terminal.comPortSettings.selComPortName.bind(foundComPortsComboBox.getSelectionModel().selectedItemProperty());
baudRateComboBox.getItems().setAll(BaudRates.values());
baudRateComboBox.getSelectionModel().select(BaudRates.BAUD_9600);
terminal.comPortSettings.selBaudRate.bind(baudRateComboBox.getSelectionModel().selectedItemProperty());
numDataBitsComboBox.getItems().setAll(NumDataBits.values());
numDataBitsComboBox.getSelectionModel().select(NumDataBits.EIGHT);
terminal.comPortSettings.selNumDataBits.bind(numDataBitsComboBox.getSelectionModel().selectedItemProperty());
parityComboBox.getItems().setAll(Parities.values());
parityComboBox.getSelectionModel().select(Parities.NONE);
terminal.comPortSettings.selParity.bind(parityComboBox.getSelectionModel().selectedItemProperty());
numStopBitsComboBox.getItems().setAll(NumStopBits.values());
numStopBitsComboBox.getSelectionModel().select(NumStopBits.ONE);
terminal.comPortSettings.selNumStopBits.bind(numStopBitsComboBox.getSelectionModel().selectedItemProperty());
//==============================================//
//====== ATTACH LISTENERS TO COM PORT SCAN =====//
//==============================================//
terminal.comPortSettings.scannedComPorts.addListener(
(ListChangeListener.Change<? extends String> c) -> {
handleComPortsScanned();
});
//==============================================//
//=== ATTACH LISTENERS TO COM PORT OPEN/CLOSE ==//
//==============================================//
terminal.isComPortOpen.addListener((observable, oldValue, newValue) -> {
onIsComPortOpen();
});
// Set default style for OpenClose button
setOpenCloseComPortButtonStyle(OpenCloseButtonStyles.OPEN);
// Attach handler for when selected COM port changes. This is responsible for
// enabling/disabling the "Open" button as appropriate
terminal.comPortSettings.selComPortName.addListener(
(observable, oldValue, newValue) -> {
logger.debug("Selected COM port name changed.");
// newValue will be null if a scan was done and no COM ports
// were found
if (newValue == null) {
openCloseComPortButton.setDisable(true);
} else {
openCloseComPortButton.setDisable(false);
}
});
}
示例15: init
import org.controlsfx.glyphfont.GlyphFont; //导入依赖的package包/类
public void init(Model model, GlyphFont glyphFont) {
this.model = model;
this.glyphFont = glyphFont;
//==============================================//
//============= STATUS MESSAGES SETUP ==========//
//==============================================//
model.status.statusMsgs.addListener((ListChangeListener.Change<? extends Node> c) -> {
statusTextFlow.getChildren().setAll(model.status.statusMsgs);
// Auto-scroll the status scroll-pane to the last received status message
statusScrollPane.setVvalue(statusTextFlow.getHeight());
});
//==============================================//
//================= LED SETUP ==================//
//==============================================//
model.globalStats.numCharactersTx.addListener((observable, oldValue, newValue) -> {
activityTxLed.flash();
});
model.globalStats.numCharactersRx.addListener((observable, oldValue, newValue) -> {
activityRxLed.flash();
});
//==============================================//
//============ TOTAL BYTE COUNT SETUP ==========//
//==============================================//
//======================= TX ===================//
ChangeListener<Number> totalByteCountTxChangeListener = (observable, oldValue, newValue) -> {
totalByteCountTx.setText(Integer.toString(newValue.intValue()));
};
model.status.totalByteCountTx.addListener(totalByteCountTxChangeListener);
// Set default (giving bogus data as it is not used)
totalByteCountTxChangeListener.changed(new SimpleIntegerProperty(), 0.0, 0.0);
//======================= RX ===================//
ChangeListener<Number> totalByteCountRxChangeListener = (observable, oldValue, newValue) -> {
totalByteCountRx.setText(Integer.toString(newValue.intValue()));
};
model.status.totalByteCountRx.addListener(totalByteCountRxChangeListener);
// Set default (giving bogus data as it is not used)
totalByteCountRxChangeListener.changed(new SimpleIntegerProperty(), 0.0, 0.0);
//==============================================//
//=========== TOTAL BYTES/SECOND SETUP =========//
//==============================================//
//======================= TX ===================//
ChangeListener<Number> totalBytesPerSecTxChangeListener = (observable, oldValue, newValue) -> {
totalBytesPerSecTx.setText(Double.toString(newValue.doubleValue()));
};
model.status.totalBytesPerSecTx.addListener(totalBytesPerSecTxChangeListener);
// Set default (giving bogus data as it is not used)
totalBytesPerSecTxChangeListener.changed(new SimpleDoubleProperty(), 0.0, 0.0);
//======================= RX ===================//
ChangeListener<Number> totalBytesPerSecRxChangeListener = (observable, oldValue, newValue) -> {
totalBytesPerSecRx.setText(Double.toString(newValue.doubleValue()));
};
model.status.totalBytesPerSecRx.addListener(totalBytesPerSecRxChangeListener);
// Set default (giving bogus data as it is not used)
totalBytesPerSecRxChangeListener.changed(new SimpleDoubleProperty(), 0.0, 0.0);
}