简体   繁体   English

如何从MySQL获取特定字段的数据到Java中的JLabel中?

[英]How to get data of a specific field from mySQL into a JLabel in java?

I have a table in mySQL called classes that have 2 columns, Class Name and Class Time, in front of each class name is its time. 我在mySQL中有一个名为class的表,该表有2列,Class Name和Class Time,每个类名的前面是它的时间。 in java I have made a window that has 8 Jlabels, 4 on the left and 4 on the right beside them. 在Java中,我创建了一个窗口,其中有8个Jlabel,左侧有4个Jlabel,右侧有4个Jlabel。 the 4 on the left is the classes names, I wrote them down. 左边的4是班级名称,我写下来了。 the other 4 which are on the right is empty, I want to get the class time of of a specific class and put it beside the class. 右边的其他4个为空,我想获取特定班级的上课时间,并将其放在班级旁边。 (get the class time of swimming class and put it in the empty label next to it) (获取游泳课的上课时间,并将其放在旁边的空白标签中)

could you please help me, it's about a project I am working on. 您能帮我吗,这是关于我正在从事的项目。

thank you. 谢谢。

Welcome in SO ! 欢迎加入!
For your question you have to read Java ResultSet docs . 对于您的问题,您必须阅读Java ResultSet docs
Of course, you can check this example that was very helpfull for me Searching daata and stting on JLabel . 当然,您可以检查这个对我很有帮助的示例搜索数据并使用JLabel
Instead of none having much information, i hope it helps. 我希望没有更多的信息,我希望能有所帮助。
Good luck 祝好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM