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,20 +132,17 @@ public abstract class FastByteComparisons {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
theUnsafe = (Unsafe) AccessController.doPrivileged(
|
theUnsafe = (Unsafe) AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Object>() {
|
(PrivilegedAction<Object>) () -> {
|
||||||
@Override
|
try {
|
||||||
public Object run() {
|
Field f = Unsafe.class.getDeclaredField("theUnsafe");
|
||||||
try {
|
f.setAccessible(true);
|
||||||
Field f = Unsafe.class.getDeclaredField("theUnsafe");
|
return f.get(null);
|
||||||
f.setAccessible(true);
|
} catch (NoSuchFieldException e) {
|
||||||
return f.get(null);
|
// It doesn't matter what we throw;
|
||||||
} catch (NoSuchFieldException e) {
|
// it's swallowed in getBestComparer().
|
||||||
// It doesn't matter what we throw;
|
throw new Error();
|
||||||
// it's swallowed in getBestComparer().
|
} catch (IllegalAccessException e) {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -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
|
if (transactionDataWindow == null)
|
||||||
public void actionPerformed(ActionEvent event) {
|
transactionDataWindow = new TransactionData(blockchainTable);
|
||||||
if (transactionDataWindow == null)
|
transactionDataWindow.setData(transaction.getData());
|
||||||
transactionDataWindow = new TransactionData(blockchainTable);
|
transactionDataWindow.setVisible(true);
|
||||||
transactionDataWindow.setData(transaction.getData());
|
transactionDataWindow.highlightText(findText.getText(), painter);
|
||||||
transactionDataWindow.setVisible(true);
|
|
||||||
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,21 +276,18 @@ public class SerpentEditor extends JFrame {
|
||||||
|
|
||||||
mainContentPane.getActionMap().put("OpenFileButton", openFile);
|
mainContentPane.getActionMap().put("OpenFileButton", openFile);
|
||||||
|
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(e -> {
|
||||||
@Override
|
File file = callFileChooser();
|
||||||
public void actionPerformed(ActionEvent e) {
|
try {
|
||||||
File file = callFileChooser();
|
if (file == null)
|
||||||
try {
|
return;
|
||||||
if (file == null)
|
String content = new Scanner(file).useDelimiter("\\Z").next();
|
||||||
return;
|
codeArea.setText(content);
|
||||||
String content = new Scanner(file).useDelimiter("\\Z").next();
|
} catch (FileNotFoundException e1) {
|
||||||
codeArea.setText(content);
|
logger.error(e1.getMessage(), e1);
|
||||||
} catch (FileNotFoundException e1) {
|
} catch (java.util.NoSuchElementException e2) {
|
||||||
logger.error(e1.getMessage(), e1);
|
// don't worry it's just the file is empty
|
||||||
} catch (java.util.NoSuchElementException e2) {
|
codeArea.setText("");
|
||||||
// don't worry it's just the file is empty
|
|
||||||
codeArea.setText("");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
toolbar.add(button);
|
toolbar.add(button);
|
||||||
|
@ -331,32 +327,29 @@ 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;
|
||||||
|
|
||||||
if (e.getModifiers() == (InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK)) {
|
if (e.getModifiers() == (InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK)) {
|
||||||
file = callFileChooser();
|
file = callFileChooser();
|
||||||
if (file == null)
|
if (file == null)
|
||||||
return;
|
return;
|
||||||
} else if (fileChooser == null
|
} else if (fileChooser == null
|
||||||
|| fileChooser.getSelectedFile() == null) {
|
|| fileChooser.getSelectedFile() == null) {
|
||||||
file = callFileChooser();
|
file = callFileChooser();
|
||||||
if (file == null)
|
if (file == null)
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
file = fileChooser.getSelectedFile();
|
file = fileChooser.getSelectedFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BufferedWriter out = new BufferedWriter(new FileWriter(file), 32768);
|
BufferedWriter out = new BufferedWriter(new FileWriter(file), 32768);
|
||||||
out.write(codeArea.getText());
|
out.write(codeArea.getText());
|
||||||
out.close();
|
out.close();
|
||||||
} 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
|
if (accountsListWindow == null)
|
||||||
public void itemStateChanged(ItemEvent e) {
|
accountsListWindow = new AccountsListWindow();
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
accountsListWindow.setVisible(true);
|
||||||
public void run() {
|
}));
|
||||||
if (accountsListWindow == null)
|
|
||||||
accountsListWindow = new AccountsListWindow();
|
|
||||||
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,20 +107,15 @@ 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
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
public void itemStateChanged(ItemEvent e) {
|
SwingUtilities.invokeLater(() -> {
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
if (serpentEditor == null)
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
serpentEditor = new SerpentEditor(ToolBar.this);
|
||||||
public void run() {
|
serpentEditor.setVisible(true);
|
||||||
if (serpentEditor == null)
|
});
|
||||||
serpentEditor = new SerpentEditor(ToolBar.this);
|
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
||||||
serpentEditor.setVisible(true);
|
serpentEditor.setVisible(false);
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
|
||||||
serpentEditor.setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -133,20 +127,15 @@ 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
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
public void itemStateChanged(ItemEvent e) {
|
SwingUtilities.invokeLater(() -> {
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
if (connectionConsoleWindow == null)
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
connectionConsoleWindow = new ConnectionConsoleWindow(ToolBar.this);
|
||||||
public void run() {
|
connectionConsoleWindow.setVisible(true);
|
||||||
if (connectionConsoleWindow == null)
|
});
|
||||||
connectionConsoleWindow = new ConnectionConsoleWindow(ToolBar.this);
|
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
||||||
connectionConsoleWindow.setVisible(true);
|
connectionConsoleWindow.setVisible(false);
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
|
||||||
connectionConsoleWindow.setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -158,20 +147,15 @@ 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
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
public void itemStateChanged(ItemEvent e) {
|
SwingUtilities.invokeLater(() -> {
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
if (mainFrame == null)
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
mainFrame = new PeersTableWindow(ToolBar.this);
|
||||||
public void run() {
|
mainFrame.setVisible(true);
|
||||||
if (mainFrame == null)
|
});
|
||||||
mainFrame = new PeersTableWindow(ToolBar.this);
|
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
||||||
mainFrame.setVisible(true);
|
mainFrame.setVisible(false);
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
|
||||||
mainFrame.setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -183,21 +167,16 @@ 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
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
public void itemStateChanged(ItemEvent e) {
|
SwingUtilities.invokeLater(() -> {
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -210,20 +189,15 @@ 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
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
public void itemStateChanged(ItemEvent e) {
|
SwingUtilities.invokeLater(() -> {
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
if (walletWindow == null)
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
walletWindow = new WalletWindow(ToolBar.this);
|
||||||
public void run() {
|
walletWindow.setVisible(true);
|
||||||
if (walletWindow == null)
|
});
|
||||||
walletWindow = new WalletWindow(ToolBar.this);
|
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
||||||
walletWindow.setVisible(true);
|
walletWindow.setVisible(false);
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
|
||||||
walletWindow.setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -237,20 +211,15 @@ 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
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
public void itemStateChanged(ItemEvent e) {
|
SwingUtilities.invokeLater(() -> {
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
if (stateExplorerWindow == null)
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
stateExplorerWindow = new StateExplorerWindow(ToolBar.this);
|
||||||
public void run() {
|
stateExplorerWindow.setVisible(true);
|
||||||
if (stateExplorerWindow == null)
|
});
|
||||||
stateExplorerWindow = new StateExplorerWindow(ToolBar.this);
|
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
||||||
stateExplorerWindow.setVisible(true);
|
stateExplorerWindow.setVisible(false);
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
|
|
||||||
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