Added text areas to FieldEditorPanel
This commit is contained in:
parent
f873a1d17a
commit
3baf16db6f
1 changed files with 24 additions and 1 deletions
|
@ -7,6 +7,7 @@ import java.awt.GridBagLayout;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
@ -28,11 +29,12 @@ import net.vhati.modmanager.ui.RegexDocument;
|
||||||
|
|
||||||
|
|
||||||
public class FieldEditorPanel extends JPanel {
|
public class FieldEditorPanel extends JPanel {
|
||||||
public enum ContentType { WRAPPED_LABEL, LABEL, STRING, INTEGER, BOOLEAN, SLIDER, COMBO, CHOOSER };
|
public enum ContentType { WRAPPED_LABEL, LABEL, STRING, TEXT_AREA, INTEGER, BOOLEAN, SLIDER, COMBO, CHOOSER };
|
||||||
|
|
||||||
private Map<String, JTextArea> wrappedLabelMap = new HashMap<String, JTextArea>();
|
private Map<String, JTextArea> wrappedLabelMap = new HashMap<String, JTextArea>();
|
||||||
private Map<String, JLabel> labelMap = new HashMap<String, JLabel>();
|
private Map<String, JLabel> labelMap = new HashMap<String, JLabel>();
|
||||||
private Map<String, JTextField> stringMap = new HashMap<String, JTextField>();
|
private Map<String, JTextField> stringMap = new HashMap<String, JTextField>();
|
||||||
|
private Map<String, JTextArea> textAreaMap = new HashMap<String, JTextArea>();
|
||||||
private Map<String, JTextField> intMap = new HashMap<String, JTextField>();
|
private Map<String, JTextField> intMap = new HashMap<String, JTextField>();
|
||||||
private Map<String, JCheckBox> boolMap = new HashMap<String, JCheckBox>();
|
private Map<String, JCheckBox> boolMap = new HashMap<String, JCheckBox>();
|
||||||
private Map<String, JSlider> sliderMap = new HashMap<String, JSlider>();
|
private Map<String, JSlider> sliderMap = new HashMap<String, JSlider>();
|
||||||
|
@ -135,6 +137,19 @@ public class FieldEditorPanel extends JPanel {
|
||||||
stringMap.put( valueName, valueField );
|
stringMap.put( valueName, valueField );
|
||||||
this.add( valueField, gridC );
|
this.add( valueField, gridC );
|
||||||
}
|
}
|
||||||
|
else if ( contentType == ContentType.TEXT_AREA ) {
|
||||||
|
gridC.anchor = GridBagConstraints.WEST;
|
||||||
|
JTextArea valueArea = new JTextArea();
|
||||||
|
valueArea.setEditable( true );
|
||||||
|
valueArea.setBorder( BorderFactory.createEtchedBorder() );
|
||||||
|
valueArea.setLineWrap( true );
|
||||||
|
valueArea.setWrapStyleWord( true );
|
||||||
|
valueArea.setFocusable( true );
|
||||||
|
valueArea.setFont( UIManager.getFont( "TextField.font" ) ); // Override small default font on systemLaf.
|
||||||
|
|
||||||
|
textAreaMap.put( valueName, valueArea );
|
||||||
|
this.add( valueArea, gridC );
|
||||||
|
}
|
||||||
else if ( contentType == ContentType.INTEGER ) {
|
else if ( contentType == ContentType.INTEGER ) {
|
||||||
gridC.anchor = GridBagConstraints.WEST;
|
gridC.anchor = GridBagConstraints.WEST;
|
||||||
JTextField valueField = new JTextField();
|
JTextField valueField = new JTextField();
|
||||||
|
@ -331,6 +346,10 @@ public class FieldEditorPanel extends JPanel {
|
||||||
return stringMap.get( valueName );
|
return stringMap.get( valueName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JTextArea getTextArea( String valueName ) {
|
||||||
|
return textAreaMap.get( valueName );
|
||||||
|
}
|
||||||
|
|
||||||
public JTextField getInt( String valueName ) {
|
public JTextField getInt( String valueName ) {
|
||||||
return intMap.get( valueName );
|
return intMap.get( valueName );
|
||||||
}
|
}
|
||||||
|
@ -362,6 +381,9 @@ public class FieldEditorPanel extends JPanel {
|
||||||
for ( JTextField valueField : stringMap.values() )
|
for ( JTextField valueField : stringMap.values() )
|
||||||
valueField.setText( "" );
|
valueField.setText( "" );
|
||||||
|
|
||||||
|
for ( JTextArea valueArea : textAreaMap.values() )
|
||||||
|
valueArea.setText( "" );
|
||||||
|
|
||||||
for ( JTextField valueField : intMap.values() )
|
for ( JTextField valueField : intMap.values() )
|
||||||
valueField.setText( "" );
|
valueField.setText( "" );
|
||||||
|
|
||||||
|
@ -386,6 +408,7 @@ public class FieldEditorPanel extends JPanel {
|
||||||
wrappedLabelMap.clear();
|
wrappedLabelMap.clear();
|
||||||
labelMap.clear();
|
labelMap.clear();
|
||||||
stringMap.clear();
|
stringMap.clear();
|
||||||
|
textAreaMap.clear();
|
||||||
intMap.clear();
|
intMap.clear();
|
||||||
boolMap.clear();
|
boolMap.clear();
|
||||||
sliderMap.clear();
|
sliderMap.clear();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue