Results 1 to 3 of 3

Thread: event creation

  1. #1
    lemontree45 is offline Member
    Join Date
    Oct 2010
    Rep Power

    Default event creation


    I am learning java these days for a project and found this forum to be really helpful for clearing lots of beginners doubts. Thanks to all the moderators here.

    Ok. So, I am using Netbeans for my project, I have to create an application where I have to search some texts in a .txt file and replace it with something else from another file(database).

    To get started, I have created a form where I could browse for the file and to select it. Now I have the file path of the .txt file in a Textfield in this form.

    I have inserted another button. Now, I have another button which does all the searching and automatically replace the text.

    So, my question is, is it advsible to create a new class for this entire search and replace algorithm and call it in the event or just write down all the codes in the action performed area of the corresponding button.

    Please advise. also when I tried to do that, I get some error and it showed some clue that I could use EXception. So what exactly is this exception. I have seen in some codes about Exception. (Is it something to avoid errors? )

    Expecting a reply soon. Thanks


  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power


    Write it elsewhere.
    In general your GUI classes should just deal with displaying stuff.
    Any events that involve "business logic" (ie dealing with data) should be done as a separate layer, written with no thought to the GUI layer. That is, this layer could be picked up and moved to a completely different architecture. A side effect of this is that you can then test this code entirely separately from your GUI code to ensure it is working correctly.

  3. #3
    lemontree45 is offline Member
    Join Date
    Oct 2010
    Rep Power

Similar Threads

  1. JVM creation failed
    By RogerP in forum NetBeans
    Replies: 12
    Last Post: 10-08-2011, 09:33 PM
  2. JAR file creation
    By Cluster Storm in forum AWT / Swing
    Replies: 4
    Last Post: 06-10-2010, 03:38 AM
  3. checking for an event during an event
    By infinity in forum AWT / Swing
    Replies: 22
    Last Post: 04-09-2009, 01:08 AM
  4. Menu Creation
    By makpandian in forum AWT / Swing
    Replies: 5
    Last Post: 01-31-2009, 03:28 AM
  5. bmp creation
    By makpandian in forum New To Java
    Replies: 1
    Last Post: 12-17-2008, 05:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts