Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.50 KB | None | 0 0
  1. package de.filoofox.frames;
  2.  
  3. import java.awt.EventQueue;
  4. import javax.swing.JFrame;
  5. import javax.swing.JPanel;
  6. import javax.swing.border.EmptyBorder;
  7. import javax.swing.JButton;
  8. import java.awt.Font;
  9. import java.awt.Color;
  10. import java.awt.Toolkit;
  11. import javax.swing.GroupLayout;
  12. import javax.swing.GroupLayout.Alignment;
  13. import javax.swing.LayoutStyle.ComponentPlacement;
  14. import java.awt.event.ActionListener;
  15. import java.io.IOException;
  16. import java.awt.event.ActionEvent;
  17. import javax.swing.JLabel;
  18. import javax.swing.JTextField;
  19.  
  20. @SuppressWarnings("serial")
  21. public class MainFrame extends JFrame {
  22.  
  23. Runtime rt = Runtime.getRuntime();
  24.  
  25. private JPanel contentPane;
  26.  
  27. public static String SpigotJar = "E:\\Programming\\Minecraft\\Test-Server/spigot.jar";
  28. private JTextField txtSpigotjarPath;
  29. public boolean isRestarting;
  30.  
  31.  
  32. /**
  33. * Launch the application.
  34. */
  35. public static void main(String[] args) {
  36. EventQueue.invokeLater(new Runnable() {
  37. public void run() {
  38. try {
  39. MainFrame frame = new MainFrame();
  40. frame.setVisible(true);
  41. } catch (Exception e) {
  42. e.printStackTrace();
  43. }
  44. }
  45. });
  46. }
  47.  
  48. /**
  49. * Create the frame.
  50. */
  51. public MainFrame() {
  52. setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\noack\\OneDrive\\Desktop\\img.jpg"));
  53. setTitle("Launch");
  54. setBackground(Color.DARK_GRAY);
  55. setResizable(false);
  56. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  57. setBounds(100, 100, 1189, 743);
  58. contentPane = new JPanel();
  59. contentPane.setBackground(Color.DARK_GRAY);
  60. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  61. setContentPane(contentPane);
  62.  
  63. JButton btnLaunch = new JButton("Launch");
  64. btnLaunch.setForeground(Color.GREEN);
  65. btnLaunch.setBackground(Color.GRAY);
  66. btnLaunch.setFont(new Font("Tahoma", Font.BOLD, 50));
  67. btnLaunch.setFocusPainted(false);
  68.  
  69. JButton btnRestart = new JButton("Restart");
  70. btnRestart.setBackground(Color.GRAY);
  71. btnRestart.setFont(new Font("Tahoma", Font.PLAIN, 35));
  72. btnRestart.setFocusPainted(false);
  73.  
  74. JButton btnStop = new JButton("Stop");
  75. btnStop.setBackground(Color.GRAY);
  76. btnStop.setFont(new Font("Tahoma", Font.PLAIN, 35));
  77. btnStop.setFocusPainted(false);
  78.  
  79. JLabel lblServerLauncher = new JLabel("Server 1 Launcher");
  80. lblServerLauncher.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 80));
  81. lblServerLauncher.setForeground(Color.GRAY);
  82.  
  83. JLabel lblfiloofox = new JLabel("@FilooFox");
  84. lblfiloofox.setForeground(Color.GRAY);
  85. lblfiloofox.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 80));
  86.  
  87. txtSpigotjarPath = new JTextField();
  88. txtSpigotjarPath.setBackground(Color.GRAY);
  89. txtSpigotjarPath.setFont(new Font("Tahoma", Font.PLAIN, 30));
  90. txtSpigotjarPath.setForeground(new Color(0, 0, 0));
  91. txtSpigotjarPath.setText(" Spigot.jar path");
  92. txtSpigotjarPath.setColumns(10);
  93.  
  94.  
  95. GroupLayout gl_contentPane = new GroupLayout(contentPane);
  96. gl_contentPane.setHorizontalGroup(
  97. gl_contentPane.createParallelGroup(Alignment.LEADING)
  98. .addGroup(gl_contentPane.createSequentialGroup()
  99. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  100. .addComponent(btnLaunch, GroupLayout.PREFERRED_SIZE, 1162, GroupLayout.PREFERRED_SIZE)
  101. .addGroup(gl_contentPane.createSequentialGroup()
  102. .addComponent(btnRestart, GroupLayout.PREFERRED_SIZE, 576, GroupLayout.PREFERRED_SIZE)
  103. .addPreferredGap(ComponentPlacement.UNRELATED)
  104. .addComponent(btnStop, GroupLayout.DEFAULT_SIZE, 577, Short.MAX_VALUE))
  105. .addGroup(gl_contentPane.createSequentialGroup()
  106. .addGap(402)
  107. .addComponent(lblfiloofox, GroupLayout.PREFERRED_SIZE, 418, GroupLayout.PREFERRED_SIZE))
  108. .addGroup(gl_contentPane.createSequentialGroup()
  109. .addGap(220)
  110. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
  111. .addComponent(txtSpigotjarPath, Alignment.TRAILING)
  112. .addComponent(lblServerLauncher, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  113. .addContainerGap())
  114. );
  115. gl_contentPane.setVerticalGroup(
  116. gl_contentPane.createParallelGroup(Alignment.LEADING)
  117. .addGroup(gl_contentPane.createSequentialGroup()
  118. .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
  119. .addComponent(btnRestart, GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE)
  120. .addComponent(btnStop, GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE))
  121. .addGap(18)
  122. .addComponent(lblServerLauncher, GroupLayout.PREFERRED_SIZE, 132, GroupLayout.PREFERRED_SIZE)
  123. .addPreferredGap(ComponentPlacement.RELATED)
  124. .addComponent(lblfiloofox, GroupLayout.PREFERRED_SIZE, 83, GroupLayout.PREFERRED_SIZE)
  125. .addPreferredGap(ComponentPlacement.RELATED)
  126. .addComponent(txtSpigotjarPath, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE)
  127. .addGap(165)
  128. .addComponent(btnLaunch, GroupLayout.PREFERRED_SIZE, 79, GroupLayout.PREFERRED_SIZE)
  129. .addContainerGap())
  130. );
  131. contentPane.setLayout(gl_contentPane);
  132.  
  133. btnLaunch.addActionListener(new ActionListener() {
  134. public void actionPerformed(ActionEvent arg0) {
  135.  
  136. try {
  137. rt.exec(SpigotJar);
  138.  
  139. } catch (IOException e) {
  140. // TODO Auto-generated catch block
  141. e.printStackTrace();
  142. }
  143.  
  144. }
  145. });
  146.  
  147. btnRestart.addActionListener(new ActionListener() {
  148. public void actionPerformed(ActionEvent arg0) {
  149.  
  150. }
  151. });
  152.  
  153.  
  154. }
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement