| 1 |
// Copyright 2003, FreeHEP. |
| 2 |
package org.freehep.graphicsio.exportchooser; |
| 3 |
|
| 4 |
import java.util.Properties; |
| 5 |
|
| 6 |
import javax.swing.JTextField; |
| 7 |
|
| 8 |
/** |
| 9 |
* |
| 10 |
* @author Mark Donszelmann |
| 11 |
* @version $Id: freehep-graphicsio/src/main/java/org/freehep/graphicsio/exportchooser/OptionTextField.java 5641ca92a537 2005/11/26 00:15:35 duns $ |
| 12 |
*/ |
| 13 |
public class OptionTextField extends JTextField implements Options { |
| 14 |
protected String initialText; |
| 15 |
|
| 16 |
protected String key; |
| 17 |
|
| 18 |
public OptionTextField(Properties options, String key, int columns) { |
| 19 |
super(options.getProperty(key, ""), columns); |
| 20 |
this.key = key; |
| 21 |
initialText = getText(); |
| 22 |
} |
| 23 |
|
| 24 |
public boolean applyChangedOptions(Properties options) { |
| 25 |
if (!getText().equals(initialText)) { |
| 26 |
options.setProperty(key, getText()); |
| 27 |
return true; |
| 28 |
} |
| 29 |
return false; |
| 30 |
} |
| 31 |
} |