Customers Java Swing Application with Source Code


I have developed the Customers Java Swing Application Demo. This application may be useful for developers who want to use Flamingo, Substance and SwingX.

Technology stack:

Model View Controller (MVC) vs Model View Presenter (MVP):

The Customers Java Swing Application Demo has MVC design pattern such as Java Swing. MVP is also popular for Desktop and RIA. Which is best, there are many discussions. Martin Fowler has written very good explanations for GUI Architectures. You may like to read.

Models and Services:

I have written entities with NamedQueries in JPA and Hibernate. The services are very simple with Generic AbstractService.


Full source code on Bitbucket

* Customers Java Swing Application images and icons credit: and


  1. Arian
    Jul 25, 2014 @ 08:08:00

    What is the version of the Flamingo that this example used? I downloaded the source from the project in github but the packages is different. The one that you are using also have slider package which is not available in the github source.

    I would like to have the doc jar, where could I found it for the version you are using?

    Thank you.


    • Cem Ikta
      Jul 25, 2014 @ 21:55:56


      This demo use Flamingo-Version: 4.1final Guenivere, Flamingo-BuildStamp: May 24, 2009 11:57:06 PDT (you can find in flamingo.jar > META-INF > file). I have Flamingo and Substance libs from,, This project sites were closed, details here.

      Unfortunetly, I haven’t javadocs from Flamingo and Substance libs.

      Best regards.


  2. Ilhama
    Nov 16, 2014 @ 23:25:41

    Hi.I can work this project my computer.i am download project on bitbucket and istall MySql 5.5 .How to work project ?


  3. hrama
    Nov 29, 2014 @ 05:25:55

    Hi. Great Project!
    I have a question to do, you are using reflection to get values from the class EntityTableColumn but this have a problem when the objects have inherited fields.
    Is there any way to get the inherited fields?


    • Cem Ikta
      Nov 29, 2014 @ 20:10:02


      You can set your class type in your EntityTableColumn as below:

      getTableModel().addColumn(new EntityTableColumn(
      "category", Category.class, 200));


  4. hrama
    Nov 30, 2014 @ 07:29:39

    Thanks For the answer!
    Perhaps I was not clear on the question.
    When i use the Entity Table Column with object with inherited Fields i have an error in the line

    Field field = entity.getClass().getDeclaredField(getFieldName());

    The error is java.lang.NoSuchFieldException: name.
    This is because the getDeclaredField method don’t support inherited fields, my question is if there is a way to obtain that field


    • Cem Ikta
      Dec 01, 2014 @ 18:11:49

      As far as I know, it should work, if that field has getters and setters. Can you write code snippet? then I can test in my project.


  5. Abhinandan
    Jan 21, 2015 @ 12:54:36

    Please give me link to download project


    • Cem Ikta
      Jan 21, 2015 @ 22:55:08

      Customers Java Swing Project source code hosted on Bitbucket, you can fork or download all files from the repository!


  6. khem nem
    Jun 02, 2015 @ 06:59:31

    how do i display id in table?


    • Cem Ikta
      Jun 02, 2015 @ 21:18:32

      You can add Id column in Page View e.g CategoryPage#addTableColumns method.

      getTableModel().addColumn(new EntityTableColumn( I18n.CUSTOMERS.getString("Category.Page.Id"), "id", Long.class, 150));


  7. khem nem
    Jun 02, 2015 @ 07:05:57

    how do i filter by id?


  8. khem nem
    Jun 06, 2015 @ 15:40:49

    Hello Cem Ikta, Can you write code snippet about filter by id?

    I have problem with with(“id”, “%” + filter + “%”)


  9. khem nem
    Jun 06, 2015 @ 16:47:00

    Thank for reply me! but getTableModel().addColumn(new EntityTableColumn( I18n.CUSTOMERS.getString(“Category.Page.Id”), “id”, Long.class, 150)); not work it has error like this
    com.devsniper.desktop.customers.framework.EntityTableColumn getValue
    SEVERE: null
    java.lang.NoSuchFieldException: id
    at java.lang.Class.getDeclaredField(


  10. bonny sebastian
    Jul 03, 2015 @ 06:42:02

    plz tell me how to import database content to mysql of this current project…….. whenever i import it shows sql dump import error… plz tell me how can import data to mysql and run my project successfully .


  11. Evanson
    Feb 04, 2016 @ 06:58:08

    Hi Cem.GreatProject.I have been reading your code and i see you have extensively used mvc pattern.However am not getting an overview hierarchical dagram of the system.Could you by any chance be having any rough architectural diagrams of the project.Am currently learning how to implement the mvp and mvc patterns in my swing projects.


    • Cem Ikta
      Feb 05, 2016 @ 00:06:50


      I haven’t UML diagrams, but I try to explain:

      Services and Models:
      Models are entities (not POJOs) in my project. It is simple so and all entities extends BaseEntity for common fields and base functions.
      Services are extends AbstractService, my services have not DAO layer, because the project has only one data source and not complex business logic.

      AppController: the application starter controller, creates main view (AppView)
      AppView: main view and its components extends JRibbonFrame (not JFrame because of ribbon components)
      CustomersDesktop is swing main class for project and extends AppController.

      Controllers and Views:
      There are four types of views: PageViews, DataPageViews, FormViews and PreviewPanel.
      PageView: A page view is typically extends JPanel and it has no data components with templates such as DashboardPage, it is always center panel of AppView.
      DataPageView: A page view with search, table, optional preview panel and it has data components with entities such as CustomerPage. it is always center panel of AppView.
      PreviewPanel: A JPanel preview panel, optional in DataPageViews, PreviewPanel shows the details of selected item from table such as CustomerPreview.
      FormViews: A modal JDialog form view, it is typically editor form view such as CustomerForm.

      Each controller must have at least one view but can have multiple views e.g. DashboardController has only DashboardPage and CustomerController has CustomerPage and CustomerForm. Every view must have a controller! Why? Does it make sense? If you have one controller and one view, it is complicated to control views!

      I hope it helps.

      Good luck with your project.


  12. peta
    Feb 05, 2016 @ 05:40:11

    good project , guys lets me know ..where is code for sql query


    • Cem Ikta
      Feb 05, 2016 @ 05:51:00

      Please see db folder.


      • peta
        Feb 06, 2016 @ 01:07:02

        thanks i got i it , btw if we build the application to jar file ,everyone can get username and password mysql server with open jar file use winrar and pick persistence.xml .. do you have solution to encrypted username and password ? and how to application (jar file) can read (eksternal file ) in same directory with jar file to get config of mysql server


  13. Berto
    Feb 28, 2016 @ 12:13:09

    Wow good looking .. , i will use this to develop my first java application , @cem ikta i has been read source code , but i don’t know to create login user .i need : 1st > Login Form 2nd > User Interface (base on level ),priveleges operator and manager is different and display username loggin in statusbar. do you have source code for login base on user level ? . thanks


    • Cem Ikta
      Feb 29, 2016 @ 12:39:08


      you have to create 2 classes: LoginController(implements Controller) LoginDialog(extends JDialog). You can show login dialog in AppController (line 65) and you can set logged user in AppController(setLoggedUser, getLoggedUser, setStatusBarUser).


  14. Berto
    Mar 01, 2016 @ 13:44:19

    hi cem ikta,
    i has create Login dialog (create at com.devsniper.desktop.customer.componen) , and add LoginDialog.showDialog(); in appcontroller . but i still not understand about LoginController(implements Controller) .AppController(setLoggedUser, getLoggedUser, setStatusBarUser). can you explain to me (with sample sourcode ) ?. thank you very much.


    • Cem Ikta
      Mar 15, 2016 @ 12:20:23

      Sorry for late answer. You have to create a controller for your every view and a controller creates its view. A simple LoginController implements Controller interface such as DashboardController. If your login successful, you can set logged user in AppController then you have access logged user via AppController everywhere in your application like AppController.get().getLoggedUser(). If you want to set your logged user in your AppView statusbar, then create a method in AppView setStatusBarLoggedUsername(User user).


  15. Wira
    Mar 14, 2016 @ 17:16:34

    Hi cem ikta , i need to modify connection pool in customer desktop use hibernate c3p0 .. i has import library hibernate-c3p0-4.3.7.Final.jar ,upgrade hibernate-core-5.0.6.Final.jar and modify JPAUtil :
    public static EntityManagerFactory getEntityManagerFactory() {

    Map props = new HashMap();
    props.put(“hibernate.connection.url”, “jdbc:mysql://localhost:3306/dbxx”);
    props.put(“hibernate.connection.username”, “root”);
    props.put(“hibernate.connection.password”, “”);
    props.put(“hibernate.show_sql”, “true”);
    props.put(“hibernate.format_sql”, “true”);
    props.put(“”, “validate”);
    props.put(“hibernate.connection.drive_class”, “com.mysql.jdbc.Driver”);
    props.put(“hibernate.c3p0.max_size”, “31″);
    props.put(“hibernate.c3p0.timeout”, “300″);
    props.put(“hibernate.c3p0.max_statements”, “50″);
    props.put(“hibernate.c3p0.idle_test_period”, “1000″);
    props.put(“hibernate.c3p0.validate”, “true”);
    props.put(“hibernate.connection.provider_class”, “org.hibernate.c3p0.internal.C3P0ConnectionProvider”);
    if (emf == null) {
    emf = Persistence.createEntityManagerFactory(“APPnew”,props);
    return emf;

    after run the program i got error:

    Mar 14, 2016 9:57:46 PM org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator instantiateExplicitConnectionProvider
    INFO: HHH000130: Instantiating explicit connection provider: org.hibernate.c3p0.internal.C3P0ConnectionProvider
    Mar 14, 2016 9:57:46 PM org.hibernate.c3p0.internal.C3P0ConnectionProvider configure
    INFO: HHH010002: C3P0 using driver: null at URL: jdbc:mysql://localhost:3306/dbxx
    Exception in thread “AWT-EventQueue-0″ java.lang.NoSuchMethodError: org.hibernate.c3p0.internal.C3P0MessageLogger.connectionProperties(Ljava/util/Properties;)V
    at org.hibernate.c3p0.internal.C3P0ConnectionProvider.configure(

    can you help me to solved this problem ? . thank you.


  16. prasanna
    Dec 08, 2016 @ 08:50:26

    Hi…can you please send the package details you have created on my email
    ..I’m beginner,please help me out


    • Cem Ikta
      Dec 09, 2016 @ 16:04:07

      Hi, you can get all projects resources from BitBucket. See project link. I don’t have JavaDocs or UML files!


  17. Customers Java Swing Application Demo | Cem's Blog
    Dec 14, 2016 @ 23:38:50

    [...] Original post is from my old blog! [...]


  18. kirra
    May 09, 2017 @ 04:59:50

    nice project. thanks for write and share this code.


  19. Orhan
    Aug 21, 2017 @ 21:29:46

    Hi Cem,

    Thanks for the code. I just forked it, and worked. But how can i see the forms as design mode in NetBeans 8.0.2? Do i need any plugin to do?



    • Cem Ikta
      Aug 21, 2017 @ 23:14:09

      Hi Orhan,

      I have implemented all forms with MigLayout in Java. So you don’t need Form Designers! All forms (e.g. CategoryForm see the link) have buildUI() method for its UI components.


  20. mtbadi39
    Dec 21, 2017 @ 13:05:17

    Hi Cem,
    Nice project. I just forked it, and it works.
    Can you please update it to support hierarchical data (ex : TreeTableModel from SwingX)


    • Cem Ikta
      Dec 21, 2017 @ 13:25:53


      In Customers Swing Application I have used only JTable and my custom TableModel. If you want to use TreeTable from SwingX, you have to implement your custom TreeTableModel with your entities!



  21. Virtue Nguyen
    Mar 02, 2018 @ 11:03:36

    Hi Cem Ikta,

    Could you show me how to use this menu interface for a Netbeans Platform Project.

    I have already try Pink Matter Ribbon, but it is not same.

    Thank Cem Ikta.


    • Cem Ikta
      Mar 05, 2018 @ 17:03:50

      Hi, I don’t use the ribbon components with the Netbeans Platform, rather with standalone Java Swing projects!


  22. Jesse James
    Aug 30, 2018 @ 10:45:32

    Hi Cem,

    Could you please tell if there’s a way to fix this error:

    Caused by: org.hibernate.exception.JDBCConnectionException: Could not open connection
    Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/customers_desktopdb


    • Jesse James
      Aug 30, 2018 @ 10:59:51

      Nevermind, I forgot to add the library of mysql to the classpath. Thanks anyway.


Leave a Reply