本文整理汇总了Java中org.controlsfx.glyphfont.Glyph类的典型用法代码示例。如果您正苦于以下问题:Java Glyph类的具体用法?Java Glyph怎么用?Java Glyph使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Glyph类属于org.controlsfx.glyphfont包,在下文中一共展示了Glyph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GoogleEntryAttendeeItem
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
public GoogleEntryAttendeeItem(EventAttendee attendee) {
this.attendee = Objects.requireNonNull(attendee);
optionalIcon = new Label();
optionalIcon.setOnMouseClicked(evt -> setOptional(!isOptional()));
optionalIcon.getStyleClass().add("button-icon");
optionalIcon.setTooltip(new Tooltip());
statusIcon = new Label();
name = new Label();
name.setMaxWidth(Double.MAX_VALUE);
setOptional(Boolean.TRUE.equals(attendee.getOptional()));
optionalProperty().addListener(obs -> updateIcon());
updateIcon();
removeButton = new Label();
removeButton.setGraphic(new FontAwesome().create(FontAwesome.Glyph.TRASH_ALT));
removeButton.getStyleClass().add("button-icon");
removeButton.setOnMouseClicked(evt -> removeAttendee(attendee));
HBox.setHgrow(optionalIcon, Priority.NEVER);
HBox.setHgrow(name, Priority.ALWAYS);
HBox.setHgrow(removeButton, Priority.NEVER);
getStyleClass().add("attendee-item");
getChildren().addAll(optionalIcon, statusIcon, name, removeButton);
ContextMenu menu = new ContextMenu();
MenuItem optionalItem = new MenuItem("Mark as optional");
optionalItem.setOnAction(evt -> setOptional(true));
MenuItem requiredItem = new MenuItem("Mark as required");
requiredItem.setOnAction(evt -> setOptional(false));
MenuItem removeItem = new MenuItem("Remove attendee");
removeItem.setOnAction(evt -> removeAttendee(attendee));
menu.getItems().addAll(optionalItem, requiredItem, new SeparatorMenuItem(), removeItem);
addEventHandler(CONTEXT_MENU_REQUESTED, evt -> menu.show(this, evt.getScreenX(), evt.getScreenY()));
}
示例2: startTimer
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
private void startTimer() {
resetTimer();
timeMinutes.set(Settings.instance().getTime().format(DateTimeFormatter.ofPattern("mm:ss")));
timeline = new Timeline();
timeline.setCycleCount(Settings.instance().getTimeInSeconds());
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() {
// KeyFrame event handler
public void handle(ActionEvent event) {
Settings.instance().setTime(Settings.instance().getTime().minusSeconds(1));
timeMinutes.set(Settings.instance().getTime().format(DateTimeFormatter.ofPattern("mm:ss")));
if ("00:00".equals(Settings.instance().getTime().format(DateTimeFormatter.ofPattern("mm:ss")))) {
showRotate();
}
}
}));
timeline.playFromStart();
Settings.instance().displayUserMessage();
Settings.instance().displayNextUserMessage();
paneColor.set("-fx-background-color:#71B284");
pauseButton.setGraphic(new Glyph("FontAwesome", "PAUSE"));
hideWindow();
}
示例3: getActionToggleButton
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
public ToggleButton getActionToggleButton(GUIActions actionType, boolean hideActionText, ToggleGroup group) {
Action action = getAction(actionType);
ToggleButton button = ActionUtils.createToggleButton(action, hideActionText ? ActionTextBehavior.HIDE : ActionTextBehavior.SHOW);
if (hideActionText && action.getText() != null) {
Tooltip.install(button, new Tooltip(action.getText()));
// button.setTooltip(new Tooltip(action.getText()));
//// button.setText(null);
}
// Internally, ControlsFX duplicates graphics (or gives up) because Nodes can't appear multiple times the scene graph
// Consequently, we need to bind changes to the text fill here so that they filter through
if (button.getGraphic() instanceof Glyph) {
((Glyph)button.getGraphic()).textFillProperty().bind(((Glyph)action.getGraphic()).textFillProperty());
}
if (group != null)
button.setToggleGroup(group);
return button;
}
示例4: createGlyph
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
private Glyph createGlyph(int size) {
Glyph g = icoMoon.create(getCode()).size(size);
if (observableColor == null) {
// This isn't ideal, but it turns out that Glyphs don't seem to stick with the label colors
// defined in CSS - possibly because of the way in which they are duplicated?
if (color != null)
g.color(color);
// else {
// g.setStyle("-fx-text-fill:white");
// }
} else {
if (observableColor.getValue() == null)
g.color(color);
else
g.setTextFill(ColorToolsFX.getCachedColor(observableColor.get()));
// Respond to color changes
observableColor.addListener((v, o, n) -> {
if (n != null) {
g.setTextFill(ColorToolsFX.getCachedColor(n.intValue()));
}
});
}
return g;
}
示例5: createNode
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
public static Node createNode(int width, int height, PathIcons type) {
try {
Glyph g = type.createGlyph(width);
// g.useGradientEffect();
// g.useHoverEffect();
// g.setOpacity(0.5);
// g.setStyle("-fx-text-fill: ladder(-fx-background-color, white 49%, black 50%);");
// g.setStyle("-fx-background-color:red;");
return g;
// return icoMoon.create(type.getCode()).size(width+2).color(javafx.scene.paint.Color.GRAY);
}
catch (Exception e) {
logger.error("Unable to load icon {}", type, e);
return null;
}
}
示例6: createIcon
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
private Node createIcon(FontAwesome.Glyph glyph, String tooltip, Runnable action){
Glyph icon = font
.create(glyph.name())
.color(Color.WHITE)
.size(40);
if(action != null) {
icon.useHoverEffect();
}
icon.setPadding(new Insets(0,20,0,20));
Tooltip tip = new Tooltip(tooltip);
tip.setFont(new Font(tip.getFont().getName(), 18));
icon.setTooltip(tip);
icon.setOnMouseClicked(x -> action.run());
return icon;
}
示例7: createIconButton
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
private Node createIconButton(Character glyphCharacter, Runnable action, String tooltip){
Glyph icon = font
.create(glyphCharacter)
.color(Color.WHITE)
.size(40);
if(action != null) {
icon.useHoverEffect();
}
icon.setPadding(new Insets(0,20,0,20));
Tooltip tip = new Tooltip(tooltip);
tip.setFont(new Font(tip.getFont().getName(), 18));
icon.setTooltip(tip);
icon.setOnMouseClicked(x -> action.run());
return icon;
}
示例8: SearchTextField
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
/**
* Creates a new SearchTextField
*/
public SearchTextField(){
// Make round corners which is commonly used for search fields
setStyle("-fx-border-radius: 15;" +
"-fx-background-radius: 15;");
// Add a clear button
TextFields.makeClearable(this);
Glyph icon = new Glyph("FontAwesome", FontAwesome.Glyph.SEARCH)
.size(14);
icon.setPadding(new Insets(0,5,0,5));
this.setLeft(icon);
}
示例9: createButton
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
private void createButton() {
editButton = new Button();
editButton.setText("Edit");
editButton.setPrefWidth(100);
editButton.setOnAction(this);
editButton.setGraphic(Glyph.create("FontAwesome|pencil"));
}
示例10: updateIcon
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
private void updateIcon() {
FontAwesome fontAwesome = new FontAwesome();
Glyph img = fontAwesome.create(FontAwesome.Glyph.MALE);
img.setOpacity(isOptional() ? 0.4 : 1.0);
optionalIcon.setGraphic(img);
optionalIcon.getTooltip().setText(isOptional() ? "optional" : "required");
name.setText(attendee.getEmail() + (isOptional() ? " (optional)" : ""));
}
示例11: resetTimer
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
private void resetTimer() {
if (timeline != null) {
timeline.stop();
}
pauseButton.setGraphic(new Glyph("FontAwesome", "PLAY"));
timeMinutes.set("Start");
Settings.instance().initializeTime();
paneColor.set("-fx-background-color:#333333");
}
示例12: pauseTimer
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
private void pauseTimer() {
boolean paused = false;
if (timeline != null && timeline.getStatus().equals(Status.RUNNING)) {
timeline.pause();
paused = true;
}
if (nag != null && nag.getStatus().equals(Status.RUNNING)) {
nag.stop();
paused = true;
}
if (paused) {
paneColor.set("-fx-background-color:#FFBF00");
pauseButton.setGraphic(new Glyph("FontAwesome", "PLAY"));
}
}
示例13: initCurrentlyPlayingModel
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
/**
* Initializes the CurrentlyPlayingModel which this class will get data from when a song is
* clicked within the SongBrowser and this class will use the song object to play the song.
*
* @param currentlyPlayingModel - currentlyPlayingModel object to send data to.
*/
public void initCurrentlyPlayingModel(CurrentlyPlayingModel currentlyPlayingModel) {
//Make sure model is only set once.
if (this.currentlyPlayingModel != null) {
throw new IllegalStateException("Model can only be initialized once");
}
this.currentlyPlayingModel = currentlyPlayingModel;
//Bind currently playing song strings to the song title and artist label.
this.songSong.textProperty().bind(currentlyPlayingModel.getCurrentSongTitle());
this.songArtist.textProperty().bind(currentlyPlayingModel.getCurrentSongArtist());
currentlyPlayingModel.getCurrentSong().addListener(new InvalidationListener() {
@Override
public void invalidated(Observable observable) {
//Less disgusting solution than using SupressWarning?
@SuppressWarnings("unchecked")
ObjectProperty<Song> property = (ObjectProperty<Song>) observable;
player.setSong(property.getValue());
player.play();
playing = true;
songPlayIco.setIcon(FontAwesome.Glyph.PAUSE);
}
});
}
示例14: getRefIcon
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
public static Node getRefIcon(GitRef ref) {
if (ref instanceof GitTag) {
return getIcon(Octicons.Glyph.TAG);
} else if (ref instanceof GitBranch) {
return getIcon(Octicons.Glyph.BRANCH);
} else {
return null;
}
}
示例15: getGlyph
import org.controlsfx.glyphfont.Glyph; //导入依赖的package包/类
public Glyph getGlyph(Enum<?> glyphName) {
if (symbolFont == null) {
logger.warn("No symbol font available");
return null;
}
return symbolFont.create(glyphName);
}