java - First GUI, app organization -


This is my first Java swing application and I have some questions about the organization.

I need to create an application that after logging in to the user (call it), "normal user page", "admin page" or "super user page" redirect. After reading some articles, I came to know that use the java swing app, a jehfram and panels to hide or show content (some things like some pages).

My questions are now:

  1. Do I need to create 4 "main classes" (login, normal user, administrator, super) and each one spreads a gefrem Because they are specially separate applications and this has their own sections of jframes (panels), with them I hide the content on them / show
  2. or, log my main jframe and After the entry, I show a different panel (normal user, admii Or super), and they have panels to hide the show content
  3. When my first question is correct, then it's a good folder structure:

    folder ap: login, normal, admin, super user class (frame) folder neither user: related sections / panel. .

    Thank you in advance :))

    Question / Answer:

    Do I need to create 4 "main square" (login, normal user, admin, super) and each one provides a Jeffrey because they are specially different - There are different applications and these Jframes have their classes (panel), with them I hide / show the content on them

    If you are making a good swing GUI, Probably the none sections will expand to the Graff, and in fact it is rare that you want to do this anytime. More commonly, your GUI classes will be designed to make JPNLs, which can then be kept in JFRAMS or JDIOLOG or JetAbadePain or can be swapped via card layout, wherever needed. This will greatly increase the flexibility of your GUI coding

    You will have a Master View Class / JPN, and can swap your content with other sub-visual classes, which will be used for your non-GUI model class. Will be consistent with different states, whether it is normal user, administrator, or super user

    Or, logging in is my main Jeffrey and after I log in, I show a separate panel (normal user, administrator or super) in a separate window or dialog, and show the panel to them I have a panel for

    I usually use a dialog to log in as a JDI, and then after confirming the credentials, I show the main GUI, then With the right view from Thus based on Odl conditions.

    When my first question is correct then this is a good folder structure:
    folder app: login, normal, administrator, super user class (frame) folder neither user: class / Panel related to him .

    I think your package is to be separated into models, views, controls and main. You can use sub-packages for different sub-sections of your program.

    I urge you to read on the model-view-control pattern of GUI structure, and then many useful types of this.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -