当前位置: 首页>>代码示例>>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;未经允许,请勿转载。