Example #1
0
        private void setMViewPanel()
        {
            mviewControl = new MViewControl();
            initMViewControl(mviewControl);

            mviewControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((
                System.Windows.Forms.AnchorStyles.Top
                | System.Windows.Forms.AnchorStyles.Bottom)
                | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right)));
            mviewControl.Location = new System.Drawing.Point(1, 0);
            mviewControl.Name = "mViewPanel";
            mviewControl.Size = new System.Drawing.Size(293, 273);
            mviewControl.TabIndex = 0;
            mviewControl.Size = new Size(mviewPanel.Width, this.mviewPanel.Height);
            this.mviewPanel.Controls.Add(mviewControl);

            mviewControl.addPropertyChangeListener(this);
            mviewControl.addMouseListener(this);
        }
Example #2
0
        private void initMViewControl(MViewControl mviewControl)
        {
            MViewPane mViewPane = mviewControl.getMViewPane();

            // set layout
            mViewPane.setParams("rows=3\n" +
            "cols=2\n" +
            "border=1\n" +
            "visibleRows=2\n" +
            "layout=:2:1:M:1:0:1:1:c:b:1:1:L:0:0:1:1:c:n:0:1\n" +
            "param=:M:100:100:L:10b\n");
            UserSettings settings = mViewPane.getUserSettings();
            settings.setViewNavmode2d("rotZ");

            // create main menu
            JMenuBar menubar = new JMenuBar();
            mViewPane.setJMenuBar(menubar);
            JMenu menu = new JMenu("File");
            menubar.add(menu);
            JMenu submenu = new JMenu("Save As Image...");
            mViewPane.makeSaveImageMenu(submenu);
            menu.add(submenu);

            JMenuItem mi;
            mi = createMenuItem("Save All as Image", "saveAllImage", mViewPane);
            menu.add(mi);

            mi = createMenuItem("Exit","exit", mViewPane);
            menu.add(mi);

            menu = new JMenu("View");
            mViewPane.makeViewMenu(menu);
            menubar.add(menu);

            mViewPane.addHelpMenu(menubar);

            mViewPane.setM(0, "../../../view/mols-2d/caffeine.mol");
            mViewPane.setL(0, "Caffeine");
            mViewPane.setM(1, "../../../view/mols-2d/lysergide.csmol");
            mViewPane.setL(1, "Lysergide");
            mViewPane.setM(2, "../../../view/mols-2d/vitaminc.csmol");
            mViewPane.setL(2, "Vitamin C");
            mViewPane.setM(3, "../../../view/mols-2d/aspirin.csmol");
            mViewPane.setL(3, "Aspirin");
        }