Model « Dialog « Java Swing Q&A





1. Java GUI Swing Model Explanation    stackoverflow.com

I've been working with Java GUI for a while now but the whole model/structure of JFrames, paint(), super, etc is all murky in my mind. I need a clear explanation or link ...

2. Model-view-controller    stackoverflow.com

Why a developer should pay attention to Model-view-controller for designing a GUI? and is there other elements that a developer should pay attention for designing a GUI?

3. java+swing+mvc: how to make a model that interfaces w/ multiple controls?    stackoverflow.com

I have this Swing app I'm working on that has a pair of JSliders and JTextFields that both display & control the value of two numbers. Right now I kind of ...

4. how to use JRadioButton groups with a model    stackoverflow.com

Is there any way to associate a group of JRadioButtons with a data model so it is easier to tell which button (if any) is selected? In an ideal world, I would ...

5. swing: best way to make components enabled/disabled depending on the state of a model    stackoverflow.com

I have a data model model which has a boolean flag connected, and I have a view with several components that I want to enable if model.isConnected() is true and disable ...

6. Using the MVC model with Swing Application Framework    stackoverflow.com

I'm trying to create a simple Java desktop application using the Swing Application Framework and the MVC model but I'm struggling on some areas because there is a lack of good ...

7. Proper model-view-controller design    stackoverflow.com

I have a Java project that I'm trying to implement with a model-view-controller design. I have the backbone of all of the components established. I'm having some trouble deciding ...

8. How the swing's BoxModel works?    stackoverflow.com

Let's say I would like to create a simple calculator. It consists of 3 fields. Text field to show result, field with checkboxes to select system and field with numbers. What kind ...

9. How to create UI and Model based on some business logic    stackoverflow.com

I had following business logic. In this Op1 and Op2 represents some operation. And param1,param2,... represents parameters required for executing these operations Op1=param1, param2 Op2=param1, param2, param3 Now in UI I had a drop ...





10. Bubbling up in the AWT event model?    stackoverflow.com

If I implement an action event on a JFrame that has some buttons it give me the button clicked via getSource but if I implement on the same frame a mouse event it ...

11. properly writing a model with a property intended for view binding    stackoverflow.com

I have a class MyModel with a property datalogEnabled (and other ones, but let's start there) that I would like to be able to implement properly for use with UI/view binding.

public ...

12. Can the model refresh the view?    stackoverflow.com

I have a MVCish deisgn using SWT. I have a class which implements the whole GUI (buttons and action listeners) and it has a Shop object, which has a list of ...

13. Swing beans binding: how do I notify the target that the model has changed?    stackoverflow.com

I have a swing app with a text box bound to a property on my model (this is a READ_WRITE AutoBinding). The model also has an isDirty property that I want ...

14. How do I create a relation between the view part and the model part in MVC design in Java?    stackoverflow.com

The app is a small Chess game. In my modelling classes I have a board class which has an [8][8] array of squares. Now what I did to paint the squares (I'm ...

15. Handling drag and drop: view or business logic?    stackoverflow.com

I have a TransferHandler class that is used to handle file drag and drop. It is applied to Swing components and as such interacts with the view. My question is as follows:

  • In ...

16. Using a model to represent the overall state of a view    stackoverflow.com

Is there a standard practise for representing the state of a user interface that is not linked to a single Component? For example, a Swing interface could have a series of tabs ...





17. In MVC, what does the model do and what is the relation with SwingWorker?    stackoverflow.com

I read a lot about Java, Swing, MVC and SwingWorker but I'm totally confused about the role of the Model in MVC. I'm building an app that has two buttons:

  1. select file
  2. read file
There ...

18. Clojure defrecord and private fields    stackoverflow.com

I frequently implement my Java swing GUIs using Martin Fowler's Presentation Model pattern. Here is an example:

import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ListModel;

interface MainView {
  ...

19. Java - How distinguish boundaries for graphical movement along a window    stackoverflow.com

Hey guys, I'm needing a start on discussion at least on a project I'm working on for fun. I'm wanting to create a window, 320 by 320, that will have 10 squares ...

20. Templating Views Based on Data Type in Model and Dynamic Updates in Griffon    stackoverflow.com

A short version of my question can be summed up be asking: Can the concept of DataTemplates, found in WPF, be applied in Griffon? Now, the longer version... QUESTION 1: I would like ...

21. How do I design a Java Swing model that also responds to back-end events?    stackoverflow.com

I have written a GUI for operating a card reader - mainly consisting of an ADD button that brings up a FileChooser dialog and queues the chosen File onto a CardHopper, ...

22. Java SwingWorker NullPointerException on model.reload() call    stackoverflow.com

I am trying to add child nodes to a JTree inside a SwingWorker thread. Then reload the model to update the UI. When I reload the JTree DefaultModel it throws a ...

23. Design Issue: MVC model with Java CardLayout application    stackoverflow.com

Sorry for the vague title, I am trying to layout an application i have unfortunately starting coding without following proper MVC architecture rules. I have an application that has the following ...

24. Java MVC: updating View that observes multiple Models    stackoverflow.com

In my MVC application I display a chart, using Swing. It is controlled by multiple panels with different settings. I have MainModel to build and feed the DomainObject that ChartView ...

25. Update JMenu display names    stackoverflow.com

So I have a JMenu with a few submenus inside. The names of those menus are set by getting the name of a 1 of 4 players. I added ...

26. using the gui to add event listeners for model objects    forums.netbeans.org

For example I have a JTable. If I go to the events tab in the designer I can add events for ancestorAdded etc.. However what I really want to do is ...

27. Swing Data model    coderanch.com

Without knowing your application requirements, its complexity etc, it is very difficult to give you a design suggestion that will fit your scenario. If the application is simple. Your design is ok. If it is complex with lot of screens and a lot of db access. Things will get messy. Therefore, you should use Mediator Pattern that will encapsulate the interaction ...

29. Model Dialog From JApplet    coderanch.com

30. Index color model......    coderanch.com

31. Data Models in Swing    coderanch.com

32. mixing Hierarchical and Delegation Evt Models    coderanch.com

"Java Programming Language". SL-275. Student Guide. Sun Microsystems. Revision C.1, September 1999 states on the page 9-13:

"Although the current Java 2 SDk supports the JDK 1.0 event model in addition to the delegation model, you cannot mix the JDK1.0 and JDK1.1 event models."
I have difficulties with English. Does this phrase means impossibility or just a recommendation?

33. why called event delegation model    coderanch.com

34. mvc model    coderanch.com

35. Saving Table Model data    coderanch.com

I have a 'spreadsheet' like application in which the user selects a file, using JFileChooser, which is passed to the constructor of a class extending abstract table model. This file is read and then used to populate a Jtable which is then displayed in an internal frame. The user can change the values in the table, and I need to be ...

37. Customized Data model help needed    coderanch.com

The scenario is that I have a swing frontend which listens to messages from the servlet. What I need to do is to display the data in the swing frontend as and when the data changes. I had seen a posting in some site suggesting setting up a data model which will hold the data. This model could fire events to ...

38. Data Models    coderanch.com

hi Gregg, I know only of one "theory" about data models: the Model-View-Controller Pattern. Examples for this pattern are JTable and its TableModel where the Controller functionalities are shared between the view and the model. I find it helpful to think of all graphic components as views that don't care of any data they display. They don't have to check anything ...

39. Default table model    coderanch.com

40. Model View Controller problem    coderanch.com

The above interface won't work if there are already Observer objects out there expecting a class of java.util.Observable... he'd have to implement his own Observer/Observable classes, which would be a waste of time since Java supplies it's own. My solution would be to create an inner class that extends Observable and wrap it with your tree model... something like this: public ...

41. Data model    coderanch.com

42. Model    coderanch.com

43. spent three hour already, please help on table model issue!    coderanch.com

Hi, I am new to java, need help! I have a table in a GUI, in default I just want it show column names and no rows, but after I press some button on GUI I get some data , but I don't know how to add data to table and make them show in rows. part of the code is ...

45. MVC : How to pass object from model back to View    coderanch.com

Hi all, I'm new to Swing, now i work on the project that use MVC pattern. I try to seperate my application into 3 packet, model view controleur (ActionListener). I write one small application, in view, i create texte field and one button. When user click on button the controleur pass the texte to the model. I just try to change ...

46. Swing Model Classes    coderanch.com

How useful are the model classes provided by Swing especially when the application been built has it's own business model code? It seems a little odd that you can have 2 different models in the one application as there would have to be some mapping between the model for the view and the model representing the business reality. the bridge seems ...

47. Can a Table model contain JPanels    coderanch.com

48. Data Model Design    coderanch.com

I am new to Swings..and I am working on Swing application >> it has Module1, Module2, Module3. I am working on Module3, For which I designed three Panels in one class, each screen has back and next buttons and some radio buttons and text boxes, In this scenario by going back and forth the data is maintained. I have link for ...

49. Thinking about Table Models...    coderanch.com

Last night I was trying to sleep but I kept pondering on this Table Model I was going to have to work on today. It's not that complex but I wondered if there was a better way. Currently, we extend AbstractTableModel and supply the methods for handling the data. By default this is done with a String[] of column headers and ...

50. Java 3D model of earth and satellites    coderanch.com

51. How to write a generic table model for resultset access ?    coderanch.com

Fellow Ranchers, I would like to hear your opinions regarding the best way to implement a generic table model which provides access to resultsets queried from a database. I know that when implementing a concrete class which extends the AbstractTableModel abstract class, I can provide the source data as an array. However, when using database queries as source of data such ...

52. Domain model, layers and swing    coderanch.com

53. Swing Model Binding    coderanch.com

54. How do I apply Model-View-Controller in Java Swing?    coderanch.com

I have been exercising for a way to build a good structure in an GUI application using the Model View Controller, MVC, architecture for a while now, and particularly how to apply it in a good way in a Java Swing application. Okay, for a small toy application is the structure maybe not that important. It may still be reasonably easy ...

55. trouble with table model    coderanch.com

56. how to create model window    coderanch.com

57. event model without GUI    coderanch.com

Hi, I think I have been always confused with this event topic. In Java, whenever I touched event before, it is GUI related, as adding a listener and so on. However, if I want to build an event in a non-GUI program, for example, start a timer in a class to check time, which changing the content of a hashtable based ...

58. BufferedImage color model    coderanch.com

Miklos Szeles wrote:I thought that. When I realized the color model is not the information what I was looking for then I found the pixelsize, which tells much more. So the question is not whether RGB used or not, but which type of RGB used. Is it operation system dependent? Video card dependent? I'm not sure exactly what you are asking, ...

59. EditorKit with xml as model    coderanch.com

Hi, I have some questions in how to create an editorkit and have an xml document as the model. I have used HTMLEditorKit before and parsed the generated html in a wysiwyg editor to text or xml ( this is later used in creating indesign document and other documents ) Can anyone point me to the right direction in how to ...

60. Table model event    coderanch.com

Hello. I'm using a table component made by SwinLabs (http://swinglabs.org/docs.jsp). The component's name is JXTable. With that table I'm able to sort the table at runtime, and change the columns' order, using the table's header. My problem is that when a user orders the table using the column header, the table's model does not change. So If I select a row ...

61. Listening to model changes with PropertyChangeEvent - and breaking your Swing app?    coderanch.com

I'm looking for a good Swing application architecture. One pattern is see mentioned is separating your Swing UI from model (the core of your application), and then listening to model property changes with propertychangelisteners. There might be additional controller-type layer between or beansbinding in use, but the main idea is: Swing view <---> controller <-----> model ^ \---- notification event------| One ...

62. AWT's event model, Newbie Question    coderanch.com

63. Handling EDT issues when listening to model events with Model View Presenter    coderanch.com

I'm planning on using model-view-presenter (passive screen/humble dialog variant) http://martinfowler.com/eaaDev/PassiveScreen.html as the basis for my Swing application. view <-> presenter <-> model The view is very thin and dumb and only shows what presenter tells it to. Presenter listens to UI events from the view, updates the model based on them, listens to model update events, and reads view state and ...

64. AWT Event Model and Swing Event Model    coderanch.com

Hi, This is probably a Beginner's question, so please bear with me. I was asked by a friend whether AWT Event Model and Swing Event Model are different or the same. I couldn't answer the question, so I googled it, but it's still not quite clear to me, so I was hoping someone here could help me understand. I'd really appreciate ...

65. model for group of radio buttons    coderanch.com

I hope you are not using the action command in a big bank of if-elses. I am not certain, because I haven't seen all your code, but I am not convinced that "open" and "close" are suitable for radio buttons. I would have thought that is more appropriate for an ordinary button.

67. mvc-model view controller    java-forums.org

Hey, I'm trying to understand the model-view-controller design patter, but I have a problem: Normally the model holds the data with get( ) and set( ) methods on that data. But what to do if several views, and thus several controllers, must access the model? Normally seen, 1 controller per view seems the best to me. Hannes

68. inner class Mouse listener not working in MVC model    java-forums.org

I'm using the Model View Controller design for a current project. There is a grid (2D array) of JButtons that need a mouse listener adding to them, however when I have the mouse listener inside the controller it doesnt work (using a method called from the controller constructor that is in the view to add the listener to the grid). Its ...

69. firing an event as soon as value (in SpinnerNumber model) is deleted    java-forums.org

I have created hours and minutes using JSpinner()(SpinnerNumberModel). private JSpinner spHrs; private JSpinner spMin; this.spHrs = new JSpinner(); this.spMin= new JSpinner(); this.spHrs.setModel(new SpinnerNumberModel(0, 0, 999, 1)); this.spMin.setModel(new SpinnerNumberModel(0, 0, 59, 1);; User is required to select hours(range 1-999) and min(range 1-59) and then click save. Problem is that whenever user deletes any value in spHours model,and then click save the original ...

70. model.addrow with background color    java-forums.org

71. List models awesome usage -.-''    java-forums.org

Java Code: public class TextsListModel extends AbstractListModel implements Collection { /** * */ private static final long serialVersionUID = 5971875615507695748L; private ArrayList texts; /** * */ public TextsListModel() { this.texts = new ArrayList( ApplicationSettings.DEFAULT_ARRAYLISTS_SIZE); } @Override public int getSize() { return texts.size(); } @Override public TextsWrapper getElementAt(int index) { return texts.get(index); } @Override public int size() { return texts.size(); } @Override ...

73. JPanel Model View Controller Problem    forums.oracle.com

anyways... if i use a layout manager how do i get those people into the swimmingpool if everything is switched up in cells or in boxes. I just want to do it with coordinates for example i just draw a rectangle into the swimming pool with where the coordinates of the swimming pool is located.. so i do it via the ...

75. Swing MVC --- UI Delegate / Model ...    forums.oracle.com

I'm reading Swing MVC tutorial, but it's tough for me to get the concept clearly. I understand that Swing follows a MVC model that dates back to Small talk, which separates Model and Control/View. Control/View are binded together as a UI Delegate, and each component has its model and UI Delegate? So if there is any user input, the model notifes ...