mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-15 15:58:41 -04:00
added a simple terminal
This commit is contained in:
parent
c8fb6026b4
commit
a68c2984a0
@ -167,27 +167,172 @@
|
||||
<entry>
|
||||
<string>Data</string>
|
||||
<data>
|
||||
<size>13</size>
|
||||
<long>5137</long>
|
||||
<size>158</size>
|
||||
<long>5120</long>
|
||||
<long>6145</long>
|
||||
<long>15888</long>
|
||||
<long>29521</long>
|
||||
<long>15375</long>
|
||||
<long>26107</long>
|
||||
<long>8193</long>
|
||||
<long>16400</long>
|
||||
<long>29521</long>
|
||||
<long>21328</long>
|
||||
<long>21488</long>
|
||||
<long>5130</long>
|
||||
<long>21312</long>
|
||||
<long>21472</long>
|
||||
<long>32800</long>
|
||||
<long>4608</long>
|
||||
<long>21040</long>
|
||||
<long>21104</long>
|
||||
<long>21152</long>
|
||||
<long>21200</long>
|
||||
<long>21264</long>
|
||||
<long>21424</long>
|
||||
<long>32805</long>
|
||||
<long>4608</long>
|
||||
<long>21168</long>
|
||||
<long>21280</long>
|
||||
<long>21440</long>
|
||||
<long>32865</long>
|
||||
<long>4608</long>
|
||||
<long>21216</long>
|
||||
<long>32868</long>
|
||||
<long>4608</long>
|
||||
<long>21248</long>
|
||||
<long>32869</long>
|
||||
<long>4608</long>
|
||||
<long>21024</long>
|
||||
<long>21392</long>
|
||||
<long>32870</long>
|
||||
<long>4608</long>
|
||||
<long>21136</long>
|
||||
<long>32871</long>
|
||||
<long>4608</long>
|
||||
<long>21344</long>
|
||||
<long>32872</long>
|
||||
<long>4608</long>
|
||||
<long>21008</long>
|
||||
<long>32873</long>
|
||||
<long>4608</long>
|
||||
<long>21360</long>
|
||||
<long>32877</long>
|
||||
<long>4608</long>
|
||||
<long>21088</long>
|
||||
<long>32878</long>
|
||||
<long>4608</long>
|
||||
<long>21232</long>
|
||||
<long>32879</long>
|
||||
<long>4608</long>
|
||||
<long>21120</long>
|
||||
<long>32883</long>
|
||||
<long>4608</long>
|
||||
<long>21056</long>
|
||||
<long>21408</long>
|
||||
<long>32884</long>
|
||||
<long>4608</long>
|
||||
<long>20992</long>
|
||||
<long>32885</long>
|
||||
<long>4608</long>
|
||||
<long>21072</long>
|
||||
<long>32886</long>
|
||||
<long>4608</long>
|
||||
<long>21376</long>
|
||||
<long>32888</long>
|
||||
<long>4608</long>
|
||||
<long>21184</long>
|
||||
<long>21296</long>
|
||||
<long>21456</long>
|
||||
<long>5125</long>
|
||||
<long>8417</long>
|
||||
<long>19680</long>
|
||||
<long>5124</long>
|
||||
<long>8417</long>
|
||||
<long>19680</long>
|
||||
<long>5120</long>
|
||||
<long>8417</long>
|
||||
<long>19680</long>
|
||||
<long>8417</long>
|
||||
<long>32850</long>
|
||||
<long>4848</long>
|
||||
<long>19695</long>
|
||||
<long>28175</long>
|
||||
<long>6371</long>
|
||||
<long>5129</long>
|
||||
<long>8417</long>
|
||||
<long>19680</long>
|
||||
<long>5382</long>
|
||||
<long>8417</long>
|
||||
<long>19680</long>
|
||||
<long>8417</long>
|
||||
<long>32862</long>
|
||||
<long>4848</long>
|
||||
<long>19695</long>
|
||||
<long>28163</long>
|
||||
<long>6370</long>
|
||||
<long>31744</long>
|
||||
<long>28643</long>
|
||||
<long>8417</long>
|
||||
<long>19693</long>
|
||||
<long>734</long>
|
||||
<long>589</long>
|
||||
<long>6210</long>
|
||||
<long>20020</long>
|
||||
<long>19971</long>
|
||||
<long>15360</long>
|
||||
<long>26107</long>
|
||||
<long>28661</long>
|
||||
<long>24070</long>
|
||||
<long>32805</long>
|
||||
<long>14848</long>
|
||||
<long>24073</long>
|
||||
<long>29680</long>
|
||||
<long>6193</long>
|
||||
<long>28663</long>
|
||||
<long>749</long>
|
||||
<long>20190</long>
|
||||
<long>6369</long>
|
||||
<long>20222</long>
|
||||
<long>6369</long>
|
||||
<long>27151</long>
|
||||
<long>6193</long>
|
||||
<long>19971</long>
|
||||
<long>32888</long>
|
||||
<long>14848</long>
|
||||
<long>25605</long>
|
||||
<long>6209</long>
|
||||
<long>19972</long>
|
||||
<long>32900</long>
|
||||
<long>26864</long>
|
||||
<long>28654</long>
|
||||
<long>32805</long>
|
||||
<long>4688</long>
|
||||
<long>29685</long>
|
||||
<long>28649</long>
|
||||
<long>18432</long>
|
||||
<long>18944</long>
|
||||
<long>32915</long>
|
||||
<long>26656</long>
|
||||
<long>18944</long>
|
||||
<long>32915</long>
|
||||
<long>26656</long>
|
||||
<long>18432</long>
|
||||
<long>18944</long>
|
||||
<long>32915</long>
|
||||
<long>26656</long>
|
||||
<long>18944</long>
|
||||
<long>32915</long>
|
||||
<long>26656</long>
|
||||
<long>27151</long>
|
||||
<long>528</long>
|
||||
<long>10271</long>
|
||||
<long>15386</long>
|
||||
<long>25091</long>
|
||||
<long>32816</long>
|
||||
<long>5648</long>
|
||||
<long>28162</long>
|
||||
<long>32823</long>
|
||||
<long>5648</long>
|
||||
<long>29681</long>
|
||||
<long>27138</long>
|
||||
<bits>16</bits>
|
||||
</data>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>lastDataFile</string>
|
||||
<string>
|
||||
/home/hneemann/Dokumente/DHBW/Technische_Informatik_II/Systemnahes_Programmieren/java/assembler3/src/main/asm/lightChase.hex
|
||||
/home/hneemann/Dokumente/DHBW/Technische_Informatik_II/Systemnahes_Programmieren/java/assembler3/src/main/asm/printf.hex
|
||||
</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
@ -372,6 +517,12 @@
|
||||
<pos x="750" y="350"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Terminal.dig</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="670" y="310"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
@ -406,10 +557,6 @@
|
||||
<p1 x="720" y="200"/>
|
||||
<p2 x="750" y="190"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="750" y="210"/>
|
||||
<p2 x="720" y="210"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="720" y="220"/>
|
||||
<p2 x="750" y="230"/>
|
||||
@ -434,10 +581,18 @@
|
||||
<p1 x="720" y="280"/>
|
||||
<p2 x="750" y="350"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="720" y="250"/>
|
||||
<p2 x="750" y="290"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="310" y="320"/>
|
||||
<p2 x="460" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="610" y="320"/>
|
||||
<p2 x="670" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="130"/>
|
||||
<p2 x="390" y="130"/>
|
||||
@ -446,6 +601,14 @@
|
||||
<p1 x="410" y="130"/>
|
||||
<p2 x="470" y="130"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="650" y="130"/>
|
||||
<p2 x="660" y="130"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="660" y="130"/>
|
||||
<p2 x="690" y="130"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="140" y="260"/>
|
||||
<p2 x="240" y="260"/>
|
||||
@ -454,10 +617,6 @@
|
||||
<p1 x="310" y="260"/>
|
||||
<p2 x="320" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="720" y="250"/>
|
||||
<p2 x="750" y="290"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="450" y="70"/>
|
||||
<p2 x="500" y="70"/>
|
||||
@ -494,6 +653,14 @@
|
||||
<p1 x="30" y="200"/>
|
||||
<p2 x="370" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="630" y="330"/>
|
||||
<p2 x="670" y="330"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="310" y="330"/>
|
||||
<p2 x="480" y="330"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="220" y="10"/>
|
||||
<p2 x="550" y="10"/>
|
||||
@ -502,10 +669,6 @@
|
||||
<p1 x="550" y="10"/>
|
||||
<p2 x="700" y="10"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="310" y="330"/>
|
||||
<p2 x="480" y="330"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="350" y="140"/>
|
||||
<p2 x="390" y="140"/>
|
||||
@ -566,6 +729,10 @@
|
||||
<p1 x="420" y="80"/>
|
||||
<p2 x="430" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="720" y="210"/>
|
||||
<p2 x="750" y="210"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="20" y="210"/>
|
||||
<p2 x="200" y="210"/>
|
||||
@ -587,8 +754,8 @@
|
||||
<p2 x="500" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="650" y="130"/>
|
||||
<p2 x="690" y="130"/>
|
||||
<p1 x="650" y="340"/>
|
||||
<p2 x="670" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="280" y="150"/>
|
||||
@ -602,6 +769,10 @@
|
||||
<p1 x="220" y="150"/>
|
||||
<p2 x="230" y="150"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="630" y="150"/>
|
||||
<p2 x="690" y="150"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="310" y="280"/>
|
||||
<p2 x="340" y="280"/>
|
||||
@ -710,10 +881,6 @@
|
||||
<p1 x="310" y="360"/>
|
||||
<p2 x="640" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="630" y="150"/>
|
||||
<p2 x="690" y="150"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="310" y="300"/>
|
||||
<p2 x="400" y="300"/>
|
||||
@ -762,6 +929,10 @@
|
||||
<p1 x="310" y="310"/>
|
||||
<p2 x="440" y="310"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="660" y="310"/>
|
||||
<p2 x="670" y="310"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="120"/>
|
||||
<p2 x="390" y="120"/>
|
||||
@ -828,6 +999,10 @@
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="650" y="160"/>
|
||||
<p2 x="650" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="650" y="340"/>
|
||||
<p2 x="650" y="370"/>
|
||||
</wire>
|
||||
<wire>
|
||||
@ -850,6 +1025,10 @@
|
||||
<p1 x="340" y="230"/>
|
||||
<p2 x="340" y="280"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="660" y="130"/>
|
||||
<p2 x="660" y="310"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="470" y="80"/>
|
||||
<p2 x="470" y="130"/>
|
||||
@ -886,6 +1065,10 @@
|
||||
<p1 x="610" y="80"/>
|
||||
<p2 x="610" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="610" y="140"/>
|
||||
<p2 x="610" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="420" y="80"/>
|
||||
<p2 x="420" y="140"/>
|
||||
@ -974,6 +1157,10 @@
|
||||
<p1 x="630" y="150"/>
|
||||
<p2 x="630" y="210"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="630" y="210"/>
|
||||
<p2 x="630" y="330"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="310" y="30"/>
|
||||
<p2 x="310" y="60"/>
|
||||
|
151
src/main/dig/processor/Terminal.dig
Normal file
151
src/main/dig/processor/Terminal.dig
Normal file
@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<circuit>
|
||||
<visualElements>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>A</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Bits</string>
|
||||
<int>16</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="180" y="80"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>D</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Bits</string>
|
||||
<int>16</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="180" y="60"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Comparator</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Bits</string>
|
||||
<int>16</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="220" y="80"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Const</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Value</string>
|
||||
<int>31</int>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Bits</string>
|
||||
<int>16</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="210" y="90"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Terminal</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>Terminal</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="330" y="60"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>C</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="180" y="130"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>And</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Inputs</string>
|
||||
<int>3</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="280" y="90"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>W</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="180" y="110"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="180" y="80"/>
|
||||
<p2 x="220" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="180" y="130"/>
|
||||
<p2 x="270" y="130"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="310" y="100"/>
|
||||
<p2 x="320" y="100"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="270" y="100"/>
|
||||
<p2 x="280" y="100"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="320" y="70"/>
|
||||
<p2 x="330" y="70"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="250" y="90"/>
|
||||
<p2 x="280" y="90"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="210" y="90"/>
|
||||
<p2 x="220" y="90"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="180" y="60"/>
|
||||
<p2 x="330" y="60"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="180" y="110"/>
|
||||
<p2 x="280" y="110"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="320" y="70"/>
|
||||
<p2 x="320" y="100"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="270" y="100"/>
|
||||
<p2 x="270" y="130"/>
|
||||
</wire>
|
||||
</wires>
|
||||
</circuit>
|
@ -24,6 +24,8 @@ public class AttributeKey<VALUE> {
|
||||
public static final AttributeKey<Boolean> FlipSelPositon = new AttributeKey<>("flipSelPos", Lang.get("key_flipSelPos"), false);
|
||||
public static final AttributeKey<Rotation> Rotate = new AttributeKey<>("rotation", Lang.get("key_rotation"), new Rotation(0));
|
||||
public static final AttributeKey<Integer> Width = new AttributeKey<>("Width", Lang.get("key_width"), 3);
|
||||
public static final AttributeKey<Integer> TermWidth = new AttributeKey<>("termWidth", Lang.get("key_termWidth"), 50);
|
||||
public static final AttributeKey<Integer> TermHeight = new AttributeKey<>("termHeight", Lang.get("key_termHeight"), 25);
|
||||
public static final AttributeKey<Integer> Cycles = new AttributeKey<>("Cycles", Lang.get("key_cycles"), 100000);
|
||||
|
||||
|
||||
|
@ -15,6 +15,7 @@ import de.neemann.digital.core.io.In;
|
||||
import de.neemann.digital.core.io.Out;
|
||||
import de.neemann.digital.core.memory.*;
|
||||
import de.neemann.digital.core.wiring.*;
|
||||
import de.neemann.digital.gui.components.terminal.Terminal;
|
||||
import de.neemann.digital.lang.Lang;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -51,6 +52,7 @@ public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer>
|
||||
add(Break.DESCRIPTION, menu);
|
||||
add(Out.SEVENDESCRIPTION, menu);
|
||||
add(Out.SEVENHEXDESCRIPTION, menu);
|
||||
add(Terminal.DESCRIPTION, menu);
|
||||
|
||||
menu = Lang.get("lib_mux");
|
||||
add(Multiplexer.DESCRIPTION, menu);
|
||||
|
@ -361,6 +361,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
||||
|
||||
private void createAndStartModel(boolean runClock, ModelEvent.Event updateEvent) {
|
||||
try {
|
||||
circuitComponent.removeHighLighted();
|
||||
circuitComponent.setModeAndReset(CircuitComponent.Mode.running);
|
||||
|
||||
setModelDescription(new ModelDescription(circuitComponent.getCircuit(), library), runClock);
|
||||
|
@ -0,0 +1,59 @@
|
||||
package de.neemann.digital.gui.components.terminal;
|
||||
|
||||
import de.neemann.digital.core.Node;
|
||||
import de.neemann.digital.core.NodeException;
|
||||
import de.neemann.digital.core.ObservableValue;
|
||||
import de.neemann.digital.core.element.AttributeKey;
|
||||
import de.neemann.digital.core.element.Element;
|
||||
import de.neemann.digital.core.element.ElementAttributes;
|
||||
import de.neemann.digital.core.element.ElementTypeDescription;
|
||||
|
||||
/**
|
||||
* @author hneemann
|
||||
*/
|
||||
public class Terminal extends Node implements Element {
|
||||
|
||||
public static final ElementTypeDescription DESCRIPTION
|
||||
= new ElementTypeDescription(Terminal.class, "D", "C")
|
||||
.addAttribute(AttributeKey.TermWidth)
|
||||
.addAttribute(AttributeKey.TermHeight)
|
||||
.addAttribute(AttributeKey.Rotate)
|
||||
.addAttribute(AttributeKey.Label);
|
||||
|
||||
private final ElementAttributes attr;
|
||||
private ObservableValue data;
|
||||
private ObservableValue clock;
|
||||
private TerminalFrame terminalFrame;
|
||||
private boolean lastClock;
|
||||
|
||||
public Terminal(ElementAttributes attributes) {
|
||||
attr = attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInputs(ObservableValue... inputs) throws NodeException {
|
||||
data = inputs[0];
|
||||
clock = inputs[1].addObserver(this).checkBits(1, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue[] getOutputs() {
|
||||
return new ObservableValue[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readInputs() throws NodeException {
|
||||
boolean clockVal = clock.getBool();
|
||||
if (!lastClock && clockVal) {
|
||||
if (terminalFrame == null)
|
||||
terminalFrame = new TerminalFrame(attr);
|
||||
terminalFrame.addChar((char) data.getValue());
|
||||
}
|
||||
lastClock = clockVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeOutputs() throws NodeException {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package de.neemann.digital.gui.components.terminal;
|
||||
|
||||
import de.neemann.digital.core.element.AttributeKey;
|
||||
import de.neemann.digital.core.element.ElementAttributes;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
|
||||
/**
|
||||
* @author hneemann
|
||||
*/
|
||||
public class TerminalFrame extends JFrame {
|
||||
private final JTextArea textArea;
|
||||
private final int width;
|
||||
private int pos;
|
||||
|
||||
public TerminalFrame(ElementAttributes attr) {
|
||||
super(attr.get(AttributeKey.Label));
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
width = attr.get(AttributeKey.TermWidth);
|
||||
textArea = new JTextArea(attr.get(AttributeKey.TermHeight), width);
|
||||
textArea.setFont(new Font("monospaced", Font.PLAIN, 12));
|
||||
getContentPane().add(new JScrollPane(textArea));
|
||||
pack();
|
||||
setLocationRelativeTo(null);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
public void addChar(char value) {
|
||||
if (value == 13 || value == 10) {
|
||||
pos = 0;
|
||||
textArea.append("\n");
|
||||
} else {
|
||||
textArea.append("" + value);
|
||||
pos++;
|
||||
if (pos == width) {
|
||||
pos = 0;
|
||||
textArea.append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -29,6 +29,8 @@ key_flipSelPos=Tausche Position des Selectors
|
||||
key_rotation=Rotation
|
||||
key_width=Breite
|
||||
key_cycles=Timeout Zyklen
|
||||
key_termWidth=Zeichen pro Zeile
|
||||
key_termHeight=Zeilen
|
||||
|
||||
rot_0=0\u00B0
|
||||
rot_90=90\u00B0
|
||||
@ -132,6 +134,7 @@ menu_fast=Schneller Lauf
|
||||
menu_fast_tt=F\u00FChrt das Modell aus, bis ein Stopsignal \u00FCber ein BRK-Element detektiert wird.
|
||||
menu_export=Export
|
||||
menu_exportSVG=Export SVG
|
||||
menu_exportSVGLaTex=Export SVG+LaTeX
|
||||
menu_delete=L\u00F6schen
|
||||
menu_delete_tt=L\u00F6scht ausgew\u00E4hlte Elemente
|
||||
|
||||
|
@ -29,6 +29,8 @@ key_flipSelPos=Flip selector position
|
||||
key_rotation=Rotation
|
||||
key_width=Width
|
||||
key_cycles=Timeout cycles
|
||||
key_termWidth=Characters per line
|
||||
key_termHeight=Lines
|
||||
|
||||
rot_0=0\u00B0
|
||||
rot_90=90\u00B0
|
||||
|
Loading…
x
Reference in New Issue
Block a user