TBondPopupMenu(MolecularView v) { super("Torsional Bond"); view = v; miInfo = new JMenuItem("Info", new ImageIcon(getClass().getResource("resources/info.gif"))); miInfo.setBackground(new Color(0xFFFFD070)); miInfo.setEnabled(false); add(miInfo); addSeparator(); JMenuItem mi = new JMenuItem(view.getActionMap().get(Resource.get("Editor_java_jianqie"))); String s = MolecularContainer.getInternationalText(Resource.get("Editor_java_jianqie")); if (s != null) mi.setText(s); add(mi); addSeparator(); s = MolecularContainer.getInternationalText("Properties"); mi = new JMenuItem(s != null ? s : "Properties", IconPool.getIcon("properties")); mi.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { DialogFactory.showDialog(view.selectedComponent); } }); add(mi); pack(); }
public void show(Component invoker, int x, int y) { if (view.selectedComponent instanceof TBond) { TBond t = (TBond) view.selectedComponent; String s = MolecularContainer.getInternationalText("TorsionalBondHtml"); miInfo.setText( "<html><i>" + (s != null ? s : "Torsional Bond") + "</i> #" + view.getModel().getTBonds().indexOf(t) + ": ( " + t.getAtom1() + " - " + t.getAtom2() + " - " + t.getAtom3() + " - " + t.getAtom4() + " ) " + MolecularView.FORMAT.format(t.getAngle() * 180 / Math.PI) + "°</html>"); } super.show(invoker, x, y); }