• Post Reply Bookmark Topic Watch Topic
  • New Topic

Events from sub components

 
Adam Sailer
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was hoping you could help me out with a GUI design issue. I'm creating an image viewer using the Java Advanced Imaging API, and I want to make my components flexible enough to be able to do any of the following combinations:
Components:
JaiPane extends JPanel (gets passed a vector of files)
JaiBar extends JToolBar (contains button that opens filechooser, prev, next, zoomFull, zoomFit, zoomIn, zoomOut buttons)
JaiDetails extends JPanel (contains a sortTable showing fileName, size, etc)
I want to be able to display a JPanel which may include any combination of these. I may want to make a panel with all three, or just the image display and toolbar, or just the image display. I'm going for code reusability here. Now, if these components have been added to my Overall Panel, how can I make a button such as "next" trigger an event that calls methods jaiPane.setNext() and jaiDetails.setNext()? Keep in mind they are all sub-components of the same component.
Until now I have just been creating everything in the same class, but now I'm trying to force myself to use better design, and I don't know how to handle the action events. Any help is greatly appreciated.
Thank you,
Adam Sailer
otters@sunflower.com
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!