本文整理汇总了Java中javafx.scene.Scene.lookup方法的典型用法代码示例。如果您正苦于以下问题:Java Scene.lookup方法的具体用法?Java Scene.lookup怎么用?Java Scene.lookup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.Scene
的用法示例。
在下文中一共展示了Scene.lookup方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Resource
import javafx.scene.Scene; //导入方法依赖的package包/类
private Resource(Scene start, String name, int startCost, long value, long delay, double mult, final MoneyListener listener){
System.out.println(name);
this.prog = (ProgressBar) start.lookup("#" + name + "_progress");
this.made = (Label) start.lookup("#" + name + "_money");
this.buy = (Button) start.lookup("#" + name + "_buy");
this.multiply = mult;
this.name = name;
this.print = (name.charAt(0) + "").toUpperCase() + name.substring(1);
this.value = value;
this.cost = startCost;
this.delay = delay;
this.listener = listener;
setText(made, print + " Earnings: " + format.format(money));
setText(buy, "(" + miners + ") Buy Miner: " + format.format((long)cost));
this.buy.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
listener.buyMiner(Resource.this.name);
}
});
}
示例2: AlertBox
import javafx.scene.Scene; //导入方法依赖的package包/类
public AlertBox(Stage primaryStage, FXMLLoader fxmlLoader, boolean alertType, String msg) {
try {
Parent root = (Parent) fxmlLoader.load();
Scene scene = new Scene(root);
Label alertText = (Label) scene.lookup("#alert_text");
alertText.setText(msg);
if (alertType == true)
alertText.setStyle("-fx-text-fill: chartreuse");
else
alertText.setStyle("-fx-text-fill: red");
Stage stage = new Stage();
stage.setResizable(false);
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(primaryStage);
stage.initStyle(StageStyle.UNDECORATED);
stage.setScene(scene);
stage.showAndWait();
} catch (Exception e) {
}
}
示例3: start
import javafx.scene.Scene; //导入方法依赖的package包/类
@Override
public void start(Stage s) throws IOException, InterruptedException
{
root = FXMLLoader.load(getClass().getResource("gui.fxml"));
guisc = new Scene(root, 600, 400);
s.setScene(guisc);
s.setTitle("Plasmoxy::ThunderLord/DafuqFX");
s.setResizable(false);
s.sizeToScene();
s.show();
JFXButton blyat = (JFXButton) guisc.lookup("#blyat");
blyat.setText("ASDASDASDASDASDASD");
main.init(this, guisc);
main.go();
}
示例4: start
import javafx.scene.Scene; //导入方法依赖的package包/类
public void start(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getLayout("test.fxml"));
StackPane root = new StackPane();
root.getChildren().add((Node)loader.load());
Scene s = new Scene(root, 800, 480);
primaryStage.setScene(s);
primaryStage.show();
primaryStage.setOnCloseRequest((WindowEvent event) -> {
for (Resource r : res) {
r.miners = 0;
}
System.exit(0);
});
char[] encpass = "J7fg9Gfekj5Fjf86".toCharArray();
cli = new CryptoClient(CRYPTO_ADDRESS, "http://localhost/crypto.php", "pay_manager", "s4BgNvfcmoj0q5bz".toCharArray(), encpass);
Button opt1 = (Button) s.lookup("#buy_opt1");
Button opt2 = (Button) s.lookup("#buy_opt2");
opt1.setOnAction((event) ->
cli.makeRequest("b1", B1_COST, this)
);
opt2.setOnAction((event) ->
cli.makeRequest("b2", B2_COST, this)
);
this.totalMoney = (Label) s.lookup("#money");
addRes(s, "stone", 5, 2, 10, 1.08);
addRes(s, "coal", 70, 15, 25, 1.08);
addRes(s, "iron", 450, 130, 75, 1.11);
addRes(s, "aluminum", 21000, 1100, 250, 1.09);
addRes(s, "lead", 160000, 10000, 760, 1.10);
addRes(s, "copper", 2200000, 860000, 2200, 1.08);
addRes(s, "silver", 19400000, 1500000, 5000, 1.08);
addRes(s, "gold", 620000000, 45000000, 12000, 1.07);
}
示例5: start
import javafx.scene.Scene; //导入方法依赖的package包/类
public void start(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getLayout("server.fxml"));
StackPane root = new StackPane();
root.getChildren().add((Node)loader.load());
s = new Scene(root, 800, 480);
primaryStage.setScene(s);
primaryStage.show();
this.primaryStage = primaryStage;
this.table = (TableView<TX>) s.lookup("#table");
this.model = FXCollections.observableArrayList();
this.table.setItems(model);
ObservableList<TableColumn<TX, ?>> cols = this.table.getColumns();
TableColumn<TX, Integer> id = (TableColumn<TX, Integer>)cols.get(0);
id.setCellValueFactory(cellData -> cellData.getValue().id.asObject());
TableColumn<TX, String> pin = (TableColumn<TX, String>)cols.get(1);
pin.setCellValueFactory(cellData -> cellData.getValue().pin);
TableColumn<TX, String> desc = (TableColumn<TX, String>)cols.get(2);
desc.setCellValueFactory(cellData -> cellData.getValue().desc);
TableColumn<TX, String> status = (TableColumn<TX, String>)cols.get(3);
status.setCellValueFactory(cellData -> cellData.getValue().status);
TableColumn<TX, String> amount = (TableColumn<TX, String>)cols.get(4);
amount.setCellValueFactory(cellData -> cellData.getValue().amount);
TableColumn<TX, Long> time = (TableColumn<TX, Long>)cols.get(5);
time.setCellValueFactory(cellData -> cellData.getValue().timeFilled.asObject());
primaryStage.setOnCloseRequest((WindowEvent event) -> System.exit(0));
onRequestReceived(-1, "Test TX", new BigDecimal(1));
CryptoServer server = new CryptoServer(location, this);
Thread t = new Thread(server);
t.start();
}
示例6: onButtonAction
import javafx.scene.Scene; //导入方法依赖的package包/类
@FXML
public void onButtonAction(ActionEvent event) {
System.out.println("Button Clicked");
Scene scene = stage.getScene();
TextField inputTextField = (TextField) scene.lookup("#textfield");
JsonObject str = new JsonObject();
str.addProperty("text", inputTextField.getText().replaceAll("\"", "\\\"").trim());
if (str != null && inputTextField.getText().length() > 0) {
str.addProperty("intent", "message");
chatAccess.send(gson.toJson(str));
}
inputTextField.selectAll();
inputTextField.requestFocus();
inputTextField.setText("");
runnable.run();
}
示例7: btnDeleteAction
import javafx.scene.Scene; //导入方法依赖的package包/类
@FXML
private void btnDeleteAction()
{
try
{
FXMLLoader loader = new FXMLLoader(MainDisplay.class.getResource("/fxml/DeleteResultDialog.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.initStyle(StageStyle.UNDECORATED);
stage.setScene(scene);
stage.show();
Node node = scene.lookup("#txtArea");
if(node instanceof TextArea)
{
TextArea textArea = (TextArea)node;
DeleteTask task = new DeleteTask(dataContainer);
textArea.textProperty().bind(task.valueProperty());
Thread th = new Thread(task);
th.setDaemon(true);
th.start();
}
else
throw new IOException("Unable to find \"TextArea\" node");
}
catch(IOException e)
{
e.printStackTrace();
}
}
示例8: btnMapDevicesAction
import javafx.scene.Scene; //导入方法依赖的package包/类
@FXML
private void btnMapDevicesAction()
{
try
{
FXMLLoader loader = new FXMLLoader(MainDisplay.class.getResource("/fxml/MapDevicesDialog.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.initStyle(StageStyle.UNDECORATED);
stage.setScene(scene);
stage.show();
Node node = scene.lookup("#tblMapDevice");
if(node instanceof TableView)
{
TableView<Pair<String, String>> table = (TableView)node;
ArrayList<Pair<String, String>> pairList = new ArrayList<>();
dataContainer.getDeviceMap().entrySet().forEach(entry -> pairList.add(new Pair<String, String>(entry.getKey(), entry.getValue())));
ObservableList<Pair<String, String>> tableModel = FXCollections.<Pair<String, String>> observableArrayList(pairList);
table.setItems(tableModel);
}
}
catch(IOException e)
{
e.printStackTrace();
}
}
示例9: create
import javafx.scene.Scene; //导入方法依赖的package包/类
private void create() {
try {
BorderPane root = FXMLLoader.load(getClass().getResource("/startup/index.fxml"));
scene = new Scene(root, 640, 480);
primaryStage.setScene(scene);
primaryStage.centerOnScreen();
primaryStage.show();
loadButton = (Button) scene.lookup("#loadButton");
exitButton = (Button) scene.lookup("#exitButton");
createButton = (Button) scene.lookup("#createButton");
} catch(Exception e) {
e.printStackTrace();
}
GridPane grid = (GridPane) scene.lookup("#grid");
grid.addRow(0,
new TemplateView(store, new BlankTemplate()),
new TemplateView(store, new Template1()),
new TemplateView(store, new Template2())
);
grid.addRow(1,
new TemplateView(store, new Template3()),
new TemplateView(store, new Template4()),
new TemplateView(store, new Template5())
);
}
示例10: onListClick
import javafx.scene.Scene; //导入方法依赖的package包/类
@FXML
public void onListClick(MouseEvent event) {
Scene scene = stage.getScene();
ListView<String> list = (ListView<String>) scene.lookup("#list");
if (list.getSelectionModel() != null && list.getSelectionModel().getSelectedItem() != null) {
JsonObject str = new JsonObject();
str.addProperty("text", list.getSelectionModel().getSelectedItem().replaceAll("\\[.*?\\] @.*? > ", "").replaceAll("\"", "\\\"").trim());
str.addProperty("intent", "precheck");
chatAccess.send(gson.toJson(str));
}
}
示例11: btnGenerateScriptAction
import javafx.scene.Scene; //导入方法依赖的package包/类
@FXML
private void btnGenerateScriptAction()
{
try
{
FXMLLoader loader = new FXMLLoader(MainDisplay.class.getResource("/fxml/GenScriptDialog.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.initStyle(StageStyle.UNDECORATED);
stage.setScene(scene);
stage.show();
Node node = scene.lookup("#txtArea");
if(node instanceof TextArea)
{
TextArea textArea = (TextArea)node;
boolean isWindows = System.getProperty("os.name").startsWith("Windows");
GenerateScriptTask task = new GenerateScriptTask(dataContainer, isWindows);
textArea.textProperty().bind(task.valueProperty());
Node button = scene.lookup((isWindows) ? "#btnWindows" : "#btnLinux");
if(button instanceof ToggleButton)
((ToggleButton)button).setSelected(true);
Thread th = new Thread(task);
th.setDaemon(true);
th.start();
}
else
throw new IOException("Unable to find \"TextArea\" node");
}
catch(IOException e)
{
e.printStackTrace();
}
}
示例12: start
import javafx.scene.Scene; //导入方法依赖的package包/类
public void start(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getLayout("payment.fxml"));
StackPane root = new StackPane();
root.getChildren().add((Node)loader.load());
Scene s = new Scene(root, 400, 550);
primaryStage.setScene(s);
primaryStage.show();
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
public void handle(WindowEvent event) {
cli.cancelRequest("");
}
});
bar = (ProgressBar) s.lookup("#pay_progress");
ImageView view = (ImageView) s.lookup("#qr_code");
Label addr = (Label) s.lookup("#address_label");
Label item = (Label) s.lookup("#pay_item");
Label cost = (Label) s.lookup("#pay_cost");
Label code = (Label) s.lookup("#pay_code");
Button copy = (Button) s.lookup("#btn_copy");
Button cancel = (Button) s.lookup("#pay_cancel");
copy.setOnAction((event) -> {
final Clipboard clipboard = Clipboard.getSystemClipboard();
final ClipboardContent content = new ClipboardContent();
content.putString(address);
clipboard.setContent(content);
});
cancel.setOnAction((event) -> {
cli.cancelRequest("");
close();
});
try{
Image img = cli.getQR(250, 250);
view.setImage(img);
} catch(Exception e){
e.printStackTrace();
}
cost.setText(this.amount.toPlainString() + " " + this.ticker);
item.setText(this.item);
code.setText(this.pass);
addr.setText("Pay to: " + address);
this.primaryStage = primaryStage;
}