Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.filoofox.frames;
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.border.EmptyBorder;
- import javax.swing.JButton;
- import java.awt.Font;
- import java.awt.Color;
- import java.awt.Toolkit;
- import javax.swing.GroupLayout;
- import javax.swing.GroupLayout.Alignment;
- import javax.swing.LayoutStyle.ComponentPlacement;
- import java.awt.event.ActionListener;
- import java.io.IOException;
- import java.awt.event.ActionEvent;
- import javax.swing.JLabel;
- import javax.swing.JTextField;
- @SuppressWarnings("serial")
- public class MainFrame extends JFrame {
- Runtime rt = Runtime.getRuntime();
- private JPanel contentPane;
- public static String SpigotJar = "E:\\Programming\\Minecraft\\Test-Server/spigot.jar";
- private JTextField txtSpigotjarPath;
- public boolean isRestarting;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- MainFrame frame = new MainFrame();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- */
- public MainFrame() {
- setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\noack\\OneDrive\\Desktop\\img.jpg"));
- setTitle("Launch");
- setBackground(Color.DARK_GRAY);
- setResizable(false);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 1189, 743);
- contentPane = new JPanel();
- contentPane.setBackground(Color.DARK_GRAY);
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- setContentPane(contentPane);
- JButton btnLaunch = new JButton("Launch");
- btnLaunch.setForeground(Color.GREEN);
- btnLaunch.setBackground(Color.GRAY);
- btnLaunch.setFont(new Font("Tahoma", Font.BOLD, 50));
- btnLaunch.setFocusPainted(false);
- JButton btnRestart = new JButton("Restart");
- btnRestart.setBackground(Color.GRAY);
- btnRestart.setFont(new Font("Tahoma", Font.PLAIN, 35));
- btnRestart.setFocusPainted(false);
- JButton btnStop = new JButton("Stop");
- btnStop.setBackground(Color.GRAY);
- btnStop.setFont(new Font("Tahoma", Font.PLAIN, 35));
- btnStop.setFocusPainted(false);
- JLabel lblServerLauncher = new JLabel("Server 1 Launcher");
- lblServerLauncher.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 80));
- lblServerLauncher.setForeground(Color.GRAY);
- JLabel lblfiloofox = new JLabel("@FilooFox");
- lblfiloofox.setForeground(Color.GRAY);
- lblfiloofox.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 80));
- txtSpigotjarPath = new JTextField();
- txtSpigotjarPath.setBackground(Color.GRAY);
- txtSpigotjarPath.setFont(new Font("Tahoma", Font.PLAIN, 30));
- txtSpigotjarPath.setForeground(new Color(0, 0, 0));
- txtSpigotjarPath.setText(" Spigot.jar path");
- txtSpigotjarPath.setColumns(10);
- GroupLayout gl_contentPane = new GroupLayout(contentPane);
- gl_contentPane.setHorizontalGroup(
- gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addComponent(btnLaunch, GroupLayout.PREFERRED_SIZE, 1162, GroupLayout.PREFERRED_SIZE)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(btnRestart, GroupLayout.PREFERRED_SIZE, 576, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addComponent(btnStop, GroupLayout.DEFAULT_SIZE, 577, Short.MAX_VALUE))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGap(402)
- .addComponent(lblfiloofox, GroupLayout.PREFERRED_SIZE, 418, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGap(220)
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
- .addComponent(txtSpigotjarPath, Alignment.TRAILING)
- .addComponent(lblServerLauncher, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addContainerGap())
- );
- gl_contentPane.setVerticalGroup(
- gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
- .addComponent(btnRestart, GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE)
- .addComponent(btnStop, GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE))
- .addGap(18)
- .addComponent(lblServerLauncher, GroupLayout.PREFERRED_SIZE, 132, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(lblfiloofox, GroupLayout.PREFERRED_SIZE, 83, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(txtSpigotjarPath, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE)
- .addGap(165)
- .addComponent(btnLaunch, GroupLayout.PREFERRED_SIZE, 79, GroupLayout.PREFERRED_SIZE)
- .addContainerGap())
- );
- contentPane.setLayout(gl_contentPane);
- btnLaunch.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- try {
- rt.exec(SpigotJar);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- });
- btnRestart.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement