当前位置: 首页>>代码示例>>Java>>正文


Java Button.setText方法代码示例

本文整理汇总了Java中javafx.scene.control.Button.setText方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setText方法的具体用法?Java Button.setText怎么用?Java Button.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.Button的用法示例。


在下文中一共展示了Button.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSaveFlightButton

import javafx.scene.control.Button; //导入方法依赖的package包/类
private Button createSaveFlightButton(Stage stage){
       Button btnSaveFlight = new Button();
       btnSaveFlight.setLayoutX(10);
       btnSaveFlight.setLayoutY(60);;
       btnSaveFlight.setText("Save Flight");

       btnSaveFlight.setOnAction(       
       new EventHandler<ActionEvent>() {
          @Override
          public void handle(final ActionEvent e) {
       	   FileChooser fileChooser = new FileChooser();
      		   fileChooser.setTitle("Flight plan (xml)");
      		   File file = fileChooser.showSaveDialog(stage);
      		   if (file != null) {
      		       System.out.println("Selected " + file);
      		       try {
      		    	    fzv.setPlanningMode(false);
   				    new SaveXMLFlight(file.getAbsolutePath(),wayPoints);
			   } catch (IOException | FlightZoneException e1) {
   					// TODO Auto-generated catch block
   					e1.printStackTrace();
   			   }     
      	    }
       }});
       return btnSaveFlight;
}
 
开发者ID:JaneClelandHuang,项目名称:Dronology,代码行数:27,代码来源:InteractiveFlightPlannerView.java

示例2: start

import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Hello World!");
    Button btn = new Button();
    btn.setText("Say 'Hello World'");
    btn.setOnAction(new EventHandler<ActionEvent>() {
 
        @Override
        public void handle(ActionEvent event) {
            System.out.println("Hello World!");
        }
    });
    
    StackPane root = new StackPane();
    root.getChildren().add(btn);
    primaryStage.setScene(new Scene(root, 300, 250));
    primaryStage.show();
}
 
开发者ID:Mozilla-Campus-Club-IIT,项目名称:Hello-World-Collection,代码行数:19,代码来源:JavaFX_saidHello.java

示例3: start

import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
  public void start(Stage primaryStage) {
      String title = "Obfuscate";
primaryStage.setTitle(title + " " + StringUtils.length(title));
      Button btn = new Button();
      btn.setText("Obfuscated?");
      btn.setOnAction(new EventHandler<ActionEvent>() {
 
          @Override
          public void handle(ActionEvent event) {
              System.out.println("Obfuscated?");
          }
      });
      
      View view = new View();
      view.addButton(btn);
      primaryStage.setScene(new Scene(view, 300, 250));
      primaryStage.show();
  }
 
开发者ID:sixro,项目名称:javafx-experiments,代码行数:20,代码来源:HelloWorldApp.java

示例4: PrescriptionAction

import javafx.scene.control.Button; //导入方法依赖的package包/类
public PrescriptionAction() {

        button = new Button();
        button0 = new Button();

        setSpacing(3.0);
        setStyle("-fx-background-color: none;");
        getStylesheets().add("/view/common/../../css/main.css");

        button.setDefaultButton(true);
        button.setMnemonicParsing(false);
        button.setOnAction(this::handleEditButton);
        button.setText("Edit");

        button0.setCancelButton(true);
        button0.setMnemonicParsing(false);
        button0.setOnAction(this::handleDeleteButton);
        button0.setText("Delete");

        getChildren().add(button);
        getChildren().add(button0);

    }
 
开发者ID:kmrifat,项目名称:Dr-Assistant,代码行数:24,代码来源:PrescriptionAction.java

示例5: createNewFlightButton

import javafx.scene.control.Button; //导入方法依赖的package包/类
private Button createNewFlightButton(Stage stage){
       Button btnNewFlight = new Button();
       btnNewFlight.setLayoutX(10);
       btnNewFlight.setLayoutY(10);;
       btnNewFlight.setText("Record New Flight");
       btnNewFlight.setOnAction(
       new EventHandler<ActionEvent>() {
          @Override
          public void handle(final ActionEvent e) {
       	   fzv.setPlanningMode(true);
       	}});
       return btnNewFlight;
}
 
开发者ID:JaneClelandHuang,项目名称:Dronology,代码行数:14,代码来源:InteractiveFlightPlannerView.java

示例6: 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

示例7: makePlatoonButton

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Initiate the construction of a platoon
 * @param flightManager
 * @param btnText
 * @param stage
 * @return
 */
Button makePlatoonButton(FlightZoneManager flightManager, String btnText, Stage stage){
    Button platoonBtn = createButton(btnText, 120);
    platoonBtn.setText(btnText);
    platoonBtn.setOnAction(
    new EventHandler<ActionEvent>() {
       @Override
       public void handle(final ActionEvent e) {
    	  flightManager.getDroneFleet().setupPlatoon();
   	   }
    });
    return platoonBtn;
}
 
开发者ID:JaneClelandHuang,项目名称:Dronology,代码行数:20,代码来源:ButtonGenerator.java

示例8: 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

示例9: formatButtons

import javafx.scene.control.Button; //导入方法依赖的package包/类
private void formatButtons() {
    int min = pokemon.getMinIndividualValues().get(stat).get();
    int max = pokemon.getMaxIndividualValues().get(stat).get();
    for (int i = 0; i < 32; ++i) {
        Button button = statButtons.get(i);
        button.setDisable(i < min || i > max);
        button.setText(String.valueOf(pokemon.getExpectedStat(stat, i)));
    }
}
 
开发者ID:wartab,项目名称:gen7-iv-calculator,代码行数:10,代码来源:StatSelectorPresenter.java

示例10: createButtonMinW

import javafx.scene.control.Button; //导入方法依赖的package包/类
public static Button createButtonMinW(String text, double width)
{
	Button button = createButton();
	button.setText(text);
	button.setMinWidth(width);
	return button;
}
 
开发者ID:PolyphasicDevTeam,项目名称:NoMoreOversleeps,代码行数:8,代码来源:JavaFxHelper.java

示例11: createButtonMaxW

import javafx.scene.control.Button; //导入方法依赖的package包/类
public static Button createButtonMaxW(String text, double width)
{
	Button button = createButton();
	button.setText(text);
	button.setMaxWidth(width);
	return button;
}
 
开发者ID:PolyphasicDevTeam,项目名称:NoMoreOversleeps,代码行数:8,代码来源:JavaFxHelper.java

示例12: start

import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
  public void start(Stage primaryStage) throws Exception {

      //设置布局
      GridPane grid = new GridPane();
      grid.setAlignment(Pos.CENTER);
      grid.setHgap(10);
      grid.setVgap(10);
      grid.setPadding(new Insets(5, 5, 5, 5));
      //增加一个现实密码的Label
      Label label = new Label(StringResource.PASSWORD_MESSAGE);
      label.setFont(new Font(19));
      grid.add(label, 0, 1);
TextField textField = new TextField(Password.genRandomNum(8));
textField.setFont(new Font(19));
grid.add(textField,1,1);
      //增加一个刷新按钮
      Button button = new Button();
      button.setText(StringResource.BTN_PASSWORD_REFRESH);
      button.setOnAction(ActionEvent ->{
      		String newPassword = Password.genRandomNum(8);
      		System.out.println(StringResource.PASSWORD_MESSAGE + newPassword);
		textField.setText(newPassword);
          }
      );
      grid.add(button, 2, 1);
      Scene scene = new Scene(grid, 535, 60);
      primaryStage.setScene(scene);
      primaryStage.setTitle(TITLE);
      primaryStage.show();
  }
 
开发者ID:ddknight,项目名称:javafx-password-generator,代码行数:32,代码来源:JavaFXPasswordGenerator.java

示例13: OptionsPane

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Creation of the OptionsPane. Pass in a map that fully maps all titles to their respective panes.
 * <p>
 * CAUTION: Map should can't be null. However, the map can be empty.
 *
 * @param optionsMenuModel
 * 		Map from tree names to panes
 */
public OptionsPane( Map<OptionSection, Pane> optionsMenuModel )
{
	//TODO use some kind of selection model to default to select first item or last item selected
	optionScreenMap = optionsMenuModel;
	sections = new OptionsSettingsTree(optionsMenuModel.keySet());
	sections.setTreeDoubleClick(this::onTreeDoubleClick);

	sectionView = new SwapPane();

	SplitPane sectionContentSplitPane = new SplitPane();
	sectionContentSplitPane.setOrientation(Orientation.HORIZONTAL);
	sectionContentSplitPane.getItems().addAll(sections, sectionView);

	sectionContentSplitPane.setDividerPositions(0.2, 1);
	setCenter(sectionContentSplitPane);

	okAction = () -> {
	};
	cancelAction = () -> {
	};

	Button okButton = new Button();
	okButton.setText("OK");
	okButton.setOnMouseClicked(this::okButtonClicked);

	Button cancelButton = new Button();
	cancelButton.setText("Cancel");
	cancelButton.setOnMouseClicked(this::cancelButtonClicked);

	HBox buttonBar = new HBox();
	buttonBar.getChildren().addAll(okButton, cancelButton);
	buttonBar.setAlignment(Pos.BASELINE_RIGHT);

	setBottom(buttonBar);
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:44,代码来源:OptionsPane.java

示例14: updateCells

import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
protected void updateCells() {
    final Calendar calendar = (Calendar) calendarView.getCalendar().clone();

    int year = calendar.get(Calendar.YEAR);
    // Get the beginning of the decade.
    int a = year % 10;
    if (a < 5) {
        a += 10;
    }
    int startYear = year - a;
    for (int i = 0; i < 10 * NUMBER_OF_DECADES; i++) {
        final int y = i + startYear;
        calendar.set(Calendar.YEAR, y);
        calendar.set(Calendar.MONTH, 0);
        calendar.set(Calendar.DATE, 1);
        Button button = (Button) getChildren().get(i);

        boolean disabled = normalizedMaxDate.get() != null && calendar.getTime().after(normalizedMaxDate.get());
        calendar.set(Calendar.MONTH, calendar.getActualMaximum(Calendar.MONTH));
        calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DATE));
        disabled = disabled || normalizedMinDate.get() != null && calendar.getTime().before(normalizedMinDate.get());

        button.setDisable(disabled);
        button.setText(Integer.toString(y));
        button.setUserData(y);
    }
    title.set(String.format("%s - %s", startYear, startYear + 10 * NUMBER_OF_DECADES - 1));
}
 
开发者ID:scourgemancer,项目名称:graphing-loan-analyzer,代码行数:30,代码来源:CalendarViewSkin.java

示例15: start

import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
    StackPane centerPane = new StackPane();
    Button centerButton = new Button();
    centerButton.setText("Center");
    centerButton.setOnAction( new ButtonEventHandler("Center") );
    centerPane.getChildren().add(centerButton);
    
    StackPane bottomPane = new StackPane();
    Button bottomButton = new Button();
    bottomButton.setText("Bottom");
    bottomButton.setOnAction( new ButtonEventHandler("Bottom") );
    bottomPane.getChildren().add(bottomButton);
    
    StackPane topPane = new StackPane();
    Button topButton = new Button();
    topButton.setText("Top");
    topButton.setOnAction( new ButtonEventHandler("Top") );
    topPane.getChildren().add(topButton);
    
    StackPane leftPane = new StackPane();
    Button leftButton = new Button();
    leftButton.setText("Left");
    leftButton.setOnAction( new ButtonEventHandler("Left") );
    leftPane.getChildren().add(leftButton);
    
    IHasAButton button = new IHasAButton("SOmething else");
    
    
    StackPane rightPane = new StackPane();
    Button rightButton = new Button();
    rightButton.setText("Right");
    rightButton.setOnAction( new ButtonEventHandler("Right") );
    rightPane.getChildren().add(rightButton);
    
    BorderPane root = new BorderPane();
    root.setCenter(centerPane);
    root.setTop(topPane);
    root.setBottom(bottomPane);
    root.setLeft(leftPane);
    root.setRight(button.getStackPane());
    
    Scene scene = new Scene(root, 300, 250);
    
    primaryStage.setTitle("Hello World!");
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
开发者ID:EricCharnesky,项目名称:CIS2353-Fall2017,代码行数:49,代码来源:JavaFXApplication1.java


注:本文中的javafx.scene.control.Button.setText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。