tag:blogger.com,1999:blog-4827130394695649251.post806471103521836814..comments2023-07-12T16:02:21.498+05:30Comments on Netbeans IDE Blog by Tushar Joshi, Nagpur: Matisse GUI designer - Seperation of ConcernsTushar Joshihttp://www.blogger.com/profile/03931011991029693685noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-4827130394695649251.post-69845370069609789692008-05-03T07:24:00.000+05:302008-05-03T07:24:00.000+05:30Hi Shaul,In my example I have highlighted the use ...Hi Shaul,<BR/><BR/>In my example I have highlighted the use of SimpleWindow, the GUI generated class and ISimpleListener one interface to communicate with the GUI.<BR/><BR/>Now by using this interface we can implement the GUI from many places and in many ways we want. Using an interface will also enable us to implement it anywhere.<BR/><BR/>with regards<BR/>Tushar Joshi, NagpurTushar Joshihttps://www.blogger.com/profile/03931011991029693685noreply@blogger.comtag:blogger.com,1999:blog-4827130394695649251.post-84921395149101255862008-05-03T07:20:00.000+05:302008-05-03T07:20:00.000+05:30>> What if i have another label in >> SimpleWindow...>> What if i have another label in <BR/>>> SimpleWindow and i want to show <BR/>>> the greetings in that label <BR/>>> instead in a new JOptionPane. How <BR/>>> do you keep things separated in <BR/>>> that case?.<BR/><BR/>Hi Ramiro,<BR/>In this case I will introduce one method in SimpleWindow class so users of this class can set values in the label.<BR/><BR/>simpleWindow.setLabel(text);<BR/><BR/>I will call this method from the greet event handler in SimpleExample class.<BR/><BR/>with regards<BR/>TusharTushar Joshihttps://www.blogger.com/profile/03931011991029693685noreply@blogger.comtag:blogger.com,1999:blog-4827130394695649251.post-75186514955548342912008-05-03T07:18:00.000+05:302008-05-03T07:18:00.000+05:30Thanks Ramiro for pointing out one descripency in ...Thanks Ramiro for pointing out one descripency in the example. Earlier I used SimpleView in some places incorrectly now I have updated the post with correction.<BR/><BR/>with regards<BR/>Tushar Joshi, NagpurTushar Joshihttps://www.blogger.com/profile/03931011991029693685noreply@blogger.comtag:blogger.com,1999:blog-4827130394695649251.post-23078507819991490392008-05-03T01:24:00.000+05:302008-05-03T01:24:00.000+05:30I separate my code from the GUI by making a model ...I separate my code from the GUI by making a model class for each GUI class. I make a new model class from the Gui and invoke it's methods for each event. In your way you use three classes instead of two in this way. Could you explain the pros of your way, while considering this way.<BR/><BR/>Thanks,<BR/>ShaulUnknownhttps://www.blogger.com/profile/15611216571611868646noreply@blogger.comtag:blogger.com,1999:blog-4827130394695649251.post-53693792660712557182008-05-03T01:19:00.000+05:302008-05-03T01:19:00.000+05:30What if i have another label in SimpleWindow and i...What if i have another label in SimpleWindow and i want to show the greetings in that label instead in a new JOptionPane. How do you keep things separated in that case?.<BR/>Thanks!Ramirohttps://www.blogger.com/profile/04320815180266464946noreply@blogger.comtag:blogger.com,1999:blog-4827130394695649251.post-2791917052919405512008-05-03T00:39:00.000+05:302008-05-03T00:39:00.000+05:30Why did you use two different names for your main ...Why did you use two different names for your main class, SimpleExample in the explanation and SimpleView in the code.<BR/>Thanks!Ramirohttps://www.blogger.com/profile/04320815180266464946noreply@blogger.comtag:blogger.com,1999:blog-4827130394695649251.post-26234781113780184632008-05-02T11:35:00.000+05:302008-05-02T11:35:00.000+05:30Hi Howard,I wanted to keep thing as simple as I ca...Hi Howard,<BR/><BR/>I wanted to keep thing as simple as I can in this example. My point was to highlight use of the interface ISimpleListener.<BR/><BR/>I see your point. There can be many ways to do the things like you said. I could have shifted the methods show() and close() to the SimpleWindow class and just called them from my main class. Now this solution looks better to me. Thanks for the comment.<BR/><BR/>One more thing I was trying to achieve is keep the generated class free from custom code as much as I can. Now I wonder why these methods are not automatically generated in the frame class in NetBeans as they are so common things we usually do with the Frame.<BR/><BR/>with regards<BR/>TusharTushar Joshihttps://www.blogger.com/profile/03931011991029693685noreply@blogger.comtag:blogger.com,1999:blog-4827130394695649251.post-55516049942076639582008-05-02T11:00:00.000+05:302008-05-02T11:00:00.000+05:30I am intrigued that you chose to have the main cla...I am intrigued that you chose to have the main class do window things, like invokeLater and popping up panels.<BR/><BR/>An alternative is to put this code into your frame class, change your interface to just have a greet method, and have greet return the greetings string.<BR/><BR/>Why did you choose the first method?hlovatthttps://www.blogger.com/profile/07048859648718746436noreply@blogger.com