本文整理匯總了Java中javafx.scene.control.Label.setPadding方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setPadding方法的具體用法?Java Label.setPadding怎麽用?Java Label.setPadding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Label
的用法示例。
在下文中一共展示了Label.setPadding方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: PremisesAndConclusion
import javafx.scene.control.Label; //導入方法依賴的package包/類
public PremisesAndConclusion(String sPremises, String sConclusion) {
premises = new TextField(sPremises);
premises.textProperty().addListener((ov, oldValue, newValue) -> {
parseAndStyle(premises, newValue);
});
parseAndStyle(premises, sPremises);
premises.getStyleClass().add("myText");
turnstile = new Label("⊢");
turnstile.setPrefHeight(25);
turnstile.setPrefWidth(26.0);
turnstile.setPadding(new Insets(5,0,0,0));
turnstile.setAlignment(Pos.CENTER);
conclusion = new TextField(sConclusion);
conclusion.textProperty().addListener((ov, oldValue, newValue) -> {
parseAndStyle(conclusion, newValue);
});
parseAndStyle(conclusion, sConclusion);
conclusion.getStyleClass().add("myText");
consumeKeys(premises);
consumeKeys(conclusion);
this.getChildren().addAll(premises, turnstile, conclusion);
setPrefs();
}
示例2: ActionTextPane
import javafx.scene.control.Label; //導入方法依賴的package包/類
public ActionTextPane() {
actionText = new Label("Test");
graphic = new ImageView(new Image("assets/icons/editor_action_info_icon.png"));
actionText.setGraphic(graphic);
actionText.setTextFill(Utils.getDefaultTextColor());
actionText.setAlignment(Pos.CENTER);
actionText.setPadding(new Insets(0, 0, 0, 5));
getChildren().add(actionText);
setAlignment(Pos.CENTER);
ft = new FadeTransition(Duration.millis(500), graphic);
ft.setFromValue(1.0);
ft.setToValue(0.0);
ft.setAutoReverse(true);
ft.setCycleCount(4);
}
示例3: initProgressBarUI
import javafx.scene.control.Label; //導入方法依賴的package包/類
private void initProgressBarUI() {
Label runLabel = new Label("Runs: ");
runLabel.setMinWidth(Region.USE_PREF_SIZE);
nRuns = new Text((int) progress + "/" + maxTestCount);
Label errorLabel = new Label("Errors: ");
errorLabel.setMinWidth(Region.USE_PREF_SIZE);
errorLabel.setGraphic(FXUIUtils.getIcon("error"));
errorLabel.setPadding(new Insets(0, 0, 0, 80));
errorText = new Text(errors + "");
Label failureLabel = new Label("Failures: ");
failureLabel.setMinWidth(Region.USE_PREF_SIZE);
failureLabel.setGraphic(FXUIUtils.getIcon("failure"));
failureLabel.setPadding(new Insets(0, 0, 0, 80));
failureText = new Text(failures + "");
progressBarString.setAlignment(Pos.CENTER);
progressBarString.setPadding(new Insets(5, 0, 5, 0));
progressBarString.getChildren().addAll(runLabel, nRuns, errorLabel, errorText, failureLabel, failureText);
}
示例4: mkRoot
import javafx.scene.control.Label; //導入方法依賴的package包/類
@Override
public Node mkRoot() {
try {
Parent node = FXMLLoader.load(getClass().getResource("/ComplexScene.fxml"));
node.setPickOnBounds(true);
node.setMouseTransparent(true);
WebView webview = (WebView) node.lookup("webview");
if(webview != null){
webview.getEngine().load("http://purecss3.net/doraemon/doraemon_css3.html");
}
GesturePane pane = new GesturePane(new SubScene(node, 500, 500));
VBox.setVgrow(pane, Priority.ALWAYS);
Label description = new Label("Zoom and scroll on the SubScene below, " +
"observe that controls in JavaFX are vectors " +
"and that lighting effects are respected" +
"(different zoom alters light distance).");
description.setWrapText(true);
description.setPadding(new Insets(16));
return new VBox(description, pane);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例5: apply
import javafx.scene.control.Label; //導入方法依賴的package包/類
@Override
public Node apply(int idx) {
Val<String> formatted = paragraphs.map(n -> format(idx + 1, n));
Label lineNo = new Label();
lineNo.setCursor(Cursor.HAND);
lineNo.setBackground(DEFAULT_BACKGROUND);
lineNo.setPadding(DEFAULT_INSETS);
lineNo.getStyleClass().add("lineno");
lineNo.textProperty().bind(formatted.conditionOnShowing(lineNo));
return lineNo;
}
示例6: addRow
import javafx.scene.control.Label; //導入方法依賴的package包/類
/**
* Add a new row to the grid, with a label and value. For each new row, an empty RowConstaints object is created.
*
* @param rowIndex Index to add row
* @param label Label node of row
* @param value Value node of row
* @return RowConstraints object for the newly added row
*/
private RowConstraints addRow(int rowIndex, Label label, Node value) {
// Set padding on the label
label.setPadding(new Insets(vGap, 0, vGap, 0));
// Add the new row
paramsGrid.addRow(rowIndex, label, value);
// Create the row constraints for it
RowConstraints rowConstraints = new RowConstraints();
paramsGrid.getRowConstraints().add(rowConstraints);
return rowConstraints;
}
示例7: createBuildInformation
import javafx.scene.control.Label; //導入方法依賴的package包/類
private HBox createBuildInformation( ) {
final HBox tileContent = new HBox( );
tileContent.setAlignment( CENTER_LEFT );
final Label tileTitle = new Label( );
tileTitle.setFont( UIUtils.font( 50, FontWeight.BOLD ) );
tileTitle.setTextFill( Color.WHITE );
tileTitle.setPadding( new Insets( 5 ) );
tileTitle.setWrapText( true );
tileTitle.setEffect( UIUtils.shadowEffect( ) );
tileTitle.textProperty( ).bind( _model.displayedNameProperty( ) );
tileTitle.prefWidthProperty( ).bind( widthProperty( ) );
tileTitle.prefHeightProperty( ).bind( heightProperty( ) );
tileTitle.alignmentProperty( ).bind( createObjectBinding( ( ) -> _model.isLightMode( ) ? Pos.CENTER : CENTER_LEFT, _model.lightModeProperty( ) ) );
tileTitle.textAlignmentProperty( ).bind( createObjectBinding( ( ) -> _model.isLightMode( ) ? CENTER : LEFT, _model.lightModeProperty( ) ) );
HBox.setHgrow( tileTitle, Priority.SOMETIMES );
tileContent.getChildren( ).add( tileTitle );
final VBox contextPart = createContextPart( _model );
contextPart.visibleProperty( ).bind( _model.lightModeProperty( ).not( ) );
contextPart.prefWidthProperty( ).bind( createIntegerBinding( ( ) -> contextPart.isVisible( ) ? 145 : 0, contextPart.visibleProperty( ) ) );
contextPart.prefHeightProperty( ).bind( heightProperty( ) );
contextPart.setMinSize( USE_PREF_SIZE, USE_PREF_SIZE );
contextPart.setMaxSize( USE_PREF_SIZE, USE_PREF_SIZE );
tileContent.getChildren( ).add( contextPart );
return tileContent;
}
示例8: refreshView
import javafx.scene.control.Label; //導入方法依賴的package包/類
@Override
public void refreshView()
{
lines.clear();
StackShowList.getChildren().clear();
ArrayList<String> names = new ArrayList<String>();
int dataLength = 8;
names.clear();
names.add("first serverdoor");
names.add("second serverdoor");
names.add("third serverdoor");
names.add("fourth serverdoor");
names.add("first serverdoor");
names.add("second serverdoor");
names.add("third serverdoor");
names.add("fourth serverdoor");
names.add("first serverdoor");
names.add("second serverdoor");
names.add("third serverdoor");
names.add("fourth serverdoor");
names.add("first serverdoor");
names.add("second serverdoor");
names.add("third serverdoor");
names.add("fourth serverdoor");
for(int i = 0; i < dataLength; i++)
{
int counter = i;
HBox entry = new HBox();
Label lblServerDoor = new Label(names.get(i));
lblServerDoor.setPadding(new Insets(15,0,0,250));
lblServerDoor.setMinWidth(740);
//AppButton btnMerge = new AppButton("Bearbeiten");
AppButton btnModify = new AppButton("Bearbeiten");
btnModify.setOnAction(e ->
{
ArrayList<String> list = new ArrayList<String>();
list.add(names.get(counter));
getFXController().getModel("dmomodifystackmodel").setDataList(list);
getFXController().showView("dmomodifystackview");
}
);
entry.getChildren().addAll(lblServerDoor,btnModify);
lines.add(entry);
}
for(HBox l : lines)
{
StackShowList.getChildren().add(l);
}
}
示例9: HeaderPanel
import javafx.scene.control.Label; //導入方法依賴的package包/類
public HeaderPanel(AppSession session) {
this.session = session;
content = new HBox(5);
content.setPadding(new Insets(5));
setCenter(content);
textContent = new TextArea();
textContent.setPrefRowCount(16);
textContent.setVisible(false);
setBottom(textContent);
textContent.setManaged(false);
textContent.setFont(App.getDefaultFont());
textContent.focusedProperty().addListener((val, before, after) -> {
if (!after) { // if we lost focus
rebuildFeatureIfTextChanged();
}
});
MenuBar menuBar = new MenuBar();
Menu fileMenu = new Menu("File");
openFileMenuItem = new MenuItem("Open");
fileMenu.getItems().addAll(openFileMenuItem);
Menu importMenu = new Menu("Import");
openImportMenuItem = new MenuItem("Open");
importMenu.getItems().addAll(openImportMenuItem);
menuBar.getMenus().addAll(fileMenu, importMenu);
setTop(menuBar);
if (session != null) {
Label envLabel = new Label("karate.env");
envLabel.setPadding(new Insets(5, 0, 0, 0));
TextField envTextField = new TextField();
envTextField.setText(session.getEnv().env);
Button envButton = new Button("Reset");
envButton.setOnAction(e -> session.resetAll(envTextField.getText()));
Button runAllButton = new Button("Run ►►");
runAllButton.setOnAction(e -> session.runAll());
Button showContentButton = new Button(getContentButtonText(false));
initTextContent();
showContentButton.setOnAction(e -> {
boolean visible = !textContent.isVisible();
textContent.setVisible(visible);
textContent.setManaged(visible);
showContentButton.setText(getContentButtonText(visible));
});
content.getChildren().addAll(envLabel, envTextField, envButton, runAllButton, showContentButton);
}
}
示例10: initTabProcesses
import javafx.scene.control.Label; //導入方法依賴的package包/類
private Node initTabProcesses() {
userProcessesList = FXCollections.observableArrayList();
allProcessesList = FXCollections.observableArrayList();
ProcessesUtil.getProcesses(allProcessesList, true);
ProcessesUtil.getProcesses(userProcessesList, false);
TableColumn pidCol = new TableColumn("PID");
TableColumn nameCol = new TableColumn("Nome do processo");
TableColumn userCol = new TableColumn("Usuário");
TableColumn cpuCol = new TableColumn("CPU (%)");
TableColumn memCol = new TableColumn("Memória (%)");
pidCol.setCellValueFactory(
new PropertyValueFactory<>("pid")
);
nameCol.setCellValueFactory(
new PropertyValueFactory<>("readableName")
);
userCol.setCellValueFactory(
new PropertyValueFactory<>("user")
);
cpuCol.setCellValueFactory(
new PropertyValueFactory<>("CPU")
);
memCol.setCellValueFactory(
new PropertyValueFactory<>("MEM")
);
viewProcesses = new TableView();
viewProcesses.setEditable(false);
viewProcesses.getColumns().addAll(pidCol, nameCol, userCol, cpuCol, memCol);
viewProcesses.setItems(userProcessesList);
viewProcesses.setOnMousePressed(mouseEventHandler);
checkBoxAllProcesses = new CheckBox("Processos de todos usuários");
checkBoxAllProcesses.setOnAction(actionEventHandler);
inputFilter = new TextField();
inputFilter.textProperty().addListener(this);
Label labelFilter = new Label("Filtrar:");
labelFilter.setPadding(new Insets(0, 10, 0, 0));
HBox hBoxFilter = new HBox(labelFilter, inputFilter);
hBoxFilter.setAlignment(Pos.BASELINE_RIGHT);
HBox.setHgrow(hBoxFilter, Priority.ALWAYS);
HBox hBoxOptions = new HBox(checkBoxAllProcesses, hBoxFilter);
hBoxOptions.setPrefWidth(prefWidth);
hBoxOptions.setPadding(new Insets(10));
return new VBox(viewProcesses, hBoxOptions);
}
示例11: refreshView
import javafx.scene.control.Label; //導入方法依賴的package包/類
@Override
public void refreshView()
{
lines.clear();
StackShowList.getChildren().clear();
ArrayList<String> names = new ArrayList<String>();
int dataLength = 8;
names.clear();
names.add("first Doorlocal");
names.add("second Doorlocal");
names.add("third Doorlocal");
names.add("fourth Doorlocal");
names.add("first Doorlocal");
names.add("second Doorlocal");
names.add("third Doorlocal");
names.add("fourth Doorlocal");
names.add("first Doorlocal");
names.add("second Doorlocal");
names.add("third Doorlocal");
names.add("fourth Doorlocal");
names.add("first Doorlocal");
names.add("second Doorlocal");
names.add("third Doorlocal");
names.add("fourth Doorlocal");
for(int i = 0; i < dataLength; i++)
{
int counter = i;
HBox entry = new HBox();
Label lblServerDoor = new Label(names.get(i));
lblServerDoor.setPadding(new Insets(15,0,0,250));
lblServerDoor.setMinWidth(590);
AppButton btnMerge = new AppButton("Merge");
AppButton btnInformation = new AppButton("i");
btnInformation.setOnAction(e ->
{
ArrayList<String> list = new ArrayList<String>();
list.add(names.get(counter));
getFXController().getModel("doorstackinformationmodel").setDataList(list);
getFXController().showView("doorstackinformationview");
}
);
entry.getChildren().addAll(lblServerDoor,btnInformation,btnMerge);
lines.add(entry);
}
for(HBox l : lines)
{
StackShowList.getChildren().add(l);
}
}
示例12: initializeLabel
import javafx.scene.control.Label; //導入方法依賴的package包/類
private void initializeLabel() {
final Label label = (Label) lookup("#label");
final JFXTextField textField = (JFXTextField) lookup("#textField");
final Path shape = (Path) lookup("#shape");
final Insets insets = new Insets(0,2,0,2);
textField.setPadding(insets);
label.setPadding(insets);
final int padding = 0;
label.layoutBoundsProperty().addListener((obs, oldBounds, newBounds) -> {
double newWidth = Math.max(newBounds.getWidth(), 10);
final double res = GRID_SIZE * 2 - (newWidth % (GRID_SIZE * 2));
newWidth += res;
textField.setMinWidth(newWidth);
textField.setMaxWidth(newWidth);
l2.setX(newWidth + padding);
l3.setX(newWidth + padding);
setMinWidth(newWidth + padding);
setMaxWidth(newWidth + padding);
textField.setMinHeight(TAG_HEIGHT);
textField.setMaxHeight(TAG_HEIGHT);
textField.focusedProperty().addListener((observable, oldFocused, newFocused) -> {
if (newFocused) {
shape.setTranslateY(2);
textField.setTranslateY(2);
}
});
if (getWidth() >= 1000) {
setWidth(newWidth);
setHeight(TAG_HEIGHT);
shape.setTranslateY(-1);
textField.setTranslateY(-1);
}
// Fixes the jumping of the shape when the text field is empty
if (textField.getText().isEmpty()) {
shape.setLayoutX(0);
}
});
label.textProperty().bind(new When(textField.textProperty().isNotEmpty()).then(textField.textProperty()).otherwise(textField.promptTextProperty()));
}
示例13: mkRoot
import javafx.scene.control.Label; //導入方法依賴的package包/類
@Override
public Node mkRoot() {
GesturePane pane = new GesturePane();
WebView webview = new WebView();
WebEngine engine = webview.getEngine();
pane.addEventHandler(AffineEvent.CHANGED, e -> {
String script = String.format(
"document.getElementsByTagName('body')[0].style.transform = " +
"'matrix(%s,0,0,%s,%s,%s)';",
e.namedCurrent().scaleX(),
e.namedCurrent().scaleY(),
e.namedCurrent().translateX(),
e.namedCurrent().translateY());
engine.executeScript(script);
});
TextField bar = new TextField(INTERESTING_CSS);
bar.setOnAction(e -> engine.load(bar.getText()));
engine.load(bar.getText());
engine.documentProperty().addListener((o, p, n) -> {
if (n == null) return;
pane.zoomTo(1, Point2D.ZERO);
pane.setTarget(new Transformable() {
@Override
public double width() {
return Double.valueOf(engine.executeScript("document.body.scrollWidth")
.toString());
}
@Override
public double height() {
return Double.valueOf(engine.executeScript("document.body.scrollHeight")
.toString());
}
});
});
Label description = new Label("GesturePane supports Transformable implementation. This " +
"sample shows a WebView behind an empty GesturePane " +
"listening for AffineEvents. The Affine matrix is " +
"translated to CSS matrix and applied the the body " +
"element. \nBe aware that all mouse events will be " +
"consumed by the pane so you cannot click any " +
"links.");
description.setWrapText(true);
description.setPadding(new Insets(16));
StackPane glass = new StackPane(webview, pane);
glass.setPrefSize(0, 0);
VBox.setVgrow(glass, Priority.ALWAYS);
return new VBox(description, bar, glass);
}
示例14: MemberPane
import javafx.scene.control.Label; //導入方法依賴的package包/類
public MemberPane(Organization organization, EditOrganizationStage oms) {
super();
this.organization = organization;
this.eos = oms;
members = FXCollections.observableArrayList();
forceUpdateMemberList();
memberTable = new TableView<>(members);
TableColumn<MemberView, String> nameCol = new TableColumn<>("Name");
nameCol.setCellValueFactory(new PropertyValueFactory<>("username"));
ColumnConstraints cc = new ColumnConstraints();
cc.setPercentWidth(100);
memberTable.getColumns().add(nameCol);
memberTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
buttonPane = new GridPane();
buttonPane.setPadding(new Insets(10, 0, 0, 0));
buttonPane.setHgap(5);
addMember = new Button("Add Member...");
removeMember = new Button("Remove selected");
transfertOwnership = new Button("Transfert Ownership");
buttonPane.addRow(0, addMember, removeMember, transfertOwnership);
addMember.setOnAction(this::addMemberAction);
removeMember.setOnAction(this::removeMemberAction);
transfertOwnership.setOnAction(this::transferOwnershipAction);
removeMember.setDisable(true);
transfertOwnership.setDisable(true);
Label title = new Label("Members :");
title.setPadding(new Insets(0, 0, 10, 0));
setTop(title);
setCenter(memberTable);
setBottom(buttonPane);
memberTable.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
if (newSelection == null || newSelection.isYou()) {
removeMember.setDisable(true);
transfertOwnership.setDisable(true);
} else {
removeMember.setDisable(false);
transfertOwnership.setDisable(false);
}
});
}
示例15: ServerPane
import javafx.scene.control.Label; //導入方法依賴的package包/類
public ServerPane(Organization organization, OrganizationManagerStage oms) {
super();
this.organization = organization;
this.oms = oms;
servers = FXCollections.observableArrayList();
forceUpdateServerList();
serverTable = new TableView<>(servers);
serverTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
TableColumn<ServerView, String> nameCol = new TableColumn<>("Name");
TableColumn<ServerView, String> addressCol = new TableColumn<>("Address");
nameCol.setCellValueFactory(new PropertyValueFactory<>("name"));
addressCol.setCellValueFactory(new PropertyValueFactory<>("address"));
serverTable.getColumns().add(nameCol);
serverTable.getColumns().add(addressCol);
buttonPane = new GridPane();
buttonPane.setPadding(new Insets(10, 0, 0, 0));
buttonPane.setHgap(5);
addButton = new Button("Add Server...");
editButton = new Button("Edit selected...");
removeButton = new Button("Remove selected");
addButton.setOnAction(this::addServerAction);
editButton.setOnAction(this::editServerAction);
removeButton.setOnAction(this::removeServerAction);
editButton.setDisable(true);
removeButton.setDisable(true);
buttonPane.addRow(0, addButton, editButton, removeButton);
Label title = new Label("Servers :");
title.setPadding(new Insets(0, 0, 10, 0));
setTop(title);
setCenter(serverTable);
setBottom(buttonPane);
serverTable.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
if (newSelection == null) {
editButton.setDisable(true);
removeButton.setDisable(true);
} else {
editButton.setDisable(false);
removeButton.setDisable(false);
}
});
}