MVC « Development « Java Swing Q&A





1. How can I best apply OOP principles to games and other input-driven GUI apps?    stackoverflow.com

Whenever I try to write graphical programs (whether a game or really any GUI app) I always wind up with one or two god classes with way too many methods (and ...

2. What's the best way to store app settings? (MVC)    stackoverflow.com

I'm developing a swing app which suits the MVC pattern and I'm wondering about the best place to store settings such as width/height, xml files location... Should those settings be avaiable ...

3. Architectural MVC and Swing    stackoverflow.com

I want to use MVC to structure my Swing application, but there seems to be a conflict. As I understand MVC, the controller should handle input and update the model. The model ...

4. Winforms for a java swing guy [Applying MVC]    stackoverflow.com

I am developing a GUI application in C# using the design mode in VS2008. Now that I am finished with the looks of the application I am ready to add some ...

5. using attach(this); in a GUI program    stackoverflow.com

I'm looking at a GUI program made using MVC and they have this method. What does this method do and when will you need to use it?

attach(this);
Here is one of the ...

6. How to make a Java serialized object being passed over network notify client GUI of change    stackoverflow.com

I am making a client-server Java app that is going to be MV(C, P) like. My current problem is once the client get's a Player object it needs to tell ...

7. How to go about with real GUI development with Java Swing and MVC    stackoverflow.com

I am creating a Blackjack Card game emulator. I am a SCJP,familiar with Core Java concepts. I have a very basic understanding of Java swings and awt. Already finished writing the basic ...

8. Avoid Circular Reference in Swing GUI    stackoverflow.com

Maybe it's not worth worrying about in this scenario, but lets say you have two classes, a JFrame with all its components, and a server-like class that handles requests from remote ...

9. Java Swing MVC question    stackoverflow.com

I'm following this MVC model: http://java.sun.com/developer/technicalArticles/javase/mvc/ In my model I have an "ArrayList shapes" field and I need the shapes in my view. Is the only way of getting my shapes by ...





10. MVC Pattern in Java Swing?    stackoverflow.com

Please give me an example for MVC pattern used in Java SWING package ?

11. Best practice for an application with GUI    stackoverflow.com

I'm about to start an application which will have both console and GUI interfaces. What I wan't to achieve is COMPLETE decoupling of application logic from interface. In future, I may ...

12. MVC/MVP/MVVM frameworks for Java GUI applications    stackoverflow.com

Can anybody recommend a (preferably open-source) framework for decoupling GUI from model in Java desktop applications?

13. Converting app to MVC and running it in both console and gui    stackoverflow.com

I have a simple java gui calculator, with 3 number systems (there are some bugs but that doesn't matter now). Currently all code is in one file. My task is to ...

14. Gui problem after rewriting to MVC    stackoverflow.com

I'm practicing MVC style programming. I have a Mastermind game in a single file, working with no problems (maybe apart of the fact that "Check" button is invisible at start).

15. Java Swing Program Structure    stackoverflow.com

I'm looking for some guidance on best practices for an application using Java Swing to be structured. I'm a webapp guy normally and try to follow MVC. Is MVC ...

16. How does Swing fit in with MVC?    stackoverflow.com

There are many examples on the web when it comes to the MVC pattern with Swing. However, there doesn't seem to be a straightforward way of doing things. Here's some questions:

  1. Can the ...





17. Java List MVC Pattern    stackoverflow.com

I'm having some trouble implementing a JList in Java using the MVC Pattern because I can't figure out how am I suppose to write the controller and the view(each one in ...

18. What are MVC frameworks available for java desktop/winform application?    stackoverflow.com

I am going a develop a winform application. I want to keep Model, View and controller separate. I have not used any MVC framework in Java and have been out of ...

19. Is MVC the only acceptable way to develop a desktop application with a GUI?    stackoverflow.com

Or are there other generally accepted patterns for creating a generic business application with a graphical interface and no network connectivity.

20. The MVC pattern and SWING    stackoverflow.com

One of the design patterns which I find most difficult to get a real grasp of in "real SWING life" is the MVC pattern. I've been through quite a few of ...

21. Is it OK to let the controller inherit the view when applying the MVC pattern?    stackoverflow.com

I am in the process of learning the MVC pattern in "practise", meaning that I am trying to get a grasp of how to implement it in any given Java application. ...

22. Apply the MVC pattern to an existing application    stackoverflow.com

This is a follow up question to The MVC pattern and SWING. I am trying to implement the MVC pattern in an existing piece of code. The existing code creates ...

23. MVC design question    stackoverflow.com

Just a note, I'm new to MVC. I'm trying to make my code as much decoupled and testable as possible. I have a view with a text box and button. I want to enable ...

24. AWT XOR SWING together in one application?    stackoverflow.com

I am looking into developing an Java GUI for a biological analysis tool. My question is, Can I use both AWT and SWING libraries under the same Model View ...

25. What is the controller in Java Swing?    stackoverflow.com

I would like to apply the MVC design to my Java application using Swing in a meaningful way. Therefore my question is, what how in Java Swing the controllers would be ...

26. Passing Swing classes (references) on network?    stackoverflow.com

I want to know that is it possible to send major Swing classes event/actionlisteners, Events, components via RMI. Possible scenario: If one client press the button or move the slider every client's ...

27. Realizing real time Collaborative GUI with Java?    stackoverflow.com

I wanted to create a real time collaborative GUI , as far as my knowledge is concern, i thought java swing MVC roots can play some role in that and ...

28. MVC with several identical views    stackoverflow.com

for the purpose of my application i need to create several identical views that should behave and response to the same events. Should i instanciate each identical views that i ...

29. MVC pattern: which is better? For views or controllers to create and reference the other?    stackoverflow.com

We are making a rather large Swing application which has to implement the MVC pattern. The application currently looks like this:


There are quite a few views. They are created in a hierarchical ...

30. How Swing components implements MVC architecture?    stackoverflow.com

Suppose I have a JTextfield . How does only this JTextfield implement an MVC architecture?

31. How to work with swing with multiple classes    stackoverflow.com

I just want to know some thing about the swing 1) How to use MVC model in swing? 2)Say i Have an Main window and i need to do the menu as ...

32. How to divide the controller?    stackoverflow.com

My View-Controller

public class MainForm implements java.util.Observer{
@Override
    public void update(Observable o, Object arg) {
        System.err.println("update View ....");
      ...

33. How to divide method?    stackoverflow.com

I have some method, update(). In the methods of the model, I call

notifyObservers() 
How do I update the gui separately?

34. Views displays different component based on configuration    stackoverflow.com

I would like to know if there is a design pattern that would help me to build views differently based on some configuration parameters. For exemple if configuration 1 is ...

35. For RESTful services in Java, is JAX-RS better than an MVC framework like Swing, Grails or Play?    stackoverflow.com

For example, Play-framework supports RESTful services like this: RESTful on Play! framework How does this compare to something like Jax-RS Jersey implementation? Does a framework like Play run circles around ...

36. Binding domain object to GUI    stackoverflow.com

I would like to know how to bind my domain object with are POJOs to my GUI component. Should I inject my domain object to the constructor of my view, ...

37. 3 Swing applications designs : which is the best?    stackoverflow.com

I'm quite new in desktop applications developpment and I have a pretty big project do deliver this summer. The thing is that the code has to be very clear, so I ...

38. Beans binding and mvc    stackoverflow.com

I use beans binding between my model object and components in my views. I directly pass model to each view constructor, and then bind model's property to components. I ...

39. How much GUI logic is too much in MVC?    stackoverflow.com

I'm writing a little Java desktop application and I'm using an MVC pattern. I've read about how logic should be kept in the model, but there are some places where ...

40. Learning about Java MVC and Swing framework    stackoverflow.com

I have been looking around for tutorials on Java MVC concept and Swing framework. But, unfortunately, the ones I found aren't understandable . I want something to follow. Please help. Thanks, ...

41. Java Swing MVC architecture    stackoverflow.com

How is a Java Swing application organized to achieve MVC architecture?

42. How do I use JUNG2 in a MVC-gui?    stackoverflow.com

I was playing around with JUNG2 and wanted to implement a small GUI that allows me to display and change a Graph. Following the examples from the JUNG library worked fine, ...

43. Lookup versus traditional swing MVC approach    forums.netbeans.org

An RCP app I'm starting on (finally!) requires creating a complex GUI component. My first thought was to build it in the traditional way with swing-like models, events and listeners. As ...

44. MVC in NetBeans was: Lookup versus traditional swing MVC approach    forums.netbeans.org

On June 3rd, I gave a presentation about MVC in NetBeans: http://dsrg.mff.cuni.cz/%7Ehnetynka/teaching/netbeans/2009/day1/nbp-mvc.odp It is about a theory that MVC is too limiting, not really flexible, that DCI is much better and ...

45. Re: Using Lookup for EventBus was: MVC in NetBeans was: Lookup versus traditional swing MVC approach    forums.netbeans.org

(first time working with Lookup, this analysis may be flawed) I'm working on a complex GUI component with several models. I decided to forgo the classic model-listener/event and implement an EventBus ...

46. using mvc in swing application    forums.netbeans.org

Hi: I am using netbeans to build a swing application, and I tried to use the mvc for my UI. However I meet some problems, I post a thread at www.statckoverflow.com ...

47. How can i user Swing as "V" in the Struts MVC    struts.1045723.n5.nabble.com

Hi .. i m going to build a struts based application but i dont want to use JSP's  instead of JSP's i want to use Swing GUI .. how can i communicate Swing GUI with struts app and how i will get the response back .. e.g. search results ........ waiting for reply ....

48. MVC pattern    coderanch.com

49. MVC    coderanch.com

what is actually mvc(model view controller)? I know only that to get the plf(pluggable look and feel) the technology used is mvc..but how to use it I don't know..I got this q in an interview..how would we use mvc to get this plf.. Pl. throw some light on me.. thanks in advacne -shree

50. How does MVC scale?    coderanch.com

Hi All, I'm embarking on my first real Swing app. I've been using Java for Servlet/JSP type applications, I'm not hugely experienced, but I have a decent grasp of how Java works. Right, I'm having trouble with understanding how a Swing application should be put together. I understand how MVC (or Model/Delegate) works for trival little application with a single class ...

51. MVC pattern in Swing    coderanch.com

52. how to use MVC architecture in Java Swing application    coderanch.com

Hi, I'm creating an application using Java Swing. I want to use Model View Controller (MVC) architecture to design by application. I want to use MVC to seperate by business logic functionality from the control and presentation logic that uses this logic. I need your help to get this done successfully. Please send me a SAMPLE JAVA SWING APPLICATION where they ...

53. Where can I find the discuss of MVC    coderanch.com

54. MVC in swing?    coderanch.com

55. Question Regarding MVC Approach    coderanch.com

Hi All, I'm looking primarily for non-technical replies it's more an opinion based post. I have implemented the following approach: // MVC Approach // Class Model (observable)- holds the collection storing my data. Sets class GUI as an observer. Class GUI (observer) - displays a table displaying the collection data When changes are made in the model it uses the following ...

56. Fake MVC in Swing - Is real MVC possible?    coderanch.com

Hi all. I'm not very experienced with Swing, so I hope I don't get too confusing or just insignificant here. The last few days I've been searching a bit about MVC with Swing. After reading some stuff I feel a little disapointed. I might not be right about this, so please correct me if I'm wrong. But here is my thought. ...

57. MVC in Swing    coderanch.com

Hi, We can implement MVC by writing our own classes. 1. Write one BusinessDeligate Class, which contains mapping of ur server side methods and Client side methods. -use servicelocator design pattern for Lookup EJBs -this acts as Controller 2. Write one abstract Command class, for each method in delegate write specific Command classe which extends ur abstract Command class. 3. If ...

58. Complicated MVC question.    coderanch.com

I was hoping someone could suggest a few possible solutions to my problem. I have an object of class A which contains a few properties and a list of objects of type B. The type B objects contain a few properties and a list of object of type C which in turn contain their own properties. I'm writing a part of ...

60. Swing and MVC design    coderanch.com

I feel the Swing framework itself is built on MVC framework and hence there, without doubt, are controllers. A view object such as Jtree has a corresponding TreeModel. But the controller code typically, in such cases, is part of the view class itself. However if we are talking about a serious UI application, you must consider the MVC pattern with separate ...

61. MVC Architecture for every Component??    coderanch.com

62. A newbie to MVC Architecture,components in JFC    coderanch.com

Hi all, I read that swing components are lightweight components as compared to heavyweight components of AWT. What are components in AWT & SWING ? Is it refers to the java classes? What is a lightweight component & a heavy weight component! What is the difference b/w them? What things can we do in Swing which we cannot do Using Swing ...

63. MVC in Swing for a modularised View    coderanch.com

Hi everyone, I've been reading up on MVC, and MVC in Swing and have come to understand Swing's delegate model. However, this current assignment I'm working on, for MVC, the tutor insists on having one controller for the whole application. This would mean removing the controller in the gui (actionPerformed methods) and make the controller implement the actionListener interface, then passing ...

64. MVC in Java Text Component    coderanch.com

The view is the JTextComponent (which is an abstract class so you'd use a JTextField or a JTextArea or a JPane) this is the view because the JTextComponent is the class that draws what is viewable in the window. The model is the Document object that the JComponent has a reference to. The Document object is accessible by calling the method: ...

65. Known good tutorial on doing MVC with Swing?    coderanch.com

Hi! Is there a known good tutorial showing how to to MVC with Swing? I'm looking for something that shows code samples and explain how the model, view and controller interact with each other... I've googled on the Net and I had found something which was closed to what I was looking for but one of my colleagues (who is a ...

66. mvc design pattern    coderanch.com

67. MVC in Swing    coderanch.com

Hi! I have used Java for a while but I'm not sure how to enforce MVC in a Swing application. Normally I have a POJO's to represent the Model part and I have a main JFrame class which is also an ActionListener My questions are: Do I create a single ActionListener to handle all events? Do I create an ActionListener that ...

68. Best design for a swing application? MVC or one of its variants?    coderanch.com

Hello, I am about to start developping a Swing application and I am not sure which design to use. I have read that "pure MVC" is not the best possible design for Swing. So can any Swing practionner please advise on which is the best design I should choose please? Thanks in advance, Julien.

69. How swing follows MVC pattern    coderanch.com

70. MVC Swing big problem    coderanch.com

71. MVC and swing    java-forums.org

72. MVC - have 2 Views but only 1 updates    java-forums.org

This is your current code (with slight modification so that all code is in one class): Java Code: import java.awt.*; import java.awt.event.*; import java.util.Observable; import java.util.Observer; import javax.swing.*; public class McvGame { public static void main(String[] args) { GameModel model = new GameModel(); GameController controller = new GameController(model); GameView view = new GameView(controller, model); GameView view2 = new GameView(controller, model); model.addObserver(view2); ...

73. Apply MVC to a Swing app?    forums.oracle.com

But I'm really unsure of how go about doing that... I studied program design back in the heyday of pseudo-code and structure charts, and I was hoping for some free advise (pretty please) or maybe some practical exercises/tutorials on OO program design. I've read some theory, but to be honest, it just goes over my head... in one ear and out ...

75. Swing-MVC    forums.oracle.com

Hai Respected Friend could you explain me why we are calling all swing component based on MVC model?. Actually , i have knowledge about MVC Arch in JSF,Struts but not in Swing. In j2ee platform we can separate our application into three part like view(JSP) , controller(Servlet) , model(business Logic ) when we introduce MVC design pattern into our application . ...

76. Implementing MVC with Swing? View/Controller separation?    forums.oracle.com

Thanks, I'll have a good read over that later. I notice that Java has a lot of pre-defined interfaces and abstract classes for things I'd usually go ahead and write myself in other languages. To avoid wasting time re-inventing the wheel which of the commonly used patterns below already provide the necessary interfaces? * Singleton (yuck -- I avoid this where ...