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


Java RadioButton.setUserData方法代码示例

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


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

示例1: createButtonGroup

import javafx.scene.control.RadioButton; //导入方法依赖的package包/类
/**
 * Create a radio button for each String in the list, add them to the container, and bind the selected value to the
 * String property
 *
 * @param container     Container to put radio buttons in
 * @param radioBtns     List of Strings, one for each radio button
 * @param modelProperty Property to bind selected radio button's value to
 */
public static ToggleGroupValue createButtonGroup(Pane container, List<String> radioBtns, StringProperty modelProperty) {
    // Create new ToggleGroup and ToggleGroupValue for the radio buttons
    ToggleGroupValue groupValue = new ToggleGroupValue();
    ToggleGroup btnsGroup = new ToggleGroup();

    // Create a radio button for each option
    for (String s : radioBtns) {
        // Create radio button for this option
        RadioButton radioBtn = new RadioButton(s);
        radioBtn.setUserData(s);
        radioBtn.setToggleGroup(btnsGroup);

        // Add to RadioButton to the container pane and the ToggleGroupValue
        container.getChildren().add(radioBtn);
        groupValue.add(radioBtn, radioBtn.getUserData());
    }

    // Bind toggle group value to model
    modelProperty.bindBidirectional(groupValue.valueProperty());

    // Select first option
    groupValue.setValue(radioBtns.get(0));

    return groupValue;
}
 
开发者ID:scify,项目名称:jedai-ui,代码行数:34,代码来源:RadioButtonHelper.java

示例2: setupToggle

import javafx.scene.control.RadioButton; //导入方法依赖的package包/类
private LinkedList<RadioButton> setupToggle(ToggleGroup group) {

		// Use Dijkstra as default
		RadioButton rbD = new RadioButton("Dijkstra");
		rbD.setUserData("Dijkstra");
		rbD.setSelected(true);

		RadioButton rbA = new RadioButton("A*");
		rbA.setUserData("A*");

		RadioButton rbB = new RadioButton("BFS");
		rbB.setUserData("BFS");

		rbB.setToggleGroup(group);
		rbD.setToggleGroup(group);
		rbA.setToggleGroup(group);
		return new LinkedList<RadioButton>(Arrays.asList(rbB, rbD, rbA));
	}
 
开发者ID:Cs4r,项目名称:UCSDGraphs,代码行数:19,代码来源:MapApp.java

示例3: setupToggle

import javafx.scene.control.RadioButton; //导入方法依赖的package包/类
private LinkedList<RadioButton> setupToggle(ToggleGroup group) {

	  // Use Dijkstra as default
	  RadioButton rbD = new RadioButton("Dijkstra");
	  rbD.setUserData("Dijkstra");
	  rbD.setSelected(true);

	  RadioButton rbA = new RadioButton("A*");
	  rbA.setUserData("A*");

	  RadioButton rbB = new RadioButton("BFS");
	  rbB.setUserData("BFS");

	  rbB.setToggleGroup(group);
	  rbD.setToggleGroup(group);
	  rbA.setToggleGroup(group);
	  return new LinkedList<RadioButton>(Arrays.asList(rbB, rbD, rbA));
	}
 
开发者ID:MacSimmy,项目名称:Maps,代码行数:19,代码来源:MapApp.java

示例4: MessageTypeDialog

import javafx.scene.control.RadioButton; //导入方法依赖的package包/类
public MessageTypeDialog() {
    super(null, "Choose message type", false, DialogStyle.NATIVE);
    setMasthead("Choose message type");

    group = new ToggleGroup();

    RadioButton textButton = new RadioButton("Text");
    textButton.setUserData(new JmsTextMessage());
    textButton.setToggleGroup(group);
    textButton.setSelected(true);
    RadioButton bytesButton = new RadioButton("Bytes");
    bytesButton.setUserData(new JmsBytesMessage());
    bytesButton.setToggleGroup(group);

    HBox hbox = new HBox(5);
    hbox.getChildren().add(textButton);
    hbox.getChildren().add(bytesButton);
    setContent(hbox);

    Action action = new JmsMessageAction();
    action.disabledProperty().bind(group.selectedToggleProperty().isNull());

    ButtonBar.setType(action, ButtonBar.ButtonType.OK_DONE);
    getActions().addAll(action, Dialog.Actions.CANCEL);
}
 
开发者ID:Mykolas-Molis,项目名称:mq-visualizer,代码行数:26,代码来源:MessageTypeDialog.java

示例5: createXPathVersionPanel

import javafx.scene.control.RadioButton; //导入方法依赖的package包/类
private javafx.scene.Node createXPathVersionPanel() {

		HBox p = new HBox(5);
		p.setPadding(new Insets(5, 5, 5, 5));
		//		JPanel p = new JPanel();
		Label e = new Label("XPath Version:");
		e.setAlignment(Pos.CENTER_LEFT);
		p.add(e);
		for (Object[] values : XPathRule.VERSION_DESCRIPTOR.choices()) {
			//			JRadioButton b = new JRadioButton();
			RadioButton b = new RadioButton((String) values[0]);

			//			b.setText((String) values[0]);
			b.setUserData(b.getText());
			//			b.setActionCommand(b.getText());
			if (values[0].equals(XPathRule.VERSION_DESCRIPTOR.defaultValue())) {
				b.setSelected(true);
			}
			b.setToggleGroup(xpathVersionButtonGroup);
			//			xpathVersionButtonGroup.add(b);
			p.add(b);
		}

		//		SwingNode swingNode = new SwingNode();
		//		createSwingContent(swingNode, p);
		return p;
	}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:28,代码来源:DesignerFx.java

示例6: getLine

import javafx.scene.control.RadioButton; //导入方法依赖的package包/类
private HBox getLine (RadioButton button, TextField text)
{
  HBox line = new HBox (10);
  line.getChildren ().addAll (button, text);
  button.setPrefWidth (LABEL_WIDTH);
  text.setPrefWidth (300);
  text.setFont (defaultFont);
  text.setEditable (false);
  text.setFocusTraversable (false);
  button.setUserData (text);

  return line;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:14,代码来源:TransfersTab.java

示例7: setupToggle

import javafx.scene.control.RadioButton; //导入方法依赖的package包/类
private LinkedList<RadioButton> setupToggle(ToggleGroup group) {

	  // Use Dijkstra as default
	  RadioButton rbD = new RadioButton("Dijkstra");
	  rbD.setUserData("Dijkstra");
	  rbD.setSelected(true);

	  RadioButton rbA = new RadioButton("A*");
	  rbA.setUserData("A*");

	  RadioButton rbB = new RadioButton("BFS");
	  rbB.setUserData("BFS");
	  
	  RadioButton rbGreedyTSP = new RadioButton("GreedyTSP");
	  rbGreedyTSP.setUserData("GreedyTSP");
	  
	  RadioButton rbGreedy2OptTSP = new RadioButton("Greedy2OptTSP");
	  rbGreedy2OptTSP.setUserData("Greedy2OptTSP");
	  

	  rbB.setToggleGroup(group);
	  rbD.setToggleGroup(group);
	  rbA.setToggleGroup(group);
	  rbGreedyTSP.setToggleGroup(group);
	  rbGreedy2OptTSP.setToggleGroup(group);
	  return new LinkedList<RadioButton>(Arrays.asList(rbB, rbD, rbA, 
			  										   rbGreedyTSP, 
			  										   rbGreedy2OptTSP) );
	}
 
开发者ID:ryanwc,项目名称:GraphSearch,代码行数:30,代码来源:MapApp.java

示例8: Home

import javafx.scene.control.RadioButton; //导入方法依赖的package包/类
public Home() {
	group = new ToggleGroup();
	RadioButton rb1 = new RadioButton("Create a new transaction");
	RadioButton rb2 = new RadioButton("Review existing transactions");
	rb1.setToggleGroup(group);
	rb2.setToggleGroup(group);
	rb1.setSelected(true);

	VBox vboxRb = new VBox(10);
	vboxRb.getChildren().addAll(rb1, rb2);

	initGenerateForm();
	initReviewForm();

	rb1.setUserData(generate);
	rb2.setUserData(review);

	vbox = new VBox(25);
	vbox.setPadding(new Insets(50, 50, 50, 50));
	vbox.getChildren().addAll(vboxRb, generate);

	group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
		@Override
		public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) {
			vbox.getChildren().remove(1);
			vbox.getChildren().add((NewForm) group.getSelectedToggle().getUserData());
		}
	});
}
 
开发者ID:egordon,项目名称:btcoracle,代码行数:30,代码来源:Home.java

示例9: updateItem

import javafx.scene.control.RadioButton; //导入方法依赖的package包/类
@Override
protected void updateItem(T item, boolean empty)
{
    super.updateItem(item, empty);
    if (!empty)
    {

        TableRow currentRow = getTableRow();
        RequestEntry requestEntry = (RequestEntry) getTableView().getItems().get(getIndex());
        if(currentRow != null && requestEntry.isGray()) {
            currentRow.setStyle("-fx-background-color: darkgrey");
        }

        // gui setup
        HBox hb = new HBox(7);
        hb.setAlignment(Pos.CENTER);
        final ToggleGroup group = new ToggleGroup();

        // create a radio button for each 'element' of the enumeration
        for (Enum<RequestTypeGUI> enumElement : enumeration) {
            RadioButton radioButton = new RadioButton(enumElement.toString());
            radioButton.setUserData(enumElement);
            radioButton.setToggleGroup(group);
            hb.getChildren().add(radioButton);
            if (enumElement.equals(item)) {
                radioButton.setSelected(true);
            }
        }

        // issue events on change of the selected radio button
        group.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
            if(disableEvent == true) {
                return;
            }
            if(EditRequestsController.isEditable(requestEntry.getEventDutyDTO().getRehearsalFor())) {
                requestEntry.setEdited(true);
                RequestTypeGUI requestTypeGUI = (RequestTypeGUI) newValue.getUserData();
                requestEntry.setRequestType(requestTypeGUI);

                // todo change
                if(requestTypeGUI.equals(RequestTypeGUI.Absence)) {
                    EditRequestsController.setReahearsalsAbsence(requestEntry.getEventDutyDTO().getEventDutyId());
                }
            } else {
                disableEvent = true;
                group.selectToggle(oldValue);
                disableEvent = false;
                requestEntry.requestTypeProperty().set(RequestTypeGUI.Absence);
                requestEntry.setRequestType(RequestTypeGUI.Absence);
            }
        });
        setGraphic(hb);
    }
}
 
开发者ID:ITB15-S4-GroupD,项目名称:Planchester,代码行数:55,代码来源:RequestRadioButtonCell.java

示例10: start

import javafx.scene.control.RadioButton; //导入方法依赖的package包/类
@Override
  public void start(Stage pPrimaryStage) 
  {
aText.setText(PART_1);
      pPrimaryStage.setTitle(aLabelProvider.getBoth());
      aButton.setOnAction(this);
      
      aSkin.selectedToggleProperty().addListener(this);

      RadioButton rb1 = new RadioButton("Plain");
      rb1.setToggleGroup(aSkin);
      rb1.setUserData("Plain");
      rb1.setSelected(true);

      RadioButton rb2 = new RadioButton("Floral");
      rb2.setUserData("Floral");
      rb2.setToggleGroup(aSkin);
       
      RadioButton rb3 = new RadioButton("Chintz");
      rb3.setUserData("Chintz");
      rb3.setToggleGroup(aSkin);
      
      VBox centerPanel = new VBox(MARGIN);
      centerPanel.setPadding(new Insets(MARGIN));
      centerPanel.setAlignment(Pos.CENTER);
      centerPanel.getChildren().addAll(aText, aButton);
      
      BorderPane root = new BorderPane();
      root.setCenter(centerPanel);
      
      HBox bottomPanel = new HBox(MARGIN);
      bottomPanel.setPadding(new Insets(MARGIN));
      bottomPanel.setAlignment(Pos.CENTER);
      bottomPanel.getChildren().addAll(rb1, rb2, rb3);
      root.setBottom(bottomPanel);
      
      aScene = new Scene(root, WIDTH, HEIGHT);
      pPrimaryStage.setResizable(false);
      pPrimaryStage.setScene(aScene);
      pPrimaryStage.show();
  }
 
开发者ID:prmr,项目名称:COMP303Starter,代码行数:42,代码来源:Welcome.java

示例11: baseLayout

import javafx.scene.control.RadioButton; //导入方法依赖的package包/类
protected GridPane baseLayout()
{    
    final GridPane grid = new GridPane();
    grid.setHgap(30);
    grid.setVgap(30);
    grid.setAlignment(Pos.TOP_LEFT);
    grid.setPadding(new Insets(10));
    
   final DropShadow dropShadow = new DropShadow();
   dropShadow.setRadius(5.0);
   dropShadow.setOffsetX(0.0);
   dropShadow.setOffsetY(0.0);
   dropShadow.setColor(Color.color(0.0, 0.0, 0.0));  
    
    Text q = new Text("Q"+(index+1)+") "+questions[index]); 
    q.setWrappingWidth(remX*rem-50); //set Wrap Boundary relative to Screen DPI
    grid.setColumnSpan(q, 31);
    grid.setRowSpan(q,1);
    q.setId("question");
    grid.add(q, 1, 5);
  
    final ToggleGroup tg = new ToggleGroup(); //ToggleGroup for options for the question
    
    /*
        HBox hOpt will get options arranged Row-wise
        VBox vOpt will get the hOpt multiple times
        GridPane grid will get the VBox, hence, options are arranged in a grid/matrix            
    */
    
    HBox hOpt= new HBox(100);
    VBox vOpt= new VBox(100);        
    
    /*
        Each option has data so that it can be used to access the corresponding matrix data
    */
    RadioButton opt1 = new RadioButton(answers[index][0]);
    opt1.setUserData("0");
    opt1.setToggleGroup(tg); 
    
    RadioButton opt2 = new RadioButton(answers[index][1]);
    opt2.setUserData("1");
    opt2.setToggleGroup(tg);
    
    hOpt.getChildren().addAll(opt1, opt2);
    vOpt.getChildren().addAll(hOpt);
    hOpt = new HBox(100);
    
    RadioButton opt3 = new RadioButton(answers[index][2]);
    opt3.setUserData("2");
    opt3.setToggleGroup(tg);
    
    RadioButton opt4 = new RadioButton(answers[index][3]);
    opt4.setUserData("3");
    opt4.setToggleGroup(tg);
    
    hOpt.getChildren().addAll(opt3, opt4); 
    vOpt.getChildren().addAll(hOpt);
    grid.setColumnSpan(vOpt, 20);    
    grid.add(vOpt, 8, 6); 
    
    if(userAnswers[index] != -1) //if the user returns to previous question, the already selected options to be selected again
    {
        switch(userAnswers[index])
        {
            case 0: opt1.setSelected(true); break;
            case 1: opt2.setSelected(true); break;
            case 2: opt3.setSelected(true); break;
            case 3: opt4.setSelected(true); break;
        }
    }
    tg.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { //when the user selects an option
                     @Override
                     public void changed(ObservableValue<? extends Toggle> ov, Toggle t, Toggle t1)
                     {                             
                         userAnswers[index] = Integer.valueOf(tg.getSelectedToggle().getUserData().toString());
                     }
                     });
    
    grid.getStylesheets().add(FossAsiaQuiz.class.getResource("FossAsiaQuizCSS.css").toExternalForm());   
    return grid;        
}
 
开发者ID:svr8,项目名称:FossAsiaQuiz,代码行数:82,代码来源:FossAsiaQuiz.java

示例12: addTransformingModeOptions

import javafx.scene.control.RadioButton; //导入方法依赖的package包/类
private HBox addTransformingModeOptions() {
  	HBox hBox = new HBox();
  	
  	hBox.setPadding(new Insets(15, 12, 15, 12));
  	hBox.setSpacing(10);
  	hBox.setStyle("-fx-background-color: #66FFFF;");
  	
  	final ToggleGroup optionGroup = new ToggleGroup();
  	
  	Label lblMouseMode = new Label("Mouse Mode: ");
  	lblMouseMode.setPrefSize(100,  20);
  	
  	RadioButton rbTransform = new RadioButton("Pan & Zoom");
  	rbTransform.setPrefSize(100, 20);
  	rbTransform.setToggleGroup(optionGroup);
  	rbTransform.setUserData("T");
  	rbTransform.setSelected(true);
  	
  	RadioButton rbPick = new RadioButton("Picking");
  	rbPick.setPrefSize(100, 20);
  	rbPick.setUserData("P");
  	rbPick.setToggleGroup(optionGroup);
  	
  	
  	
  	optionGroup.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {

	@Override
	public void changed(ObservableValue<? extends Toggle> observable,
			Toggle oldValue, Toggle newValue) {
		if (optionGroup.getSelectedToggle() != null){
			DefaultModalGraphMouse dmg = (DefaultModalGraphMouse) vv.getGraphMouse();
			
			if (optionGroup.getSelectedToggle().getUserData().equals("T")){
				dmg.setMode(Mode.TRANSFORMING);
			} else 	if (optionGroup.getSelectedToggle().getUserData().equals("P")){
				dmg.setMode(Mode.PICKING);
			}
		}
		
	}
});
  	
  	
  	
  	hBox.getChildren().addAll(lblMouseMode, rbTransform, rbPick);
  	
  	return hBox;

  }
 
开发者ID:gems-uff,项目名称:dominoes,代码行数:51,代码来源:GraphPane.java


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