From: Pete C. <pet...@us...> - 2009-06-30 07:15:22
|
Update of /cvsroot/jmri/jmri/jmrit/display In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv19793 Modified Files: PositionableLabel.java Log Message: Window close bug fix Index: PositionableLabel.java =================================================================== RCS file: /cvsroot/jmri/jmri/jmrit/display/PositionableLabel.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** PositionableLabel.java 29 Jun 2009 08:08:27 -0000 1.45 --- PositionableLabel.java 30 Jun 2009 07:12:19 -0000 1.46 *************** *** 245,263 **** } ! JFrame editorFrame; ! IconAdder editor; void edit() { ! if (editorFrame != null) { ! editorFrame.setLocationRelativeTo(null); ! editorFrame.toFront(); return; } ! editor = new IconAdder(); NamedIcon icon = new NamedIcon(namedIcon); icon.scale(0.15); ! editor.setIcon(0, "plainIcon", icon); ! editorFrame = makeAddIconFrame("EditIcon", "addIconToPanel", ! "pressAdd", editor); ! editor.makeIconPanel(); ActionListener addIconAction = new ActionListener() { --- 245,263 ---- } ! JFrame _editorFrame; ! IconAdder _editor; void edit() { ! if (_editorFrame != null) { ! _editorFrame.setLocationRelativeTo(null); ! _editorFrame.toFront(); return; } ! _editor = new IconAdder(); NamedIcon icon = new NamedIcon(namedIcon); icon.scale(0.15); ! _editor.setIcon(0, "plainIcon", icon); ! makeAddIconFrame("EditIcon", "addIconToPanel", ! "pressAdd", _editor); ! _editor.makeIconPanel(); ActionListener addIconAction = new ActionListener() { *************** *** 268,286 **** ActionListener changeIconAction = new ActionListener() { public void actionPerformed(ActionEvent a) { ! editor.addCatalog(); ! editorFrame.pack(); } }; ! editor.complete(addIconAction, changeIconAction, false); } void editIcon() { ! String url = editor.getIcon("plainIcon").getURL(); namedIcon = jmri.jmrit.catalog.CatalogPanel.getIconByName(url); setIcon(namedIcon); updateSize(); ! editorFrame.dispose(); ! editorFrame = null; ! editor = null; invalidate(); } --- 268,286 ---- ActionListener changeIconAction = new ActionListener() { public void actionPerformed(ActionEvent a) { ! _editor.addCatalog(); ! _editorFrame.pack(); } }; ! _editor.complete(addIconAction, changeIconAction, false); } void editIcon() { ! String url = _editor.getIcon("plainIcon").getURL(); namedIcon = jmri.jmrit.catalog.CatalogPanel.getIconByName(url); setIcon(namedIcon); updateSize(); ! _editorFrame.dispose(); ! _editorFrame = null; ! _editor = null; invalidate(); } *************** *** 572,578 **** } ! JFrame makeAddIconFrame(String title, String select1, String select2, IconAdder editor) { ! JFrame frame = new JFrame(rb.getString(title)); if (editor != null) { JPanel p = new JPanel(); --- 572,578 ---- } ! void makeAddIconFrame(String title, String select1, String select2, IconAdder editor) { ! _editorFrame = new JFrame(rb.getString(title)); if (editor != null) { JPanel p = new JPanel(); *************** *** 580,591 **** p.add(new JLabel(rb.getString(select1))); p.add(new JLabel(rb.getString(select2))); ! frame.getContentPane().add(p,BorderLayout.NORTH); ! frame.getContentPane().add(editor); ! editor.setParent(frame); } ! frame.setLocationRelativeTo(this); ! frame.setVisible(true); ! frame.pack(); ! return frame; } --- 580,598 ---- p.add(new JLabel(rb.getString(select1))); p.add(new JLabel(rb.getString(select2))); ! _editorFrame.getContentPane().add(p,BorderLayout.NORTH); ! _editorFrame.getContentPane().add(editor); ! editor.setParent(_editorFrame); } ! ! _editorFrame.addWindowListener(new java.awt.event.WindowAdapter() { ! public void windowClosing(java.awt.event.WindowEvent e) { ! log.debug("windowClosing: _editorFrame= "+_editorFrame); ! _editorFrame.dispose(); ! _editorFrame = null; ! } ! }); ! _editorFrame.setLocationRelativeTo(this); ! _editorFrame.setVisible(true); ! _editorFrame.pack(); } |