Separate Swing code from Real code?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Separate Swing code from Real code?

  1. #1
    Join Date
    May 2006
    Posts
    4

    Separate Swing code from Real code?

    Is there an easy way to separate the swing-related stuff from the real code of a program? Like if you have a program that is Swing based, but want the functionality to run as part of another project or to run in a console instead, is there any way of ripping out the Swing stuff?

  2. #2
    Join Date
    Feb 2006
    Location
    Cologne - Germany
    Posts
    271
    you will have to use the classical mvc design pattern, where you seperate you model (the core logic with the data) from the swing classes which use it.

  3. #3
    Join Date
    Jun 2004
    Posts
    199
    And put them in different packages - that way you can use a build tool to include/exclude classes easily.

    And Unit test - that way you can prove you have good separation.

  4. #4
    Join Date
    May 2006
    Posts
    4
    Thanks guys, but I meant if you already had the source code to an existing program based in swing and wanted just the functionality out of it. But it's ok, I ended up doing it the hardway

    Cheers.

  5. #5
    Join Date
    Mar 2004
    Posts
    635
    If it's tied in with swing components that much, you have no choice but to extract the functions and rebuild a more modular design.

Similar Threads

  1. VS.Net and Code Behind
    By Chaitanya Marvici in forum ASP.NET
    Replies: 6
    Last Post: 07-21-2003, 10:15 AM
  2. Replies: 60
    Last Post: 09-13-2002, 06:41 PM
  3. Another Language
    By Steven Bell in forum .NET
    Replies: 260
    Last Post: 06-01-2001, 05:32 PM
  4. Replies: 90
    Last Post: 04-17-2001, 01:45 AM
  5. Replies: 0
    Last Post: 04-03-2001, 05:32 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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center