Java Examples for javafx.scene.control.TextArea
The following java examples will help you to understand the usage of javafx.scene.control.TextArea. These source code samples are taken from different open source projects.
Example 1
| Project: sandboxes-master File: ChildrenInHBox.java View source code |
@Override
public void start(Stage stage) throws Exception {
HBox container = new HBox();
container.setAlignment(Pos.BOTTOM_RIGHT);
TextArea textArea = new TextArea("some bogus text");
container.getChildren().addAll(textArea, new Label("With a label"));
textArea.setMaxHeight(Control.USE_PREF_SIZE);
stage.setScene(new Scene(container));
stage.show();
}Example 2
| Project: closurefx-builder-master File: GSSCopySectionController.java View source code |
public AnchorPane create() throws Exception {
AnchorPane anchorPane = new AnchorPane();
anchorPane.setId("AnchorPane");
anchorPane.setMinHeight(Control.USE_PREF_SIZE);
anchorPane.setMinWidth(Control.USE_PREF_SIZE);
anchorPane.setPrefHeight(Control.USE_COMPUTED_SIZE);
anchorPane.setPrefWidth(Control.USE_COMPUTED_SIZE);
TitledPane titledPane = new TitledPane();
titledPane.setAnimated(false);
titledPane.setCollapsible(false);
titledPane.setPrefHeight(Control.USE_COMPUTED_SIZE);
titledPane.setPrefWidth(Control.USE_COMPUTED_SIZE);
titledPane.setText(bundle.getString("GSSCopySection"));
AnchorPane.setBottomAnchor(titledPane, 0.0);
AnchorPane.setLeftAnchor(titledPane, 0.0);
AnchorPane.setRightAnchor(titledPane, 0.0);
AnchorPane.setTopAnchor(titledPane, 0.0);
VBox vBox3 = new VBox();
vBox3.setPrefHeight(Control.USE_COMPUTED_SIZE);
vBox3.setPrefWidth(Control.USE_COMPUTED_SIZE);
vBox3.setSpacing(5.0);
controlCopyrightNotice = new TextArea();
controlCopyrightNotice.setMinHeight(50.0);
controlCopyrightNotice.setMinWidth(100.0);
controlCopyrightNotice.setPrefWidth(Control.USE_COMPUTED_SIZE);
controlCopyrightNotice.setPromptText(bundle.getString("GSSCopySection_Desc"));
controlCopyrightNotice.setWrapText(true);
VBox.setVgrow(controlCopyrightNotice, Priority.ALWAYS);
vBox3.getChildren().add(controlCopyrightNotice);
Insets insets5 = new Insets(10.0, 10.0, 10.0, 10.0);
vBox3.setPadding(insets5);
titledPane.setContent(vBox3);
anchorPane.getChildren().add(titledPane);
initialize(null, bundle);
return anchorPane;
}Example 3
| Project: griffon-master File: ApplicationEventHandler.java View source code |
public void onThrowableEvent(ThrowableEvent event) {
uiThreadManager.runInsideUIAsync(() -> {
TitledPane pane = new TitledPane();
pane.setCollapsible(false);
pane.setText("Stacktrace");
TextArea textArea = new TextArea();
textArea.setEditable(false);
pane.setContent(textArea);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
event.getThrowable().printStackTrace(new PrintStream(baos));
textArea.setText(baos.toString());
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Error");
alert.setHeaderText("An unexpected error occurred");
alert.getDialogPane().setContent(pane);
alert.showAndWait();
});
}Example 4
| Project: idnadrev-master File: InsertImage.java View source code |
@Override
public void execute(TextArea editor) {
collectImages();
if (dialog == null) {
dialog = new Stage();
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.initOwner(button.getScene().getWindow());
dialog.setTitle(Localized.get("select.image"));
}
StackPane container = new StackPane();
container.setPadding(new Insets(5));
container.getChildren().add(selectImageController.getImagePane());
Scene scene = new Scene(container);
dialog.setOnHiding( e -> {
scene.setRoot(new StackPane());
});
dialog.setScene(scene);
cssSheets.forEach(( sheet) -> {
scene.getStylesheets().add(sheet);
});
dialog.show();
}Example 5
| Project: jabref-master File: EditorMenus.java View source code |
public static List<MenuItem> getDefaultMenu(TextArea textArea) {
List<MenuItem> menuItems = new ArrayList<>();
menuItems.add(new CaseChangeMenu(textArea.textProperty()));
menuItems.add(new ConversionMenu(textArea.textProperty()));
menuItems.add(new SeparatorMenuItem());
menuItems.add(new ProtectedTermsMenu(textArea));
menuItems.add(new SeparatorMenuItem());
return menuItems;
}Example 6
| Project: JFoenix-master File: JFXTextArea.java View source code |
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
if (STYLEABLES == null) {
final List<CssMetaData<? extends Styleable, ?>> styleables = new ArrayList<>(Control.getClassCssMetaData());
styleables.addAll(getClassCssMetaData());
styleables.addAll(TextArea.getClassCssMetaData());
STYLEABLES = Collections.unmodifiableList(styleables);
}
return STYLEABLES;
}Example 7
| Project: POL-POM-5-master File: StepRepresentationLicence.java View source code |
@Override
protected void drawStepContent() {
super.drawStepContent();
TextArea licenceWidget = new TextArea(licenceText);
licenceWidget.setLayoutX(10);
licenceWidget.setLayoutY(100);
licenceWidget.setMinWidth(700);
licenceWidget.setMaxWidth(700);
licenceWidget.setMinHeight(308);
licenceWidget.setMaxHeight(308);
licenceWidget.setEditable(false);
CheckBox confirmWidget = new CheckBox(translate("I agree"));
confirmWidget.setOnAction( event -> {
isAgree = !isAgree;
confirmWidget.setSelected(isAgree);
setNextButtonEnabled(isAgree);
});
confirmWidget.setLayoutX(10);
confirmWidget.setLayoutY(418);
setNextButtonEnabled(false);
this.addToContentPane(licenceWidget);
this.addToContentPane(confirmWidget);
}Example 8
| Project: sphereMiners-master File: ErrorPopup.java View source code |
public static void create(String titleText, String longMessage, @Nullable Throwable t) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("A Problem occured while running Sphere Miners");
alert.setHeaderText(titleText);
alert.setContentText(longMessage);
if (t != null) {
Label label = new Label("The exception stacktrace was:");
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
TextArea textArea = new TextArea(sw.toString());
textArea.setEditable(false);
textArea.setWrapText(true);
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(label, 0, 0);
expContent.add(textArea, 0, 1);
// Set expandable Exception into the dialog pane.
alert.getDialogPane().setExpandableContent(expContent);
}
alert.showAndWait();
}Example 9
| Project: TwitDuke-master File: Main.java View source code |
@Override
public void start(Stage stage) throws Exception {
if (!existsTwitDukeDir()) {
DirectoryHelper.createTwitDukeDirectories();
}
AccountManager accountManager = AccountManagerFactory.newInstance();
if (accountManager.hasValidAccount()) {
FXMLLoader mainLoader = FXMLResources.MAIN.loader();
FXMLLoader toolbarLoader = FXMLResources.TWEET_TEXTAREA_TOOLBAR.loader();
FXMLLoader textAreaLoader = FXMLResources.TWEET_TEXTAREA.loader();
Scene main = new Scene(mainLoader.load());
MainViewController mainController = mainLoader.getController();
BorderPane borderPane = toolbarLoader.load();
TextArea textArea = textAreaLoader.load();
mainController.setTweetTextAreaToolbar(borderPane);
mainController.setTweetTextArea(textArea);
TweetTextareaToolbarController toolbarController = toolbarLoader.getController();
TweetTextareaController tweetTextareaController = textAreaLoader.getController();
toolbarController.addTweetTextAreaController(tweetTextareaController);
toolbarController.setSaveDraftButtonListener(tweetTextareaController);
applyKeymap(stage);
stage.setScene(main);
stage.show();
} else {
startOAuth(accountManager, System.out::println);
}
}Example 10
| Project: bitcoin-exchange-master File: CashDepositForm.java View source code |
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
CashDepositAccountContractData data = (CashDepositAccountContractData) paymentAccountContractData;
String countryCode = data.getCountryCode();
String requirements = data.getRequirements();
boolean showRequirements = requirements != null && !requirements.isEmpty();
if (data.getHolderTaxId() != null)
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name / email / " + BankUtil.getHolderIdLabel(countryCode), data.getHolderName() + " / " + data.getHolderEmail() + " / " + data.getHolderTaxId());
else
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name / email:", data.getHolderName() + " / " + data.getHolderEmail());
if (!showRequirements)
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Country of bank:", CountryUtil.getNameAndCode(countryCode));
else
requirements += "\nCountry of bank: " + CountryUtil.getNameAndCode(countryCode);
// We don't want to display more than 6 rows to avoid scrolling, so if we get too many fields we combine them horizontally
int nrRows = 0;
if (BankUtil.isBankNameRequired(countryCode))
nrRows++;
if (BankUtil.isBankIdRequired(countryCode))
nrRows++;
if (BankUtil.isBranchIdRequired(countryCode))
nrRows++;
if (BankUtil.isAccountNrRequired(countryCode))
nrRows++;
if (BankUtil.isAccountTypeRequired(countryCode))
nrRows++;
String bankNameLabel = BankUtil.getBankNameLabel(countryCode);
String bankIdLabel = BankUtil.getBankIdLabel(countryCode);
String branchIdLabel = BankUtil.getBranchIdLabel(countryCode);
String accountNrLabel = BankUtil.getAccountNrLabel(countryCode);
String accountTypeLabel = BankUtil.getAccountTypeLabel(countryCode);
boolean accountNrAccountTypeCombined = false;
boolean bankNameBankIdCombined = false;
boolean bankIdBranchIdCombined = false;
boolean bankNameBranchIdCombined = false;
boolean branchIdAccountNrCombined = false;
if (nrRows > 2) {
// Try combine AccountNr + AccountType
accountNrAccountTypeCombined = BankUtil.isAccountNrRequired(countryCode) && BankUtil.isAccountTypeRequired(countryCode);
if (accountNrAccountTypeCombined)
nrRows--;
if (nrRows > 2) {
// Next we try BankName + BankId
bankNameBankIdCombined = BankUtil.isBankNameRequired(countryCode) && BankUtil.isBankIdRequired(countryCode);
if (bankNameBankIdCombined)
nrRows--;
if (nrRows > 2) {
// Next we try BankId + BranchId
bankIdBranchIdCombined = !bankNameBankIdCombined && BankUtil.isBankIdRequired(countryCode) && BankUtil.isBranchIdRequired(countryCode);
if (bankIdBranchIdCombined)
nrRows--;
if (nrRows > 2) {
// Next we try BankId + BranchId
bankNameBranchIdCombined = !bankNameBankIdCombined && !bankIdBranchIdCombined && BankUtil.isBankNameRequired(countryCode) && BankUtil.isBranchIdRequired(countryCode);
if (bankNameBranchIdCombined)
nrRows--;
if (nrRows > 2) {
branchIdAccountNrCombined = !bankNameBranchIdCombined && !bankIdBranchIdCombined && !accountNrAccountTypeCombined && BankUtil.isBranchIdRequired(countryCode) && BankUtil.isAccountNrRequired(countryCode);
if (branchIdAccountNrCombined)
nrRows--;
if (nrRows > 2)
log.warn("We still have too many rows....");
}
}
}
}
}
if (bankNameBankIdCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel.substring(0, bankNameLabel.length() - 1) + " / " + bankIdLabel.substring(0, bankIdLabel.length() - 1) + ":", data.getBankName() + " / " + data.getBankId());
}
if (bankNameBranchIdCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel.substring(0, bankNameLabel.length() - 1) + " / " + branchIdLabel.substring(0, branchIdLabel.length() - 1) + ":", data.getBankName() + " / " + data.getBranchId());
}
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && BankUtil.isBankNameRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel, data.getBankName());
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && !branchIdAccountNrCombined && bankIdBranchIdCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankIdLabel.substring(0, bankIdLabel.length() - 1) + " / " + branchIdLabel.substring(0, branchIdLabel.length() - 1) + ":", data.getBankId() + " / " + data.getBranchId());
}
if (!bankNameBankIdCombined && !bankIdBranchIdCombined && BankUtil.isBankIdRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankIdLabel, data.getBankId());
if (!bankNameBranchIdCombined && !bankIdBranchIdCombined && branchIdAccountNrCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, branchIdLabel.substring(0, branchIdLabel.length() - 1) + " / " + accountNrLabel.substring(0, accountNrLabel.length() - 1) + ":", data.getBranchId() + " / " + data.getAccountNr());
}
if (!bankNameBranchIdCombined && !bankIdBranchIdCombined && !branchIdAccountNrCombined && BankUtil.isBranchIdRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, branchIdLabel, data.getBranchId());
if (!branchIdAccountNrCombined && accountNrAccountTypeCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountNrLabel.substring(0, accountNrLabel.length() - 1) + " / " + accountTypeLabel, data.getAccountNr() + " / " + data.getAccountType());
}
if (!branchIdAccountNrCombined && !accountNrAccountTypeCombined && BankUtil.isAccountNrRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountNrLabel, data.getAccountNr());
if (!accountNrAccountTypeCombined && BankUtil.isAccountTypeRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountTypeLabel, data.getAccountType());
if (showRequirements) {
TextArea textArea = addLabelTextArea(gridPane, ++gridRow, "Extra requirements:", "").second;
textArea.setMinHeight(45);
textArea.setMaxHeight(45);
textArea.setEditable(false);
textArea.setId("text-area-disabled");
textArea.setText(requirements);
}
return gridRow;
}Example 11
| Project: bitsquare-master File: CashDepositForm.java View source code |
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
CashDepositAccountContractData data = (CashDepositAccountContractData) paymentAccountContractData;
String countryCode = data.getCountryCode();
String requirements = data.getRequirements();
boolean showRequirements = requirements != null && !requirements.isEmpty();
if (data.getHolderTaxId() != null)
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name / email / " + BankUtil.getHolderIdLabel(countryCode), data.getHolderName() + " / " + data.getHolderEmail() + " / " + data.getHolderTaxId());
else
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name / email:", data.getHolderName() + " / " + data.getHolderEmail());
if (!showRequirements)
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Country of bank:", CountryUtil.getNameAndCode(countryCode));
else
requirements += "\nCountry of bank: " + CountryUtil.getNameAndCode(countryCode);
// We don't want to display more than 6 rows to avoid scrolling, so if we get too many fields we combine them horizontally
int nrRows = 0;
if (BankUtil.isBankNameRequired(countryCode))
nrRows++;
if (BankUtil.isBankIdRequired(countryCode))
nrRows++;
if (BankUtil.isBranchIdRequired(countryCode))
nrRows++;
if (BankUtil.isAccountNrRequired(countryCode))
nrRows++;
if (BankUtil.isAccountTypeRequired(countryCode))
nrRows++;
String bankNameLabel = BankUtil.getBankNameLabel(countryCode);
String bankIdLabel = BankUtil.getBankIdLabel(countryCode);
String branchIdLabel = BankUtil.getBranchIdLabel(countryCode);
String accountNrLabel = BankUtil.getAccountNrLabel(countryCode);
String accountTypeLabel = BankUtil.getAccountTypeLabel(countryCode);
boolean accountNrAccountTypeCombined = false;
boolean bankNameBankIdCombined = false;
boolean bankIdBranchIdCombined = false;
boolean bankNameBranchIdCombined = false;
boolean branchIdAccountNrCombined = false;
if (nrRows > 2) {
// Try combine AccountNr + AccountType
accountNrAccountTypeCombined = BankUtil.isAccountNrRequired(countryCode) && BankUtil.isAccountTypeRequired(countryCode);
if (accountNrAccountTypeCombined)
nrRows--;
if (nrRows > 2) {
// Next we try BankName + BankId
bankNameBankIdCombined = BankUtil.isBankNameRequired(countryCode) && BankUtil.isBankIdRequired(countryCode);
if (bankNameBankIdCombined)
nrRows--;
if (nrRows > 2) {
// Next we try BankId + BranchId
bankIdBranchIdCombined = !bankNameBankIdCombined && BankUtil.isBankIdRequired(countryCode) && BankUtil.isBranchIdRequired(countryCode);
if (bankIdBranchIdCombined)
nrRows--;
if (nrRows > 2) {
// Next we try BankId + BranchId
bankNameBranchIdCombined = !bankNameBankIdCombined && !bankIdBranchIdCombined && BankUtil.isBankNameRequired(countryCode) && BankUtil.isBranchIdRequired(countryCode);
if (bankNameBranchIdCombined)
nrRows--;
if (nrRows > 2) {
branchIdAccountNrCombined = !bankNameBranchIdCombined && !bankIdBranchIdCombined && !accountNrAccountTypeCombined && BankUtil.isBranchIdRequired(countryCode) && BankUtil.isAccountNrRequired(countryCode);
if (branchIdAccountNrCombined)
nrRows--;
if (nrRows > 2)
log.warn("We still have too many rows....");
}
}
}
}
}
if (bankNameBankIdCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel.substring(0, bankNameLabel.length() - 1) + " / " + bankIdLabel.substring(0, bankIdLabel.length() - 1) + ":", data.getBankName() + " / " + data.getBankId());
}
if (bankNameBranchIdCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel.substring(0, bankNameLabel.length() - 1) + " / " + branchIdLabel.substring(0, branchIdLabel.length() - 1) + ":", data.getBankName() + " / " + data.getBranchId());
}
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && BankUtil.isBankNameRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel, data.getBankName());
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && !branchIdAccountNrCombined && bankIdBranchIdCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankIdLabel.substring(0, bankIdLabel.length() - 1) + " / " + branchIdLabel.substring(0, branchIdLabel.length() - 1) + ":", data.getBankId() + " / " + data.getBranchId());
}
if (!bankNameBankIdCombined && !bankIdBranchIdCombined && BankUtil.isBankIdRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankIdLabel, data.getBankId());
if (!bankNameBranchIdCombined && !bankIdBranchIdCombined && branchIdAccountNrCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, branchIdLabel.substring(0, branchIdLabel.length() - 1) + " / " + accountNrLabel.substring(0, accountNrLabel.length() - 1) + ":", data.getBranchId() + " / " + data.getAccountNr());
}
if (!bankNameBranchIdCombined && !bankIdBranchIdCombined && !branchIdAccountNrCombined && BankUtil.isBranchIdRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, branchIdLabel, data.getBranchId());
if (!branchIdAccountNrCombined && accountNrAccountTypeCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountNrLabel.substring(0, accountNrLabel.length() - 1) + " / " + accountTypeLabel, data.getAccountNr() + " / " + data.getAccountType());
}
if (!branchIdAccountNrCombined && !accountNrAccountTypeCombined && BankUtil.isAccountNrRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountNrLabel, data.getAccountNr());
if (!accountNrAccountTypeCombined && BankUtil.isAccountTypeRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountTypeLabel, data.getAccountType());
if (showRequirements) {
TextArea textArea = addLabelTextArea(gridPane, ++gridRow, "Extra requirements:", "").second;
textArea.setMinHeight(45);
textArea.setMaxHeight(45);
textArea.setEditable(false);
textArea.setId("text-area-disabled");
textArea.setText(requirements);
}
return gridRow;
}Example 12
| Project: javaee7-samples-master File: GoogleDocClient.java View source code |
@Override
public void start(Stage stage) throws Exception {
final Session session = connectToServer();
System.out.println("Connected to server: " + session.getId());
stage.setTitle("Google Docs Emulator using WebSocket");
textarea = new TextArea();
textarea.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
System.out.println("New value: " + newValue);
try {
session.getBasicRemote().sendText(newValue);
} catch (IOException ex) {
Logger.getLogger(GoogleDocClient.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
textarea.setPrefSize(500, 300);
textarea.setWrapText(true);
Scene scene = new Scene(textarea);
stage.setScene(scene);
stage.show();
}Example 13
| Project: chunky-master File: ChunkyErrorDialog.java View source code |
/**
* Add a log record to be displayed by this error dialog.
*/
public synchronized void addErrorMessage(String message) {
errorCount += 1;
BorderPane.setMargin(tabPane, new Insets(10, 0, 0, 0));
BorderPane pane = new BorderPane();
pane.setPadding(new Insets(10));
TextArea text = new TextArea();
text.setText(message);
text.setEditable(false);
text.setPrefHeight(Region.USE_COMPUTED_SIZE);
pane.setPrefHeight(Region.USE_COMPUTED_SIZE);
pane.setCenter(text);
Button dismiss = new Button("Dismiss");
BorderPane.setAlignment(dismiss, Pos.BOTTOM_RIGHT);
BorderPane.setMargin(dismiss, new Insets(10, 0, 0, 0));
pane.setBottom(dismiss);
Tab tab = new Tab("Error " + errorCount, pane);
tabPane.getTabs().add(tab);
dismiss.setOnAction( event -> {
tabPane.getTabs().remove(tab);
if (tabPane.getTabs().isEmpty()) {
hide();
}
});
}Example 14
| Project: chvote-1-0-master File: InterruptibleProcessController.java View source code |
private void showAlert(ProcessInterruptedException e) {
Alert alert = new Alert(Alert.AlertType.ERROR);
ResourceBundle resources = getResourceBundle();
alert.setTitle(resources.getString("exception_alert.title"));
alert.setHeaderText(resources.getString("exception_alert.header"));
alert.setContentText(e.getMessage());
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
String exceptionText = sw.toString();
Label stackTraceLabel = new Label(resources.getString("exception_alert.label"));
TextArea stackTraceTextArea = new TextArea(exceptionText);
stackTraceTextArea.setEditable(false);
stackTraceTextArea.setWrapText(true);
GridPane.setVgrow(stackTraceTextArea, Priority.ALWAYS);
GridPane.setHgrow(stackTraceTextArea, Priority.ALWAYS);
GridPane expandableContent = new GridPane();
expandableContent.setPrefSize(400, 400);
expandableContent.setMaxWidth(Double.MAX_VALUE);
expandableContent.add(stackTraceLabel, 0, 0);
expandableContent.add(stackTraceTextArea, 0, 1);
alert.getDialogPane().setExpandableContent(expandableContent);
// Expandable zones cause the dialog not to resize correctly
if (System.getProperty("os.name").matches(".*[Ll]inux.*")) {
alert.getDialogPane().setPrefSize(600, 400);
alert.setResizable(true);
alert.getDialogPane().setExpanded(true);
}
alert.showAndWait();
}Example 15
| Project: joa-master File: NoteTaskPane.java View source code |
@Override
public Scene createScene() throws ComException {
// The Outlook application interface
app = Globals.getThisAddin().getApplication();
// Selected mail
mailItem = inspector.getCurrentItem().as(MailItem.class);
// Categories
final Categories categories = app.GetNamespace("MAPI").getCategories();
catList = CategoryItem.createObservableListOfCategories(categories);
catList.sort(( p, q) -> p.toString().compareTo(q.toString()));
// ------------------------------------------------------------------------
// The task panes position might be of interest for building the layout
// of the scene:
// MsoCTPDockPosition dockPosition =
// super.customTaskPane.getDockPosition();
// int wd = super.customTaskPane.getWidth();
// int ht = super.customTaskPane.getHeight();
// Allow to dock the task pane only at the left and right border
// of the inspector window
customTaskPane.setDockPositionRestrict(MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoHorizontal);
// ------------------------------------------------------------------------
// Initialize note category with mail category
String mailCats = mailItem.getCategories();
if (mailCats != null && mailCats.length() != 0) {
String[] mailCatArr = mailCats.split(categoryListDelimiter);
String mailCat = mailCatArr.length != 0 ? mailCatArr[mailCatArr.length - 1] : null;
if (mailCat != null) {
for (CategoryItem cat : catList) {
if (cat.toString().equals(mailCat)) {
noteGridDefaultBackgColor = cat.getColor();
break;
}
}
}
}
// ------------------------------------------------------------------------
// Build the scene
VBox root = new VBox();
root.setSpacing(4);
final Scene scene = new Scene(root);
scene.getStylesheets().add("com/wilutions/joa/example/cnaddin/stylesheet.css");
// ------------------------------------------------------------------------
// The note is displayed in a view based on a GridPane with three
// columns
int noteRowIdx = 0;
noteGrid = new GridPane();
setNoteGridStyleIfUnsafed(noteGrid, noteGridDefaultBackgColor);
noteGrid.setPadding(new Insets(2));
noteGrid.setVgap(2);
root.getChildren().add(noteGrid);
// ------------------------------------------------------------------------
// The note header bar
int headerRectsSize = 16;
noteGrid.getRowConstraints().add(new RowConstraints(headerRectsSize, headerRectsSize, headerRectsSize));
noteGrid.getColumnConstraints().add(new ColumnConstraints(headerRectsSize, headerRectsSize, headerRectsSize));
noteGrid.getColumnConstraints().add(new ColumnConstraints(headerRectsSize, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true));
noteGrid.getColumnConstraints().add(new ColumnConstraints(headerRectsSize, headerRectsSize, headerRectsSize));
// Note icon in left column
Image img = new Image("com/wilutions/joa/example/cnaddin/NoteIcon.png");
ImageView noteLeftBox = new ImageView(img);
noteLeftBox.setFitWidth(16);
noteLeftBox.setFitHeight(16);
// Note header label (*New*, *Modified*, -Saved-)
VBox noteHeaderBar = new VBox();
GridPane.setMargin(noteHeaderBar, new Insets(8, 4, 8, 4));
noteHeaderBar.setAlignment(Pos.CENTER);
noteHeaderLabel = new Label();
noteHeaderLabel.setStyle("-fx-background-color: " + toRGB(noteHeaderColor) + "; -fx-text-fill: white");
noteHeaderLabel.setMinHeight(16);
noteHeaderLabel.setMaxHeight(16);
noteHeaderLabel.setMinWidth(10);
noteHeaderLabel.setMaxWidth(Double.MAX_VALUE);
noteHeaderLabel.setAlignment(Pos.CENTER);
updateNoteState(NoteState.New);
noteHeaderBar.getChildren().add(noteHeaderLabel);
// Right square
Rectangle noteRightBox = new Rectangle(headerRectsSize, headerRectsSize, noteHeaderColor);
noteGrid.add(noteLeftBox, 0, noteRowIdx);
noteGrid.add(noteHeaderBar, 1, noteRowIdx);
noteGrid.add(noteRightBox, 2, noteRowIdx);
noteRowIdx++;
// --------------------------------------------------------------------
// Edit box for note text
noteText = new TextArea();
noteText.setPrefRowCount(10);
noteText.setWrapText(true);
String subject = mailItem.getSubject();
if (!subject.isEmpty()) {
noteText.setText(subject + CRLF);
}
noteGrid.add(noteText, 0, noteRowIdx++, 3, 1);
noteGrid.getRowConstraints().add(new RowConstraints());
// Add a change listener to set the header label to "*Modified*".
noteText.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
updateNoteState(NoteState.Modified);
}
});
// The edit box should not eat the TAB key. This listener forwards
// the focus to the next control, if the TAB key is pressed.
noteText.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (event.getCode() == KeyCode.TAB) {
TextAreaSkin skin = (TextAreaSkin) noteText.getSkin();
if (skin.getBehavior() instanceof TextAreaBehavior) {
TextAreaBehavior behavior = (TextAreaBehavior) skin.getBehavior();
if (event.isControlDown()) {
behavior.callAction("InsertTab");
} else if (event.isShiftDown()) {
behavior.callAction("TraversePrevious");
} else {
behavior.callAction("TraverseNext");
}
event.consume();
}
}
}
});
// --------------------------------------------------------------------
// Line between edit box and date label
Line noteBottomLine = new Line();
noteBottomLine.setStartX(0);
noteBottomLine.setStartY(0);
noteBottomLine.setEndX(0);
noteBottomLine.setEndY(0);
NumberBinding bottomLineBinding = Bindings.add(noteGrid.widthProperty(), 0);
noteBottomLine.endXProperty().bind(bottomLineBinding.subtract(8));
noteGrid.add(noteBottomLine, 0, noteRowIdx++, 3, 1);
noteGrid.getRowConstraints().add(new RowConstraints(3, 3, 3));
// --------------------------------------------------------------------
// Date label
final Text noteDate = new Text();
noteDate.setStyle("-fx-font: 12px \"Courier\"; -fx-font-weight: bold");
noteGrid.getRowConstraints().add(new RowConstraints());
noteGrid.add(noteDate, 0, noteRowIdx++, 3, 1);
// This timer updates the note date
timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
Platform.runLater(() -> {
DateTimeFormatter dateFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT);
ZonedDateTime date = ZonedDateTime.now();
noteDate.setText(date.format(dateFormatter));
});
}
}, 0, 1000);
// --------------------------------------------------------------------
// Checkbox "Display new note"
ckDisplay = new CheckBox("Display new note");
ckDisplay.setSelected(reg_displayNote);
root.getChildren().add(ckDisplay);
// --------------------------------------------------------------------
// Checkbox "Assign category to mail"
ckCatMail = new CheckBox("Assign category to mail");
ckCatMail.setSelected(reg_alsoCategorizeMail);
root.getChildren().add(ckCatMail);
for (CategoryItem cat : catList) {
Button btn = new Button(cat.toString());
root.getChildren().add(btn);
String style = "-fx-background-color: " + toRGB(cat.getColor()) + "; ";
if (isDarkColor(cat.getColor())) {
style += "-fx-text-fill: white;";
}
btn.setStyle(style);
btn.setMaxWidth(Double.MAX_VALUE);
btn.setMaxHeight(20);
btn.setCursor(Cursor.HAND);
btn.setTooltip(new Tooltip("Create the note \n and assign it to category \"" + cat.toString() + "\"."));
// This event handlers color the note view with the color of the
// category
btn.setOnMouseEntered(( e) -> setNoteGridStyleIfUnsafed(noteGrid, cat.getColor()));
btn.setOnMouseExited(( e) -> setNoteGridStyleIfUnsafed(noteGrid, noteGridDefaultBackgColor));
// This action handler creates the note.
btn.setOnAction(new CategoryButtonActionEvent(cat));
}
return scene;
}Example 16
| Project: ScreenFX-master File: RunDemo.java View source code |
@Override
public void start(final Stage stage) {
try {
Stage stage1 = stage;
stage1.setResizable(true);
stage1.setWidth(300);
stage1.setHeight(300);
stage1.setX(200);
stage1.setY(200);
stage1.initStyle(StageStyle.DECORATED);
stage1.setTitle("ScreenFX 1. stage");
URL location = getClass().getResource("/examples/RunDemo.fxml");
FXMLLoader fxmlLoader = new FXMLLoader();
Parent root = (Parent) fxmlLoader.load(location.openStream());
Scene sc = new Scene(root);
ScreenFXDemo fooController = (ScreenFXDemo) fxmlLoader.getController();
stage1.setScene(sc);
ScreenFX sfx0 = new ScreenFX();
sfx0.installOn(fooController.getButtonShowScreenFX(), true);
sfx0.installOn(fooController.getToggleButtonScreenFX(), false);
stage1.show();
Stage infoStage = new Stage(StageStyle.UNIFIED);
ScreenFX sfx1 = new ScreenFX();
sfx1.installOn(infoStage);
infoStage.setTitle("ScreenFX info box");
AnchorPane secondaryStageRoot = new AnchorPane();
TextArea description = new TextArea(sfx1.getTooltipText());
description.setEditable(false);
description.setWrapText(true);
AnchorPane.setBottomAnchor(description, 0d);
AnchorPane.setTopAnchor(description, 0d);
AnchorPane.setLeftAnchor(description, 0d);
AnchorPane.setRightAnchor(description, 0d);
secondaryStageRoot.getChildren().add(description);
infoStage.setWidth(300);
infoStage.setHeight(300);
infoStage.setX(500);
infoStage.setY(200);
infoStage.setScene(new Scene(secondaryStageRoot));
infoStage.show();
Stage stage2 = new Stage();
stage2.setTitle("ScreenFX 2. stage");
AnchorPane stage2root = new AnchorPane();
stage2.initStyle(StageStyle.DECORATED);
// stage2.setResizable(false);
Button button = new Button("Show ScreenFX");
stage2root.getChildren().add(button);
stage2.setWidth(300);
stage2.setHeight(300);
stage2.setX(200);
stage2.setY(500);
Scene scene = new Scene(stage2root);
stage2.setScene(scene);
ScreenFX sfx2 = new ScreenFX();
// install the resize
sfx2.installOn(button, false);
// controller
// a stage to control another
// stage
stage2.show();
Stage stage3 = new Stage();
stage3.setTitle("ScreenFX 3. stage");
AnchorPane stage3root = new AnchorPane();
stage3root.getChildren().add(button);
stage3.setWidth(300);
stage3.setHeight(300);
stage3.setX(500);
stage3.setY(500);
stage3.setScene(new Scene(stage3root));
stage3.show();
} catch (Exception e) {
e.printStackTrace();
}
}Example 17
| Project: AoW-Java-API-master File: JavaFxConsole.java View source code |
/**
* @throws IOException If an error loading the .fxml file occurs.
*/
public Parent build() throws IOException {
final Parent consoleNode = (Parent) loader.load();
// Create the terminal.
final TextArea textArea = (TextArea) consoleNode.lookup("#terminal");
textArea.setFocusTraversable(false);
mTerminal = new JavaFxTerminal(textArea);
// Create the shell.
final DisplayDriver displayDriver = new TerminalDisplayDriver(mTerminal, configuration);
final Shell shell = new Shell(fileSystem, displayDriver, welcomeMessage);
// Create the command line.
final TextField commandLine = (TextField) consoleNode.lookup("#commandLine");
final CommandLineDriver commandLineDriver = new JavaFxCommandLineDriver(commandLine);
// Create the console.
final Console console = new ConsoleImpl(shell, commandLineDriver, maxCommandHistory);
// Hook the commandLine to the console.
commandLine.requestFocus();
commandLine.addEventFilter(KeyEvent.KEY_PRESSED, new JavaFxConsoleDriver(console));
return consoleNode;
}Example 18
| Project: CCAutotyper-master File: FXGuiUtils.java View source code |
public static Alert buildLongAlert(String context, String longMessage, Node... additional) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setHeaderText(context);
Label label = new Label("Details: ");
TextArea textArea = new TextArea(longMessage);
textArea.setEditable(false);
textArea.setWrapText(false);
textArea.setMaxHeight(Double.MAX_VALUE);
textArea.setMaxWidth(Double.MAX_VALUE);
GridPane.setVgrow(textArea, Priority.ALWAYS);
GridPane.setHgrow(textArea, Priority.ALWAYS);
GridPane expanded = new GridPane();
expanded.setMaxWidth(Double.MAX_VALUE);
expanded.add(label, 0, 0);
expanded.add(textArea, 0, 1);
for (int i = 0; i < additional.length; i++) expanded.add(additional[i], 0, 2 + i);
alert.getDialogPane().setContent(expanded);
alert.getDialogPane().setPrefWidth(700);
alert.getDialogPane().setPrefHeight(400);
return alert;
}Example 19
| Project: grantmaster-master File: Utils.java View source code |
public static Optional<ButtonType> showSimpleErrorDialog(String title, String message, List<ButtonType> extraButtons) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle(Utils.getString(title));
alert.setResizable(true);
TextArea text = new TextArea(message);
text.setWrapText(true);
text.setEditable(false);
alert.setGraphic(text);
if (extraButtons != null) {
alert.getButtonTypes().addAll(extraButtons);
}
return alert.showAndWait();
}Example 20
| Project: htm.java-examples-master File: BreakingNewsDemoView.java View source code |
public DualPanel createInputPane() {
DualPanel retVal = new DualPanel();
LabelledRadiusPane left = new LabelledRadiusPane("Input Tweet");
TextArea lArea = new TextArea();
lArea.setWrapText(true);
lArea.setFont(Font.font("Helvetica", FontWeight.MEDIUM, 16));
lArea.layoutYProperty().bind(left.labelHeightProperty().add(10));
left.layoutBoundsProperty().addListener(( v, o, n) -> {
lArea.setLayoutX(10);
lArea.setPrefWidth(n.getWidth() - 20);
lArea.setPrefHeight(n.getHeight() - left.labelHeightProperty().get() - 20);
});
Label queueLabel = new Label("Processing Queue Size:");
queueLabel.layoutXProperty().bind(lArea.widthProperty().subtract(queueLabel.getLayoutBounds().getWidth() + 330));
queueLabel.setLayoutY(lArea.getLayoutY() - queueLabel.getLayoutBounds().getHeight() - 35);
queueLabel.setFont(Font.font("Helvetica", FontWeight.BOLD, 12));
queueLabel.setTextFill(Color.rgb(00, 70, 107));
queueDisplayProperty.set(queueLabel);
Label curLabel = new Label("Current Tweet:");
curLabel.layoutXProperty().bind(lArea.widthProperty().subtract(curLabel.getLayoutBounds().getWidth() + 110));
curLabel.setLayoutY(lArea.getLayoutY() - curLabel.getLayoutBounds().getHeight() - 35);
curLabel.setFont(Font.font("Helvetica", FontWeight.BOLD, 12));
curLabel.setTextFill(Color.rgb(00, 70, 107));
currentLabelProperty.set(curLabel.textProperty());
left.getChildren().addAll(lArea, queueLabel, curLabel);
LabelledRadiusPane right = new LabelledRadiusPane("Scrubbed Tweet");
TextArea rArea = new TextArea();
rArea.setWrapText(true);
rArea.setFont(Font.font("Helvetica", FontWeight.MEDIUM, 16));
rArea.layoutYProperty().bind(right.labelHeightProperty().add(10));
right.layoutBoundsProperty().addListener(( v, o, n) -> {
rArea.setLayoutX(10);
rArea.setPrefWidth(n.getWidth() - 20);
rArea.setPrefHeight(n.getHeight() - right.labelHeightProperty().get() - 20);
});
right.getChildren().add(rArea);
retVal.setLeftPane(left);
retVal.setRightPane(right);
inputPaneProperty.set(new Pair<>(lArea, rArea));
return retVal;
}Example 21
| Project: JacpFX-demos-master File: ComponentLeftTop.java View source code |
/**
* create the UI on first call
*
* @return
*/
private Node createUI() {
text = new TextArea();
text.setText("");
text.setWrapText(true);
text.setStyle("-fx-background-color: #4D7A97; -fx-text-fill: #e1e1e1; -fx-font-style: oblique;-fx-font-size: 20;");
HBox.setHgrow(text, Priority.ALWAYS);
VBox.setVgrow(text, Priority.ALWAYS);
text.setMaxHeight(250);
return text;
}Example 22
| Project: JFXScad-master File: RedirectableStream.java View source code |
@Override
public synchronized void write(byte[] buf, int off, int len) {
if (isRedirectToUi()) {
invokeAndWait(() -> {
int i = 0;
for (TextArea view : views) {
String s = new String(buf, off, len);
if (filters.get(i).onMatch(s)) {
try {
int startOffSet = view.getText().length();
view.insertText(startOffSet, s);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
}
i++;
}
});
// view.setCaretPosition(startOffSet + len);
// }
// catch (BadLocationException e) {
// e.printStackTrace();
// Platform.invokeLater(new Runnable() {
//
// @Override
// public void run() {
// // automatically scroll down to the last line
//// view.scrollRectToVisible(
//// new Rectangle(0, view.getHeight() - 1, 1, 1));
//
// }
// });
}
if (isRedirectToStdOut()) {
super.write(buf, off, len);
}
}Example 23
| Project: jfxtras-master File: PopupReviseAllTest.java View source code |
@Test
public void canEditDescribableProperties() {
VEvent vevent = ICalendarStaticComponents.getDaily1();
TestUtil.runThenWaitForPaintPulse(() -> {
getEditComponentPopup().setupData(vevent, LocalDateTime.of(2016, 5, 15, 10, 0), LocalDateTime.of(2016, 5, 15, 11, 0), categories());
});
// Get properties
LocalDateTimeTextField startDateTimeTextField = find("#startDateTimeTextField");
LocalDateTimeTextField endDateTimeTextField = find("#endDateTimeTextField");
CheckBox wholeDayCheckBox = find("#wholeDayCheckBox");
TextField summaryTextField = find("#summaryTextField");
TextArea descriptionTextArea = find("#descriptionTextArea");
TextField locationTextField = find("#locationTextField");
TextField categoryTextField = find("#categoryTextField");
CategorySelectionGridPane categorySelectionGridPane = find("#categorySelectionGridPane");
// Check initial state
assertEquals(LocalDateTime.of(2016, 5, 15, 10, 00), startDateTimeTextField.getLocalDateTime());
assertEquals(LocalDateTime.of(2016, 5, 15, 11, 00), endDateTimeTextField.getLocalDateTime());
assertTrue(startDateTimeTextField.isVisible());
assertTrue(endDateTimeTextField.isVisible());
assertEquals("Daily1 Summary", summaryTextField.getText());
assertEquals("Daily1 Description", descriptionTextArea.getText());
assertEquals("group05", categoryTextField.getText());
assertFalse(wholeDayCheckBox.isSelected());
// Edit and check properties
TestUtil.runThenWaitForPaintPulse(() -> wholeDayCheckBox.setSelected(true));
LocalDateTextField startDateTextField = find("#startDateTextField");
LocalDateTextField endDateTextField = find("#endDateTextField");
assertEquals(LocalDate.of(2016, 5, 15), startDateTextField.getLocalDate());
assertEquals(LocalDate.of(2016, 5, 16), endDateTextField.getLocalDate());
assertTrue(startDateTextField.isVisible());
assertTrue(endDateTextField.isVisible());
TestUtil.runThenWaitForPaintPulse(() -> wholeDayCheckBox.setSelected(false));
assertTrue(startDateTimeTextField.isVisible());
assertTrue(endDateTimeTextField.isVisible());
// Make changes
startDateTimeTextField.setLocalDateTime(LocalDateTime.of(2016, 5, 15, 8, 0));
summaryTextField.setText("new summary");
descriptionTextArea.setText("new description");
locationTextField.setText("new location");
TestUtil.runThenWaitForPaintPulse(() -> categorySelectionGridPane.setCategorySelected(11));
assertEquals("group11", categoryTextField.getText());
categoryTextField.setText("new group name");
// save to all
clickOn("#saveComponentButton");
ComboBox<ChangeDialogOption> comboBox = find("#changeDialogComboBox");
TestUtil.runThenWaitForPaintPulse(() -> {
comboBox.getSelectionModel().select(ChangeDialogOption.ALL);
});
clickOn("#changeDialogOkButton");
// test iTIP message
List<VCalendar> vMessages = getEditComponentPopup().iTIPMessagesProperty().get();
assertEquals(1, vMessages.size());
VCalendar vMessage = vMessages.get(0);
assertEquals(1, vMessage.getVEvents().size());
VEvent revisedVEvent = vMessage.getVEvents().get(0);
VEvent expectedRevisedVEvent = ICalendarStaticComponents.getDaily1();
expectedRevisedVEvent.setCategories(null);
expectedRevisedVEvent.withDateTimeStart(LocalDateTime.of(2015, 11, 9, 8, 0)).withDateTimeEnd(LocalDateTime.of(2015, 11, 9, 9, 0)).withSummary("new summary").withDescription("new description").withLocation("new location").withCategories(Arrays.asList(new Categories("new group name"))).withDateTimeStamp(revisedVEvent.getDateTimeStamp()).withSequence(1);
assertEquals(expectedRevisedVEvent, revisedVEvent);
String iTIPMessage = vMessages.stream().map( v -> v.toString()).collect(Collectors.joining(System.lineSeparator()));
String dtStamp = getEditComponentPopup().iTIPMessagesProperty().get().get(0).getVEvents().get(0).getDateTimeStamp().toString();
String expectediTIPMessage = "BEGIN:VCALENDAR" + System.lineSeparator() + "METHOD:REQUEST" + System.lineSeparator() + "PRODID:" + ICalendarAgenda.DEFAULT_PRODUCT_IDENTIFIER + System.lineSeparator() + "VERSION:" + Version.DEFAULT_ICALENDAR_SPECIFICATION_VERSION + System.lineSeparator() + "BEGIN:VEVENT" + System.lineSeparator() + "CATEGORIES:new group name" + System.lineSeparator() + "DTSTART:20151109T080000" + System.lineSeparator() + "DTEND:20151109T090000" + System.lineSeparator() + "DESCRIPTION:new description" + System.lineSeparator() + "SUMMARY:new summary" + System.lineSeparator() + dtStamp + System.lineSeparator() + "UID:20150110T080000-004@jfxtras.org" + System.lineSeparator() + "RRULE:FREQ=DAILY" + System.lineSeparator() + "ORGANIZER;CN=Papa Smurf:mailto:papa@smurf.org" + System.lineSeparator() + "LOCATION:new location" + System.lineSeparator() + "SEQUENCE:1" + System.lineSeparator() + "END:VEVENT" + System.lineSeparator() + "END:VCALENDAR";
assertEquals(expectediTIPMessage, iTIPMessage);
}Example 24
| Project: jointry-master File: MainDemo.java View source code |
@Override
public void start(Stage stage) {
stage.setTitle("FX Keyboard (" + System.getProperty("javafx.runtime.version") + ")");
stage.setResizable(true);
String fontUrl = this.getClass().getResource("/font/FontKeyboardFX.ttf").toExternalForm();
Font f = Font.loadFont(fontUrl, -1);
System.err.println(f);
/*
Path numblockLayout = null;
try {
numblockLayout = Paths.get(this.getClass().getResource("/xml/numblock").toURI());
} catch (URISyntaxException e) {
e.printStackTrace();
}
popup = KeyBoardPopupBuilder.create().initScale(1.0).initLocale(Locale.ENGLISH).addIRobot(RobotFactory.createFXRobot()).layerPath(numblockLayout)
.build();
*/
popup = KeyBoardPopupBuilder.create().initScale(1.0).initLocale(Locale.ENGLISH).addIRobot(RobotFactory.createFXRobot()).build();
popup.getKeyBoard().setOnKeyboardCloseButton(new EventHandler<Event>() {
public void handle(Event event) {
setPopupVisible(false, null);
}
});
FlowPane pane = new FlowPane();
pane.setVgap(20);
pane.setHgap(20);
pane.setPrefWrapLength(100);
final TextField tf = new TextField("");
final TextArea ta = new TextArea("");
Button okButton = new Button("Ok");
okButton.setDefaultButton(true);
Button cancelButton = new Button("Cancel");
cancelButton.setCancelButton(true);
pane.getChildren().add(new Label("Text1"));
pane.getChildren().add(tf);
pane.getChildren().add(new Label("Text2"));
pane.getChildren().add(ta);
pane.getChildren().add(okButton);
pane.getChildren().add(cancelButton);
//pane.getChildren().add(KeyBoardBuilder.create().addIRobot(RobotFactory.createFXRobot()).build());
Scene scene = new Scene(pane, 200, 300);
// add keyboard scene listener to all text components
scene.focusOwnerProperty().addListener(new ChangeListener<Node>() {
@Override
public void changed(ObservableValue<? extends Node> value, Node n1, Node n2) {
if (n2 != null && n2 instanceof TextInputControl) {
setPopupVisible(true, (TextInputControl) n2);
} else {
setPopupVisible(false, null);
}
}
});
String css = this.getClass().getResource("/css/KeyboardButtonStyle.css").toExternalForm();
scene.getStylesheets().add(css);
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
public void handle(WindowEvent event) {
System.exit(0);
}
});
stage.setScene(scene);
popup.show(stage);
stage.show();
}Example 25
| Project: tilisty-master File: PropertyPanel.java View source code |
/**
* Sets up the default properties required by the GridPane
*
*/
private void setupLayout() {
this.setHgap(10);
this.setVgap(10);
this.setPadding(new Insets(25, 25, 25, 25));
this.setAlignment(Pos.CENTER);
jsonView = new TextArea();
jsonView.setEditable(false);
jsonView.setPrefHeight(TilistyView.APP_HEIGHT);
jsonView.setPrefWidth(TilistyView.APP_WIDTH);
//jsonView.applyCss();
//set the default title for all properties panels.
Text scenetitle = new Text("PROPERTIES");
scenetitle.setFont(Font.font("Arial", FontWeight.NORMAL, 20));
this.add(scenetitle, 0, 0, 1, 1);
switchButton = new Button("VIEW JSON");
switchButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
if (currentView != null) {
if (switchButton.getText().equals("VIEW JSON")) {
switchButton.setText("VIEW PROPERTIES");
displayJSON();
} else {
switchButton.setText("VIEW JSON");
renderPropertiesForView(currentView);
}
}
}
});
this.add(switchButton, 1, 0);
}Example 26
| Project: aic-praise-master File: FXUtil.java View source code |
public static void exception(Throwable th) {
Dialog<ButtonType> dialog = new Dialog<ButtonType>();
dialog.setTitle("Program exception");
final DialogPane dialogPane = dialog.getDialogPane();
dialogPane.setContentText("Details of the problem:");
dialogPane.getButtonTypes().addAll(ButtonType.OK);
dialogPane.setContentText(th.getMessage());
dialog.initModality(Modality.APPLICATION_MODAL);
Label label = new Label("Exception stacktrace:");
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
th.printStackTrace(pw);
pw.close();
TextArea textArea = new TextArea(sw.toString());
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, Priority.ALWAYS);
GridPane.setHgrow(textArea, Priority.ALWAYS);
GridPane root = new GridPane();
root.setVisible(false);
root.setMaxWidth(Double.MAX_VALUE);
root.add(label, 0, 0);
root.add(textArea, 0, 1);
dialogPane.setExpandableContent(root);
dialog.showAndWait();
}Example 27
| Project: bgfinancas-master File: Janela.java View source code |
public static void showException(Exception ex) {
Alert alerta = new Alert(AlertType.ERROR);
alerta.setTitle(idioma.getMensagem("erro"));
alerta.setHeaderText(null);
alerta.setContentText(ex.getMessage());
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
String exceptionText = sw.toString();
TextArea textArea = new TextArea(exceptionText);
textArea.setBackground(Background.EMPTY);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
alerta.getDialogPane().setExpandableContent(textArea);
alerta.showAndWait();
}Example 28
| Project: Bias-master File: DialogUtil.java View source code |
/**
* Shows an exception {@link Dialog} with the specified properties. This is an error {@link Dialog} which contains
* the stack trace of the {@link Throwable} as expandable content.
* <p>
*
* @param appCtx the {@link ApplicationContext} for the application
* @param title the title of the {@link Dialog}
* @param header the header of the {@link Dialog}
* @param content the content of the {@link Dialog}
* @param t the {@link Throwable} whose stacktrace will be included in the {@link Dialog}
*/
public static void showExceptionDialog(ApplicationContext appCtx, String title, String header, String content, Throwable t) {
Alert alert = new Alert(ERROR);
alert.setTitle(title);
alert.setHeaderText(header);
alert.setContentText(content);
String exceptionText = null;
try (StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw)) {
t.printStackTrace(pw);
exceptionText = sw.toString();
} catch (IOException ioe) {
}
Label label = new Label(appCtx.textFor(CONTENT_LABEL_EXCEPTION));
TextArea textArea = new TextArea(exceptionText);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, ALWAYS);
GridPane.setHgrow(textArea, ALWAYS);
GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(label, 0, 0);
expContent.add(textArea, 0, 1);
// Set expandable Exception into the dialog pane.
alert.getDialogPane().setExpandableContent(expContent);
alert.showAndWait();
}Example 29
| Project: blackmarket-master File: Dialogs.java View source code |
public static void showExceptionDialog(Throwable throwable) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Sorry something wrong happened");
String header = throwable.getMessage();
header = isBlank(header) ? throwable.getClass().getSimpleName() : header;
alert.setHeaderText(header);
// alert.setGraphic(new ImageView(ImageCache.getInstance().get("/images/gallio/gallio-"
// + comics[RandomUtils.nextInt(0, 3)] +
// ".png")));
alert.setGraphic(new ImageView(ImageCache.getInstance().get("/images/gallio/gallio-sad.png")));
// Create expandable Exception.
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
throwable.printStackTrace(pw);
String exceptionText = sw.toString();
StringBuilder sb = new StringBuilder();
// sb.append("Error Message: ");
// sb.append(System.lineSeparator());
// sb.append(throwable.getMessage());
sb.append("The exception stacktrace was:");
sb.append(System.lineSeparator());
sb.append(exceptionText);
TextArea textArea = new TextArea(sb.toString());
textArea.setEditable(false);
textArea.setWrapText(false);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(150);
// Set expandable Exception into the dialog pane.
alert.getDialogPane().setExpandableContent(textArea);
alert.getDialogPane().setExpanded(true);
alert.showAndWait();
}Example 30
| Project: e-fx-clipse-master File: MediaPropertiesView.java View source code |
@PostConstruct
void init(BorderPane pane) {
VBox box = new VBox();
GridPane mediaProperties = new GridPane();
EMFDataBindingContext dbc = new EMFDataBindingContext();
{
Label l = new Label("Title");
mediaProperties.add(l, 0, 0);
TextField f = new TextField();
IEMFValueProperty mProp = EMFProperties.value(MEDIA__TITLE);
IJFXBeanValueProperty tProp = JFXBeanProperties.value("text");
dbc.bindValue(tProp.observe(f), mProp.observeDetail(currentSelection));
mediaProperties.add(f, 1, 0);
GridPane.setHgrow(f, Priority.ALWAYS);
}
{
Label l = new Label("Description");
mediaProperties.add(l, 0, 1);
GridPane.setValignment(l, VPos.TOP);
TextArea area = new TextArea();
area.setPrefColumnCount(5);
mediaProperties.add(area, 1, 1);
GridPane.setHgrow(area, Priority.ALWAYS);
dbc.bindValue(EMFProperties.value(MEDIA__DESCRIPTION).observeDetail(currentSelection), JFXBeanProperties.value("text").observe(area));
}
TitledPane generalProps = new TitledPane("General Properties", mediaProperties);
box.getChildren().add(generalProps);
photoAreas = new TableView<PhotoArea>();
{
TableColumn<PhotoArea, String> col = new TableColumn<PhotoArea, String>();
col.setText("Bounds");
col.setPrefWidth(50);
{
TableColumn<PhotoArea, Double> subCol = new TableColumn<PhotoArea, Double>();
subCol.setText("x");
subCol.setPrefWidth(20);
subCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<PhotoArea, Double>, ObservableValue<Double>>() {
@Override
public ObservableValue<Double> call(final CellDataFeatures<PhotoArea, Double> param) {
return AdapterFactory.adapt(EMFProperties.value(PHOTO_AREA__X).observe(param.getValue()));
}
});
col.getColumns().add(subCol);
}
{
TableColumn<PhotoArea, Double> subCol = new TableColumn<PhotoArea, Double>();
subCol.setText("y");
subCol.setPrefWidth(20);
subCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<PhotoArea, Double>, ObservableValue<Double>>() {
@Override
public ObservableValue<Double> call(final CellDataFeatures<PhotoArea, Double> param) {
return AdapterFactory.adapt(EMFProperties.value(PHOTO_AREA__Y).observe(param.getValue()));
}
});
col.getColumns().add(subCol);
}
{
TableColumn<PhotoArea, Double> subCol = new TableColumn<PhotoArea, Double>();
subCol.setText("width");
subCol.setPrefWidth(20);
subCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<PhotoArea, Double>, ObservableValue<Double>>() {
@Override
public ObservableValue<Double> call(final CellDataFeatures<PhotoArea, Double> param) {
return AdapterFactory.adapt(EMFProperties.value(PHOTO_AREA__WIDTH).observe(param.getValue()));
}
});
col.getColumns().add(subCol);
}
{
TableColumn<PhotoArea, Double> subCol = new TableColumn<PhotoArea, Double>();
subCol.setText("heigth");
subCol.setPrefWidth(20);
subCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<PhotoArea, Double>, ObservableValue<Double>>() {
@Override
public ObservableValue<Double> call(final CellDataFeatures<PhotoArea, Double> param) {
return AdapterFactory.adapt(EMFProperties.value(PHOTO_AREA__HEIGHT).observe(param.getValue()));
}
});
col.getColumns().add(subCol);
}
photoAreas.getColumns().add(col);
}
{
TableColumn<PhotoArea, String> col = new TableColumn<PhotoArea, String>();
col.setText("Description");
col.setMaxWidth(100);
col.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<PhotoArea, String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(CellDataFeatures<PhotoArea, String> param) {
//TODO We need to remove the dispose the observable created here
IObservableValue v = EMFProperties.value(PHOTO_AREA__DESCRIPTION).observe(param.getValue());
return AdapterFactory.adapt(v);
}
});
col.setCellFactory(new Callback<TableColumn<PhotoArea, String>, TableCell<PhotoArea, String>>() {
@Override
public TableCell<PhotoArea, String> call(TableColumn<PhotoArea, String> param) {
return new EditingCell();
}
});
col.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<PhotoArea, String>>() {
@Override
public void handle(CellEditEvent<PhotoArea, String> event) {
photoAreas.getSelectionModel().getSelectedItem().setDescription(event.getNewValue());
}
});
photoAreas.getColumns().add(col);
}
photoAreas.setEditable(true);
ContextMenu mCtx = new ContextMenu();
MenuItem mItem = new MenuItem("Remove");
mItem.setGraphic(new ImageView(new Image(getClass().getClassLoader().getResource("/icons/edit-delete.png").toExternalForm())));
mItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
PhotoArea area = photoAreas.getSelectionModel().getSelectedItem();
photoAreas.getItems().remove(area);
}
});
mCtx.getItems().add(mItem);
photoAreas.setContextMenu(mCtx);
ObservableList<PhotoArea> list = AdapterFactory.adapt(EMFProperties.list(PHOTO__AREAS).observeDetail(currentSelection));
photoAreas.setItems(list);
TitledPane areaProps = new TitledPane("Media Area Properties", photoAreas);
box.getChildren().add(areaProps);
VBox.setVgrow(areaProps, Priority.ALWAYS);
pane.setCenter(box);
}Example 31
| Project: honest-profiler-master File: DialogUtil.java View source code |
/**
* Shows an exception {@link Dialog} with the specified properties. This is an error {@link Dialog} which contains
* the stack trace of the {@link Throwable} as expandable content.
* <p>
*
* @param appCtx the {@link ApplicationContext} for the application
* @param title the title of the {@link Dialog}
* @param header the header of the {@link Dialog}
* @param content the content of the {@link Dialog}
* @param t the {@link Throwable} whose stacktrace will be included in the {@link Dialog}
*/
public static void showExceptionDialog(ApplicationContext appCtx, String title, String header, String content, Throwable t) {
Alert alert = new Alert(ERROR);
alert.setTitle(title);
alert.setHeaderText(header);
alert.setContentText(content);
String exceptionText = null;
try (StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw)) {
t.printStackTrace(pw);
exceptionText = sw.toString();
} catch (IOException ioe) {
}
Label label = new Label(appCtx.textFor(CONTENT_LABEL_EXCEPTION));
TextArea textArea = new TextArea(exceptionText);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, ALWAYS);
GridPane.setHgrow(textArea, ALWAYS);
GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(label, 0, 0);
expContent.add(textArea, 0, 1);
// Set expandable Exception into the dialog pane.
alert.getDialogPane().setExpandableContent(expContent);
alert.showAndWait();
}Example 32
| Project: jaci-master File: JavaFxCliBuilder.java View source code |
/**
* @return A {@link Parent} that functions as a CLI built out of this builder's parameters.
* @throws RuntimeException If an error occurs.
*/
public Parent build() {
try {
final CliCommandHierarchy hierarchy = CliCommandHierarchyImpl.from(hierarchyBuilder.build());
final URL fxmlUrl = getFxmlUrl();
final FXMLLoader loader = new FXMLLoader(fxmlUrl);
final Parent cliNode = (Parent) loader.load();
// Label for 'working directory'.
final Label workingDirectory = (Label) cliNode.lookup("#workingDirectory");
final CliGui gui = new JavaFxCliGui(workingDirectory);
// Printers for cli output.
final TextArea textArea = (TextArea) cliNode.lookup("#cliOutput");
textArea.setFocusTraversable(false);
final CliPrinter out = new CliPrinter(new JavaFxCliOutput(textArea));
final CliPrinter err = new CliPrinter(new JavaFxCliOutput(textArea));
// TextField as command line.
final TextField commandLine = (TextField) cliNode.lookup("#commandLine");
final CommandLineManager commandLineManager = new JavaFxCommandLineManager(commandLine);
// Create the shell and the actual CLI.
final CliShell shell = new CliShell.Builder(hierarchy, gui, out, err).setMaxCommandHistory(maxCommandHistory).build();
final Cli cli = new Cli(shell, commandLineManager);
// Hook input events to CLI events.
commandLine.requestFocus();
commandLine.addEventFilter(KeyEvent.KEY_PRESSED, new JavaFxCliEventHandler(cli));
return cliNode;
} catch (Exception e) {
throw SneakyException.sneakyThrow(e);
}
}Example 33
| Project: jidefx-oss-master File: IntelliHintsDemo.java View source code |
public Region getDemoPanel() {
final String[] fontNames = DemoData.getFontNames();
// create file text field
List<String> urls = null;
try {
urls = DemoData.readUrls();
} catch (IOException e) {
e.printStackTrace();
}
TextField urlTextField = new TextField("http://");
ListDataIntelliHints intelliHints = new ListDataIntelliHints<>(urlTextField, urls);
intelliHints.setCaseSensitive(false);
TextField pathTextField = new TextField();
FileIntelliHints fileIntelliHints = new FileIntelliHints(pathTextField);
fileIntelliHints.setFilter(new FilenameFilter() {
public boolean accept(File dir, String name) {
return !_applyFileFilter.get() || dir.getAbsolutePath().contains("Program") || name.contains("Program");
}
});
fileIntelliHints.setFolderOnly(false);
fileIntelliHints.setShowFullPath(false);
// create file text field
TextField fileTextField = new TextField();
new FileIntelliHints(fileTextField);
// create file text field
TextArea fileTextArea = new TextArea();
new FileIntelliHints(fileTextArea);
fileTextArea.setPrefRowCount(4);
//
// create font text field
TextField fontTextField = new TextField();
ListDataIntelliHints fontIntelliHints = new ListDataIntelliHints<>(fontTextField, fontNames);
fontIntelliHints.setCaseSensitive(false);
TextField textField = new TextField();
new AbstractListIntelliHints<Long>(textField) {
protected Label _messageLabel;
@Override
public Node createHintsNode() {
BorderPane pane = (BorderPane) super.createHintsNode();
_messageLabel = new Label();
pane.setTop(_messageLabel);
pane.setStyle("-fx-background-color: white; -fx-border-color: gray; -fx-padding: 6;");
return pane;
}
// update list model depending on the data in textfield
public boolean updateHints(Object value) {
if (value == null) {
return false;
}
String s = value.toString();
s = s.trim();
if (s.length() == 0) {
return false;
}
try {
long l = Long.parseLong(s);
boolean prime = isProbablePrime(l);
_messageLabel.setText("");
if (prime) {
return false;
} else {
List<Long> list = new ArrayList<>();
long nextPrime = l;
for (int i = 0; i < 10; i++) {
nextPrime = nextPrime(nextPrime);
list.add(nextPrime);
}
setAvailableHints(FXCollections.observableArrayList(list));
_messageLabel.setText("Next 10 prime numbers:");
_messageLabel.setTextFill(Color.BLACK);
return true;
}
} catch (NumberFormatException e) {
setAvailableHints(null);
_messageLabel.setText("Invalid long number");
_messageLabel.setTextFill(Color.RED);
return true;
}
}
};
VBox panel = new VBox(3);
panel.setPadding(new Insets(10, 10, 10, 10));
panel.getChildren().addAll(new Label("ListDataIntelliHints TextField for URLs: "), urlTextField, new Box(), new Label("FileIntelliHints TextField for paths (folders only, show partial path): "), pathTextField, new Box(), new Label("FileIntelliHints TextField for files (files and folders, show full path):"), fileTextField, new Box(), new Label("IntelliHints TextField to choose a font: "), fontTextField, new Box(), new Label("FileIntelliHints TextArea for files (each line is for a new file):"), fileTextArea, new Box(), new Label("A custom IntelliHints for prime numbers: "), textField);
return panel;
}Example 34
| Project: jitwatch-master File: JITWatchUI.java View source code |
@Override
public void start(final Stage stage) {
StageManager.registerListener(this);
this.stage = stage;
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent arg0) {
StageManager.closeStage(stage);
stopParsing();
}
});
BorderPane borderPane = new BorderPane();
Scene scene = UserInterfaceUtil.getScene(borderPane, WINDOW_WIDTH, WINDOW_HEIGHT);
Button btnChooseWatchFile = new Button("Open Log");
btnChooseWatchFile.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
stopParsing();
chooseJITLog();
}
});
btnStart = new Button("Start");
btnStart.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
if (nothingMountedStage == null) {
int classCount = getConfig().getConfiguredClassLocations().size();
int sourceCount = getConfig().getSourceLocations().size();
if (classCount == 0 && sourceCount == 0) {
if (getConfig().isShowNothingMounted()) {
nothingMountedStage = new NothingMountedStage(JITWatchUI.this, getConfig());
StageManager.addAndShow(JITWatchUI.this.stage, nothingMountedStage);
startDelayedByConfig = true;
}
}
}
if (!startDelayedByConfig) {
readLogFile();
}
}
});
btnStop = new Button("Stop");
btnStop.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
stopParsing();
}
});
btnConfigure = new Button("Config");
btnConfigure.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
openConfigStage();
}
});
btnTimeLine = new Button("Timeline");
btnTimeLine.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
timeLineStage = new TimeLineStage(JITWatchUI.this);
StageManager.addAndShow(JITWatchUI.this.stage, timeLineStage);
btnTimeLine.setDisable(true);
}
});
btnHisto = new Button("Histo");
btnHisto.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
histoStage = new HistoStage(JITWatchUI.this);
StageManager.addAndShow(JITWatchUI.this.stage, histoStage);
btnHisto.setDisable(true);
}
});
btnTopList = new Button("TopList");
btnTopList.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
topListStage = new TopListStage(JITWatchUI.this);
StageManager.addAndShow(JITWatchUI.this.stage, topListStage);
btnTopList.setDisable(true);
}
});
btnCodeCacheTimeline = new Button("Cache");
btnCodeCacheTimeline.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
codeCacheTimelineStage = new CodeCacheStage(JITWatchUI.this);
StageManager.addAndShow(JITWatchUI.this.stage, codeCacheTimelineStage);
btnCodeCacheTimeline.setDisable(true);
}
});
btnNMethods = new Button("NMethods");
btnNMethods.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
codeCacheBlocksStage = new CodeCacheLayoutStage(JITWatchUI.this);
StageManager.addAndShow(JITWatchUI.this.stage, codeCacheBlocksStage);
btnNMethods.setDisable(true);
codeCacheBlocksStage.redraw();
}
});
btnTriView = new Button("TriView");
btnTriView.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
if (selectedMember == null && selectedMetaClass != null) {
selectedMember = selectedMetaClass.getFirstConstructor();
}
openTriView(selectedMember, false);
}
});
btnReportSuggestions = new Button("Suggest");
btnReportSuggestions.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
reportStageSuggestions = new ReportStage(JITWatchUI.this, "JITWatch Code Suggestions", ReportStageType.SUGGESTION, reportListSuggestions);
StageManager.addAndShow(JITWatchUI.this.stage, reportStageSuggestions);
btnReportSuggestions.setDisable(true);
}
});
btnReportEliminatedAllocations = new Button("-Allocs");
btnReportEliminatedAllocations.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
reportStageElminatedAllocations = new ReportStage(JITWatchUI.this, "JITWatch Eliminated Allocation Report", ReportStageType.ELIMINATED_ALLOCATION, reportListEliminatedAllocations);
StageManager.addAndShow(JITWatchUI.this.stage, reportStageElminatedAllocations);
btnReportEliminatedAllocations.setDisable(true);
}
});
btnReportElidedLocks = new Button("-Locks");
btnReportElidedLocks.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
reportStageElidedLocks = new ReportStage(JITWatchUI.this, "JITWatch Elided Lock Report", ReportStageType.ELIDED_LOCK, reportListElidedLocks);
StageManager.addAndShow(JITWatchUI.this.stage, reportStageElidedLocks);
btnReportElidedLocks.setDisable(true);
}
});
btnOptimizedVirtualCalls = new Button("OVCs");
btnOptimizedVirtualCalls.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
OptimizedVirtualCallVisitable optimizedVCallVisitable = new OptimizedVirtualCallVisitable();
List<OptimizedVirtualCall> optimizedVirtualCalls = optimizedVCallVisitable.buildOptimizedCalleeReport(logParser.getModel(), getConfig().getAllClassLocations());
ovcStage = new OptimizedVirtualCallStage(JITWatchUI.this, optimizedVirtualCalls);
StageManager.addAndShow(JITWatchUI.this.stage, ovcStage);
btnOptimizedVirtualCalls.setDisable(true);
}
});
btnSandbox = new Button("Sandbox");
btnSandbox.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
openSandbox();
}
});
btnErrorLog = new Button("Errors (0)");
btnErrorLog.setStyle("-fx-padding: 2 6;");
btnErrorLog.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
openTextViewer("Error Log", errorLog.toString(), false, false);
}
});
btnStats = new Button("Stats");
btnStats.setStyle("-fx-padding: 2 6;");
btnStats.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
statsStage = new StatsStage(JITWatchUI.this);
StageManager.addAndShow(JITWatchUI.this.stage, statsStage);
btnStats.setDisable(true);
}
});
btnReset = new Button("Reset");
btnReset.setStyle("-fx-padding: 2 6;");
btnReset.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
logParser.reset();
clear();
}
});
lblHeap = new Label();
lblVmVersion = new Label();
StringBuilder vmBuilder = new StringBuilder();
vmBuilder.append("VM is ");
vmBuilder.append(Runtime.class.getPackage().getImplementationVendor());
vmBuilder.append(C_SPACE);
vmBuilder.append(Runtime.class.getPackage().getImplementationVersion());
lblVmVersion.setText(vmBuilder.toString());
lblTweakLog = new Label();
int menuBarHeight = 40;
int textAreaHeight = 100;
int statusBarHeight = 25;
HBox hboxTop = new HBox();
hboxTop.setPadding(new Insets(10));
hboxTop.setPrefHeight(menuBarHeight);
hboxTop.setSpacing(10);
hboxTop.getChildren().add(btnSandbox);
hboxTop.getChildren().add(btnChooseWatchFile);
hboxTop.getChildren().add(btnStart);
hboxTop.getChildren().add(btnStop);
hboxTop.getChildren().add(btnConfigure);
hboxTop.getChildren().add(btnTimeLine);
hboxTop.getChildren().add(btnHisto);
hboxTop.getChildren().add(btnTopList);
hboxTop.getChildren().add(btnCodeCacheTimeline);
hboxTop.getChildren().add(btnNMethods);
hboxTop.getChildren().add(btnTriView);
hboxTop.getChildren().add(btnReportSuggestions);
hboxTop.getChildren().add(btnReportEliminatedAllocations);
hboxTop.getChildren().add(btnReportElidedLocks);
hboxTop.getChildren().add(btnOptimizedVirtualCalls);
compilationRowList = FXCollections.observableArrayList();
compilationTable = CompilationTableBuilder.buildTableMemberAttributes(compilationRowList);
compilationTable.setPlaceholder(new Text("Select a JIT-compiled class member to view compilations."));
compilationTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<CompilationTableRow>() {
@Override
public void changed(ObservableValue<? extends CompilationTableRow> arg0, CompilationTableRow oldVal, CompilationTableRow newVal) {
if (!selectedProgrammatically) {
if (selectedMember != null && newVal != null) {
selectedMember.setSelectedCompilation(newVal.getIndex());
openTriView(selectedMember, true);
refreshOnce();
}
}
}
});
SplitPane spMethodInfo = new SplitPane();
spMethodInfo.setOrientation(Orientation.VERTICAL);
classMemberList = new ClassMemberList(this, getConfig());
classMemberList.registerListener(this);
spMethodInfo.getItems().add(classMemberList);
spMethodInfo.getItems().add(compilationTable);
classMemberList.prefHeightProperty().bind(scene.heightProperty());
compilationTable.prefHeightProperty().bind(scene.heightProperty());
classTree = new ClassTree(this, getConfig());
classTree.prefWidthProperty().bind(scene.widthProperty());
SplitPane spMain = new SplitPane();
spMain.setOrientation(Orientation.VERTICAL);
SplitPane spCentre = new SplitPane();
spCentre.getItems().add(classTree);
spCentre.getItems().add(spMethodInfo);
spCentre.setDividerPositions(0.33, 0.67);
textAreaLog = new TextArea();
textAreaLog.setStyle("-fx-font-family:" + FONT_MONOSPACE_FAMILY + ";-fx-font-size:" + FONT_MONOSPACE_SIZE + "px");
textAreaLog.setPrefHeight(textAreaHeight);
log("Welcome to JITWatch by Chris Newland (@chriswhocodes on Twitter) and the AdoptOpenJDK project.\n");
log("Please send feedback to our mailing list (https://groups.google.com/forum/#!forum/jitwatch) \nor come and find us on GitHub (https://github.com/AdoptOpenJDK/jitwatch).\n");
log("Includes assembly reference from x86asm.net licenced under http://ref.x86asm.net/index.html#License\n");
if (jitLogFile == null) {
if (logParser instanceof HotSpotLogParser) {
log("HotSpot mode. Choose a JIT log file or open the Sandbox");
} else {
log("J9 Mode. Choose a JIT log file (Sandbox only available for HotSpot)");
}
} else {
log("Using JIT log file: " + jitLogFile.getAbsolutePath());
}
spMain.getItems().add(spCentre);
spMain.getItems().add(textAreaLog);
spMain.setDividerPositions(0.68, 0.32);
HBox hboxBottom = new HBox();
Region springLeft = new Region();
Region springRight = new Region();
final String labelStyle = "-fx-padding: 3 0 0 0;";
HBox.setHgrow(springLeft, Priority.ALWAYS);
HBox.setHgrow(springRight, Priority.ALWAYS);
lblHeap.setStyle(labelStyle);
lblVmVersion.setStyle(labelStyle);
hboxBottom.setPadding(new Insets(4));
hboxBottom.setPrefHeight(statusBarHeight);
hboxBottom.setSpacing(4);
hboxBottom.getChildren().add(lblHeap);
hboxBottom.getChildren().add(btnErrorLog);
hboxBottom.getChildren().add(btnStats);
hboxBottom.getChildren().add(btnReset);
hboxBottom.getChildren().add(springLeft);
hboxBottom.getChildren().add(lblTweakLog);
hboxBottom.getChildren().add(springRight);
hboxBottom.getChildren().add(lblVmVersion);
borderPane.setTop(hboxTop);
borderPane.setCenter(spMain);
borderPane.setBottom(hboxBottom);
stage.setTitle("JITWatch - Just In Time Compilation Inspector");
stage.setScene(scene);
stage.show();
int refreshMillis = 1000;
final Duration oneFrameAmt = Duration.millis(refreshMillis);
final KeyFrame oneFrame = new KeyFrame(oneFrameAmt, new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
refresh();
}
});
Timeline timeline = new Timeline();
timeline.setCycleCount(Animation.INDEFINITE);
timeline.getKeyFrames().add(oneFrame);
timeline.play();
updateButtons();
}Example 35
| Project: nocturne-master File: Main.java View source code |
@Override
public void start(Stage primaryStage) throws Exception {
mainStage = primaryStage;
String[] icons = new String[] { "icon-16", "icon-24", "icon-32", "icon-48", "icon-64", "icon-128", "icon-256", "icon-512" };
for (String icon : icons) {
mainStage.getIcons().add(new Image(getClass().getResourceAsStream("/img/icons/" + icon + ".png")));
}
loadView(locale);
Thread.currentThread().setUncaughtExceptionHandler(( thread, throwable) -> {
throwable.printStackTrace();
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle(resourceBundle.getString("exception.title"));
alert.setHeaderText(resourceBundle.getString("exception.header"));
TextFlow description = new TextFlow(new Text(resourceBundle.getString("exception.dialog1") + "\n"), new Text(resourceBundle.getString("exception.dialog2") + "\n\n"), new Text(resourceBundle.getString("exception.dialog3")), new Text(" "), new WebLink("https://github.com/LapisBlue/Nocturne/issues"), new Text("\n\n"), new Text(resourceBundle.getString("exception.dialog4")));
description.setLayoutX(20);
description.setLayoutY(25);
TextArea exceptionText = new TextArea();
StringWriter exceptionWriter = new StringWriter();
throwable.printStackTrace(new PrintWriter(exceptionWriter));
exceptionText.setText(exceptionWriter.toString());
exceptionText.setLayoutX(20);
exceptionText.setLayoutY(140);
Pane contentPane = new Pane(description, exceptionText);
alert.getDialogPane().setContent(contentPane);
alert.getButtonTypes().setAll(ButtonType.OK, ButtonType.CLOSE);
alert.showAndWait();
if (alert.getResult() == ButtonType.CLOSE) {
System.exit(0);
}
});
}Example 36
| Project: SONDY-master File: GlobalUI.java View source code |
public final void editConfigurationFile() {
try {
TextArea textArea = new TextArea();
textArea.setText(FileUtils.readFileToString(Paths.get("./configuration.properties").toFile()));
UIUtils.setSize(textArea, Main.columnWidthLEFT / 2 + 10, 100);
final Stage stage = new Stage();
stage.setResizable(false);
stage.initModality(Modality.WINDOW_MODAL);
stage.initStyle(StageStyle.UTILITY);
stage.setTitle("Edit configuration");
Button saveButton = new Button("Save changes");
UIUtils.setSize(saveButton, Main.columnWidthLEFT / 2 + 10, 24);
Button cancelButton = new Button("Cancel changes");
cancelButton.setOnAction((ActionEvent t) -> {
stage.close();
});
saveButton.setOnAction((ActionEvent t) -> {
try {
FileUtils.write(Paths.get("./configuration.properties").toFile(), textArea.getText());
stage.close();
} catch (IOException ex) {
Logger.getLogger(GlobalUI.class.getName()).log(Level.SEVERE, null, ex);
}
});
UIUtils.setSize(cancelButton, Main.columnWidthLEFT / 2 + 10, 24);
Label label = new Label();
label.setId("smalltext");
label.setText("SONDY needs to restart for the changes to take effect");
Scene scene = new Scene(VBoxBuilder.create().children(textArea, label, saveButton, cancelButton).alignment(Pos.CENTER).padding(new Insets(10)).spacing(3).build());
scene.getStylesheets().add("resources/fr/ericlab/sondy/css/GlobalStyle.css");
stage.setScene(scene);
stage.show();
} catch (IOException ex) {
Logger.getLogger(GlobalUI.class.getName()).log(Level.SEVERE, null, ex);
}
}Example 37
| Project: spdx-edit-master File: FileIoLogic.java View source code |
public static SpdxDocument loadTagValue(File file) throws IOException, InvalidSPDXAnalysisException {
try (FileInputStream in = new FileInputStream(file)) {
List<String> warnings = new LinkedList<>();
SpdxDocumentContainer container = TagToRDF.convertTagFileToRdf(in, "RDF/XML", warnings);
if (warnings.size() > 0) {
Alert warningsAlert = new Alert(Alert.AlertType.WARNING, "Warnings occured in parsing Tag document", ButtonType.OK);
TextArea warningList = new TextArea();
warningList.setText(Joiner.on("\n").join(warnings));
warningsAlert.getDialogPane().setExpandableContent(warningList);
warningsAlert.showAndWait();
}
return container.getSpdxDocument();
} catch (Exception e) {
if (e instanceof InvalidSPDXAnalysisException)
throw (InvalidSPDXAnalysisException) e;
if (e instanceof IOException)
throw (IOException) e;
throw new IOException("Unable to read/parse tag-value file " + file.getAbsolutePath(), e);
}
}Example 38
| Project: TerasologyLauncher-master File: LauncherUpdater.java View source code |
public boolean showUpdateDialog(Stage parentStage) {
final String infoText = getUpdateInfo();
FutureTask<Boolean> dialog = new FutureTask<Boolean>(() -> {
Parent root = BundleUtils.getFXMLLoader("update_dialog").load();
((TextArea) root.lookup("#infoTextArea")).setText(infoText);
((TextArea) root.lookup("#changelogTextArea")).setText(changeLog);
final Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle(BundleUtils.getLabel("message_update_launcher_title"));
alert.setHeaderText(BundleUtils.getLabel("message_update_launcher"));
alert.getDialogPane().setContent(root);
alert.initOwner(parentStage);
alert.getButtonTypes().setAll(ButtonType.YES, ButtonType.NO);
alert.initModality(Modality.APPLICATION_MODAL);
alert.setResizable(true);
return alert.showAndWait().filter( response -> response == ButtonType.YES).isPresent();
});
Platform.runLater(dialog);
boolean result = false;
try {
result = dialog.get();
} catch (InterruptedExceptionExecutionException | e) {
logger.error("Uh oh, something went wrong with the update dialog!", e);
}
return result;
}Example 39
| Project: GitFx-master File: GitFxDialog.java View source code |
/*
* Implementation of Generic Exception Dialog
*/
@Override
public void gitExceptionDialog(String title, String header, String content, Exception e) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle(title);
alert.setHeaderText(header);
alert.setContentText(content);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
String exceptionText = sw.toString();
Label label = new Label("Exception stack trace:");
TextArea textArea = new TextArea(exceptionText);
textArea.setEditable(false);
textArea.setWrapText(true);
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(label, 0, 0);
expContent.add(textArea, 0, 1);
alert.getDialogPane().setExpandableContent(expContent);
alert.showAndWait();
}Example 40
| Project: mqtt-spy-master File: DialogFactory.java View source code |
public static void createExceptionDialog(final String title, final Exception e) {
final Alert alert = new Alert(AlertType.ERROR);
alert.setTitle(title);
alert.setHeaderText(null);
alert.setContentText(e.getMessage() + " - " + ExceptionUtils.getRootCauseMessage(e));
final StringWriter sw = new StringWriter();
final PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
final TextArea textArea = new TextArea(sw.toString());
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, Priority.ALWAYS);
GridPane.setHgrow(textArea, Priority.ALWAYS);
GridPane content = new GridPane();
content.setMaxWidth(Double.MAX_VALUE);
content.add(textArea, 0, 0);
alert.getDialogPane().setExpandableContent(content);
alert.showAndWait();
}Example 41
| Project: VisibleTesla-master File: OverviewController.java View source code |
@FXML
void detailsButtonHandler(ActionEvent event) {
AnchorPane pane = new AnchorPane();
VehicleState car = vtVehicle.vehicleState.get();
String info = vtVehicle.getVehicle().toString() + "\nFirmware Version: " + car.version + "\nRemote Start Enabled: " + vtVehicle.getVehicle().remoteStartEnabled() + "\nCalendar Enabled: " + vtVehicle.getVehicle().calendarEnabled() + "\nNotifications Enabled: " + vtVehicle.getVehicle().notificationsEnabled() + "\n--------------------------------------------" + "\nLow level information: " + vtVehicle.getVehicle().getUnderlyingValues() + "\nVehicle UUID: " + vtVehicle.getVehicle().getUUID() + "\nApp UUID: " + app.getAppID() + "\n";
TextArea t = new TextArea(info);
pane.getChildren().add(t);
Dialogs.showCustomDialog(app.stage, pane, "Detailed Vehicle Description", "Details", DialogOptions.OK, null);
}Example 42
| Project: jvarkit-master File: NgsStage.java View source code |
@Override
public void run() {
try {
this.bindings.put(HEADER_CONTEXT_KEY, this.copyNgsFile.getHeader());
this.bindings.put(OUT_CONTEXT_KEY, this.out);
this.bindings.put(ITER_CONTEXT_KEY, this.iter);
this.compiledScript.eval(this.bindings);
this.iter.close();
this.out.flush();
Platform.runLater(() -> {
AbstractAwkLike.this.progessLabel.setText("Done.");
});
if (this.iter.__stop_flag != 0) {
//nothing
} else if (this.out.checkError()) {
Platform.runLater(() -> {
final Alert alert = new Alert(AlertType.ERROR, "I/O Error. Check Stream limits in preferences.", ButtonType.OK);
alert.showAndWait();
});
} else if (this.saveToStringWriter != null) {
final String output = new String(this.saveToStringWriter.toByteArray());
Platform.runLater(() -> {
final Stage showResultStage = new Stage();
showResultStage.setTitle("BioAlcidae");
showResultStage.setScene(new Scene(new ScrollPane(new TextArea(output))));
showResultStage.show();
});
} else {
Platform.runLater(() -> {
final Alert alert = new Alert(AlertType.CONFIRMATION, "Done", ButtonType.OK);
alert.showAndWait();
});
}
//we close after to avoid check error is user closed the stream
this.out.close();
this.out = null;
this.iter = null;
} catch (final Exception err) {
Platform.runLater(() -> {
AbstractAwkLike.this.progessLabel.setText("Error :" + err.getMessage());
});
err.printStackTrace();
} finally {
AbstractAwkLike.this.curentrunner = null;
dispose();
}
}Example 43
| Project: sea-master File: Connection.java View source code |
public static void getSongFromPleer(TextArea songLabelText) throws IOException {
String bandArtist;
String songTitle;
// these top two dont do anyhting
bandArtist = deAccent(FXController.bandArtist);
songTitle = deAccent(FXController.songTitle);
if (FXController.bandArtist.contains("feat"))
bandArtist = FXController.bandArtist.split("feat")[0];
if (FXController.songTitle.contains("feat"))
songTitle = FXController.songTitle.split("feat")[0];
if (FXController.bandArtist.contains("Feat"))
bandArtist = FXController.bandArtist.split("feat")[0];
if (FXController.songTitle.contains("Feat"))
songTitle = FXController.songTitle.split("feat")[0];
String fullURLPath = "http://www.pleer.com/browser-extension/search?limit=100&q=" + bandArtist.replace(" ", "+").replaceAll("[!@#$%^&*(){}:\"<>?]", "") + "+" + songTitle.replace(" ", "+").replaceAll("[!@#$%^&*(){}:\"<>?]", "").replaceAll("\\[.*\\]", "");
final URL url = new URL(fullURLPath);
HttpURLConnection request = (HttpURLConnection) url.openConnection();
request.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 (.NET CLR 3.5.30729)");
request.connect();
JsonParser jp = new JsonParser();
JsonElement root = jp.parse(new InputStreamReader((InputStream) request.getContent()));
JsonObject rootobj = root.getAsJsonObject();
JsonArray arr = rootobj.getAsJsonArray("tracks");
try {
rootobj = arr.get(0).getAsJsonObject();
} catch (IndexOutOfBoundsException e) {
songLabelText.setText("Song not found");
}
List<String> fileList = new ArrayList<>();
List<String> fullTitleList = new ArrayList<>();
List<String> qualityList = new ArrayList<>();
Pattern p = Pattern.compile("^[\\x20-\\x7d]*$");
Matcher m3 = Pattern.compile("rework", Pattern.CASE_INSENSITIVE).matcher(rootobj.get("track").toString());
Matcher m4 = Pattern.compile("remix", Pattern.CASE_INSENSITIVE).matcher(rootobj.get("track").toString());
Matcher m5 = Pattern.compile("rework", Pattern.CASE_INSENSITIVE).matcher(rootobj.get("track").toString());
Matcher m6 = Pattern.compile("cover", Pattern.CASE_INSENSITIVE).matcher(rootobj.get("track").toString());
Matcher m8 = Pattern.compile("rework", Pattern.CASE_INSENSITIVE).matcher(rootobj.get("artist").toString());
Matcher m9 = Pattern.compile("remix", Pattern.CASE_INSENSITIVE).matcher(rootobj.get("artist").toString());
Matcher m10 = Pattern.compile("rework", Pattern.CASE_INSENSITIVE).matcher(rootobj.get("artist").toString());
Matcher m11 = Pattern.compile("cover", Pattern.CASE_INSENSITIVE).matcher(rootobj.get("artist").toString());
Matcher m13 = Pattern.compile("mix", Pattern.CASE_INSENSITIVE).matcher(rootobj.get("track").toString());
for (int i = 0; i < arr.size(); i++) {
rootobj = arr.get(i).getAsJsonObject();
Matcher m1 = p.matcher(rootobj.get("artist").toString().replace("\"", "").replace("[", "~").replace("]", "~"));
Matcher m2 = p.matcher(rootobj.get("track").toString().replace("\"", "").replace("[", "~").replace("]", "~"));
Boolean correctArtist = false;
Boolean artistInTrack = false;
if (rootobj.get("artist").toString().toLowerCase().contains(bandArtist.toLowerCase().replaceAll("\\[.*\\]", "").replaceAll("\\(.*\\)", "")))
correctArtist = true;
if (rootobj.get("track").toString().toLowerCase().contains(songTitle.toLowerCase().replaceAll("\\[.*\\]", "").replaceAll("\\(.*\\)", "").replaceAll(" ", " ")))
artistInTrack = true;
// make sure to get only songs that aren't modifications
if (m1.find() && m2.find() && !m3.find() && !m4.find() && !m5.find() && !m6.find() && !m8.find() && !m9.find() && !m10.find() && !m11.find() && !m13.find() && correctArtist && artistInTrack) {
// searching through either high or low quality songs, depending on the setting that has been set
if ((rootobj.get("bitrate").toString().contains("VBR") || !(Integer.parseInt(rootobj.get("bitrate").toString().substring(1, 2)) >= 4)) && !rootobj.get("bitrate").toString().substring(1, 4).contains(" ")) {
switch(FXController.qualityLevel) {
case "high":
if (!rootobj.get("bitrate").toString().contains("VBR") && Integer.parseInt(rootobj.get("bitrate").toString().substring(1, 4)) >= 256) {
System.out.println("high");
fileList.add(rootobj.get("id").toString().replace("\"", ""));
fullTitleList.add(rootobj.get("artist").toString().replace("\"", "") + " - " + rootobj.get("track").toString().replace("\"", ""));
qualityList.add("High");
}
break;
case "low":
if (!rootobj.get("bitrate").toString().contains("VBR") && Integer.parseInt(rootobj.get("bitrate").toString().substring(1, 4)) < 256) {
System.out.println("low");
fileList.add(rootobj.get("id").toString().replace("\"", ""));
fullTitleList.add(rootobj.get("artist").toString().replace("\"", "") + " - " + rootobj.get("track").toString().replace("\"", ""));
qualityList.add("Low");
}
break;
case "VBR":
if (rootobj.get("bitrate").toString().contains("VBR")) {
System.out.println("VBR");
fileList.add(rootobj.get("id").toString().replace("\"", ""));
fullTitleList.add(rootobj.get("artist").toString().replace("\"", "") + " - " + rootobj.get("track").toString().replace("\"", ""));
qualityList.add("VBR");
}
break;
default:
break;
}
}
}
}
for (int i = 0; i < arr.size(); i++) {
rootobj = arr.get(i).getAsJsonObject();
Matcher m1 = p.matcher(rootobj.get("artist").toString().replace("\"", "").replace("[", "~").replace("]", "~"));
Matcher m2 = p.matcher(rootobj.get("track").toString().replace("\"", "").replace("[", "~").replace("]", "~"));
Boolean correctArtist = false;
Boolean artistInTrack = false;
if (rootobj.get("artist").toString().toLowerCase().contains(bandArtist.toLowerCase().replaceAll("\\[.*\\]", "").replaceAll("\\(.*\\)", "")))
correctArtist = true;
if (rootobj.get("track").toString().toLowerCase().contains(songTitle.toLowerCase().replaceAll("\\[.*\\]", "").replaceAll("\\(.*\\)", "").replaceAll(" ", " ")))
artistInTrack = true;
// make sure to get only songs that aren't modifications
if (m1.find() && m2.find() && !m3.find() && !m4.find() && !m5.find() && !m6.find() && !m8.find() && !m9.find() && !m10.find() && !m11.find() && !m13.find() && correctArtist && artistInTrack) {
// searching through either high or low quality songs, depending on the setting that has been set
if ((rootobj.get("bitrate").toString().contains("VBR") || !(Integer.parseInt(rootobj.get("bitrate").toString().substring(1, 2)) >= 4)) && !rootobj.get("bitrate").toString().substring(1, 4).contains(" ")) {
if (FXController.qualityLevel.equals("low") || FXController.qualityLevel.equals("VBR")) {
if (!rootobj.get("bitrate").toString().contains("VBR") && Integer.parseInt(rootobj.get("bitrate").toString().substring(1, 4)) >= 256) {
System.out.println("high");
fileList.add(rootobj.get("id").toString().replace("\"", ""));
fullTitleList.add(rootobj.get("artist").toString().replace("\"", "") + " - " + rootobj.get("track").toString().replace("\"", ""));
qualityList.add("High");
}
} else if (FXController.qualityLevel.equals("high")) {
if (!rootobj.get("bitrate").toString().contains("VBR") && Integer.parseInt(rootobj.get("bitrate").toString().substring(1, 4)) < 256) {
System.out.println("low");
fileList.add(rootobj.get("id").toString().replace("\"", ""));
fullTitleList.add(rootobj.get("artist").toString().replace("\"", "") + " - " + rootobj.get("track").toString().replace("\"", ""));
qualityList.add("Low");
}
}
}
}
}
for (int i = 0; i < arr.size(); i++) {
rootobj = arr.get(i).getAsJsonObject();
Matcher m1 = p.matcher(rootobj.get("artist").toString().replace("\"", "").replace("[", "~").replace("]", "~"));
Matcher m2 = p.matcher(rootobj.get("track").toString().replace("\"", "").replace("[", "~").replace("]", "~"));
Boolean correctArtist = false;
Boolean artistInTrack = false;
if (rootobj.get("artist").toString().toLowerCase().contains(bandArtist.toLowerCase().replaceAll("\\[.*\\]", "").replaceAll("\\(.*\\)", "")))
correctArtist = true;
if (rootobj.get("track").toString().toLowerCase().contains(songTitle.toLowerCase().replaceAll("\\[.*\\]", "").replaceAll("\\(.*\\)", "").replaceAll("\\(.*\\)", "").replaceAll(" ", " ")))
artistInTrack = true;
// make sure to get only songs that aren't modifications
if (m1.find() && m2.find() && !m3.find() && !m4.find() && !m5.find() && !m6.find() && !m8.find() && !m9.find() && !m10.find() && !m11.find() && !m13.find() && correctArtist && artistInTrack) {
// searching through either high or low quality songs, depending on the setting that has been set
if ((rootobj.get("bitrate").toString().contains("VBR") || !(Integer.parseInt(rootobj.get("bitrate").toString().substring(1, 2)) >= 4)) && !rootobj.get("bitrate").toString().substring(1, 4).contains(" ")) {
if (FXController.qualityLevel.equals("VBR")) {
if (!rootobj.get("bitrate").toString().contains("VBR") && Integer.parseInt(rootobj.get("bitrate").toString().substring(1, 4)) < 256) {
System.out.println("low");
fileList.add(rootobj.get("id").toString().replace("\"", ""));
fullTitleList.add(rootobj.get("artist").toString().replace("\"", "") + " - " + rootobj.get("track").toString().replace("\"", ""));
qualityList.add("Low");
}
} else if (FXController.qualityLevel.equals("low") || FXController.qualityLevel.equals("high")) {
if (rootobj.get("bitrate").toString().contains("VBR")) {
System.out.println("VBR");
fileList.add(rootobj.get("id").toString().replace("\"", ""));
fullTitleList.add(rootobj.get("artist").toString().replace("\"", "") + " - " + rootobj.get("track").toString().replace("\"", ""));
qualityList.add("VBR");
}
}
}
}
}
FXController.fileList = (fileList);
FXController.fullTitleList = (fullTitleList);
FXController.qualityList = qualityList;
}Example 44
| Project: behaviorsearch-master File: MainController.java View source code |
public void showAboutAction(ActionEvent event) {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("About BehaviorSearch...");
alert.setHeaderText(null);
alert.setGraphic(null);
ButtonType browseWebsite = new ButtonType("Browse BehaviorSearch web site");
ButtonType close = new ButtonType("Close", ButtonData.CANCEL_CLOSE);
alert.getButtonTypes().setAll(browseWebsite, close);
TextArea content = new TextArea();
File creditsFile = new File(GeneralUtils.attemptResolvePathFromBSearchRoot("CREDITS.TXT"));
File licFile = new File(GeneralUtils.attemptResolvePathFromBSearchRoot("LICENSE.TXT"));
String creditsText, licText;
try {
creditsText = GeneralUtils.stringContentsOfFile(creditsFile);
licText = GeneralUtils.stringContentsOfFile(licFile);
} catch (FileNotFoundException ex) {
creditsText = "ERROR: Either CREDITS.TXT or LICENSE.TXT file not found.";
licText = "";
}
content.setText("BehaviorSearch v" + GeneralUtils.getVersionString() + "\n" + creditsText + "\n*****\n\n" + licText);
content.setWrapText(true);
content.setMinHeight(400);
alert.getDialogPane().setContent(content);
;
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == browseWebsite) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
org.nlogo.swing.BrowserLauncher.openURL(null, "http://www.behaviorsearch.org/", false);
}
});
}
// ...otherwise user chose CANCEL or closed the dialog
}Example 45
| Project: itol-master File: PropertyGridView.java View source code |
private PropertyNode makeTextAreaForProperty(Issue issue, PropertyClass pclass) {
if (log.isLoggable(Level.FINE))
log.log(Level.FINE, "makeTextAreaForProperty(");
PropertyNode ret = null;
try {
final IssueService srv = Globals.getIssueService();
final IssuePropertyEditor editor = srv.getPropertyEditor(issueTaskPane, issue, pclass.getId());
// Create a standard TextArea if no special property editor is provided.
final TextArea textArea = editor != null ? null : new TextArea();
if (textArea != null) {
// Forward to next control on TAB
textArea.addEventFilter(KeyEvent.KEY_PRESSED, ( e) -> {
if (e.getCode().equals(KeyCode.TAB)) {
TextAreaSkin skin = (TextAreaSkin) textArea.getSkin();
if (e.isShiftDown()) {
skin.getBehavior().traversePrevious();
} else {
skin.getBehavior().traverseNext();
}
e.consume();
}
});
textArea.setWrapText(true);
textArea.setMinHeight(60);
textArea.setMaxHeight(Double.MAX_VALUE);
textArea.setPrefHeight(60);
}
VBox vboxEditor = null;
if (editor != null) {
final Control editorControl = (Control) editor.getNode();
VBox.setVgrow(editorControl, Priority.ALWAYS);
vboxEditor = new VBox();
vboxEditor.getChildren().clear();
vboxEditor.getChildren().add(editorControl);
vboxEditor.setStyle("-fx-border-color: LIGHTGREY;-fx-border-width: 1px;");
vboxEditor.setMinHeight(100);
vboxEditor.setMaxHeight(Double.MAX_VALUE);
vboxEditor.setPrefHeight(100);
}
Region nodeRegion = textArea != null ? textArea : vboxEditor;
ret = new PropertyNode(issue, pclass, nodeRegion) {
@Override
public void updateData(boolean save) {
if (editor != null) {
editor.updateData(save);
} else {
if (save) {
String text = textArea.getText();
issue.setPropertyString(pclass.getId(), text);
} else {
String text = issue.getPropertyString(pclass.getId(), "");
textArea.setText(text);
}
}
}
};
} catch (Exception e) {
log.log(Level.WARNING, "Failed to create text area for property=" + pclass);
}
if (log.isLoggable(Level.FINE))
log.log(Level.FINE, ")makeTextAreaForProperty");
return ret;
}Example 46
| Project: Narvaro-master File: Controller.java View source code |
@Override
public void run() {
MonthData md = null;
try {
md = DataManager.Narvaro.getMonthDataForParkAndYearMonth(YearMonth.of(getEnterYear(), getEnterMonth()), getEnterPark());
// set data on view data tab
conversionFactorPaidDayUseTF.setText(md.getPduConversionFactor().toString());
paidDayUseTotalsTF.setText(String.valueOf(md.getPduTotals()));
specialEventsTF.setText(String.valueOf(md.getPduSpecialEvents()));
annualDayUseTF.setText(String.valueOf(md.getPduAnnualDayUse()));
dayUseTF.setText(String.valueOf(md.getPduDayUse()));
seniorTF.setText(String.valueOf(md.getPduSenior()));
disabledTF.setText(String.valueOf(md.getPduDisabled()));
goldenBearTF.setText(String.valueOf(md.getPduGoldenBear()));
disabledVeteranTF.setText(String.valueOf(md.getPduDisabledVeteran()));
nonResOHVPassTF.setText(String.valueOf(md.getPduNonResOHVPass()));
annualPassSaleTF.setText(String.valueOf(md.getPduAnnualPassSale()));
campingTF.setText(String.valueOf(md.getPduCamping()));
seniorCampingTF.setText(String.valueOf(md.getPduSeniorCamping()));
disabledCampingTF.setText(String.valueOf(md.getPduDisabledCamping()));
conversionFactorFreeDayUseTF.setText(md.getFduConversionFactor().toString());
freeDayUseTotalsTF.setText(String.valueOf(md.getFduTotals()));
totalVehiclesTF.setText(String.valueOf(md.getFscTotalVehicles()));
totalPeopleTF.setText(String.valueOf(md.getFscTotalPeople()));
ratioTF.setText(md.getFscRatio().toString());
commentsTB.setText(md.getComment());
mcTF.setText(String.valueOf(md.getoMC()));
atvTF.setText(String.valueOf(md.getoATV()));
fourByFourTF.setText(String.valueOf(md.getO4X4()));
rovTF.setText(String.valueOf(md.getoROV()));
aqmaTF.setText(String.valueOf(md.getoAQMA()));
allStarKartingTF.setText(String.valueOf(md.getoAllStarKarting()));
hangtownTF.setText(String.valueOf(md.getoHangtown()));
otherTF.setText(String.valueOf(md.getoOther()));
browseFileTF.setText(md.getForm449File().toPath().toString());
showOKOnSubmit();
resetValidation();
} catch (Exception e) {
LOG.error(e.getMessage(), e);
Object[] o = userDataGroup.getChildren().toArray();
for (int i = 0; i < o.length; i++) {
if (o[i] instanceof TextField) {
((TextField) o[i]).clear();
} else if (o[i] instanceof TextArea) {
((TextArea) o[i]).clear();
}
}
resetValidation();
}
// enable buttons again
clearSubmitButtonStatusIndicator();
submitButton.setDisable(false);
clearButton.setDisable(false);
browseFileButton.setDisable(false);
}Example 47
| Project: Java-Bytecode-Editor-master File: MethodController.java View source code |
public TextArea getCodeBcel() {
return codeBcel;
}Example 48
| Project: LibFX-master File: SceneGraphNavigatorTest.java View source code |
@Override
protected Node createSingletonNode() {
return new TextArea("A node without parents and children.");
}Example 49
| Project: JFTClient-master File: TerminalPanel.java View source code |
public TextArea getTextArea() {
return textArea;
}Example 50
| Project: sportstracker-master File: AboutDialogController.java View source code |
@Override
protected void setupDialogControls() {
// Workaround: always show vertical scroll bars (otherwise they are displayed when the TextArea gets the focus)
Platform.runLater(() -> {
taAuthors.setWrapText(true);
taTranslators.setWrapText(true);
});
}Example 51
| Project: Lily-master File: ConsolePane.java View source code |
public TextArea getTextArea() {
return textArea;
}Example 52
| Project: FrostBite3Editor-master File: ModLoaderController.java View source code |
public TextArea getDesc() {
return desc;
}Example 53
| Project: FXForm2-master File: TextAreaFactory.java View source code |
public FXFormNode call(Void aVoid) {
TextArea textArea = new TextArea();
textArea.setWrapText(true);
return new FXFormNodeWrapper(textArea, textArea.textProperty());
}Example 54
| Project: nanobot-master File: LogHandler.java View source code |
static void initialize(final TextArea textArea) {
for (final Handler h : Logger.getLogger("").getHandlers()) {
if (h instanceof LogHandler) {
((LogHandler) h).setTextArea(textArea);
}
}
}Example 55
| Project: speedment-master File: DefaultTextAreaItem.java View source code |
@Override
protected TextInputControl getInputControl() {
TextArea area = new TextArea();
area.setWrapText(true);
return area;
}Example 56
| Project: Flipit-Map-Creator-master File: LogManager.java View source code |
/**
* Initialises the LogManager object
*
* @param textArea
*/
public void init(TextArea textArea) {
this.logArea = textArea;
this.logArea.setText("");
this.logArea.setEditable(false);
this.logArea.setWrapText(true);
this.logMessage = new StringBuilder();
this.preventNewLineAtFirst = true;
}Example 57
| Project: musicmount-master File: FXConsole.java View source code |
TextArea getTextArea() {
return textArea;
}Example 58
| Project: javafx-ws-client-master File: TabRestController.java View source code |
TextArea getMasterNode() {
return masterNode;
}Example 59
| Project: SyncNotes-master File: NoteViewController.java View source code |
public TextArea getBody() {
return note_body;
}Example 60
| Project: NoticEditor-master File: NoticeViewController.java View source code |
public TextArea getEditor() {
return editor;
}Example 61
| Project: simplejavayoutubeuploader-master File: TagTextArea.java View source code |
private void initTextArea() {
final TextArea textArea = new TextArea();
textArea.setWrapText(true);
textArea.textProperty().bindBidirectional(tags);
getChildren().add(textArea);
}Example 62
| Project: JRebirth-master File: AbstractView.java View source code |
/**
* Build the errorNode to display the error taht occured.
*
* @param ce the CoreException to display
*/
private void buildErrorNode(final CoreException ce) {
final TextArea ta = TextAreaBuilder.create().text(ce.getMessage()).build();
this.errorNode = PaneBuilder.create().children(ta).build();
}Example 63
| Project: SimpleDialogFX-master File: Dialog.java View source code |
/**
* Retrieves the <code>TextArea</code> object for the exception area. Allows
* user to customize FX <code>TextArea</code> object.
*
* @return TextArea object
*/
public final TextArea getExceptionArea() {
return exceptionArea;
}Example 64
| Project: JXTN-master File: JFX.java View source code |
/**
* 建立新的{@link javafx.scene.control.TextArea}建構器。
*
* @return æ–°çš„{@link javafx.scene.control.TextAreaMaker}
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static javafx.scene.control.TextAreaMaker<javafx.scene.control.TextArea, ?> textArea() {
return new javafx.scene.control.TextAreaMaker();
}Example 65
| Project: XR3Player-master File: SmartController.java View source code |
/**
* @return the informationTextArea
*/
public TextArea getInformationTextArea() {
return informationTextArea;
}