本文整理汇总了Java中com.jfoenix.controls.JFXSnackbar类的典型用法代码示例。如果您正苦于以下问题:Java JFXSnackbar类的具体用法?Java JFXSnackbar怎么用?Java JFXSnackbar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JFXSnackbar类属于com.jfoenix.controls包,在下文中一共展示了JFXSnackbar类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNotLinkedGame
import com.jfoenix.controls.JFXSnackbar; //导入依赖的package包/类
@FXML
void addNotLinkedGame(ActionEvent event) {
if(notLinkedAppName.getText().isEmpty()){
return;
}
NotLinkedSteamAppWithKey app = new NotLinkedSteamAppWithKey(notLinkedAppName.getText());
if(userAppList.getAppList().contains(app))
{
JFXSnackbar error = new JFXSnackbar(root);
error.show(I18n.getMessage("erroralreadyaddedgame"),3000);
return;
}
userAppList.addApp(app);
controllerBinder.appController.modified = true;
controllerBinder.appController.appList.getSelectionModel().select(app);
controllerBinder.appController.selectedGameInfo();
controllerBinder.appController.updateListApp();
Stage stage = (Stage) root.getScene().getWindow();
stage.close();
}
示例2: downloadImageCache
import com.jfoenix.controls.JFXSnackbar; //导入依赖的package包/类
@FXML
void downloadImageCache(ActionEvent event) {
for(AbstractSteamAppWithKey app : controllerBinder.appController.userAppList.getAppList()){
if(app instanceof LinkedSteamAppWithKey){
imageCacheHandler.addImageToCache((LinkedSteamAppWithKey) app);
}
}
try
{
imageCacheHandler.saveImageCache();
} catch (ImageCacheError imageCacheError)
{
JFXSnackbar error = new JFXSnackbar(root);
error.show(I18n.getMessage("errorcachefolder"), 3000);
}
imageCacheHandler.loadImageCache();
}
示例3: deleteImageCache
import com.jfoenix.controls.JFXSnackbar; //导入依赖的package包/类
@FXML
void deleteImageCache(ActionEvent event) {
try
{
imageCacheHandler.deleteImageCache();
} catch (ImageCacheError imageCacheError)
{
JFXSnackbar error = new JFXSnackbar(root);
error.show(I18n.getMessage("errorcachefolder"), 3000);
}
}
示例4: launchImport
import com.jfoenix.controls.JFXSnackbar; //导入依赖的package包/类
public void launchImport(File file){
try
{
Stage stage = new Stage();
stage.initStyle(StageStyle.UNDECORATED);
ResourceBundle bundle = I18n.getResourceBundle();
ImportFromCSVLoadingController importFromCSVLoadingController = new ImportFromCSVLoadingController();
FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/matthieu42/steamtradertools/view/importfromcsvloadingview.fxml"), bundle);
loader.setController(importFromCSVLoadingController);
AnchorPane root;
root = loader.load();
Scene loading = new Scene(root);
String css = AppController.class.getResource("/com/matthieu42/steamtradertools/view/style.css").toExternalForm();
loading.getStylesheets().add(css);
stage.setScene(loading);
stage.show();
Task<Void> importFromCSV = userAppList.importFromCSV(file);
importFromCSVLoadingController.progressBar.progressProperty().bind(importFromCSV.progressProperty());
importFromCSV.progressProperty().addListener((obs, oldProgress, newProgress) ->
{
double progress = (double) newProgress*100;
DecimalFormat df = new DecimalFormat("#.##");
importFromCSVLoadingController.statusLabel.setText(I18n.getMessage("percentageOfGameImported") + " " + df.format(progress) + "%");
});
importFromCSV.setOnSucceeded(t ->
{
System.out.println("done !");
JFXSnackbar info = new JFXSnackbar(root);
info.show(I18n.getMessage("CSVImportSuccess") + "importedData.xml", 3000);
stage.close();
});
importFromCSV.setOnFailed(t ->
{
JFXSnackbar error = new JFXSnackbar(root);
error.show(I18n.getMessage("errorImportingCSV"), 3000);
return;
});
new Thread(importFromCSV).start();
} catch (IOException e)
{
e.printStackTrace();
}
}
示例5: showSnackbarMessage
import com.jfoenix.controls.JFXSnackbar; //导入依赖的package包/类
public void showSnackbarMessage(final String message) {
controller.snackbar.enqueue(new JFXSnackbar.SnackbarEvent(message, "", 3000, event -> {
}));
}
示例6: init
import com.jfoenix.controls.JFXSnackbar; //导入依赖的package包/类
/**
* init fxml when loaded.
*/
@PostConstruct
public void init() {
bindAction(burger1);
bindAction(burger2);
bindAction(burger3);
bindAction(burger4);
snackbar = new JFXSnackbar(root);
snackbar.setPrefWidth(300);
badge1.setOnMouseClicked((click) -> {
int value = Integer.parseInt(badge1.getText());
if (click.getButton() == MouseButton.PRIMARY) {
value++;
} else if (click.getButton() == MouseButton.SECONDARY) {
value--;
}
if (value == 0) {
badge1.setEnabled(false);
} else {
badge1.setEnabled(true);
}
badge1.setText(String.valueOf(value));
// trigger snackbar
if (count++ % 2 == 0) {
snackbar.fireEvent(new SnackbarEvent("Toast Message " + count));
} else {
if (count % 4 == 0) {
snackbar.fireEvent(new SnackbarEvent("Snackbar Message Persistant " + count,
"CLOSE",
3000,
true,
b -> snackbar.close()));
} else {
snackbar.fireEvent(new SnackbarEvent("Snackbar Message " + count, "UNDO", 3000, false, (b) -> {
}));
}
}
});
}