Use TextField with label on top

This commit is contained in:
Christoph Atteneder 2018-10-30 15:41:54 +01:00
parent ce9c1ab459
commit 797c935a28
No known key found for this signature in database
GPG key ID: CD5DC1C529CDFD3B
3 changed files with 10 additions and 34 deletions

View file

@ -182,7 +182,7 @@ public abstract class PaymentMethodForm {
getTimeText(hours),
formatter.formatCoinWithCode(Coin.valueOf(accountAgeWitnessService.getMyTradeLimit(paymentAccount, tradeCurrency.getCode()))),
formatter.formatAccountAge(accountAge));
addTextField(gridPane, ++gridRow, Res.get("payment.limitations"), limitationsText);
addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.limitations"), limitationsText);
if (isAddAccountScreen) {
InputTextField inputTextField = addInputTextField(gridPane, ++gridRow, Res.get("payment.salt"), 0);
@ -277,12 +277,12 @@ public abstract class PaymentMethodForm {
TradeCurrency singleTradeCurrency) {
gridRowFrom = gridRow;
addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), accountName, Layout.FIRST_ROW_AND_GROUP_DISTANCE);
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(paymentMethod.getId()));
TextField field = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.no"), accountNr).second;
addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(paymentMethod.getId()));
TextField field = addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.no"), accountNr).second;
field.setMouseTransparent(false);
final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode);
addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode);
addLimitations();
}

View file

@ -35,7 +35,6 @@ import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import static bisq.desktop.util.FormBuilder.addInputTextField;
import static bisq.desktop.util.FormBuilder.addTextField;
import static bisq.desktop.util.FormBuilder.addTopLabelTextField;
public class PromptPayForm extends PaymentMethodForm {
@ -71,7 +70,7 @@ public class PromptPayForm extends PaymentMethodForm {
TradeCurrency singleTradeCurrency = promptPayAccount.getSingleTradeCurrency();
String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
addTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode);
addLimitations();
addAccountNameTextFieldWithAutoFillToggleButton();
}
@ -84,16 +83,16 @@ public class PromptPayForm extends PaymentMethodForm {
@Override
public void addFormForDisplayAccount() {
gridRowFrom = gridRow;
addTextField(gridPane, gridRow, Res.get("payment.account.name"),
addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"),
promptPayAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"),
addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
Res.get(promptPayAccount.getPaymentMethod().getId()));
TextField field = addTextField(gridPane, ++gridRow, Res.get("payment.promptPay.promptPayId"),
promptPayAccount.getPromptPayId());
TextField field = addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.promptPay.promptPayId"),
promptPayAccount.getPromptPayId()).second;
field.setMouseTransparent(false);
TradeCurrency singleTradeCurrency = promptPayAccount.getSingleTradeCurrency();
String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
addTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode);
addLimitations();
}

View file

@ -196,29 +196,6 @@ public class FormBuilder {
return label;
}
///////////////////////////////////////////////////////////////////////////////////////////
// TextField
///////////////////////////////////////////////////////////////////////////////////////////
public static TextField addTextField(GridPane gridPane, int rowIndex, String title, String value) {
return addTextField(gridPane, rowIndex, title, value, 0);
}
public static TextField addTextField(GridPane gridPane, int rowIndex, String title, String value, double top) {
TextField textField = new JFXTextField(value);
((JFXTextField) textField).setLabelFloat(true);
textField.setPromptText(title);
textField.setEditable(false);
textField.setMouseTransparent(true);
textField.setFocusTraversable(false);
GridPane.setRowIndex(textField, rowIndex);
GridPane.setMargin(textField, new Insets(top + Layout.FLOATING_LABEL_DISTANCE, 0, 0, 0));
gridPane.getChildren().add(textField);
return textField;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Label + TextField
///////////////////////////////////////////////////////////////////////////////////////////