How best to keep code and gui separated but harmonious
- From: RichT <someone@xxxxxxxxxxxxx>
- Date: Fri, 29 Feb 2008 18:50:34 +0000
Hello,
I am wishing to create an image model class and will need some way to display images.
I know that JFrame, JPanel and Canvas support displaying images and are ideal candidates.
Rather than put all the code for image related functionality in one of these components, I want to be able to create an image model class separately taking one of these components or even a subclass of these components but only this range of components and perform operations on it I guess like an MVC but only two classes not three.
So as an example I have JFrame but do not want to display the image directly on it but instead want to use a JPanel or a Canvas inside a scroll pane and have my image model class perform the operations on the JPanel or Canvas or subclass of.
So I know that the image model class would take a reference to the JPanel, Canvas or a subclass of these but nothing else and the JFrame would have a reference to the image model class.
Selecting menu or button items from the JFrame would invoke a command, passed to the image model class which would execute the command and apply changes to the JPanel, Canvas or subclass of one of these.
How would I even start I have read information on Generics and Interfaces and can see either of these could be used but not sure where to start.
I am not trying to create a photoshop clone :) but want basics like zoom in out and area, rotate and flip. In time I will probably add new image related functionality, but don't want to be tied to a JPanel or a Canvas or anything, especially if a new component appears in the future which maybe better suited?
I hope someone can understand what I am trying to achieve here I sort of do but it is still a bit hazy and vague and not sure where to start or how to start.
Thanks
Rich
.
- Follow-Ups:
- Re: How best to keep code and gui separated but harmonious
- From: Jeff Higgins
- Re: How best to keep code and gui separated but harmonious
- Prev by Date: Re: adding a crlf
- Next by Date: JRE Jar Cache
- Previous by thread: want some java projects
- Next by thread: Re: How best to keep code and gui separated but harmonious
- Index(es):