Java 类javafx.scene.control.Alert 实例源码
项目:UTGenerator
文件:FXMLDocumentController.java
/**
* Display an alert for the about button
*/
@FXML
private void onActionAbout() {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("About...");
alert.setHeaderText(null);
alert.setContentText("Author: Guduche\nVersion: 1.0.1");
alert.getButtonTypes().clear();
ButtonType boutonOk = new ButtonType("Ok");
alert.getButtonTypes().add(boutonOk);
ButtonType boutonGithub = new ButtonType("Github project");
alert.getButtonTypes().add(boutonGithub);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == boutonGithub) {
try {
java.awt.Desktop.getDesktop().browse(new URI("https://github.com/Guduche/UTGenerator"));
} catch (Exception e) {
}
}
}
项目:ChessBot
文件:UIUtils.java
public static void alwaysInTop(Alert alert) {
try{
DialogPane root = alert.getDialogPane();
Stage dialogStage = new Stage(StageStyle.UTILITY);
for (ButtonType buttonType : root.getButtonTypes()) {
ButtonBase button = (ButtonBase) root.lookupButton(buttonType);
button.setOnAction(evt -> {
root.setUserData(buttonType);
dialogStage.close();
});
}
root.getScene().setRoot(new Group());
Scene scene = new Scene(root);
dialogStage.setScene(scene);
dialogStage.initModality(Modality.APPLICATION_MODAL);
dialogStage.setAlwaysOnTop(true);
dialogStage.setResizable(false);
dialogStage.showAndWait();
}catch(Exception e){
}
// Optional<ButtonType> result = Optional.ofNullable((ButtonType) root.getUserData());
}
项目:dss-demonstrations
文件:SignatureController.java
private void save(DSSDocument signedDocument) {
FileChooser fileChooser = new FileChooser();
fileChooser.setInitialFileName(signedDocument.getName());
MimeType mimeType = signedDocument.getMimeType();
ExtensionFilter extFilter = new ExtensionFilter(mimeType.getMimeTypeString(), "*." + MimeType.getExtension(mimeType));
fileChooser.getExtensionFilters().add(extFilter);
File fileToSave = fileChooser.showSaveDialog(stage);
if (fileToSave != null) {
try {
FileOutputStream fos = new FileOutputStream(fileToSave);
Utils.copy(signedDocument.openStream(), fos);
Utils.closeQuietly(fos);
} catch (Exception e) {
Alert alert = new Alert(AlertType.ERROR, "Unable to save file : " + e.getMessage(), ButtonType.CLOSE);
alert.showAndWait();
return;
}
}
}
项目:Suji
文件:ScorePaneController.java
private void displayFinalScore(ScoreEvent event) {
unsubscribeEvents();
double finalScore = event.getScorer().getScore();
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Game Over");
if ( finalScore == 0 ) {
alert.setContentText("Game ends in a draw.");
alert.showAndWait();
return;
}
String message;
if ( finalScore > 0 )
message = "Black";
else
message = "White";
finalScore = Math.abs(finalScore);
message += " wins by " + Double.toString(finalScore) + " points.";
alert.setContentText(message);
alert.showAndWait();
}
项目:titanium
文件:MemberPane.java
private void removeMemberAction(Event e) {
MemberView selected = memberTable.selectionModelProperty().get().getSelectedItem();
if (selected != null) {
Alert conf = new Alert(AlertType.CONFIRMATION, "Do you really want to transfert " + organization.getName() + "'s ownership to "+ selected.getUsername() + " ?\n");
Optional<ButtonType> result = conf.showAndWait();
if (result.isPresent() && result.get().equals(ButtonType.OK)) {
try {
organization.removeMember(selected.getId());
} catch (JSONException | WebApiException | IOException | HttpException e1) {
ErrorUtils.getAlertFromException(e1).show();
forceUpdateMemberList();
e1.printStackTrace();
}
}
}
}
项目:AlphaLab
文件:FrmCadastroDepartamento.java
@FXML
void btnConfirmar_onAction(ActionEvent event) {
DepartamentoEntity ent;
if (novo) {
ent = new DepartamentoEntity();
} else {
ent = (DepartamentoEntity) tbvDepartamentos.getSelectionModel().getSelectedItem();
}
ent.setNome(txtNovoNomeDep.getText());
ent.setSigla(txtNovaSiglaDep.getText());
ent.setChefe((ServidorEntity) chbChefeDep.getSelectionModel().getSelectedItem());
DepartamentoException exc = (DepartamentoException) departamento.save(ent);
if (exc == null) {
Alertas.exibirAlerta(Alert.AlertType.INFORMATION, "Sucesso", "Departamento Salvo", "Departamento Salvo com Sucesso");
habilitarEdicao(false);
inicializarForm();
tbpDepartamento.getSelectionModel().select(tabConsultarDepartamento);
} else {
Alertas.exibirAlerta(Alert.AlertType.INFORMATION, "Erro", "Erro ao Salvar Departamento", "Dados Inconsistentes, favor revisar");
}
}
项目:titanium
文件:AddMemberDialog.java
private void searchAction(Event e) {
String query = queryField.getText();
searchList.clear();
try {
List<Member> orgaMemberList = organization.getMemberList();
ArrayList<MemberView> result = new ArrayList<>(organization.getWsp().searchMembers(query, 0, RESULT_SIZE).stream().map(m -> new MemberView(m)).collect(Collectors.toList()));
result.forEach(mv -> {
if (!orgaMemberList.stream().anyMatch(m -> m.getId() == mv.getId())) {
searchList.add(mv);
}
});
resultCount.setText(getResultCountText(searchList.size()));
} catch (JSONException | IOException | HttpException | WebApiException e1) {
new Alert(AlertType.ERROR, "Error while fetching member list. " + e1.getClass() + " : " + e1.getMessage()).show();
e1.printStackTrace();
}
}
项目:AlphaLab
文件:FrmGerenciarHorario.java
@FXML
void btnProximo_onAction(ActionEvent event) {
String string = getDadosTabVisualizar();
if (string.length() > 0) {
Alert alerta = new Alert(AlertType.INFORMATION);
alerta.setTitle("AlphaLab");
alerta.setHeaderText("Dados de Requisitos");
alerta.setContentText(string);
alerta.show();
} else {
tabVisualizar.setDisable(true);
tabPreencherDados.setDisable(false);
tbpDados.getSelectionModel().select(tabPreencherDados);
texLaboratorio.setText(cmbLaboratorio.getValue().getNome());
if (hbxHorarios.getChildren() != null)
hbxHorarios.getChildren().clear();
criarNovasReservas();
hbxHorarios.getChildren().addAll(buildBoxHorario());
cmbProfessor.requestFocus();
}
}
项目:javaGMR
文件:TexteditorController.java
public void saveOnExit() {
if (!taNoteText.getText().equals(this.note.getText())) {
if (!JGMRConfig.getInstance().isDontAskMeToSave()) {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Save notes?");
alert.setHeaderText("Would you like to save your notes?");
ButtonType save = new ButtonType("Save");
ButtonType dontaskmeagain = new ButtonType("Don't ask me again");
ButtonType dontsave = new ButtonType("Don't save", ButtonData.CANCEL_CLOSE);
alert.getButtonTypes().setAll(save, dontaskmeagain, dontsave);
Optional<ButtonType> result = alert.showAndWait();
if(result.get() == save){
save();
}else if(result.get() == dontaskmeagain){
JGMRConfig.getInstance().setDontAskMeToSave(true);
save();
}
} else {
save();
}
}
}
项目:Money-Manager
文件:SettingsController.java
@FXML
private void mnuUndo(ActionEvent event) {
Stage SettingsStage = (Stage) btnSignOut.getScene().getWindow();
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Action Failed");
alert.setHeaderText("Undo Function Works Only From \"Make A Transaction\" and \"History\" Window");
alert.setContentText("Press \"OK\" to go to \"Make A Transaction\" window");
alert.setX(SettingsStage.getX() + 60);
alert.setY(SettingsStage.getY() + 170);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
(new TabAccess()).setTabName("tabGetMoney"); //name of which Tab should open
(new GoToOperation()).goToMakeATransaction(SettingsStage.getX(), SettingsStage.getY());
SettingsStage.close();
}
}
项目:MinecraftServerSync
文件:UpdateDisplay.java
private void setCorrectUpdateStatus() {
updatesPane.getChildren().clear();
LOGGER.info("Checking for updates...");
if (updateChecker == null) {
LOGGER.info("Error while checking for updates.");
updatesPane.getChildren().add(checkFailed);
} else if (updateChecker.isNewerVersionAvailable()) {
LOGGER.info("Newer version available: v{}. Current version: v{}.", updateChecker.getLatestVersion(), appConfig.getAppVersion());
updatesPane.getChildren().add(newVersion);
tooltipArea.setOnMouseClicked((e) -> {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setContentText(String.format(INFO_TEMPLATE, appConfig.getAppVersion(), updateChecker.getLatestVersion()));
alert.show();
});
}
}
项目:Money-Manager
文件:SettingsController.java
@FXML
private void archiveSource(ActionEvent event) {
try {
source.archiveSource(sourcecmboArchive.getValue());
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Message");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText(sourcecmboArchive.getValue()+ " is Archived Successfully");
Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
confirmationMsg.setX(SettingsStage.getX() + 200);
confirmationMsg.setY(SettingsStage.getY() + 170);
confirmationMsg.showAndWait();
tabSourceInitialize();
} catch (Exception e) {}
}
项目:Money-Manager
文件:SettingsController.java
@FXML
private void unarchiveSource(ActionEvent event) {
try {
source.unarchiveSource(sourcecmboUnArchive.getValue());
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Message");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText(sourcecmboUnArchive.getValue()+ " is Unarchived Successfully");
Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
confirmationMsg.setX(SettingsStage.getX() + 200);
confirmationMsg.setY(SettingsStage.getY() + 170);
confirmationMsg.showAndWait();
tabSourceInitialize();
} catch (Exception e) {}
}
项目:Money-Manager
文件:SettingsController.java
@FXML
private void createSector(ActionEvent event) {
if ((sectortxtSourceName.getText()).length() == 0 || countWords(sectortxtSourceName.getText()) == 0) {
sectorlblWarningMsg.setText("Write a Sector Name Please");
} else {
sectorlblWarningMsg.setText("");
sector.createSector(sectortxtSourceName.getText());
advancedSector.createSectorToAddList(sectortxtSourceName.getText());
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Message");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Sector "+sectortxtSourceName.getText()+ " created successfully");
Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
confirmationMsg.setX(SettingsStage.getX() + 200);
confirmationMsg.setY(SettingsStage.getY() + 170);
confirmationMsg.showAndWait();
tabSectorInitialize();
}
}
项目:uPMT
文件:Main.java
public void changeLocaleAndReload(String locale){
saveCurrentProject();
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Confirmation Dialog");
alert.setHeaderText("This will take effect after reboot");
alert.setContentText("Are you ok with this?");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
// ... user chose OK
try {
Properties props = new Properties();
props.setProperty("locale", locale);
File f = new File(getClass().getResource("../bundles/Current.properties").getFile());
OutputStream out = new FileOutputStream( f );
props.store(out, "This is an optional header comment string");
start(primaryStage);
}
catch (Exception e ) {
e.printStackTrace();
}
} else {
// ... user chose CANCEL or closed the dialog
}
}
项目:ethereum-ingest
文件:Form.java
public static void showAlertFromError(Throwable e) {
Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.initStyle(StageStyle.UTILITY);
alert.setTitle("Error");
alert.setContentText("An error has occured, submit an issue with the stack " +
"trace if you need help.");
alert.setHeaderText(null);
TextArea textArea = new TextArea(throwableToString(e));
textArea.setEditable(false);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, Priority.ALWAYS);
GridPane.setHgrow(textArea, Priority.ALWAYS);
GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(textArea, 0, 1);
alert.getDialogPane().setExpandableContent(expContent);
alert.getDialogPane().getStylesheets().add(Form.class.getResource(CSS_FILE).toExternalForm());
alert.showAndWait();
});
}
项目:Money-Manager
文件:DashboardController.java
@FXML
private void mnuUndo(ActionEvent event) {
Stage DashboardStage = (Stage) btnSignOut.getScene().getWindow();
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Action Failed");
alert.setHeaderText("Undo Function Works Only From \"Make A Transaction\" and \"History\" Window");
alert.setContentText("Press \"OK\" to go to \"Make A Transaction\" window");
alert.setX(DashboardStage.getX() + 60);
alert.setY(DashboardStage.getY() + 170);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
(new TabAccess()).setTabName("tabGetMoney"); //name of which Tab should open
(new GoToOperation()).goToMakeATransaction(DashboardStage.getX(), DashboardStage.getY());
DashboardStage.close();
}
}
项目:Money-Manager
文件:AboutController.java
@FXML
private void mnuUndo(ActionEvent event) {
Stage AboutStage = (Stage) btnSignOut.getScene().getWindow();
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Action Failed");
alert.setHeaderText("Undo Function Works Only From \"Make A Transaction\" and \"History\" Window");
alert.setContentText("Press \"OK\" to go to \"Make A Transaction\" window");
alert.setX(AboutStage.getX() + 60);
alert.setY(AboutStage.getY() + 170);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
(new TabAccess()).setTabName("tabGetMoney"); //name of which Tab should open
(new GoToOperation()).goToMakeATransaction(AboutStage.getX(), AboutStage.getY());
AboutStage.close();
}
}
项目:stvs
文件:VerificationResultHandler.java
/**
* Visits a {@link VerificationError}. This displays an appropriate error dialog.
*
* @param result error to visit
*/
public void visitVerificationError(VerificationError result) {
String expandableContent = "";
if (result.getLogFile().isPresent()) {
try {
expandableContent = FileUtils.readFileToString(result.getLogFile().get(), "utf-8");
} catch (IOException ex) {
// Do nothing, don't want to distract from the actual error
}
}
System.err.println(expandableContent);
AlertFactory
.createAlert(Alert.AlertType.ERROR, "Verification Error",
"An error occurred during verification.", result.getMessage()/*
stacktrace should not be shown. (See Issue #20)
expandableContent*/)
.showAndWait();
}
项目:keyboard-light-composer
文件:DialogUtil.java
public static void showPropertyContainerEditor(Window owner, KlcPropertyContainer propertyContainer, String title,
String headerText, String contentText) {
Alert alert = new Alert(AlertType.CONFIRMATION, contentText, ButtonType.OK);
alert.setTitle(title);
alert.setHeaderText(headerText);
alert.initOwner(owner);
alert.initModality(Modality.WINDOW_MODAL);
KlcPropertyContainerEditor editor = new KlcPropertyContainerEditor();
editor.setPrefWidth(300);
editor.setPrefHeight(200);
editor.setPropertyContainer(propertyContainer);
alert.getDialogPane().setContent(editor);
alert.showAndWait();
}
项目:Planchester
文件:AlertHelper.java
public static Boolean showWarningMessage(String headerText, String contentText, String okButtonLabel, Pane pane) {
ButtonType okButton = new ButtonType(okButtonLabel);
ButtonType cancelButton = new ButtonType("Cancel");
List<ButtonType> buttonList = new LinkedList<>();
buttonList.add(okButton);
buttonList.add(cancelButton);
Optional optional = showMessage("Warning", headerText, contentText, Alert.AlertType.WARNING, null, buttonList, pane);
if(optional != null) {
if(optional.get().equals(okButton)) {
return true;
} else {
return false;
}
}
return null;
}
项目:MythRedisClient
文件:HashAction.java
/**
* 修改值.
*
* @param key 数据库中的键
* @param nowSelectRow 当前选择的值
* @param selected 是否选择值
*/
@Override
public void setValueByIndex(String key, int nowSelectRow, boolean selected) {
if (selected) {
ShowPanel showPanel = new ShowPanel();
boolean ok = showPanel.showValuePanel(false);
if (ok) {
String childKey = dataTable.getSelectionModel().getSelectedItem().getKey();
String value = showPanel.getValueText();
redisHash.save(key, childKey, value);
}
} else {
Alert alert = MyAlert.getInstance(Alert.AlertType.ERROR);
alert.setTitle("错误");
alert.setContentText("请选择一个键");
alert.showAndWait();
}
}
项目:kanphnia2
文件:MainApp.java
public void saveEntryDataToFile(File f) {
try {
JAXBContext context = JAXBContext.newInstance(EntryListWrapper.class);
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// wrapping the entry data
EntryListWrapper wrapper = new EntryListWrapper();
wrapper.setEntries(entryList);
// marshalling and saving xml to file
m.marshal(wrapper, f);
// save file path
setFilePath(f);
}
catch (Exception e) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error");
alert.setHeaderText("Could not save data");
alert.setContentText("Could not save data to file:\n" + f.getPath());
alert.showAndWait();
}
}
项目:SensorThingsProcessor
文件:FXMLController.java
@FXML
private void actionSave(ActionEvent event) {
JsonElement json = configEditor.getConfig();
String config = new GsonBuilder().setPrettyPrinting().create().toJson(json);
fileChooser.setTitle("Save Config");
File file = fileChooser.showSaveDialog(paneConfig.getScene().getWindow());
try {
FileUtils.writeStringToFile(file, config, "UTF-8");
} catch (IOException ex) {
LOGGER.error("Failed to write file.", ex);
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("failed to write file");
alert.setContentText(ex.getLocalizedMessage());
alert.showAndWait();
}
}
项目:mountieLibrary
文件:MountieQueries.java
/**
* Constructor with arguments; used to search a record that matched 2 parameter.
* @param sql The SQL statement to be executed.
* @param search1 The first specific record attribute to be search for.
* @param search2 The second specific record attribute to be search for.
*/
public MountieQueries(String sql, String search1, String search2) {
try{
setSQL(sql);
//get the connection to database
connection = DriverManager.getConnection(URL, userDB, passDB);
//prepatre statements
preparedStatment = connection.prepareStatement(sql);
//set parameters
preparedStatment.setString(1, search1);
preparedStatment.setString(2, search2);
//execute query
resultSet = preparedStatment.executeQuery();
}
catch (SQLException sqlException) {
sqlException.printStackTrace();
displayAlert(Alert.AlertType.ERROR,"Error" ,
"Data base could not be loaded", searchString);
System.exit(1);
}
}
项目:KutuphaneOtomasyonSistemi
文件:Secimler.java
public static void writeToFile(Secimler secimler) throws IOException
{
Gson gson=new Gson();
Writer writer=new FileWriter(CONFIG_FILE);
gson.toJson(secimler,writer);
Alert alert=new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Ayarlar Kaydedildi");
alert.setHeaderText(null);
alert.setContentText("Ayarlar�n�z ba�ar� ile kaydedildi...");
alert.showAndWait();
writer.close();
}
项目:marathonv5
文件:ObjectMapNamingStrategy.java
public void init() {
runtimeLogger = RuntimeLogger.getRuntimeLogger();
omapService = getObjectMapService();
try {
omapService.load();
runtimeLogger.info(MODULE, "Loaded object map omapService");
} catch (IOException e) {
StringWriter w = new StringWriter();
e.printStackTrace(new PrintWriter(w));
runtimeLogger.error(MODULE, "Error in creating naming strategy:" + e.getMessage(), w.toString());
FXUIUtils.showMessageDialog(null, "Error in creating naming strategy:" + e.getMessage(), "Error in NamingStrategy",
Alert.AlertType.ERROR);
e.printStackTrace();
System.exit(1);
}
}
项目:gatepass
文件:OfficeRecords.java
public void editClicked(){
if(lstudname.getText().equals(""))
{
// Nothing selected.
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("No Selection");
alert.setHeaderText("No Person Selected");
alert.setContentText("Please select a Staff in the list.");
alert.showAndWait();
}
else
{
try {
new EditOffice().start(new Stage());
EditOffice.txtid.setText(lstudname.getText());
} catch (Exception e) {
ErrorMessage.display("Launch Error", e.getMessage()+" Application Launch Error");
e.printStackTrace();
}
}
}
项目:AlphaLab
文件:Alertas.java
private static Alert createAlert(AlertType tipo, String titulo, String cabecalho, String corpo){
msg=new Alert(tipo);
msg.setTitle(titulo);
msg.setHeaderText(cabecalho);
msg.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
msg.setContentText(corpo);
return msg;
}
项目:Elementary-Number-Theory
文件:AboutFXMLController.java
@FXML
private void handleopengithublink(ActionEvent event) {
try {
java.awt.Desktop.getDesktop().browse(java.net.URI.create("https://github.com/WaleedMortaja/Elementary-Number-Theory"));
} catch (IOException e) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Error");
alert.setHeaderText(null);
alert.setContentText(e.getMessage());
alert.showAndWait();
}
}
项目:fwm
文件:App.java
public static void main(String[] args) throws Exception {
// PRODUCTION mode needs to be determined before we get here...
AppConfig.firstInit();
prod = AppConfig.getProd();
appFileUtil = new AppFileUtil();
if(!appFileUtil.success()){
System.err.println(appFileUtil.getErrorMessage());
Platform.runLater(new Runnable(){
public void run(){
Alert al = new Alert(AlertType.ERROR);
al.setResizable(true);
for(Node n : al.getDialogPane().getChildren()){
if(n instanceof Label){
((Label)n).setMinHeight(Region.USE_PREF_SIZE);
}
}
al.setContentText(appFileUtil.getErrorMessage());
al.setHeaderText("FWM Startup Error");
al.showAndWait();
System.exit(-1);
}
});
return;
}
// ignore everything else because this means that we're in a jar file, so the app won't work
// if it doesn't think that we're prod.
PropertyConfigurator.configure(appFileUtil.getLog4JFile().getAbsolutePath());
AppConfig.init();
HotkeyController.init();
log.debug("Currently prod? " + prod);
log.debug(retGlobalResource("/src/main/webapp/WEB-INF/images/FWM-icon.png").getFile());
launch(args);
}
项目:titanium
文件:ServerTab.java
public void switchToDisconnectedWithAlert() {
switchToDisconnected();
Platform.runLater(() -> {
Alert a = ErrorUtils.newErrorAlert("Disconnected from " + server.getName(), "Server connection lost.","");
a.show();
});
}
项目:WebtoonDownloadManager
文件:AlertSupport.java
public void alertInfoMsg(Stage stage) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("알림");
alert.setHeaderText(null);
alert.setContentText(this.msg);
alert.initOwner(stage);
alert.showAndWait();
}
项目:gatepass
文件:LecturersReports.java
public void deleteClicked()
{
if(lstudname.getText().equals(""))
{
// Nothing selected.
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("No Selection");
alert.setHeaderText("No Lecturer Selected");
alert.setContentText("Please select a Lecturer in the list.");
alert.showAndWait();
}
else
{
boolean result = Confirmation.display("Delete Record", " Are you sure you want to delete this \n Lecturer? ");
if(result)
{
ObservableList<Reports> selectedProd, allProd;
allProd= tableView.getItems();
selectedProd = tableView.getSelectionModel().getSelectedItems();
//selectedProd.forEach(allProd:: remove);
//the delete query is now complete ------------------>
String query = "DELETE FROM Lecturers where s_id = '" + lstudname.getText() + "'";
//connect to database
DBConnect.connect();
try {
DBConnect.stmt.execute(query);
selectedProd.forEach(allProd:: remove);
SuccessMessage.display("Success", "Lecturer has been deleted successfully");
DBConnect.closeConnection();
} catch (Exception ea) {
ErrorMessage.display("Launching Error", ea.getMessage()+" Error has occurred. Consult administrator");
}
}
}
}
项目:Dr-Assistant
文件:RegistrationController.java
private boolean isValidEmail() {
boolean valid = false;
Matcher matcher = VALID_EMAIL_ADDRESS_REGEX.matcher(tfEmail.getText());
if (matcher.find()) {
valid = true;
} else {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Email not valid");
alert.setHeaderText("Email address is not valid");
alert.setContentText("Email address is not valid please enter a valid email address");
alert.show();
valid = false;
}
return valid;
}
项目:AlphaLab
文件:ManutencaoSoftware.java
@FXML
public void btnExcluirOnAction(ActionEvent evt) {
SoftwareEntity tmpSoftware = getSoftwareSelected();
if (tmpSoftware != null) {
if (Alertas.exibirAlerta(Alert.AlertType.CONFIRMATION, "Excluir", "Confirmar exclusão?", "Deseja mesmo excluir o software " + tmpSoftware.getDescricao() + "?", Alertas.SIM_NAO_BOTOES).get() == ButtonType.YES) {
SoftwareException delete = negocio.delete(software);
if (delete != null) {
Alertas.exibirAlerta(Alert.AlertType.ERROR, "Erro", "Erro ao excluir o software", delete.getLocalizedMessage());
} else {
listaSoftwares.remove(tmpSoftware);
}
}
}
}
项目:AlphaLab
文件:FrmSolicitarReservaHorarioPorRequisito.java
@FXML
void btnProximoRequisitos_onAction(ActionEvent event) {
String string = getDadosTabRequisitos();
if (string.length() > 0) {
Alert alerta = new Alert(AlertType.INFORMATION);
alerta.setTitle("AlphaLab");
alerta.setHeaderText("Dados de Requisitos");
alerta.setContentText(string);
alerta.show();
} else {
tabPreencherDados.setDisable(false);
tabRequisitos.setDisable(true);
tabPaneDados.getSelectionModel().select(tabPreencherDados);
cmbDisciplina.requestFocus();
if (hbxHorarios.getChildren().size() > 1)
hbxHorarios.getChildren().remove(1, hbxHorarios.getChildren().size());
hbxHorarios.getChildren().add(buildBoxHorario());
texRequisitos.setText(resources.getString("label.numMaxAlunos") + " " + numMaxAlunos);
if (!listaSoftwaresSelecionados.isEmpty()) {
for (SoftwareEntity software : listaSoftwaresSelecionados) {
vbxSoftwares.getChildren().add(new Text(software.getDescricao()));
}
} else {
vbxSoftwares.getChildren().add(new Text("Nenhum software\nsolicitado!"));
}
// TabPreencherDados
}
}
项目:titanium
文件:OrganizationManagerStage.java
private void newAction(Event e) {
TextInputDialog dialog = new TextInputDialog();
dialog.setTitle("New organization");
dialog.setHeaderText("Create a new organization");
dialog.setContentText("Organization name");
Optional<String> result = dialog.showAndWait();
if (result.isPresent() && result.get().length() > 0) {
System.out.println("present");
if (result.get().length() <= 3) {
new Alert(AlertType.ERROR, "The name is too short.").show();;
} else {
try {
wsp.newOrganization(result.get());
wsp.fecthAndSetOrganization();
forceOrganizationListRefresh();
App.getCurrentInstance().refreshWSPTabs();
} catch (JSONException | IOException | HttpException | WebApiException e1) {
ErrorUtils.getAlertFromException(e1).show();
}
}
} else {
System.out.println("not present");
}
System.out.println(result);
}
项目:titanium
文件:MainPane.java
private void removeServerAction(Event e) {
Alert conf = new Alert(AlertType.CONFIRMATION, "Do you really want to remove this server ?");
Optional<ButtonType> result = conf.showAndWait();
if (result.isPresent() && result.get().equals(ButtonType.OK)) {
Server s = content.removeSelectedServer();
if (s != null) {
servers.remove(s);
ServerListLoader.writeServerList(servers);
} else
new Alert(AlertType.ERROR, "No selected server");
}
}