Examples of JChemPaintPanel


Examples of org.openscience.jchempaint.JChemPaintPanel

            AbstractJChemPaintPanel jcpPanel, boolean debug) {
        try {
            IChemModel chemModel = JChemPaint.readFromFile(inFile, type, jcpPanel);

            String name = inFile.getName();
            JChemPaintPanel p = JChemPaint.showInstance(chemModel, name, debug);
            p.setCurrentWorkDirectory(inFile.getParentFile());
            p.setLastOpenedFile(inFile);
            p.setIsAlreadyAFile(inFile);
        } catch (CDKException ex) {
            JOptionPane.showMessageDialog(jcpPanel, ex.getMessage());
            return;
        } catch (FileNotFoundException e) {
            JOptionPane.showMessageDialog(jcpPanel, GT.get("File does not exist")
View Full Code Here

Examples of org.openscience.jchempaint.JChemPaintPanel

            String title, boolean debug) {
        JFrame f = new JFrame(title + " - JChemPaint");
        chemModel.setID(title);
        f.addWindowListener(new JChemPaintPanel.AppCloser());
        f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        JChemPaintPanel p = new JChemPaintPanel(chemModel, GUI_APPLICATION, debug, null, new ArrayList<String>());
        p.updateStatusBar();
        f.setPreferredSize(new Dimension(800, 494));    //1.618
        f.setJMenuBar(p.getJMenuBar());
        f.add(p);
        f.pack();
        Point point = GraphicsEnvironment.getLocalGraphicsEnvironment()
                .getCenterPoint();
        int w2 = (f.getWidth() / 2);
View Full Code Here

Examples of org.openscience.jchempaint.JChemPaintPanel

*/
public class Issue32Test extends AbstractAppletTest {

    @Test public void testIssue32() throws AWTException {
        JPanelFixture jcppanel=applet.panel("appletframe");
        JChemPaintPanel panel = (JChemPaintPanel)jcppanel.target;
        applet.button("C").click();
        applet.button("bondTool").click();
        applet.panel("renderpanel").robot.click(applet.panel("renderpanel").component(),new Point(100,100));
    IAtomContainer ethane = panel.getChemModel().getMoleculeSet().getAtomContainer(0);
    IAtomContainer selected = ethane.getBuilder().newInstance(IAtomContainer.class);
    selected.addAtom(ethane.getAtom(0));
    panel.getRenderPanel().getHub().deleteFragment(selected);
       
        /*
        applet.button("C").click();
        applet.button("bondTool").click();
        applet.panel("renderpanel").robot.click(applet.panel("renderpanel").component(),new Point(100,100));
        applet.button("select").click();
    Point2d p1 = panel.getChemModel().getMoleculeSet().getAtomContainer(0).getAtom(0).getPoint2d();
    Point2d p2 = panel.getChemModel().getMoleculeSet().getAtomContainer(0).getAtom(0).getPoint2d();
    double d = p2.x - p1.x;
    Point2d moveto=panel.getRenderPanel().getRenderer().toScreenCoordinates((p1.x+p2.x)/2, p1.y+d);
        applet.panel("renderpanel").robot.moveMouse((int)moveto.x, (int)moveto.y);
        applet.panel("renderpanel").robot.pressMouse(MouseButton.LEFT_BUTTON);
        robot.delay(1000);
    moveto=panel.getRenderPanel().getRenderer().toScreenCoordinates(p1.x-d/2, p1.y-d);
        applet.panel("renderpanel").robot.moveMouse((int)moveto.x, (int)moveto.y);
        robot.delay(1000);
        applet.panel("renderpanel").robot.releaseMouseButtons();
*/

        int atomCount=0, hCount=0;
    for(IAtomContainer atc : panel.getChemModel().getMoleculeSet().atomContainers()) {
      atomCount+=atc.getAtomCount();
      hCount+=atc.getAtom(0).getImplicitHydrogenCount().intValue();
    }
    Assert.assertEquals(1, atomCount);
    Assert.assertEquals(4, hCount);
View Full Code Here

Examples of org.openscience.jchempaint.JChemPaintPanel

  public void init() {
    super.init();
    IChemModel chemModel = DefaultChemObjectBuilder.getInstance().newInstance(IChemModel.class);
    chemModel.setMoleculeSet(chemModel.getBuilder().newInstance(IAtomContainerSet.class));
    chemModel.getMoleculeSet().addAtomContainer(chemModel.getBuilder().newInstance(IAtomContainer.class));
    JChemPaintPanel p = new JChemPaintPanel(chemModel,GUI_APPLET,debug,this, this.blacklist);
    p.setName("appletframe");
    p.setShowInsertTextField(true);
    p.setShowStatusBar(false);
    setTheJcpp(p);
    this.add(p);
  }
View Full Code Here

Examples of org.openscience.jchempaint.JChemPaintPanel

                    while(!(applet instanceof JChemPaintEditorApplet || applet instanceof JChemPaintViewerApplet)){
                        applet=applet.getParent();
                    }
                    if (e.getButton() == 1 && e.getClickCount() == 2 && applet instanceof JChemPaintViewerApplet)
                        if (!getJexf().isShowing()) {
                            final JChemPaintPanel p = new JChemPaintPanel(theJcpp.getChemModel(),JChemPaintEditorApplet.GUI_APPLET,debug,JChemPaintAbstractApplet.this, blacklist);
                            p.setName("appletframe");
                            p.setShowInsertTextField(false);
                            p.setShowStatusBar(false);
                            p.getChemModel().setID("JChemPaint Editor");
                            getJexf();
                            jexf.setTitle("JChemPaint Editor");
                            jexf.add(p);
                            jexf.pack();
                            jexf.setVisible(true);
                            jexf.addWindowListener(new WindowAdapter(){
                                public void windowClosing(WindowEvent e) {
                                    JChemPaintAbstractApplet.this.setChemModel(p.getChemModel());
                                }
                            });
                        }
                }
            });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.