我是编程的新手。我正在尝试创建一个婚礼跟踪器,我正在GUI上工作。我的代码没有显示任何内容

时间:2022-09-04 08:39:41

A user should be able to type in their first name and their last name. Use radio buttons to select if they are there for the bride or the groom. Type in their relationship to the bride or groom. Use radio buttons to select if they prefer chicken, pork, or beef for their meal. Then I have JButtons to select at the bottom. One shows the bride's guest list with a time stamp. One shows the groom's list with a time stamp. Another shows the bride's list in alphabetical order, the groom's list in alphabetical order. One has a master list with a time stamp and a master list in alphabetical order. Finally, a meal preference list and exit button.

用户应该能够输入他们的名字和姓氏。使用单选按钮选择新娘或新郎是否在那里。输入他们与新娘或新郎的关系。使用单选按钮选择他们是否喜欢吃鸡肉,猪肉或牛肉。然后我在底部选择JButtons。一个显示新娘的客人名单和时间戳。一个显示带有时间戳的新郎列表。另一个按字母顺序显示新娘的清单,按字母顺序显示新郎的清单。一个主列表具有时间戳和按字母顺序排列的主列表。最后,用餐首选项列表和退出按钮。

Isn't this code suppose to print out something?

这段代码是不是要打印出来的东西?

    if (groomstate) {

        groomstate = false;

        Person person = new Person(firstNameTextField.getText(),lastNameTextField.getText(), relationshipTextField.getText(), "bride", "groom");

        PersonNode personNode = new PersonNode(person);

        brideLinkedList.addLast(personNode);

        jTextArea1.append(Person.getfirstName()

            + person.getlastName() + " is with the groom's party and is the "
            + person.getrelationship() + " of the groom.\n");

    }

}

2 个解决方案

#1


The best tool for such problems is to debug your code. Put a breakpoint at the line of your if statement, and check what happens there. Here is some tutorial for debugging in Netbeans:

解决此类问题的最佳工具是调试代码。在if语句的行中放置一个断点,并检查那里发生了什么。以下是Netbeans中的一些调试教程:

https://netbeans.org/kb/docs/php/debugging.html

Sorry, that I couldn't post it as a comment, due to not exceeding sufficient rep points ;)

对不起,由于没有超过足够的重复点,我无法将其作为评论发布;)

#2


jTextArea1.append(Person.getfirstName() + person.getlastName() + " is with the groom's party and is the " + person.getrelationship() + " of the groom.\n"); }

jTextArea1.append(Person.getfirstName()+ person.getlastName()+“与新郎的派对一起,是新郎的”+ person.getrelationship()+“。\ n”); }

Person.getFirstName() should be person.getfirstName()

Person.getFirstName()应该是person.getfirstName()

#1


The best tool for such problems is to debug your code. Put a breakpoint at the line of your if statement, and check what happens there. Here is some tutorial for debugging in Netbeans:

解决此类问题的最佳工具是调试代码。在if语句的行中放置一个断点,并检查那里发生了什么。以下是Netbeans中的一些调试教程:

https://netbeans.org/kb/docs/php/debugging.html

Sorry, that I couldn't post it as a comment, due to not exceeding sufficient rep points ;)

对不起,由于没有超过足够的重复点,我无法将其作为评论发布;)

#2


jTextArea1.append(Person.getfirstName() + person.getlastName() + " is with the groom's party and is the " + person.getrelationship() + " of the groom.\n"); }

jTextArea1.append(Person.getfirstName()+ person.getlastName()+“与新郎的派对一起,是新郎的”+ person.getrelationship()+“。\ n”); }

Person.getFirstName() should be person.getfirstName()

Person.getFirstName()应该是person.getfirstName()