Replace anonymous types with lambdas and method refs
This commit is contained in:
parent
366f6246ce
commit
d099100adf
|
@ -65,11 +65,7 @@ public class EthereumImpl implements Ethereum {
|
||||||
worldManager.loadBlockchain();
|
worldManager.loadBlockchain();
|
||||||
if (CONFIG.listenPort() > 0) {
|
if (CONFIG.listenPort() > 0) {
|
||||||
Executors.newSingleThreadExecutor().submit(
|
Executors.newSingleThreadExecutor().submit(
|
||||||
new Runnable() {
|
() -> peerServer.start(CONFIG.listenPort())
|
||||||
public void run() {
|
|
||||||
peerServer.start(CONFIG.listenPort());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,9 +132,7 @@ public abstract class FastByteComparisons {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
theUnsafe = (Unsafe) AccessController.doPrivileged(
|
theUnsafe = (Unsafe) AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Object>() {
|
(PrivilegedAction<Object>) () -> {
|
||||||
@Override
|
|
||||||
public Object run() {
|
|
||||||
try {
|
try {
|
||||||
Field f = Unsafe.class.getDeclaredField("theUnsafe");
|
Field f = Unsafe.class.getDeclaredField("theUnsafe");
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
|
@ -146,7 +144,6 @@ public abstract class FastByteComparisons {
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
BYTE_ARRAY_BASE_OFFSET = theUnsafe.arrayBaseOffset(byte[].class);
|
BYTE_ARRAY_BASE_OFFSET = theUnsafe.arrayBaseOffset(byte[].class);
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.math.BigInteger;
|
||||||
import java.security.SignatureException;
|
import java.security.SignatureException;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
@ -175,12 +174,7 @@ public class ECKeyTest {
|
||||||
final ECKey key = new ECKey();
|
final ECKey key = new ECKey();
|
||||||
for (byte i = 0; i < ITERATIONS; i++) {
|
for (byte i = 0; i < ITERATIONS; i++) {
|
||||||
final byte[] hash = HashUtil.sha3(new byte[]{i});
|
final byte[] hash = HashUtil.sha3(new byte[]{i});
|
||||||
sigFutures.add(executor.submit(new Callable<ECKey.ECDSASignature>() {
|
sigFutures.add(executor.submit(() -> key.doSign(hash)));
|
||||||
@Override
|
|
||||||
public ECKey.ECDSASignature call() throws Exception {
|
|
||||||
return key.doSign(hash);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
List<ECKey.ECDSASignature> sigs = Futures.allAsList(sigFutures).get();
|
List<ECKey.ECDSASignature> sigs = Futures.allAsList(sigFutures).get();
|
||||||
for (ECKey.ECDSASignature signature : sigs) {
|
for (ECKey.ECDSASignature signature : sigs) {
|
||||||
|
|
|
@ -823,16 +823,12 @@ public class BlockChainTable extends JFrame implements ActionListener {
|
||||||
transactionPanel.add(nonce, c);
|
transactionPanel.add(nonce, c);
|
||||||
|
|
||||||
JButton data = new JButton("Data");
|
JButton data = new JButton("Data");
|
||||||
data.addActionListener(new ActionListener() {
|
data.addActionListener(event -> {
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent event) {
|
|
||||||
if (transactionDataWindow == null)
|
if (transactionDataWindow == null)
|
||||||
transactionDataWindow = new TransactionData(blockchainTable);
|
transactionDataWindow = new TransactionData(blockchainTable);
|
||||||
transactionDataWindow.setData(transaction.getData());
|
transactionDataWindow.setData(transaction.getData());
|
||||||
transactionDataWindow.setVisible(true);
|
transactionDataWindow.setVisible(true);
|
||||||
transactionDataWindow.highlightText(findText.getText(), painter);
|
transactionDataWindow.highlightText(findText.getText(), painter);
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
data.setFont(plain);
|
data.setFont(plain);
|
||||||
if (findText.getText().length() > 0 && ByteUtil.toHexString(transaction.getData()).contains(findText.getText
|
if (findText.getText().length() > 0 && ByteUtil.toHexString(transaction.getData()).contains(findText.getText
|
||||||
|
|
|
@ -89,14 +89,12 @@ public class ConnectionConsoleWindow extends JFrame {
|
||||||
UIEthereumManager.ethereum.addListener(new EthereumListenerAdapter() {
|
UIEthereumManager.ethereum.addListener(new EthereumListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void trace(final String output) {
|
public void trace(final String output) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
public void run() {
|
|
||||||
textArea.append(output);
|
textArea.append(output);
|
||||||
textArea.append("\n");
|
textArea.append("\n");
|
||||||
|
|
||||||
if (autoScroll)
|
if (autoScroll)
|
||||||
textArea.setCaretPosition(textArea.getText().length());
|
textArea.setCaretPosition(textArea.getText().length());
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -149,11 +147,7 @@ public class ConnectionConsoleWindow extends JFrame {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// Start all Swing applications on the EDT.
|
// Start all Swing applications on the EDT.
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> new ConnectionConsoleWindow(null).setVisible(true));
|
||||||
public void run() {
|
|
||||||
new ConnectionConsoleWindow(null).setVisible(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,11 +70,7 @@ class ContractCallDialog extends JDialog implements MessageAwareDialog {
|
||||||
@Override
|
@Override
|
||||||
public void focusLost(FocusEvent e) {
|
public void focusLost(FocusEvent e) {
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(ContractCallDialog.this::populateContractDetails);
|
||||||
public void run() {
|
|
||||||
populateContractDetails();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -235,11 +235,9 @@ class PayOutDialog extends JDialog implements MessageAwareDialog {
|
||||||
inputMap.put(stroke, "ESCAPE");
|
inputMap.put(stroke, "ESCAPE");
|
||||||
rootPane.getActionMap().put("ESCAPE", actionListener);
|
rootPane.getActionMap().put("ESCAPE", actionListener);
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
public void run() {
|
|
||||||
setSize(500, 255);
|
setSize(500, 255);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -250,26 +248,22 @@ class PayOutDialog extends JDialog implements MessageAwareDialog {
|
||||||
|
|
||||||
final PayOutDialog dialog = this;
|
final PayOutDialog dialog = this;
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
public void run() {
|
|
||||||
dialog.statusMsg.setForeground(Color.GREEN.darker().darker());
|
dialog.statusMsg.setForeground(Color.GREEN.darker().darker());
|
||||||
dialog.statusMsg.setText(text);
|
dialog.statusMsg.setText(text);
|
||||||
dialog.revalidate();
|
dialog.revalidate();
|
||||||
dialog.repaint();
|
dialog.repaint();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void alertStatusMsg(final String text) {
|
public void alertStatusMsg(final String text) {
|
||||||
final PayOutDialog dialog = this;
|
final PayOutDialog dialog = this;
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
public void run() {
|
|
||||||
dialog.statusMsg.setForeground(Color.RED);
|
dialog.statusMsg.setForeground(Color.RED);
|
||||||
dialog.statusMsg.setText(text);
|
dialog.statusMsg.setText(text);
|
||||||
dialog.revalidate();
|
dialog.revalidate();
|
||||||
dialog.repaint();
|
dialog.repaint();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,10 +81,6 @@ public class PeerInfoWindow extends JFrame {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// Start all Swing applications on the EDT.
|
// Start all Swing applications on the EDT.
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> new PeerInfoWindow(null).setVisible(true));
|
||||||
public void run() {
|
|
||||||
new PeerInfoWindow(null).setVisible(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,12 +32,7 @@ public class PeersTableModel extends AbstractTableModel {
|
||||||
updater.scheduleAtFixedRate(new TimerTask() {
|
updater.scheduleAtFixedRate(new TimerTask() {
|
||||||
public void run() {
|
public void run() {
|
||||||
SwingUtilities.invokeLater(
|
SwingUtilities.invokeLater(
|
||||||
new Runnable() {
|
PeersTableModel.this::updateModel
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
updateModel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, 0, 100);
|
}, 0, 100);
|
||||||
|
|
|
@ -64,11 +64,7 @@ public class PeersTableWindow extends JFrame {
|
||||||
PeersTableModel model = (PeersTableModel) table.getModel();
|
PeersTableModel model = (PeersTableModel) table.getModel();
|
||||||
if (me.getClickCount() == 2) {
|
if (me.getClickCount() == 2) {
|
||||||
final PeersTableModel.PeerInfo peerInfo = model.getPeerInfo(row);
|
final PeersTableModel.PeerInfo peerInfo = model.getPeerInfo(row);
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> new PeerInfoWindow(peerInfo).setVisible(true));
|
||||||
public void run() {
|
|
||||||
new PeerInfoWindow(peerInfo).setVisible(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
System.out.println(peerInfo);
|
System.out.println(peerInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,10 +190,6 @@ public class ProgramPlayDialog extends JPanel implements ActionListener,
|
||||||
// final byte[] code = SerpentCompiler.compileAssemblyToMachine(asmCode);
|
// final byte[] code = SerpentCompiler.compileAssemblyToMachine(asmCode);
|
||||||
|
|
||||||
final byte[] code = Hex.decode("7f4e616d65526567000000000000000000000000000000000000000000000000003057307f4e616d6552656700000000000000000000000000000000000000000000000000573360455760415160566000396000f20036602259604556330e0f600f5933ff33560f601e5960003356576000335700604158600035560f602b590033560f60365960003356573360003557600035335700");
|
final byte[] code = Hex.decode("7f4e616d65526567000000000000000000000000000000000000000000000000003057307f4e616d6552656700000000000000000000000000000000000000000000000000573360455760415160566000396000f20036602259604556330e0f600f5933ff33560f601e5960003356576000335700604158600035560f602b590033560f60365960003356573360003557600035335700");
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> createAndShowGUI(code, null, null));
|
||||||
public void run() {
|
|
||||||
createAndShowGUI(code, null, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.InputEvent;
|
import java.awt.event.InputEvent;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
|
@ -277,9 +276,7 @@ public class SerpentEditor extends JFrame {
|
||||||
|
|
||||||
mainContentPane.getActionMap().put("OpenFileButton", openFile);
|
mainContentPane.getActionMap().put("OpenFileButton", openFile);
|
||||||
|
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(e -> {
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
File file = callFileChooser();
|
File file = callFileChooser();
|
||||||
try {
|
try {
|
||||||
if (file == null)
|
if (file == null)
|
||||||
|
@ -292,7 +289,6 @@ public class SerpentEditor extends JFrame {
|
||||||
// don't worry it's just the file is empty
|
// don't worry it's just the file is empty
|
||||||
codeArea.setText("");
|
codeArea.setText("");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
toolbar.add(button);
|
toolbar.add(button);
|
||||||
}
|
}
|
||||||
|
@ -331,9 +327,7 @@ public class SerpentEditor extends JFrame {
|
||||||
|
|
||||||
mainContentPane.getActionMap().put("OpenSaveButton", saveFile);
|
mainContentPane.getActionMap().put("OpenSaveButton", saveFile);
|
||||||
|
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(e -> {
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
|
|
||||||
File file = null;
|
File file = null;
|
||||||
|
|
||||||
|
@ -357,7 +351,6 @@ public class SerpentEditor extends JFrame {
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
logger.error(e1.getMessage(), e1);
|
logger.error(e1.getMessage(), e1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
toolbar.add(button);
|
toolbar.add(button);
|
||||||
}
|
}
|
||||||
|
@ -384,12 +377,7 @@ public class SerpentEditor extends JFrame {
|
||||||
|
|
||||||
mainContentPane.getActionMap().put("CompileButton", compile);
|
mainContentPane.getActionMap().put("CompileButton", compile);
|
||||||
|
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(e -> compileCode());
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
compileCode();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
toolbar.add(button);
|
toolbar.add(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,14 +403,12 @@ public class SerpentEditor extends JFrame {
|
||||||
|
|
||||||
mainContentPane.getActionMap().put("DeployButton", deploy);
|
mainContentPane.getActionMap().put("DeployButton", deploy);
|
||||||
|
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(e -> {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
byte[] machineCode = prepareCodeForSend();
|
byte[] machineCode = prepareCodeForSend();
|
||||||
if (machineCode == null) return;
|
if (machineCode == null) return;
|
||||||
ContractSubmitDialog payOutDialog =
|
ContractSubmitDialog payOutDialog =
|
||||||
new ContractSubmitDialog((Frame) SwingUtilities.getAncestorOfClass(JFrame.class,
|
new ContractSubmitDialog((Frame) SwingUtilities.getAncestorOfClass(JFrame.class,
|
||||||
contentPane), machineCode);
|
contentPane), machineCode);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
toolbar.add(button);
|
toolbar.add(button);
|
||||||
}
|
}
|
||||||
|
@ -449,12 +435,10 @@ public class SerpentEditor extends JFrame {
|
||||||
|
|
||||||
mainContentPane.getActionMap().put("CallButton", call);
|
mainContentPane.getActionMap().put("CallButton", call);
|
||||||
|
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(e -> {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
ContractCallDialog payOutDialog = new ContractCallDialog(
|
ContractCallDialog payOutDialog = new ContractCallDialog(
|
||||||
(Frame) SwingUtilities.getAncestorOfClass(
|
(Frame) SwingUtilities.getAncestorOfClass(
|
||||||
JFrame.class, contentPane));
|
JFrame.class, contentPane));
|
||||||
}
|
|
||||||
});
|
});
|
||||||
toolbar.add(button);
|
toolbar.add(button);
|
||||||
}
|
}
|
||||||
|
@ -489,10 +473,6 @@ public class SerpentEditor extends JFrame {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// Start all Swing applications on the EDT.
|
// Start all Swing applications on the EDT.
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> new SerpentEditor(null).setVisible(true));
|
||||||
public void run() {
|
|
||||||
new SerpentEditor(null).setVisible(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,6 @@ import org.ethereum.vm.Program;
|
||||||
import org.spongycastle.util.encoders.Hex;
|
import org.spongycastle.util.encoders.Hex;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.ItemEvent;
|
|
||||||
import java.awt.event.ItemListener;
|
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
|
||||||
|
@ -70,18 +66,11 @@ public class StateExplorerWindow extends JFrame {
|
||||||
btnListAccounts.setBorderPainted(false);
|
btnListAccounts.setBorderPainted(false);
|
||||||
btnListAccounts.setFocusPainted(false);
|
btnListAccounts.setFocusPainted(false);
|
||||||
btnListAccounts.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
btnListAccounts.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||||
btnListAccounts.addItemListener(new ItemListener() {
|
btnListAccounts.addItemListener(e -> SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
|
||||||
public void itemStateChanged(ItemEvent e) {
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
if (accountsListWindow == null)
|
if (accountsListWindow == null)
|
||||||
accountsListWindow = new AccountsListWindow();
|
accountsListWindow = new AccountsListWindow();
|
||||||
accountsListWindow.setVisible(true);
|
accountsListWindow.setVisible(true);
|
||||||
}
|
}));
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
horizontalBox.add(btnListAccounts);
|
horizontalBox.add(btnListAccounts);
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,12 +125,10 @@ public class StateExplorerWindow extends JFrame {
|
||||||
l1.setAlignmentX(Component.CENTER_ALIGNMENT);
|
l1.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||||
JComboBox cmbKey = new JComboBox(dataTypes);
|
JComboBox cmbKey = new JComboBox(dataTypes);
|
||||||
cmbKey.setSelectedIndex(1);
|
cmbKey.setSelectedIndex(1);
|
||||||
cmbKey.addActionListener(new ActionListener() {
|
cmbKey.addActionListener(e -> {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
JComboBox cmb = (JComboBox) e.getSource();
|
JComboBox cmb = (JComboBox) e.getSource();
|
||||||
DataEncodingType t = DataEncodingType.getTypeFromString((String) cmb.getSelectedItem());
|
DataEncodingType t = DataEncodingType.getTypeFromString((String) cmb.getSelectedItem());
|
||||||
dataModel.setKeyEncoding(t);
|
dataModel.setKeyEncoding(t);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
VBox1.add(l1);
|
VBox1.add(l1);
|
||||||
VBox1.add(cmbKey);
|
VBox1.add(cmbKey);
|
||||||
|
@ -152,12 +139,10 @@ public class StateExplorerWindow extends JFrame {
|
||||||
l2.setAlignmentX(Component.CENTER_ALIGNMENT);
|
l2.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||||
JComboBox cmbValue = new JComboBox(dataTypes);
|
JComboBox cmbValue = new JComboBox(dataTypes);
|
||||||
cmbValue.setSelectedIndex(1);
|
cmbValue.setSelectedIndex(1);
|
||||||
cmbValue.addActionListener(new ActionListener() {
|
cmbValue.addActionListener(e -> {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
JComboBox cmb = (JComboBox) e.getSource();
|
JComboBox cmb = (JComboBox) e.getSource();
|
||||||
DataEncodingType t = DataEncodingType.getTypeFromString((String) cmb.getSelectedItem());
|
DataEncodingType t = DataEncodingType.getTypeFromString((String) cmb.getSelectedItem());
|
||||||
dataModel.setValueEncoding(t);
|
dataModel.setValueEncoding(t);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
VBox2.add(l2);
|
VBox2.add(l2);
|
||||||
VBox2.add(cmbValue);
|
VBox2.add(cmbValue);
|
||||||
|
@ -319,10 +304,6 @@ public class StateExplorerWindow extends JFrame {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// Start all Swing applications on the EDT.
|
// Start all Swing applications on the EDT.
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> new StateExplorerWindow(null).setVisible(true));
|
||||||
public void run() {
|
|
||||||
new StateExplorerWindow(null).setVisible(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ItemEvent;
|
import java.awt.event.ItemEvent;
|
||||||
import java.awt.event.ItemListener;
|
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
|
|
||||||
|
@ -108,21 +107,16 @@ public class ToolBar extends JFrame {
|
||||||
editorToggle.setBorderPainted(false);
|
editorToggle.setBorderPainted(false);
|
||||||
editorToggle.setFocusPainted(false);
|
editorToggle.setFocusPainted(false);
|
||||||
editorToggle.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
editorToggle.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||||
editorToggle.addItemListener(new ItemListener() {
|
editorToggle.addItemListener(e -> {
|
||||||
@Override
|
|
||||||
public void itemStateChanged(ItemEvent e) {
|
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
public void run() {
|
|
||||||
if (serpentEditor == null)
|
if (serpentEditor == null)
|
||||||
serpentEditor = new SerpentEditor(ToolBar.this);
|
serpentEditor = new SerpentEditor(ToolBar.this);
|
||||||
serpentEditor.setVisible(true);
|
serpentEditor.setVisible(true);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
||||||
serpentEditor.setVisible(false);
|
serpentEditor.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
logToggle = new JToggleButton();
|
logToggle = new JToggleButton();
|
||||||
|
@ -133,21 +127,16 @@ public class ToolBar extends JFrame {
|
||||||
logToggle.setBorderPainted(false);
|
logToggle.setBorderPainted(false);
|
||||||
logToggle.setFocusPainted(false);
|
logToggle.setFocusPainted(false);
|
||||||
logToggle.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
logToggle.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||||
logToggle.addItemListener(new ItemListener() {
|
logToggle.addItemListener(e -> {
|
||||||
@Override
|
|
||||||
public void itemStateChanged(ItemEvent e) {
|
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
public void run() {
|
|
||||||
if (connectionConsoleWindow == null)
|
if (connectionConsoleWindow == null)
|
||||||
connectionConsoleWindow = new ConnectionConsoleWindow(ToolBar.this);
|
connectionConsoleWindow = new ConnectionConsoleWindow(ToolBar.this);
|
||||||
connectionConsoleWindow.setVisible(true);
|
connectionConsoleWindow.setVisible(true);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
||||||
connectionConsoleWindow.setVisible(false);
|
connectionConsoleWindow.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
peersToggle = new JToggleButton();
|
peersToggle = new JToggleButton();
|
||||||
|
@ -158,21 +147,16 @@ public class ToolBar extends JFrame {
|
||||||
peersToggle.setBorderPainted(false);
|
peersToggle.setBorderPainted(false);
|
||||||
peersToggle.setFocusPainted(false);
|
peersToggle.setFocusPainted(false);
|
||||||
peersToggle.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
peersToggle.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||||
peersToggle.addItemListener(new ItemListener() {
|
peersToggle.addItemListener(e -> {
|
||||||
@Override
|
|
||||||
public void itemStateChanged(ItemEvent e) {
|
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
public void run() {
|
|
||||||
if (mainFrame == null)
|
if (mainFrame == null)
|
||||||
mainFrame = new PeersTableWindow(ToolBar.this);
|
mainFrame = new PeersTableWindow(ToolBar.this);
|
||||||
mainFrame.setVisible(true);
|
mainFrame.setVisible(true);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
||||||
mainFrame.setVisible(false);
|
mainFrame.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
chainToggle = new JToggleButton();
|
chainToggle = new JToggleButton();
|
||||||
|
@ -183,22 +167,17 @@ public class ToolBar extends JFrame {
|
||||||
chainToggle.setBorderPainted(false);
|
chainToggle.setBorderPainted(false);
|
||||||
chainToggle.setFocusPainted(false);
|
chainToggle.setFocusPainted(false);
|
||||||
chainToggle.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
chainToggle.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||||
chainToggle.addItemListener(new ItemListener() {
|
chainToggle.addItemListener(e -> {
|
||||||
@Override
|
|
||||||
public void itemStateChanged(ItemEvent e) {
|
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
public void run() {
|
|
||||||
|
|
||||||
if (blockchainWindow == null)
|
if (blockchainWindow == null)
|
||||||
blockchainWindow = new BlockChainTable(ToolBar.this);
|
blockchainWindow = new BlockChainTable(ToolBar.this);
|
||||||
blockchainWindow.setVisible(true);
|
blockchainWindow.setVisible(true);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
||||||
blockchainWindow.setVisible(false);
|
blockchainWindow.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
walletToggle = new JToggleButton();
|
walletToggle = new JToggleButton();
|
||||||
|
@ -210,22 +189,17 @@ public class ToolBar extends JFrame {
|
||||||
walletToggle.setFocusPainted(false);
|
walletToggle.setFocusPainted(false);
|
||||||
walletToggle.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
walletToggle.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||||
walletToggle.addItemListener(
|
walletToggle.addItemListener(
|
||||||
new ItemListener() {
|
e -> {
|
||||||
@Override
|
|
||||||
public void itemStateChanged(ItemEvent e) {
|
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
public void run() {
|
|
||||||
if (walletWindow == null)
|
if (walletWindow == null)
|
||||||
walletWindow = new WalletWindow(ToolBar.this);
|
walletWindow = new WalletWindow(ToolBar.this);
|
||||||
walletWindow.setVisible(true);
|
walletWindow.setVisible(true);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
||||||
walletWindow.setVisible(false);
|
walletWindow.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
stateExplorer = new JToggleButton();
|
stateExplorer = new JToggleButton();
|
||||||
|
@ -237,22 +211,17 @@ public class ToolBar extends JFrame {
|
||||||
stateExplorer.setFocusPainted(false);
|
stateExplorer.setFocusPainted(false);
|
||||||
stateExplorer.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
stateExplorer.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||||
stateExplorer.addItemListener(
|
stateExplorer.addItemListener(
|
||||||
new ItemListener() {
|
e -> {
|
||||||
@Override
|
|
||||||
public void itemStateChanged(ItemEvent e) {
|
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
public void run() {
|
|
||||||
if (stateExplorerWindow == null)
|
if (stateExplorerWindow == null)
|
||||||
stateExplorerWindow = new StateExplorerWindow(ToolBar.this);
|
stateExplorerWindow = new StateExplorerWindow(ToolBar.this);
|
||||||
stateExplorerWindow.setVisible(true);
|
stateExplorerWindow.setVisible(true);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
||||||
stateExplorerWindow.setVisible(false);
|
stateExplorerWindow.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -268,10 +237,6 @@ public class ToolBar extends JFrame {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> new ToolBar().setVisible(true));
|
||||||
public void run() {
|
|
||||||
new ToolBar().setVisible(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue