Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hak5
GitHub Repository: hak5/usbrubberducky-payloads
Path: blob/master/payloads/library/remote_access/duckNet/Encoder/src/Encoder_GUI.java
3020 views
1
import java.awt.*;
2
import java.awt.event.*;
3
import javax.swing.*;
4
import javax.swing.JMenu;
5
import javax.swing.JMenuBar;
6
import javax.swing.JMenuItem;
7
8
public class Encoder_GUI{
9
10
private static void createAndShowGUI() {
11
//Create and set up the window.
12
JFrame frame = new JFrame("Duck Encoder");
13
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
14
15
JLabel emptyLabel = new JLabel("");
16
emptyLabel.setPreferredSize(new Dimension(400, 400));
17
frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);
18
19
//Display the window.
20
frame.pack();
21
frame.setVisible(true);
22
23
JMenuBar menubar = new JMenuBar();
24
JMenu file = new JMenu("File");
25
JMenuItem eMenuItem = new JMenuItem("Exit");
26
eMenuItem.setMnemonic(KeyEvent.VK_C);
27
eMenuItem.setToolTipText("Exit application");
28
eMenuItem.addActionListener(new ActionListener() {
29
public void actionPerformed(ActionEvent event) {
30
System.exit(0);
31
}
32
33
});
34
35
file.add(eMenuItem);
36
37
menubar.add(file);
38
39
setJMenuBar(menubar);
40
41
setTitle("Simple menu");
42
setSize(300, 200);
43
setLocationRelativeTo(null);
44
setDefaultCloseOperation(EXIT_ON_CLOSE);
45
}
46
47
public static void main(String[] args) {
48
//Schedule a job for the event-dispatching thread:
49
//creating and showing this application's GUI.
50
javax.swing.SwingUtilities.invokeLater(new Runnable() {
51
public void run() {
52
createAndShowGUI();
53
}
54
});
55
}
56
}
57