0

I am making some application for myself, just to practice on my designs and GUI. My application is divided into two sides, first side is the model / logic however you call this, second side is the visual side, where you handle the gui, buttons and view.

So now my application has a feature that pops up and asks the user if he wants to use some feature, and then if he clicks yes, it will open a new JFrame window with many configurations.

these configurations will "probably" be in the Config class.

My question is, what is the best way to transfer data from the GUI to the model? Since you have to create a button listener in order to detect button clicks or text, what is the best proper way to update the configuration after the button was clicked?

For example, you have an application, and in order to start it you need to click on the button, I have two ideas in my head:

  1. Transfer the Config object to the area where you handle the button & listen to it

  2. Make Config static, and set up a Set() method, so you can set configurations without any objects, like Application.setConfiguration(config, type)

But I heard that statics are NOT always good, so I wondered, using static in this case is OK and good or are there better ways to do this? Or passing the config object to the GUI area is OK aswell?

This is how my structure looks like:

img
(source: gyazo.com)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Artemkller545
  • 979
  • 3
  • 21
  • 55

0 Answers0