例如,当我们向窗格添加新按钮时,我们需要编写以下代码:
StackPane pane = new StackPane();
pane.getChildren().add(new Button("OK"));
Run Code Online (Sandbox Code Playgroud)
为什么我们需要调用"getChildren()?" 它甚至做了什么?为什么我们不能说:
StackPane pane = new StackPane();
pane.add(new Button("OK"));
Run Code Online (Sandbox Code Playgroud)
我们将按钮添加到窗格中.我们不是把它添加到它的孩子,
在AEM 6.5的编辑模式下,如果我点击一个组件,就会弹出上面的工具栏。除了通过在 CRXDE 上创建 cq:dialog 节点来添加对话框(扳手按钮)之外,您是否可以在工具栏上创建自定义按钮?如果是这样,我可以在网上找到哪些工作示例?
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class ButtonInPane extends Application {
@Override
// Override the start method in the Application class
public void start(Stage primaryStage) {
// Create a scene and place a button in the scene
StackPane pane = new StackPane();
pane.getChildren().add(new Button("OK"));
Scene scene = new Scene(pane, 200, 50);
primaryStage.setTitle("Button in a pane"); // Set the stage title
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
}
public …Run Code Online (Sandbox Code Playgroud)