void setFrame()
=>Figure1
∙ Sets window listeners to this object.
DrawWindowAdapter adaptor=new DrawWindowAdapter(this);
this.addWindowListener(adaptor);
this.addWindowFocusListener(adaptor);
this.addWindowStateListener(adaptor);
∙ Creates Command object.
new Command();
∙ Creates the MenuUtil object.
MenuUtil menuUtil=new MenuUtil();
ObjectTable.menuUtil=menuUtil;
∙ Gets the GlassPane object.
JPanel glassPane=(JPanel)this.getGlassPane();
Currently, the GlassPaneis used in the GuidancePanelclass.
∙ Create the TabbedPane, StatusPanel object and sets them to the DrawMain(JFrame).
Sets the BorderLayout to the contentPane of the DrawMain(JFrame)
and add the TabbedPane and StatusPanel to the contentPane.
The StatusPanel(Figure1) is managed in the same way.
contentPane.add(tabbedPane, BorderLayout.NORTH);
contentPane.add(statusPanel, BorderLayout.SOUTH);
∙ Adds "Home", "Shape" and "Help" tabs to the TabbedPane.
∙ Creates the pop up menu.
PopupPulldownMenu.createShapePopupMenu();
PopupPulldownMenu.createGroupPopupMenu();
PopupPulldownMenu.createDrawPanelPopupMenu();
∙ Creates the DrawPanel and
ListenerPanel objects.
The DrawPanel object is used to draw shapes, text and so on.
The ListenerPanel is the extended class of the DrawPanel.
The KeyListener, InputMethodListener, InputMethodRequests interfaces are
implemented on it for text input and the MouseListener, MouseMotionListener
are also implemented on it for drawing operation.
∙ Creates the JScrollPane object and adds it to the contentPane of the DrawMain(JFrame)..
contentPane.add(scrollPane, BorderLayout.CENTER);
Sets the JViewport to the JScrollPane and sets a view(viewPanel) to the JViewport.
JPanel viewPanel=ViewUtil.getFramePanel(drawPanel);
viewport.setView(viewPanel);
scrollPane.setViewport(viewport);
∙ viewPanel
The viewPanel is the gray part in Figure1. Without the viewPanel ,
the DrawPanel is placed at the left end of the viewport.
∙ Creates the following major objects and registers them to the ObjectTable.
ContainerManager,
UndoDrawManager,
MousePositionLS,
SelectionLS,
FileIo,
Edit,
ViewUtil,
ExecCommand,
ExecPopupMenu etc.
|