java gui代码需要帮助 [英] Help needed with java gui code

查看:69
本文介绍了java gui代码需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

app.java(初始应用程序)

•MainFrame.java(外部JFrame)

•ControlPanel,面板的Java类,将包含另外两个面板,使用布局。

•TopPanel,一个用于Panel的Java类,它将显示组的名称和组的平均GPA

•group.java和student.java(以前实验室的工作版本,可能需要更新,请参阅下面重要的#2)。 />
学生应在所有提交中应用一致的缩进。这可以通过NetBeans源菜单完成。

目录

您可以从这个NetBeans项目开始。

您将创建3个面板和一个组对象。一个面板包含另外两个面板。

在顶部面板上,您将显示该组的名称和平均GPA。

中心面板将包含4个按钮,显示组4学生姓名和GPA。



重要 - #1 - 单组对象

您将在此作业中仅创建一个组对象g1。 />
只有一个语句组g1 = new group(...);在整个应用程序中。

由于需要使用两个面板,需要在某处创建g1,然后将对象g1作为参数传递给其他类。

重要 - #2 - GPA计算

您之前的小组/学生解决方案可能正在以这种方式工作;否则,您需要更新它。

因为GPA是在学生中随机计算的,根据您的计算方式,平均组GPA可能与每个学生的GPA显示的总和不一致。

为了解决这个问题,你需要:

•在小组中:

o semesterGPA是使用学生的GPA属性计算的,而不是学生中的semesterGPA()方法

•在学生中:

o它需要GPA作为属性

o属性GPA是在构造函数中计算的,当学生创建时,调用semesterGPA()随机方法

o semesterGPA()方法,无论何时调用,都会更新属性GPA的值



我尝试了什么:



我尝试编码但是我不能。我的代码中有很多错误无法修复然后导致我对此主题非常新。请帮忙。

app.java (initial application)
• MainFrame.java (external JFrame)
• ControlPanel, a Java class for the panel that will contain two other panels, using a layout.
• TopPanel, a Java class for the Panel that will display the group’s name and group's average GPA
• CenterPanel, a Java class for the Panel that will display names and semester GPAs of the 4 students in a group.
• group.java and student.java (a working version from previous labs, might need updates, see important #2 below).
Students should apply consistent indenting in all submissions. This can be done via the NetBeans Source menu.
Contents
You can start with this NetBeans project.
You will create 3 panels and one group object. One panel contains two other panels.
On a top panel you will display the group's name and average GPA.
The center panel will contain 4 buttons displaying the group 4 students name and GPA.

Important - #1 - The single group object
You will create only one group object g1 in this assignment.
There will be only one statement group g1 = new group(...); in the whole application.
Since two panels need to be used, g1 will need to be created somewhere and then pass the object g1 as a parameter to other classes.
Important - #2 - GPA Calculation
Your previous group/student solution might be working this way; otherwise, you will need to updated it.
Because GPA is calculated randomly in student, depending how you calculate it there is a chance that the average group GPA will not match with the displayed sum of each student's GPA.
In order to fix this, you need to:
• in group:
o semesterGPA is calculated using the GPA attribute in student, not the semesterGPA() method in student
• in student:
o it needs GPA as an attribute
o the attribute GPA is calculated in the constructor, when the student is created, calling the semesterGPA() random method
o the semesterGPA() method, whenever it is called, updates the value of the attribute GPA

What I have tried:

I tried coding it but I couldn’t. There are many errors in my code not able to fix then cause im very new to this topic. Please help.

Can anyone team viewer it and fix my code?

推荐答案

这听起来就像是家庭作业,所以没人真的应该进入并解决你的问题。你是在正确编码这个并试图自己做这个的正确轨道



为你的问题做的最好的事情是你更新你的帖子使用您拥有的特定代码块并在执行时收到的错误消息中发布。



一旦我们看到实际问题,它将会让我们更容易帮助您修复它;但也有助于向您展示问题发生的原因。这是你可以获得的最好的学习方法。
This sound like a homework assignment, so nobody really should be going in and fixing your problem. You are on the right track of coding this together and trying to do this on your own

What the best thing to do for your problem is for you to update your post with a specific block of code that you have AND post in the error messages that you are getting when you execute it.

Once we can see the actual problem, it will make it easier for us to not only help you fix it; but to also help show you why the problem happened. That is some of the best learning you can get.


这篇关于java gui代码需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆