minor layout improvements

This commit is contained in:
hneemann 2019-07-25 11:08:37 +02:00
parent b6eae0d99c
commit 2e78699c41
2 changed files with 5 additions and 2 deletions

View File

@ -18,6 +18,7 @@ import static de.neemann.digital.draw.graphics.text.formatter.GraphicsFormatter.
* Component to show an expression
*/
public class ExpressionComponent extends JComponent {
private static final int XPAD = 5;
private ArrayList<Expression> expressions;
private Dimension lastRectSet;
@ -63,7 +64,7 @@ public class ExpressionComponent extends JComponent {
try {
GraphicsFormatter.Fragment fr = createFragment(gr, e);
y += fr.getHeight();
fr.draw(gr, 5, y);
fr.draw(gr, XPAD, y);
y += lineSpacing;
if (dx < fr.getWidth())
@ -73,7 +74,7 @@ public class ExpressionComponent extends JComponent {
}
}
Dimension p = new Dimension(dx, y);
Dimension p = new Dimension(dx+XPAD*2, y);
if (!p.equals(lastRectSet)) {
lastRectSet = p;
SwingUtilities.invokeLater(() -> {

View File

@ -35,6 +35,8 @@ public class ExpressionListenerJK implements ExpressionListener {
String detName = name.substring(0, name.length() - 2);
DetermineJKStateMachine jk = new DetermineJKStateMachine(detName, expression);
if (detName.endsWith("^n"))
detName = detName.substring(0, detName.length() - 2);
else
detName = detName.substring(0, detName.length() - 1);
Expression j = jk.getJ();
parent.resultFound("J_" + detName, j);