【发布时间】:2019-04-13 07:15:28
【问题描述】:
我正在尝试使用 JLabels 构建学生图表
我的应用程序执行 sql 查询并为每个月的条目数返回一个 int 值,如果没有找到它返回 0。
//scale variable is an int
//ene is a return value from another method that runs before
//in case there are no students in january I dont have to graph anything
//so this 'if' doesnt run
Scale = 50;
if (Ene != 0) {
System.out.println(Ene + " ene stdds");
// this prints out 11 ene stdds
double EneBH = 449 * (Ene / Scale);
int EneBHeight = (int) Math.round(EneBH);
int EneBYLocal = 612 - EneBHeight;
EneP.setBounds(76, EneBYLocal, 7, EneBHeight);
EneP.setVisible(true);
} else {
//if the last if didnt run I want to know if it hidd the label
System.out.println("HIDDEN ENE");
EneP.setVisible(false);
}
*Ene P 是第一个用于绘图的 jlabel,它看起来是灰色的,位于 enero 区域。
*EneP 打印出 11 个学生但从未出现,不打印隐藏的 ene,它只是不显示
*EneP 如果我解决它或者你解决它,将具有与其他 jlabels 相同的代码,请
【问题讨论】:
-
抱歉,我在您的问题中看不到任何问题。
-
如需尽快获得更好的帮助,请发帖 minimal reproducible example 或 Short, Self Contained, Correct Example。 (并提出问题。)
标签: java swing interface helper