在同一事件中多次更改JFrame

时间:2015-07-08 12:01:14

标签: java swing event-dispatch-thread

我正在为Java中的应用程序创建一个更新程序。但是我遇到了框架玻璃窗格的问题。

一般来说,我的问题是我有一个数据库输入面板,它接受用户的输入。 在用户按下下一个按钮后,我想显示一个经典的进度,以告诉用户它正在连接到数据库。

My logic is 
this.glassPane.setVisible(true)
operation
this.glassPane.setVisible(false)

但我无法看到我的glassPane可见,我试图用线程停止程序,但这没有帮助。你可以帮助我吗?谢谢下面你可以看到pseude-code

**public void actionPerformed(ActionEvent e)
{
if(e.getSource==nextButton)
{
                this.getGlassPane().setVisible(true);
                glassPane.setProgressText("Connecting to Database");
                this.revalidate();
                this.repaint();
                databaseConnectionPanel.makeConnection();
                //I have thread function in this line.
                this.getGlassPane().setVisible(false);
                this.revalidate();
                this.paint();
}
}**

0 个答案:

没有答案