以下是我需要做的:询问用户他参加了多少测验。然后,提示用户输入这么多的分数。当用户输入完分数后,告诉他所有测验的平均分数。你不知道用户会输入什么数字
例如,如果用户说他参加了3次测验,则提示应该是:“输入测验等级1:",然后是”输入测验等级2:",然后是“输入测验等级3:”
这就是我所得到的。我不确定如何根据用户参加的测验次数来多次提示用户……
int numQuiz;
count = 1;
numQuiz = Integer.parseInt(JOptionPane.showInputDialog("How many quizzes did you take?"
我有一个任务要做,这个任务是一个简单的测验程序,用户需要回答数据库中的10个问题(但我目前有3个问题显示在一个框架中,因为我使用了jscrollpane..)。在测验结束时,我想要显示用户的分数,但是显示"3 / 3“,它显示"6 / 3"..and我真的花了近3天的时间来找出原因。
有人能给我这个问题的解决方案吗?
我正在使用NetBeans。
public class Quiz extends javax.swing.JFrame {
ArrayList<Question> list = new ArrayList<>();
我的程序是一个数学测验。用户完成10个问题,然后得到一个分数。然后需要将该分数附加到文本文件中。
if classs == "1":
text_file = open("Class1.txt", "r")
data = text_file.read()
text_file.close()
if name in data:
searchName(name, score)
else:
text_file = open("newFileName.txt","
我正在学习Java中的GUI。我在这里有点困惑。当我这样放置window.setVisible(true);时,只有当我调整它的大小时,我才会看到它(如果没有某种交互,它就不会显示出来)。
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
public class Main {
public static void main(String[] args) {
JFrame window = new JFrame("My App");
我正在用java做调查。我有20个问题和5个可能的选择。我想把20个标签和100个单选按钮按5分组。
我设法使用Net手动添加标签,但我想生成按钮,但它们没有显示。这是我的代码:
public class Prikaz extends javax.swing.JFrame {
/**
* Creates new form Prikaz
*/
public Prikaz() {
initComponents();
javax.swing.JRadioButton [][] buttons = new javax.swing.J
我试着做一个只显示图像的程序,一切都正常,但是控制台显示了这个警告.图片显示的很好,但我想知道什么是控制台警告和如何解决它在这里我的主要课程..。
public class main extends JFrame{
Image ryu;
imagen objRyu;
public main(){
super("Imagen1");
this.setSize(500,500);
this.setVisible(true);
this.setResi
我正在使用Netbeans GUI构建器,但它现在有点混乱。如何将图像添加到面板?我想我做的是对的,但它没有显示出来。我认为它应该在init()方法中,但是netbeans不允许我更改这部分代码。这是我为图像添加的代码:
//these four lines I added to add the image
imageIcon = new ImageIcon("login_icon.png");
image = new JLabel(imageIcon);
image.setToolTipText("SGS Secur
public LogInDatabase() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fol