[英]Hiding methods from the GUI
我正在用Java實現觀察者模式,以將模型類與GUI分開。 問題在於,每次調用update-method時,都會將model-instance作為參數給出。 這意味着,GUI可以在模型對象上調用不應從GUI調用的方法。 如何避免GUI可以操縱模型對象?
為了實現這一點,您需要引入另一層,它將使用一個模型對象並將其轉換為DTO並返回到GUI,反之亦然。 在許多項目中使用的一種數據訪問設計模式。
有關更多信息, 請訪問此鏈接
希望這能給您這個想法。
[英]Hiding data from a DefaultTableModel to the GUI
[英]Hiding certain methods from other packages
[英]Methods from external class accessible but GUI Components not
[英]JavaFX - Calling GUI methods from a different thread
[英]Running GUI Update methods from separate Class methods
[英]Hiding unimportant getter methods from swagger UI in Java
[英]Java/Patterns for hiding methods from third party classes
[英]“Hiding” overridden methods in Java
[英]Hiding methods in subclass
[英]Hiding methods with a subclass parameter
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.