mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-29 07:50:29 -04:00
The description key editor component is now a multi line JTextArea instead of a single line JTextField.
This commit is contained in:
parent
065bb891a3
commit
5f492205a9
@ -160,4 +160,18 @@ public class Key<VALUE> {
|
|||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A special string key to flag long multi line strings.
|
||||||
|
*/
|
||||||
|
public static final class LongString extends Key<String> {
|
||||||
|
/**
|
||||||
|
* Creates a new Key
|
||||||
|
*
|
||||||
|
* @param key the key
|
||||||
|
*/
|
||||||
|
public LongString(String key) {
|
||||||
|
super(key, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ public final class Keys {
|
|||||||
= new Key<>("showList", false);
|
= new Key<>("showList", false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* flag to set a ROM as programm memory
|
* flag to set a ROM as program memory
|
||||||
*/
|
*/
|
||||||
public static final Key<Boolean> IS_PROGRAM_MEMORY
|
public static final Key<Boolean> IS_PROGRAM_MEMORY
|
||||||
= new Key<>("isProgramMemory", false);
|
= new Key<>("isProgramMemory", false);
|
||||||
@ -213,8 +213,8 @@ public final class Keys {
|
|||||||
/**
|
/**
|
||||||
* the description of an element
|
* the description of an element
|
||||||
*/
|
*/
|
||||||
public static final Key<String> DESCRIPTION
|
public static final Key.LongString DESCRIPTION
|
||||||
= new Key<>("Description", "");
|
= new Key.LongString("Description");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A net name
|
* A net name
|
||||||
|
@ -18,6 +18,7 @@ import de.neemann.gui.language.Language;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||||
|
import javax.swing.text.JTextComponent;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -110,16 +111,23 @@ public final class EditorFactory {
|
|||||||
|
|
||||||
private final static class StringEditor extends LabelEditor<String> {
|
private final static class StringEditor extends LabelEditor<String> {
|
||||||
|
|
||||||
private final JTextField text;
|
private final JTextComponent text;
|
||||||
|
private final JComponent compToAdd;
|
||||||
|
|
||||||
public StringEditor(String value, Key<String> key) {
|
public StringEditor(String value, Key<String> key) {
|
||||||
text = new JTextField(10);
|
if (key instanceof Key.LongString) {
|
||||||
|
text = new JTextArea(6, 30);
|
||||||
|
compToAdd = new JScrollPane(text);
|
||||||
|
} else {
|
||||||
|
text = new JTextField(10);
|
||||||
|
compToAdd = text;
|
||||||
|
}
|
||||||
text.setText(value);
|
text.setText(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JComponent getComponent(ElementAttributes attr) {
|
public JComponent getComponent(ElementAttributes attr) {
|
||||||
return text;
|
return compToAdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user