在java中重新绘制一个框架
我已经为在线测验编写了代码。我想通过单击“下一步”按钮来更改问题,但重新绘制不起作用;只有新窗口在工作。 我什至无法隐藏 jftMainFrame,因为它仅适用于 8 个窗口。quest 是一个包含问题和选项的列表,当我单击按钮时,从访问 db.repaint() 访问它时不起作用。 我有 4 个显示标签的单选按钮。我想重新绘制单选按钮的标签,还有问题 请帮我。
JFrame jtfMainFrame, jtfMainFrame1;
nextButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Next question..");
j++;
quest = getCurrentQuestion();
createWindow();
validate();
}
});
I have written code for an online quiz. I would like to change questions by clicking "next" button, but repaint is not working; only new window is working.
i can't even hide jftMainFrame since it works for 8 windows only.quest is a list containing questions and options ,its accessed from access db.repaint() is not working while i click the button.
i have 4 radiobuttons which displays the label.i want to repaint the label of radiobutton and also question
Please help me.
JFrame jtfMainFrame, jtfMainFrame1;
nextButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Next question..");
j++;
quest = getCurrentQuestion();
createWindow();
validate();
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的问题肯定不清楚。
你想做什么。如果您只是尝试“重新绘制/刷新”面板或组件,请使用paintImmediately();
例如
希望有帮助
Your question is definitely not clear.
What are you trying to do. If you are simply trying to "repaint/refresh" a panel or a component use paintImmediately();
for example
Hope it helps
我认为您的问题是关于使用 CardLayout,而不是创建运行时有很多顶级容器
I think that your question is about using CardLayout, rather than create lots of Top-Level Comtainers on runtime