[英]Multiple JPanels in JFrame
I am writing a simple MySQL GUI driver. 我正在编写一个简单的MySQL GUI驱动程序。 I create 2
JPanels
one for log in and another for listing of databases in MySQL. 我创建了2个
JPanels
一个用于登录,另一个用于在MySQL中列出数据库。
I need to show the log in screen first and once the user authenticates will replace the log in JPanel
with DatabaseSelector JPanel
. 我需要首先显示登录屏幕,一旦用户通过身份验证,将用
DatabaseSelector JPanel
替换JPanel
的日志。
How can I do it? 我该怎么做? A friend told me to use
CardLayout
but I am not sure that I can use it. 一个朋友告诉我使用
CardLayout
但是我不确定是否可以使用它。 Since the DatabaseSelector
will be empty. 由于
DatabaseSelector
将为空。
Your friend is right, but ... 您的朋友是对的,但是...
You can find all your answers about Layouts in Oracle Java tutorials. 您可以在Oracle Java教程中找到有关布局的所有答案。
I suggest you that you look there for answers. 我建议您在那寻找答案。 Here is the link .
这是链接 。
This is much better than: A friend told me to use ... Because you will learn this, not wait for directions. 这比以下要好得多:一位朋友告诉我使用...因为您会学到这一点,而不是等待指导。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.