Yahoo Clever wird am 4. Mai 2021 (Eastern Time, Zeitzone US-Ostküste) eingestellt. Ab dem 20. April 2021 (Eastern Time) ist die Website von Yahoo Clever nur noch im reinen Lesemodus verfügbar. Andere Yahoo Produkte oder Dienste oder Ihr Yahoo Account sind von diesen Änderungen nicht betroffen. Auf dieser Hilfeseite finden Sie weitere Informationen zur Einstellung von Yahoo Clever und dazu, wie Sie Ihre Daten herunterladen.

Java: Design the program implementation separate from the GUI?

I have learned a fair amount of Java (for a beginner) and have started making a few complicated engineering-type programs which work well from the command-line interface. (As a background: I originally learned programming with Fortran -- so command-line is the level I know best).

I am now trying to implement some GUI interfaces to my programs. But my implementation code seems to inevitably get interweaven (i.e. buried!) with GUI code, so I lose all oversight.

Any suggestions or known tutorials that specifically address how to write one set of Java classes that do the GUI, another set of classes handle the implementation and cleanly link them together? Oher suggestions of how to learn to tackle this Design issue??

Thanks.

2 Antworten

Relevanz
  • Anonym
    vor 1 Jahrzehnt
    Beste Antwort

    You want to use a design pattern known as model-view-controller, which separates the code that creates the GUI (the view) from the code that reacts when an action is performed (the controller) and the underlying code that it controls (the model). It's a very useful and widely used pattern so there's a lot written about it online. I found a few articles on the Sun website to start you off.

  • vor 1 Jahrzehnt

    Go through the Java tutorials on Sun's website. The examples have the GUI in completely independent classes, so it's easier to comprehend. That's how I learned about GUIs.

    Go to the link in the sources, and then look at the examples that they give for the features. Most of them are doing what you are saying you want to implement.

Haben Sie noch Fragen? Jetzt beantworten lassen.