Swing event architecture

I'm building a rich client application based on Swing. And I'm wondering what is the best architecture for event's handling. My classes are : - MyFrame - FirstPanel, with a jbutton - SecondPanel with a jLabel I start the application with a FirstPanel within a MyFrame. Then, I add an action listener to the button in the FirstPanel, and I whant this action to (1) close the FirstPane then (2) open a new SecondPanel in the running MyFrame How to do it ? **Edit - Example** I want to show at startup a list of users, stored in a file, then the user click on his name or click on "new user". When he clicks on "new user", a second panel appears, with a form to create a new user and store it in the file. In this example, MyFrame is the main frame, created by the main() method. Then the ListUsersPanel appears. Then, the NewUserPanel appears if I click on "new user". My question is : how do I design my classes/listeners to manage all this ? ** Edit - example 2 ** What if I have a JFrame that contains 2 JPanels, and I want a button in Panel1 that change a label in Panel2 ?
you are already describing the event architecture...

以上就是Swing event architecture的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏