1个回答
展开全部
这种要并排放置的情况就把一个HBox对象设为Scene的root,然后再把两个panel放到HBox上即可。由于你只是要界面,计算器的计算逻辑我就不实现了,具体代码如下(运行环境:jdk8或以上):
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.stage.Stage;
public class TwoPane extends Application {
final static private int BUTTON_WIDTH = 40;
final static private int BUTTON_HEIGHT = 40;
public static void main(String[] args) {
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.stage.Stage;
public class TwoPane extends Application {
final static private int BUTTON_WIDTH = 40;
final static private int BUTTON_HEIGHT = 40;
public static void main(String[] args) {
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询