I suggest, while you are learning Java and reading Samar's tip, you
also go through few design patterns that could be useful in Java. Java
is designed based on patterns. So some basic knowledge of design
patterns will answer your question. To start with have a look at
observer, iterator patterns.

On Mon, Feb 6, 2012 at 8:10 AM, Sandesh Yadav
<sandeshyadav....@gmail.com> wrote:
>
> Thanx  a lot ....... it really helped me get out of my confusion ......
>
>
> On Sun, Feb 5, 2012 at 9:43 PM, Samar Dhwoj Acharya <coolsamar...@gmail.com>
> wrote:
>>
>> IMHO, it would be a better approach to write different classes for
>> action listeners of different JFrames. This would lead to a good code
>> organization. But again it might depend upon the situation as well.
>> For example, I could have several JFrames but actions to be performed
>> in all those JFrames might be same/similar. In such case, I would
>> think of making a single class which would take JFrame and other
>> necessary stuffs as the arguments. But for your kind of problem, I
>> would go for different class files for action listeners of each
>> JFrame. And you might want to organize the package of all action
>> listener classes as yourpackage.actionlisteners.
>>
>> Regarding second question, just write the single class for connection
>> and database query purposes. Using same connection codes in each
>> action listener would not be a good idea. Usually what I do is I make
>> a robust, efficient and efficient connection class and I tend to use
>> the same connection class in every project I do(I have never done
>> JAVA, though. Design issues are similar, however).
>>
>> Regards,
>> Samar
>>
>> On Feb 5, 11:29 am, Sandesh Yadav <sandeshyadav....@gmail.com> wrote:
>> > Hello everyone ,
>> > I am doing a java application using SWING and JDBC ....  I am making 5
>> > JFrames including one Login Frame. My doubt is while writing classes for
>> >  different action listeners for different JFrames , shall i write all
>> > actions in same class or make different classes for different frame's
>> > action ?
>> >
>> > And is it ok if i write one class for connection and use the same in all
>> > action Handler classes ?
>>
>> --
>> FOSS Nepal mailing list: foss-nepal@googlegroups.com
>> http://groups.google.com/group/foss-nepal
>> To unsubscribe, e-mail: foss-nepal+unsubscr...@googlegroups.com
>>
>> Mailing List Guidelines:
>> http://wiki.fossnepal.org/index.php?title=Mailing_List_Guidelines
>> Community website: http://www.fossnepal.org/
>
>
> --
> FOSS Nepal mailing list: foss-nepal@googlegroups.com
> http://groups.google.com/group/foss-nepal
> To unsubscribe, e-mail: foss-nepal+unsubscr...@googlegroups.com
>
> Mailing List Guidelines:
> http://wiki.fossnepal.org/index.php?title=Mailing_List_Guidelines
> Community website: http://www.fossnepal.org/



-- 
Warm Regards,
Sagun Dhakhwa
mobile: +977 985 11 2 88 32

-- 
FOSS Nepal mailing list: foss-nepal@googlegroups.com
http://groups.google.com/group/foss-nepal
To unsubscribe, e-mail: foss-nepal+unsubscr...@googlegroups.com

Mailing List Guidelines: 
http://wiki.fossnepal.org/index.php?title=Mailing_List_Guidelines
Community website: http://www.fossnepal.org/

Reply via email to