Class DrawingDemoView

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JInternalFrame
edu.cnu.mdi.view.BaseView
edu.cnu.mdi.view.DrawingView
edu.cnu.mdi.mdi3D.view2D.DrawingDemoView
All Implemented Interfaces:
edu.cnu.mdi.feedback.IFeedbackProvider, edu.cnu.mdi.transfer.IFileDropHandler, ComponentListener, FocusListener, MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class DrawingDemoView extends edu.cnu.mdi.view.DrawingView
An ordinary 2D drawing view, included in the MDI-3D demo application specifically to demonstrate that 2D and 3D MDI views coexist in the same application.

This is otherwise identical to DrawingView — the same view the base MDI demo application uses — with two differences: the title, and one explanatory TextItem already placed on the annotation layer so the point is visible the moment the view opens, without requiring any interaction.

See Also:
  • Constructor Details

    • DrawingDemoView

      public DrawingDemoView()
      Construct the view using DrawingView's own defaults (toolbar, background, aspect, etc.), just with a different title.

      The explanatory TextItem is not created here. A TextItem's world-space bounds are derived from the container's current local-to-world mapping (IContainer.worldToLocal/ localToWorld), which depends on the container's canvas having a real, realized pixel size. Immediately after construction — before this view has been laid out inside the desktop — that size can still be zero, which would give the item degenerate (invisible) bounds. See componentShown(ComponentEvent).

  • Method Details

    • componentShown

      public void componentShown(ComponentEvent e)

      Adds the explanatory text item the first time this view is actually shown with a real size, exactly the same "lazily created view" pattern PlainView3D uses in MDI-3D for the same reason. Guarded by explanationAdded so a later hide/show cycle does not add it twice.

      Specified by:
      componentShown in interface ComponentListener
      Overrides:
      componentShown in class edu.cnu.mdi.view.BaseView
    • createDrawingDemoView

      public static DrawingDemoView createDrawingDemoView()
      Compatibility factory, matching the create...View() pattern used by the other MDI-3D demos.
      Returns:
      a new default-configured drawing demo view
    • getViewInfo

      public edu.cnu.mdi.view.AbstractViewInfo getViewInfo()
      Overrides:
      getViewInfo in class edu.cnu.mdi.view.DrawingView