Pattern « Development « Java Swing Q&A





1. What are your best Swing design patterns and tips?    stackoverflow.com

I'm writing a GUI for an application using Swing, and in the interests of code maintenance and readability, I want to follow a consistent pattern throughout the whole system. Most of the ...

2. Best programming process for creating a graphically-complex Java Swing Application?    stackoverflow.com

I'm starting a fairly complex Swing application that heavily graphics-oriented with about 1000 separate jpegs, 30+ different forms, and timers keeping track of the rate of user-interactions throughout. My question is from ...

3. Does Mediator Pattern work in this situation?    stackoverflow.com

So for my current project, there are basically three main Java classes:

  1. GUI
  2. Instant Messaging
  3. Computation
Essentially, there needs to be full communication, so we've decided to use the mediator approach rather than than allow ...

4. Java Swing design pattern for complex class interaction    stackoverflow.com

I'm developing a java swing application that will have several subsystems. For all intents and purposes, let's assume that I am making an internet chat program with a random additional piece ...

5. Understand Command Pattern in Swing    stackoverflow.com

I can see how Swing uses Decorator and Observer pattern. Observer: Every component(fx JButton) is a subject which can add observers(ActionListeners). When someone pushes a button it notifies all its ActionListeners by ...

6. How to adapt domain objects to GUI in Java    stackoverflow.com

I'm new to the architecture of UIs and in the past I've programmed very simple UIs. Now I'm confronted with a very large domain model. Because I've used different OR-Mappers to ...

7. Problem in choosing a design pattern for my java project    stackoverflow.com

I am developing a Java Desktop Application. From a Swing GUI, a user enters 5 inputs through 5 checkboxes as follows: CheckBox1: Scrape Name CheckBox2: Scrape Address CheckBox3: Scrape Phone Number CheckBox4: Scrape State CheckBox5: Scrape ...

8. Best practice for passing configuration to each GUI object    stackoverflow.com

I am writing an application, where I do have few different windows implemented, where each window is a separate class. Now I need somehow to pass a single configuration object to ...

9. Register all GUI components as Observers or pass current object to next object as a constructor argument?    stackoverflow.com

First, I'd like to say that I think this is a common issue and there may be a simple or common solution that I am unaware of. Many have probably encountered ...





10. Is the adapter pattern usable in cases where the different interface methods have varying parameters    stackoverflow.com

I am creating a client side swing app that will have data provided by/from one of many data providers(brokers). The data providers however, have varying ways of perfoming same things e.g. broker1's ...

11. Design patterns to reduce coupling in Swing application    stackoverflow.com

Hey all, I'm currently working on a Java Swing application and I was looking for some guidence. The application is fairly small, but I'm noticing that as the code base is ...

12. GUI layer vs Code layer vs Swing    stackoverflow.com

I always coded console applications and learned some basic UML/patterns skills, using C++. Now I decided to move to Java and add GUIs to my programs. The first question is how to handle ...

13. What would be considered good examples of implementing the builder pattern when used in the development of a GUI?    stackoverflow.com

I am a complete newbie when it comes to the use of factory classes and methods, patterns, etc - in fact I first learned of them here on Stackoverflow when browsing ...

14. Composite pattern in Swing    stackoverflow.com

This is basically a architectural question. I want to implement composite pattern in handling Swing components; that is, I want to combine several components with their listeners and logic behind ...

15. Design question about Swing GUI updates via PropertyChangeSupport    stackoverflow.com

In the past I have used PCS to update Swing elements that displayed certain fields and everything worked as expected. However, I am now facing a relatively complex (in other words, ...

16. Java Swing application design in a way to create multiple instances of application by creating all objects only once    stackoverflow.com

We have a one Java Swing app. Now there is one requirement that it should be created in multiple desktops in one machine/computer. So its like creating different instances of main ...





17. Can we reuse Java Swing application components in other instances of same application?    stackoverflow.com

We have a Java Swing application which contains components like JTable, JCombobox, JTextArea and lots of other Swing components. Now there is a requirement that says we need to create multiple screens/copy ...

18. Java program using plugin type structure, need feedback on proper design pattern    stackoverflow.com

Sorry if this question has been asked/answered before, but I was unsure how to formulate it properly, and thus my searches may have been improperly worded. I am building a Paint ...

19. What object-oriented GUI design would properly combine Command and Observer patterns?    stackoverflow.com

Is there an object-oriented GUI design that would be a reasonable combination of the Command and Observer patterns? My Java GUI attempts to combine Command and Observer patterns as follows:

  • the client ...

20. Observer Pattern in J2ME    stackoverflow.com

I know that Observer pattern is not supported in the J2ME as Observer and Observable are not in the J2ME.
So, is there any work around to using Observer pattern in J2ME? I ...

21. Undocumented, mysterious class--rubbish, or a design pattern I don't know?    stackoverflow.com

I inherited the following code: (Some names are changed to protect the innocent.)

package foo.bar.baz;
import javax.swing.JPanel;

//Main panel in the GUI
class DemoRootPanel extends JPanel {
    private final MainGUIClass demo;

   ...

22. Observer pattern in non Swing applications    stackoverflow.com

Observer pattern is very commonly used in Swing based applications. Can anybody give a practical example of this pattern which can be used in non Swing, pojo applications?

23. Design patterns which seperate datamodels and gui representation    stackoverflow.com

Is there a design-pattern which is recognized as the best pattern to use when separating a datamodel and a gui drawing mechanism? So say i have a class Circle and a class ...

24. Seeking advice on complex dynamic swing interface design    stackoverflow.com

I am building a swing application that gathers order information via user input for various products. Each type of order has 20+ fields and they all vary insofar as whether ...

25. Java: Getting values from GUI    stackoverflow.com

In my application user gets to choose "distribution type" for a few parameters and then I create Graph and show it to him. There are 3 different types of these distributions ...

26. Java Swing: how do I properly instantiate GUI and pass domain objects?    stackoverflow.com

I have a GUI with nested panels(tabbed with nested panels and etc). I need to pass domain object to deeply nested panel. I can think of two ways:

  • Instantiate all gui objects ...

27. Best Pattern to adress Gui Components    forums.netbeans.org

Just migrated from Eclipse, because of the GUI Tools and now the following problem: I am building a more complex GUI, and I am at loss how to best adress the gui beans in orderly fashion. One could make them public, but that is ugly. The pattern I am looking for, should be something like: Handler.addPanelControl(somePanel); handlingPanel = Handler.getPanelControl(thePanel); handlingPanel.add(new JLabel("I ...

28. Swing Patterns    coderanch.com

29. Design Pattern for enabling/disabling components?    coderanch.com

The complexity of this undertaking depends greatly on the complexity of your interface. How many windows are we talking about? Fixed set? Arbitrary? How many types of windows? How many types of actions? Let me explain a bit about what my company's software has done. Our product interface was somewhat akin to a web browser. You could visit all sorts of ...

30. A general pattern type question    coderanch.com

If you have a class that controls the GUI and this triggers a bunch of methods in another class which actually does the work - where would you control updates to the GUI depending on the work done? One way of doing this is to pass the JLabel object (for example) to the work class and update it there but there ...

31. urgent ! swing design pattern    coderanch.com

I am developing 1 swing image manupalation application, its 1st screen has 4 buttons in "Center" of borderlayout, on respective click on them, i have to change respective JPanle in each regions (North,South,..). I also have to take care of event which are inter dependant on components in other panels. Which Design patter should i use and how ? Plese Help ...

33. best practises/patterns for gui development    coderanch.com

Hi, I know its a Gregg Bolinger topic, but as we have Java-gui-book author here, I might ask this question again. I have much more problems with developing gui-clients than putting together some dhtml pages connected by some flow organized through some kind of a servlet-controller (be it with framework like struts or webworks2 or not). My gui clients allways end ...

34. Need Ideas for Swing Coding Patterns    coderanch.com

Hi, I have recently been assigned to devlelop an inhouse swing application. Would appreciate if you could help me with your suggestions for the following problem situation. The application shall consist of many tabbed panes. >One such tabbed pane has three/four tabs. >>Each tab of this is a JPanel. >>This JPanel has two JPanels and one JListPane >>> Each of these ...

35. Command pattern java    coderanch.com

36. gui design pattern question    coderanch.com

Making a bookmark manager, just like the one in firefox. Currently in the main JFrame, I have folder tree at the left, and bookmark list at right side. I have a list of editing buttons on the top, like copy, paste, delete, which apply to either folder or bookmark, depends on which one is selected/highlighted. how do I implement those button ...

37. Which design pattern can be appied here?    coderanch.com

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - ...

38. Java rich client design patterns: where to find?    coderanch.com

Hi people, below is the copy (with little modifications) of a message I posted to the USENET group comp.lang.java.programmer. Since I have got no good answers, I decided to post it here too. My apologies to the readers of comp.lang.java.programmer for the cross-posting. The link to the original message: http://groups.google.com.br/group/comp.lang.java.programmer/browse_thread/thread/aac02566d5766156/136ae87a21eed7b2?lnk=st&q=java+rich+client&rnum=1&hl=pt-BR#136ae87a21eed7b2 Regards, Diego Hi all, another possible title for this message would ...

39. Using Command/Undo Pattern - How atomic should commands be?    coderanch.com

Hey all, I'm working on implementing a command/undo/redo system for a GUI. I'm going through the design now. Currently I'm splitting things into commands, and the way things are going I'm going to wind up with dozens and dozens of separate Command objects. In general the GUI enables creation of different types of business-related objects, edits of those objects, and deletion ...

40. Doubt in Observer pattern    coderanch.com

Hi! I'm developing an applet for drawing rectangle with resize, color, borders etc I have a ControlPanel for choosing tool ( Line, Oval, Rectangle ) and you can also choose color and bordercolor. In the drawing area you can select multiple shapes resize them. When the shapes is selected I want to send updates to the controlpanel for updating the colors ...

41. Design Pattern for Swings App    coderanch.com

Hi all -- I have doing some hobby projects in swings for quite some time. But used to code in my own way of understanding. Now I planning to start some serious applicaiton in swings and want practice some good design patterns. Can someone please suggest me some good references on net or books for Java design patterns. All I got ...

42. Gui based graphical bit pattern Analyzer    coderanch.com

i am trying to develop a GUI based application.This application displays bits for the underlying characters.For example we have 8 characters in a file.This application will display bits for each character.i have drawn rectangles to show either one or zero bits.I have used jtextarea for displaying these bits in the JTextarea.But my problem is that it only display a file up ...

43. Patterns for GUI-building ?    coderanch.com

HI all Im about to write an application. The GUI will be like a website. A menu on the leftside of the frame. The user will be able to navigate by clicking on different buttons on the left menu and the result will be presented in the right side of the frame. Which way is the best constructing a application that ...

44. Updating the GUI from 'other' objects - is there a design pattern for this ?    coderanch.com

Thanks for your reply Jeff, however I don't see the relevance of the MVC design pattern to this problem. Perhaps that's just my lack of knowledge though. Also, the Observer pattern tends to be used to notify MANY objects when ONE object changes its state. My problem is the other way round - i.e. ONE object (the "Game") being notified (with ...

45. java adapter pattern    coderanch.com

If your interface has more than one method then any non-abstract implementing class has to implement all the methods - that's the way Java works. Your implementation of the addListener method is a little unusual. Normally, all the method will do is add the class instance that was passed as a parameter to a list of some sort. Then whenever whatever ...

46. Command pattern in GUI    coderanch.com

Hello all, I know command pattern can be used in GUI but i am having tough time trying to get a example of it. in my current GUI i have the user to highlight a text from the Text area, then he needs to select a index from a List and and then he needs to select another index from another ...

47. Problem in State Design Pattern    coderanch.com

Hi, Really appreciate for all you help with my previous project. It was really nice and I got good grades in that . Thankyou everybody who gave their valuable time to me. Now this time I have got some problems in making a automatic door locking system in State Design Pattern, I have searched internet but could not find any good ...

48. Tips/Design patterns for GUI design    coderanch.com

I'm currently getting in to design patterns and I'm finding them very useful, however I'm now refactoring an older program and I'm needing some advice. I've set up a User class, then made NewUser and ExistingUser subclasses. But I'm wondering where is the best place to catch the user's errors e.g. if they enter an incorrect age, or an incorrect name ...

49. Swing design patterns    java-forums.org

Hi As you know Swing relies on the gui thread handling requests for access to components as most (not all) are not thread safe. Rather than code something piecemeal, i googled Swing patterns and i got nothing. I looked on OReilly and the same. I then used a command dispatcher (Command and CommandFactory) pattern to implement my own way of handling ...

50. Command design pattern    java-forums.org

Hey guys, I've red about the command design pattern and i want to implement it in java. I think in the command pattern there has to be an interface with a paste( ) mehtod and an object who implements this interface, right? But now i'm stuck: Do you have to make for every button your own subclass of JButton with an ...

51. facade pattern    java-forums.org

Hi, I've red about the facade pattern, but i have a question: the facade is like a controller object who has a couple of methods who invoke methods from other objects. But i have a kind of controller object who has a couple of getmethods to the objects. Is this a good design too? Hannes

52. Java Swing Design Pattern query.    forums.oracle.com