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


Java ObservableValue類代碼示例

本文整理匯總了Java中javafx.beans.value.ObservableValue的典型用法代碼示例。如果您正苦於以下問題:Java ObservableValue類的具體用法?Java ObservableValue怎麽用?Java ObservableValue使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: CheckBoxListCell

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
public CheckBoxListCell(
        final Callback<T, ObservableValue<Boolean>> getSelectedProperty, 
        final BooleanProperty disableProperty,
        final StringConverter<T> converter
) {
    this.getStyleClass().add("check-box-list-cell");
    setSelectedStateCallback(getSelectedProperty);
    setConverter(converter);
    
    checkBox = new CheckBox();
    checkBox.disableProperty().bind(disableProperty);
    
    setAlignment(Pos.CENTER_LEFT);
    setContentDisplay(ContentDisplay.LEFT);

    // by default the graphic is null until the cell stops being empty
    setGraphic(null);
}
 
開發者ID:Naoghuman,項目名稱:ABC-List,代碼行數:19,代碼來源:CheckBoxListCell.java

示例2: createTextField

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
private void createTextField() {
    textField = new TextField(getString());
    textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
    textField.focusedProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> arg0,
                Boolean arg1, Boolean arg2) {
            if (!arg2) {
                commitEdit(textField.getText());
            }
        }
    });

    textField.setOnKeyPressed(new EventHandler<KeyEvent>() {
        @Override
        public void handle(KeyEvent ke) {
            KeyCode kc = ke.getCode();
            if ((kc.equals(KeyCode.ENTER) || kc.equals(KeyCode.UP) || kc.equals(KeyCode.DOWN) || kc.equals(KeyCode.LEFT) || kc.equals(KeyCode.RIGHT))) {
                commitEdit(textField.getText());
            }
        }
    });
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:24,代碼來源:IsotopesManagerController.java

示例3: MenuItemBinder

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
public MenuItemBinder(MenuItem menuItem)
{
    super(menuItem);
    actionHandler = new EventHandler<ActionEvent>()
    {
        @Override
        public void handle(ActionEvent event)
        {
            onOccur();
        }
    };
    menuItem.addEventHandler(ActionEvent.ACTION,actionHandler);
    changeListener = new ChangeListener<String>()
    {
        @Override
        public synchronized void changed(ObservableValue<? extends String> observable, String oldValue,
                String newValue)
        {
            doOnchange(oldValue,newValue);
        }
    };
    menuItem.textProperty().addListener(changeListener);
}
 
開發者ID:gzxishan,項目名稱:OftenPorter,代碼行數:24,代碼來源:MenuItemBinder.java

示例4: initialize

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
public void initialize() 
{
   // 0-4 rounds down, 5-9 rounds up 
   currency.setRoundingMode(RoundingMode.HALF_UP);
   
   // listener for changes to tipPercentageSlider's value
   tipPercentageSlider.valueProperty().addListener(
      new ChangeListener<Number>() 
      {
         @Override
         public void changed(ObservableValue<? extends Number> ov, 
            Number oldValue, Number newValue) 
         {
            tipPercentage = 
               BigDecimal.valueOf(newValue.intValue() / 100.0);
            tipPercentageLabel.setText(percent.format(tipPercentage));
         }
      }
   );
}
 
開發者ID:cleitonferreira,項目名稱:LivroJavaComoProgramar10Edicao,代碼行數:21,代碼來源:TipCalculatorController.java

示例5: initialize

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
/**
 * Initializes the controller class.
 *
 * @param url
 * @param rb
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    scrollPan.viewportBoundsProperty().addListener((ObservableValue<? extends Bounds> observable, Bounds oldValue, Bounds newValue) -> {
        flowPane.setPrefWidth(newValue.getWidth());
    });

    lblTotalPatient.setText("Loading..........");

    Platform.runLater(() -> {
        totalPatient = patientGetway.totalPatient();
        loadPatients();
        lblTotalPatient.setText("Total :" + totalPatient);
        lblShowingPatient.setText("Showing " + paginate.getStart() + " To " + paginate.getEnd());
        if (totalPatient == 0) {
            lblTotalPatient.setText("No patient found");
            lblShowingPatient.setVisible(false);
        }
    });

}
 
開發者ID:kmrifat,項目名稱:Dr-Assistant,代碼行數:27,代碼來源:PatientsController.java

示例6: btnGo

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
@FXML
	private void btnGo(ActionEvent event) {
		historyByDate = new HistorySearchByDate(datePicker.getValue());
		
		webEngine.getLoadWorker().stateProperty().addListener(
        	    new ChangeListener<Worker.State>() {
        	        @Override
        	        public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) {
        	            if (newValue == Worker.State.SUCCEEDED) {
        	                JSObject windowObject = (JSObject) webEngine.executeScript("window");
        	                windowObject.setMember("HistorySearchByDate", historyByDate); // insert object
        	                windowObject.call("searchHistoryByDate"); // execute callback
        	            }
        	        }
        	    }
        	);
		URL url = getClass().getResource("/html/index.html");
        webEngine.load(url.toString());
		
//        String url = getClass().getResource("../html/index.html").toExternalForm();
//        webEngine.load(url);
	}
 
開發者ID:krHasan,項目名稱:Money-Manager,代碼行數:23,代碼來源:TransactionHistoryController.java

示例7: WebViewPane

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
public WebViewPane() {
    VBox.setVgrow(this, Priority.ALWAYS);
    setMaxWidth(Double.MAX_VALUE);
    setMaxHeight(Double.MAX_VALUE);

    WebView view = new WebView();
    view.setMinSize(500, 400);
    view.setPrefSize(500, 400);
    final WebEngine eng = view.getEngine();
    eng.load("http://www.oracle.com/us/index.html");
    final TextField locationField = new TextField("http://www.oracle.com/us/index.html");
    locationField.setMaxHeight(Double.MAX_VALUE);
    Button goButton = new Button("Go");
    goButton.setDefaultButton(true);
    EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent event) {
            eng.load(locationField.getText().startsWith("http://") ? locationField.getText() :
                    "http://" + locationField.getText());
        }
    };
    goButton.setOnAction(goAction);
    locationField.setOnAction(goAction);
    eng.locationProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            locationField.setText(newValue);
        }
    });
    GridPane grid = new GridPane();
    grid.setVgap(5);
    grid.setHgap(5);
    GridPane.setConstraints(locationField, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
    GridPane.setConstraints(goButton,1,0);
    GridPane.setConstraints(view, 0, 1, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
    grid.getColumnConstraints().addAll(
            new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true),
            new ColumnConstraints(40, 40, 40, Priority.NEVER, HPos.CENTER, true)
    );
    grid.getChildren().addAll(locationField, goButton, view);
    getChildren().add(grid);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:41,代碼來源:WebViewBrowser.java

示例8: initialize

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
@Override
  public void initialize(URL location, ResourceBundle resources) {
  	Main.bot.currentChannel = Main.bot.getChannels().get(0);
vbox.setSpacing(30);

      System.out.println("initialized");
      updateViewCount();
      
      new Timer().schedule(new TimerTask() {
	
	@Override
	public void run() {
		Platform.runLater(() -> { Controller.controller.viewCount
			.setText("Viewers: " + Main.bot.getChannels().get(0).getViewersNum()); });
		
	}
}, 0, 10000);

      vbox.heightProperty().addListener(new ChangeListener<Number>() {
	@Override
	public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
		scrollPane.setVvalue(1.0);
	}
});
      
  }
 
開發者ID:artek2001,項目名稱:twichat,代碼行數:27,代碼來源:Controller.java

示例9: _getValue

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public String _getValue() {
    CheckBoxTreeTableCell cell = (CheckBoxTreeTableCell) node;
    Callback selectedStateCallback = cell.getSelectedStateCallback();
    String cbText;
    if (selectedStateCallback != null) {
        ObservableValue<Boolean> call = (ObservableValue<Boolean>) selectedStateCallback.call(cell.getItem());
        int selection = call.getValue() ? 2 : 0;
        cbText = JavaFXCheckBoxElement.states[selection];
    } else {
        Node cb = cell.getGraphic();
        JavaFXElement comp = (JavaFXElement) JavaFXElementFactory.createElement(cb, driver, window);
        cbText = comp._getValue();

    }
    String cellText = cell.getText();
    if (cellText == null) {
        cellText = "";
    }
    String text = cellText + ":" + cbText;
    return text;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:22,代碼來源:JavaFXCheckBoxTreeTableCell.java

示例10: mapString

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
private static <T> StringBinding mapString(ObservableValue<T> v, Function<T, String> func) {
  return new StringBinding() {
    {
      bind(v);
    }

    @Override
    protected String computeValue() {
      if (v.getValue() == null) {
        return "";
      } else {
        return func.apply(v.getValue());
      }
    }
  };
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:17,代碼來源:StatusBarManager.java

示例11: buildEyeTrackerConfigChooser

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
private static ChoiceBox<EyeTracker> buildEyeTrackerConfigChooser(Configuration configuration,
        ConfigurationContext configurationContext) {
    ChoiceBox<EyeTracker> choiceBox = new ChoiceBox<>();

    choiceBox.getItems().addAll(EyeTracker.values());

    EyeTracker selectedEyeTracker = findSelectedEyeTracker(configuration);
    choiceBox.getSelectionModel().select(selectedEyeTracker);

    choiceBox.setPrefWidth(prefWidth);
    choiceBox.setPrefHeight(prefHeight);

    choiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<EyeTracker>() {
        @Override
        public void changed(ObservableValue<? extends EyeTracker> observable, EyeTracker oldValue,
                EyeTracker newValue) {
            final String newPropertyValue = newValue.name();
            ConfigurationBuilder.createFromPropertiesResource().withEyeTracker(newPropertyValue)
                    .saveConfigIgnoringExceptions();
        }
    });

    return choiceBox;
}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:25,代碼來源:ConfigurationContext.java

示例12: tableColumns

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
public static void tableColumns(final Visitor v, List<? extends TableColumn<?, ?>> addedSubList) {
	for(int i = 0; i < addedSubList.size(); i++){
		final TableColumn<?,?> col = addedSubList.get(i);
		
		col.setCellFactory(new DnDTableCellFactory(v, col.getCellFactory()));
		col.cellFactoryProperty().addListener(new ChangeListener<Callback>() {
			@Override
			public void changed(ObservableValue<? extends Callback> observable, Callback oldValue,
					Callback newValue) {
				if(!(newValue instanceof DnDTableCellFactory)){
					col.setCellFactory(new DnDTableCellFactory(v, col.getCellFactory()));
				}
			}
		});
	}
}
 
開發者ID:coalang-soft,項目名稱:dragdropfx,代碼行數:17,代碼來源:DnDPrepare.java

示例13: TypedToggleGroup

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
public TypedToggleGroup() {

		this.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
			@Override
			@SuppressWarnings("unchecked")
			public void changed(ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle newValue) {
				if (newValue != null) {
					T obj = (T) newValue.getUserData();
					selectedValueProperty.setValue(obj);
				} else {
					selectedValueProperty.setValue(null);
				}
			}
		});

	}
 
開發者ID:esig,項目名稱:dss-demonstrations,代碼行數:17,代碼來源:TypedToggleGroup.java

示例14: changed

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
@Override
		public void changed(ObservableValue<? extends State> observable, State oldState, State newState) {
			if (newState == Worker.State.CANCELLED) {
			// download detected
			String url = webEngine.getLocation();
			logger.info("download url: "+url);
//             try{
//                 Download download = new Download(webEngine.getLocation());
//                 Thread t = new Thread(download);
//                 t.start();
//             }catch(Exception ex){
//                 logger.log(Level.SEVERE, "download", ex);
//             }
			}
		}
 
開發者ID:goxr3plus,項目名稱:JavaFX-Web-Browser,代碼行數:16,代碼來源:WebBrowserTabController.java

示例15: spectateGame

import javafx.beans.value.ObservableValue; //導入依賴的package包/類
private void spectateGame(GameList.Game game) {
	SpectatorGameHandler handler = new SpectatorGameHandler(game.getId());
	BoardController controller = new BoardController(handler, "/fxml/localGame.fxml", false);

	PlayerPaneController playerInfo = new PlayerPaneController(game);
	controller.addToSideBar(playerInfo.getRoot());

	DockNode node = controller.getDockNode();
	node.closedProperty().addListener(new ChangeListener<Boolean>() {
		@Override
		public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
			if ( newValue ) {
				handler.disconnect();
				observable.removeListener(this);
			}
		}
	});
	node.setTitle(game.getGameName());
	node.dock(Main.instance.dockPane, DockPos.CENTER);
}
 
開發者ID:GoSuji,項目名稱:Suji,代碼行數:21,代碼來源:GameListController.java


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