ActionListeners, multiple field updates, and reloading user GUI selections from a file

后端 未结 1 1967
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-12 05:24

I have multiple places where I convert between one coordinate system and another. In each case there is a cosine/sine calculation between, let\'s call them x, y and x\', y\

1条回答
  •  暖寄归人
    2020-12-12 05:55

    I'm trying not to touch too much code.

    This is a foundational mistake; the trash can is an important design tool, and one or more minimal examples will be invaluable in learning to compose more complex applications.

    Does anyone have a suggestion on a way to save the state of a panel and refresh this (the current object, the panel)?

    Using the Model–View–Controller pattern, the program's data should be stored in a suitable model, and transformations should be done when model elements are rendered in the view; the Converter example shows how to manage custom events, and this example expands on the topic

    If I continue to do it in this way, can someone suggest a way to MINIMIZE the times the ActionListener fires?

    As suggested in the original article, use Action to encapsulate behavior. See Java SE Application Design With MVC: Issues With Application Design for a deeper examination of the problem.

    0 讨论(0)
提交回复
热议问题