Path: blob/master/payloads/library/remote_access/duckNet/Encoder/src/Encoder_GUI.java
3020 views
import java.awt.*;1import java.awt.event.*;2import javax.swing.*;3import javax.swing.JMenu;4import javax.swing.JMenuBar;5import javax.swing.JMenuItem;67public class Encoder_GUI{89private static void createAndShowGUI() {10//Create and set up the window.11JFrame frame = new JFrame("Duck Encoder");12frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);1314JLabel emptyLabel = new JLabel("");15emptyLabel.setPreferredSize(new Dimension(400, 400));16frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);1718//Display the window.19frame.pack();20frame.setVisible(true);2122JMenuBar menubar = new JMenuBar();23JMenu file = new JMenu("File");24JMenuItem eMenuItem = new JMenuItem("Exit");25eMenuItem.setMnemonic(KeyEvent.VK_C);26eMenuItem.setToolTipText("Exit application");27eMenuItem.addActionListener(new ActionListener() {28public void actionPerformed(ActionEvent event) {29System.exit(0);30}3132});3334file.add(eMenuItem);3536menubar.add(file);3738setJMenuBar(menubar);3940setTitle("Simple menu");41setSize(300, 200);42setLocationRelativeTo(null);43setDefaultCloseOperation(EXIT_ON_CLOSE);44}4546public static void main(String[] args) {47//Schedule a job for the event-dispatching thread:48//creating and showing this application's GUI.49javax.swing.SwingUtilities.invokeLater(new Runnable() {50public void run() {51createAndShowGUI();52}53});54}55}5657