好的,从我的观点来看,我的代码相当不错,可以获得及格分数但是我在添加一个简单的刷新/随机播放按钮时遇到了麻烦.不使用JOptionPane的辅助工具.Eclipse似乎没有意识到我已经创建了一个对我来说根本没有意义的按钮,因为它告诉我一些关于Node实际上是节点并且它被创建的节点.但是当我进入另一个班级并添加另一个带有3行示例的按钮时,它只是起作用.但当我把它移到我的家庭作业程序时,它只是给我一个错误的add方法打破了整个程序!说
"类型List中的方法add(Node)不适用于争论(Button)"
任何人都可以在我的代码中找出我可能出错的地方吗?它必须是一个节点到字符串转换的东西,或者我似乎无法弄明白的东西.愿意给我任何提示,但请不要解决我的问题.
这是本书的基本问题."编写一个程序,让用户点击刷新按钮,从一副54张牌中显示四张牌."
我只是需要一些关于按钮的帮助.我确实有其余的.
到目前为止,这是我的代码.因为太多了,我已经把进口了.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.stage.Stage;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import java.awt.Button;
import java.io.File;
import java.util.ArrayList;
public class Cards extends Application
{
public void start(Stage primaryStage)
{
ArrayList<String> cards = new ArrayList<>(); //Array list
Shuffle(cards); //Shuffles the Cards
String file1 = new File("cards" + "/" + cards.get(1) + ".png").toURI().toString();
String file2 = new File("cards" + "/" + cards.get(2) + ".png").toURI().toString();
String file3 = new …Run Code Online (Sandbox Code Playgroud)