Made popup showable with button
This commit is contained in:
@@ -248,6 +248,11 @@ public class GraphPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
JButton showPopup = new JButton("Show popup");
|
||||||
|
showPopup.addActionListener(e -> {
|
||||||
|
new PopupFrame(name, automata);
|
||||||
|
});
|
||||||
|
|
||||||
JButton showGrammar = new JButton("Show grammar");
|
JButton showGrammar = new JButton("Show grammar");
|
||||||
|
|
||||||
buttonPanel.add(Box.createHorizontalGlue());
|
buttonPanel.add(Box.createHorizontalGlue());
|
||||||
@@ -270,6 +275,9 @@ public class GraphPanel extends JPanel {
|
|||||||
buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
|
buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buttonPanel.add(showPopup);
|
||||||
|
buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
|
||||||
|
|
||||||
buttonPanel.add(minimize2Button);
|
buttonPanel.add(minimize2Button);
|
||||||
buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
|
buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
|
||||||
buttonPanel.add(minimizeButton);
|
buttonPanel.add(minimizeButton);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.imegumii.ui;
|
package com.imegumii.ui;
|
||||||
|
|
||||||
import com.imegumii.*;
|
import com.imegumii.*;
|
||||||
|
import com.sun.tools.internal.ws.wsdl.document.Import;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
@@ -19,7 +20,7 @@ public class PopupFrame extends JFrame {
|
|||||||
|
|
||||||
boolean selected = false;
|
boolean selected = false;
|
||||||
|
|
||||||
public PopupFrame(String name, RegExp r)
|
public PopupFrame(String name, Importable r)
|
||||||
{
|
{
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
@@ -27,7 +28,15 @@ public class PopupFrame extends JFrame {
|
|||||||
//this.setResizable(false);
|
//this.setResizable(false);
|
||||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
DFA<String> minimizedDfa = ThompsonConverter.convert(r).toDFA().minimaliseer();
|
DFA<String> tempDfa = null;
|
||||||
|
|
||||||
|
if (r.type == Importable.Type.DFA) {
|
||||||
|
tempDfa = ((DFA<String>) r).minimaliseer();
|
||||||
|
} else if (r.type == Importable.Type.REGEX) {
|
||||||
|
tempDfa = ThompsonConverter.convert((RegExp) r).toDFA().minimaliseer();
|
||||||
|
} else if (r.type == Importable.Type.NDFA) {
|
||||||
|
tempDfa = ((NDFA<String>) r).toDFA().minimaliseer();
|
||||||
|
}
|
||||||
|
|
||||||
JPanel container = new JPanel(new BorderLayout());
|
JPanel container = new JPanel(new BorderLayout());
|
||||||
|
|
||||||
@@ -63,7 +72,7 @@ public class PopupFrame extends JFrame {
|
|||||||
JTextField acceptString = new JTextField();
|
JTextField acceptString = new JTextField();
|
||||||
|
|
||||||
JButton acceptButton = new JButton("Accept string");
|
JButton acceptButton = new JButton("Accept string");
|
||||||
|
DFA<String> minimizedDfa = tempDfa;
|
||||||
generateButton.addActionListener(e -> {
|
generateButton.addActionListener(e -> {
|
||||||
textArea.setText(""); // reset
|
textArea.setText(""); // reset
|
||||||
BackgroundWorker.instance().addWorker(() -> {
|
BackgroundWorker.instance().addWorker(() -> {
|
||||||
@@ -114,7 +123,7 @@ public class PopupFrame extends JFrame {
|
|||||||
});
|
});
|
||||||
|
|
||||||
operaties.setText("4");
|
operaties.setText("4");
|
||||||
lengte.setText("100");
|
lengte.setText("5");
|
||||||
|
|
||||||
textPanel.add(scrollPane);
|
textPanel.add(scrollPane);
|
||||||
textPanel.add(acceptScrollPane);
|
textPanel.add(acceptScrollPane);
|
||||||
|
|||||||
Reference in New Issue
Block a user