1 33 34 35 package edu.rice.cs.drjava.ui; 36 37 import javax.swing.*; 38 import java.awt.event.*; 39 import java.io.Serializable ; 40 41 45 public class HistorySaveDialog extends DrJavaScrollableDialog implements Serializable { 46 47 48 private String _history; 49 50 53 55 58 public HistorySaveDialog (JFrame parent) { 59 super(parent, "Save Interactions History", 60 "Make any changes to the history, and then click \"Save\".", ""); 61 } 62 63 64 protected void _addButtons() { 65 Action saveAction = new AbstractAction("Save") { 67 public void actionPerformed (ActionEvent ae) { 68 _history = _textArea.getText(); 69 _dialog.dispose(); 70 } 71 }; 72 73 Action cancelAction = new AbstractAction("Cancel") { 75 public void actionPerformed (ActionEvent ae) { _dialog.dispose(); } 76 }; 77 78 JButton saveButton = new JButton(saveAction); 79 JButton cancelButton = new JButton(cancelAction); 80 _buttonPanel.add(saveButton); 81 _buttonPanel.add(cancelButton); 82 _dialog.getRootPane().setDefaultButton(saveButton); 83 } 84 85 89 public String editHistory(String history) { 90 _history = null; _textArea.setText(history); 93 _textArea.setEditable(true); 94 95 show(); 97 98 return _history; 100 } 102 } 103 | Popular Tags |