當前位置: 首頁>>代碼示例>>Java>>正文


Java Button.setPrefWidth方法代碼示例

本文整理匯總了Java中javafx.scene.control.Button.setPrefWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java Button.setPrefWidth方法的具體用法?Java Button.setPrefWidth怎麽用?Java Button.setPrefWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.Button的用法示例。


在下文中一共展示了Button.setPrefWidth方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: PasswordPane

import javafx.scene.control.Button; //導入方法依賴的package包/類
public PasswordPane()
{
    super();
    super.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    super.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    super.getStyleClass().add("pane");
    super.setPadding(new Insets(15,15,15,15));
    super.setVgap(10);
    
    buttons = new HBox();
    buttons.setSpacing(10);
    
    Label promptText = new Label("Sudo required.");
    
    okButton = new Button("OK");
    cancelButton = new Button("Cancel");
    
    buttons.getChildren().addAll(okButton, cancelButton);
    
    password = new PasswordField();
    
    okButton.setPrefWidth(60);
    okButton.setOnMouseClicked(new OkButtonHandler());
    
    cancelButton.setOnMouseClicked(new CancelButtonHandler());
    
    password.setPromptText("Password");
    
    super.add(promptText, 0, 0);
    super.add(password, 0, 1);
    super.add(buttons, 0, 2);

}
 
開發者ID:BlueGoliath,項目名稱:Goliath-Overclocking-Utility-FX,代碼行數:34,代碼來源:PasswordPane.java

示例2: NotifyTab

import javafx.scene.control.Button; //導入方法依賴的package包/類
public NotifyTab()
{
    super();
    super.setText("Notification");
    super.setClosable(false);
    
    pane = new Pane();
    box = new VBox();        
    header = new Label();
    desc = new Label();
    
    okButton = new Button("Ok");
    okButton.setPrefWidth(50);
    okButton.setOnMouseClicked(new OkButtonHandler());
    
    box.getChildren().addAll(header, desc, okButton);
    box.setPadding(new Insets(15, 15, 15, 15));
    box.setSpacing(15);
    
    pane.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    pane.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    pane.getChildren().add(box);
    
    super.setContent(pane);
}
 
開發者ID:BlueGoliath,項目名稱:Goliath-Overclocking-Utility-FX,代碼行數:26,代碼來源:NotifyTab.java

示例3: setupFileBox

import javafx.scene.control.Button; //導入方法依賴的package包/類
private static VBox setupFileBox() {
	VBox fileBox = new VBox();
	HBox chooseFileBox = new HBox(10);
	Label fileLocation = new Label("File location:");
	Button chooseFileButton = new Button("Choose File");

	fileLocationTextField.setPrefSize(210, 20);
	fileLocationTextField.setMinHeight(25);
	fileLocationTextField.setMaxWidth(210);
	fileLocationTextField.setEditable(false);
	
	chooseFileButton.setPrefWidth(80);
	chooseFileButton.setMaxSize(100, 50);
	chooseFileButton.setOnAction(e -> chooseFile());
	chooseFileBox.getChildren().addAll(fileLocationTextField, chooseFileButton);
	chooseFileBox.setAlignment(Pos.TOP_CENTER);
	
	fileBox.getChildren().addAll(fileLocation, chooseFileBox);
	fileBox.setAlignment(Pos.CENTER);
	
	return fileBox;
	
}
 
開發者ID:MorrisB--,項目名稱:MasterHash,代碼行數:24,代碼來源:Welcome.java

示例4: updateItem

import javafx.scene.control.Button; //導入方法依賴的package包/類
@Override
public void updateItem(Class<? extends Component> item, boolean empty) {
	super.updateItem(item, empty);
	if (item == null) {
		return;
	}
	Button componentCustomizer = new Button(item.getSimpleName());
	componentCustomizer.setOnAction((c) -> {
		infoPane.addComponent(item);
	});

	componentCustomizer.setPrefWidth(ComponentSelectorPane.this.getPrefWidth());
	this.prefWidthProperty().bind(ComponentSelectorPane.this.prefWidthProperty());
	componentCustomizer.prefWidthProperty().bind(this.prefWidthProperty());
	setGraphic(componentCustomizer);
}
 
開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:17,代碼來源:ComponentSelectorPane.java

示例5: createButton

import javafx.scene.control.Button; //導入方法依賴的package包/類
public Button createButton(String btnText, int width){
	Button btn = new Button();
	btn.setLayoutX(btnXPosition);
	btn.setLayoutY(btnYPosition);
	btn.setPrefWidth(width);
	btn.setText(btnText);
	btnXPosition = btnXPosition + width + 20;
	return btn;
}
 
開發者ID:JaneClelandHuang,項目名稱:Dronology,代碼行數:10,代碼來源:ButtonGenerator.java

示例6: OverclockingPaneTemplate

import javafx.scene.control.Button; //導入方法依賴的package包/類
public OverclockingPaneTemplate(boolean showReset)
{
    super();
    super.getStyleClass().add("hbox");
    //super.setPadding(new Insets(10,10,10,10));
    super.setPadding(new Insets(10,10,0,10));
    super.setVgap(5);
    super.setHgap(30);
    
    currentValueLabel = new Label();
    minValueLabel = new Label();
    maxValueLabel = new Label();
    currentValueSpinner = new Spinner<>();
    currentMinValue = new Label();
    currentMaxValue = new Label();
    
    apply = new Button("Apply");
    apply.setPrefWidth(100);
    
    if(showReset)
    {
        reset = new Button("Reset");
        reset.setPrefWidth(100);
    }
    
    currentValueSpinner.setPrefWidth(85);
    
    super.add(currentValueLabel, 0, 0);
    super.add(minValueLabel, 1, 0);
    super.add(maxValueLabel, 2, 0);
    super.add(apply, 3, 0);
    
    super.add(currentValueSpinner, 0, 1);
    super.add(currentMinValue, 1, 1);
    super.add(currentMaxValue, 2, 1);
    
    if(showReset)
        super.add(reset, 3, 1);
}
 
開發者ID:BlueGoliath,項目名稱:Goliath-Overclocking-Utility-FX,代碼行數:40,代碼來源:OverclockingPaneTemplate.java

示例7: PerformancePane

import javafx.scene.control.Button; //導入方法依賴的package包/類
public PerformancePane()
{
    super();
    super.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    super.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    super.getStyleClass().add("vbox");
    
    overclockingTabPane = new OverclockingTabPane();
    
    apply = new Button("Apply All");
    apply.setPrefWidth(100);
    apply.setPrefHeight(54);

    cancel = new Button("Reset All");
    cancel.setPrefWidth(100);
    cancel.setPrefHeight(54);

    buttonPane = new VBox();
    buttonPane.getChildren().addAll(apply, cancel);

    overclockingPane = new HBox();
    overclockingPane.getChildren().addAll(overclockingTabPane, buttonPane);

    apply.setOnMouseClicked(new ApplyButtonHandler());
    cancel.setOnMouseClicked(new cancelButtonHandler());

    super.getChildren().addAll(new PowerMizerPane(), overclockingPane);
}
 
開發者ID:BlueGoliath,項目名稱:Goliath-Overclocking-Utility-FX,代碼行數:29,代碼來源:PerformancePane.java

示例8: FanProfilePane

import javafx.scene.control.Button; //導入方法依賴的package包/類
public FanProfilePane()
{
    super();
    super.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    super.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    
    editPane = new FanProfileEditPane(InstanceProvider.getFanProfiles().get(0));
    
    leftPane = new VBox();
    
    profileList = new ListView<>();
    profileList.setEditable(false);
    profileList.setPrefWidth(125);
    profileList.setItems(FXCollections.observableArrayList(InstanceProvider.getFanProfiles()));
    profileList.getSelectionModel().selectFirst();
    profileList.setOnMouseClicked(new ListHandler());
    profileList.setContextMenu(new ProfileContextMenu(profileList));
    
    profileList.setPlaceholder(new Label("No Profiles"));
    
    applyButton = new Button("Apply");
    applyButton.setPrefWidth(125);
    applyButton.setMinHeight(47);
    applyButton.setOnMouseClicked(new ApplyButtonHandler());
    
    leftPane.getChildren().addAll(profileList, applyButton);
    
    infoPane = new FanOptionPane();
    
    super.setTop(infoPane);
    super.setLeft(leftPane);
    super.setCenter(editPane);
}
 
開發者ID:BlueGoliath,項目名稱:Goliath-Overclocking-Utility-FX,代碼行數:34,代碼來源:FanProfilePane.java

示例9: PromptTab

import javafx.scene.control.Button; //導入方法依賴的package包/類
public PromptTab()
{
    super();
    super.setText("Confirmation Required");
    super.setClosable(false);
    
    pane = new Pane();
    contentBox = new VBox(); 
    buttonBox = new HBox();
    header = new Label();
    desc = new Label();
    
    yesButton = new Button("Yes");
    yesButton.setPrefWidth(50);
    
    noButton = new Button("No");
    noButton.setPrefWidth(50);
    
    buttonBox.getChildren().addAll(yesButton, noButton);
    buttonBox.setSpacing(10);
    
    contentBox.getChildren().addAll(header, desc, buttonBox);
    contentBox.setPadding(new Insets(15, 15, 15, 15));
    contentBox.setSpacing(15);
    
    pane.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    pane.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    pane.getChildren().add(contentBox);
    
    super.setContent(pane);
}
 
開發者ID:BlueGoliath,項目名稱:Goliath-Overclocking-Utility-FX,代碼行數:32,代碼來源:PromptTab.java

示例10: createButton

import javafx.scene.control.Button; //導入方法依賴的package包/類
private void createButton() {
    editButton = new Button();
    editButton.setText("Edit");
    editButton.setPrefWidth(100);
    editButton.setOnAction(this);
    editButton.setGraphic(Glyph.create("FontAwesome|pencil"));
}
 
開發者ID:rumangerst,項目名稱:CSLMusicModStationCreator,代碼行數:8,代碼來源:EditCell.java

示例11: buildButton

import javafx.scene.control.Button; //導入方法依賴的package包/類
private Button buildButton(String text) {
    Button button = new Button(text);
    button.setMnemonicParsing(false);
    button.setMinWidth(USE_PREF_SIZE);
    button.setMaxWidth(USE_PREF_SIZE);
    button.setPrefWidth(30);

    button.setMinHeight(USE_PREF_SIZE);
    button.setMaxHeight(USE_PREF_SIZE);
    button.setPrefHeight(25);
    return button;
}
 
開發者ID:Kindrat,項目名稱:cassandra-client,代碼行數:13,代碼來源:TableButtons.java

示例12: FanProfileEditPane

import javafx.scene.control.Button; //導入方法依賴的package包/類
public FanProfileEditPane(FanProfile file)
{
    super();

    tempCol = new TableColumn<>("Temperature(C)");
    tempCol.setCellValueFactory(new PropertyValueFactory<>("temp"));
    tempCol.setSortable(true);
    tempCol.setSortType(TableColumn.SortType.ASCENDING);
    
    speedCol = new TableColumn<>("Speed(%)");
    speedCol.setCellValueFactory(new PropertyValueFactory<>("speed"));
    
    tempTable = new TableView<>();
    tempTable.setMinWidth(625);
    tempTable.setMaxWidth(625);
    tempTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tempTable.setItems(FXCollections.observableArrayList(InstanceProvider.getCurrentFanProfile().getNodes()));
    tempTable.getSortOrder().add(tempCol);
    tempTable.getColumns().addAll(tempCol, speedCol);
    
    menu = new ContextMenu();
    menu.getItems().add(new DeleteItem());
    tempTable.setContextMenu(menu);
    
    tempBox = new HBox();
    tempBox.getStyleClass().add("hbox");
    tempBox.setSpacing(5);
    
    speedBox = new HBox();
    speedBox.getStyleClass().add("hbox");
    speedBox.setSpacing(5);
    
    tempLabel = new Label("Temperature(C):");
    speedLabel = new Label("Speed(%):");
    
    tempSpinner = new Spinner<>();
    tempSpinner.setPrefWidth(75);
    tempSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(5, 100, 5));
    
    speedSpinner = new Spinner<>();
    speedSpinner.setPrefWidth(75);
    speedSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(5, 100, 5));
    
    tempBox.getChildren().addAll(tempLabel, tempSpinner);
    speedBox.getChildren().addAll(speedLabel, speedSpinner);
    
    apply = new Button("Add / Edit");
    apply.setPrefWidth(90); 
    apply.setOnMouseClicked(new ApplyButtonHandler());
    
    tempEditOpts = new HBox();
    tempEditOpts.getStyleClass().add("hbox");
    tempEditOpts.setPadding(new Insets(10,10,10,10));
    tempEditOpts.setSpacing(16);
    tempEditOpts.getChildren().addAll(tempBox, speedBox, apply);
    
    super.getChildren().addAll(tempTable, tempEditOpts); 
}
 
開發者ID:BlueGoliath,項目名稱:Goliath-Overclocking-Utility-FX,代碼行數:59,代碼來源:FanProfileEditPane.java

示例13: setRightBlock

import javafx.scene.control.Button; //導入方法依賴的package包/類
public VBox setRightBlock(){
	VBox jobb = new VBox(10);
	jobb.setSpacing(10);
    jobb.setPrefWidth(200);
    jobb.setPrefHeight(500);

    jobb.setLayoutX(WIDTH-200);
    Button gomb = new Button("Játék újrakezdése");
    gomb.setPrefWidth(150);
    gomb.setPadding(new Insets(10, 10, 10, 10));
    gomb.setTranslateX((jobb.getPrefWidth()-gomb.getPrefWidth())/2);
    gomb.setTranslateY(50);
    jobb.setStyle("-fx-background-color: #c2c2d6;");
    jobb.getChildren().add(gomb);
    
    Text manualTitle = new Text("Irányítás:");
    manualTitle.setTranslateX(50);
    manualTitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    manualTitle.setTranslateY(100);
    jobb.getChildren().add(manualTitle);
    
    GridPane moveHolder = new GridPane();
    moveHolder.setAlignment(Pos.CENTER);
    moveHolder.setHgap(10);
    moveHolder.setVgap(10);
    moveHolder.setPrefWidth(200);
    moveHolder.setPrefHeight(400);
    
    Text moveUp = new Text("↑ - Felfele lépés");
    moveUp.setTextAlignment(TextAlignment.CENTER);
    moveUp.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    moveHolder.add(moveUp, 0, 0, 2, 1);
    
    Text moveDown = new Text("↓ - Lefele lépés");
    moveDown.setTextAlignment(TextAlignment.CENTER);
    moveDown.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    moveHolder.add(moveDown, 0, 1, 2, 1);
    
    Text moveLeft = new Text("← - Balra lépés");
    moveLeft.setTextAlignment(TextAlignment.CENTER);
    moveLeft.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    moveHolder.add(moveLeft, 0, 2, 2, 1);
    
    Text moveRight = new Text("→ - Jobbra lépés");
    moveRight.setTextAlignment(TextAlignment.CENTER);
    moveRight.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    moveHolder.add(moveRight, 0, 3, 2, 1);
    
    jobb.getChildren().add(moveHolder);
    
    gomb.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent e) {
        	playGround.lepes = 0;
        	playGround.celban = 0;
        	playGround.getDatum(); 

        	playGround.resetPlayGround();
        	
            updatePlayGround();
            
            playGround.nyertes = 0;
            playGround.kezdes = 1;
            
            
                         
        }
    });
    
    return jobb;
}
 
開發者ID:kacshuffle,項目名稱:SokobanGame,代碼行數:71,代碼來源:ViewController.java

示例14: TatMessageBox

import javafx.scene.control.Button; //導入方法依賴的package包/類
/**
 * Constructor
 * @param owner - To which parent window this messageBox belong to
 * @param type - What type of message box it is
 * @param message - What is the actual message
 */
public TatMessageBox(Window owner, TYPE type, String message) {
    super();
    setResizable(false);
    initStyle(StageStyle.DECORATED);
    initOwner(owner);
    this.owner = owner;
    initModality(Modality.APPLICATION_MODAL);

    this.message = message;
    messageType = type;
    
    yesButton = new Button("Yes");
    yesButton.setPrefWidth(100);
    yesButton.setOnAction(e->{
        responseProperty.setValue((ID.YES).ordinal());
        hide();
    });        
    okButton = new Button("Ok");
    okButton.setPrefWidth(100);
    okButton.setOnAction(e->{
        responseProperty.setValue((ID.OK).ordinal());
        hide();
    });
    cancelButton = new Button("Cancel");
    cancelButton.setPrefWidth(100);
    cancelButton.setOnAction(e->{
        responseProperty.setValue((ID.CANCEL).ordinal());
        hide();
    });
    noButton = new Button("No");
    noButton.setPrefWidth(100);
    noButton.setOnAction(e->{
        responseProperty.setValue((ID.NO).ordinal());
        hide();
    });
    openLogButton = new Button("Open Log File");
    openLogButton.setPrefWidth(100);
    openLogButton.setOnAction(e->{
        hide();
    });
    
    switch(type) {
    case CONFIRM:
        makeConfirmGUI();
        break;
    case INFO:
        makeInfoGUI();
        break;
    case WARNING:
        makeWaningGUI();
        break;
    case ERROR:
        makeErrorGUI();
        break;
    default:
        break;
    }
}
 
開發者ID:ztan5,項目名稱:TechnicalAnalysisTool,代碼行數:65,代碼來源:TatMessageBox.java


注:本文中的javafx.scene.control.Button.setPrefWidth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。