Advertisement
Guest User

Untitled

a guest
May 8th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.64 KB | None | 0 0
  1. package me.Redstone_Pro_73.CV7;
  2.  
  3. import java.awt.*;
  4. import java.awt.event.ActionEvent;
  5. import java.awt.event.ActionListener;
  6. import java.io.BufferedReader;
  7. import java.io.FileReader;
  8. import java.net.URL;
  9.  
  10. import javax.swing.*;
  11.  
  12. @SuppressWarnings("serial")
  13. public class Panel extends JPanel implements ActionListener {
  14.  
  15. public static JFrame frame = new JFrame ("RedCraft Network");
  16.  
  17. public static JButton startminecraft = new JButton("Start");
  18. public static JButton stopminecraft = new JButton("Stop");
  19. public static JButton consoleminecraft = new JButton("Console");
  20.  
  21. public static void main (String[] args) throws Exception {
  22. build();
  23. }
  24.  
  25. public static void build() throws Exception {
  26. //font
  27. URL fontUrl = new URL("http://www.WebpagePublicity.com/free-fonts/a/Amiga%20Forever.ttf");
  28. Font font = Font.createFont(Font.TRUETYPE_FONT, fontUrl.openStream());
  29. font = font.deriveFont(Font.PLAIN,20);
  30. GraphicsEnvironment ge =
  31. GraphicsEnvironment.getLocalGraphicsEnvironment();
  32. ge.registerFont(font);
  33.  
  34. //add labels
  35. JLabel welcome = new JLabel("<html>Loading</html>", JLabel.CENTER);
  36. welcome.setBounds(250, 150, 200, 100);
  37. welcome.setFont(font);
  38. welcome.setForeground(Color.decode("#9b59b6"));
  39. frame.add(welcome);
  40. welcome.setVisible(true);
  41.  
  42. JLabel minecraft = new JLabel("<html>Minecraft</html>", JLabel.CENTER);
  43. minecraft.setBounds(20, 20, 200, 100);
  44. minecraft.setFont(font);
  45. minecraft.setForeground(Color.decode("#3498db"));
  46. frame.add(minecraft);
  47. minecraft.setVisible(false);
  48.  
  49. JLabel server1 = new JLabel("<html>Server</html>", JLabel.CENTER);
  50. server1.setBounds(20, 40, 200, 100);
  51. server1.setFont(font);
  52. server1.setForeground(Color.decode("#2980b9"));
  53. frame.add(server1);
  54. server1.setVisible(false);
  55.  
  56. //add buttons
  57. startminecraft.setBounds(40, 120, 150, 40);
  58. startminecraft.setFont(font);
  59. startminecraft.setForeground(Color.decode("#2ecc71"));
  60. frame.add(startminecraft);
  61. startminecraft.setVisible(false);
  62.  
  63. stopminecraft.setBounds(40, 220, 150, 40);
  64. stopminecraft.setFont(font);
  65. stopminecraft.setForeground(Color.decode("#e74c3c"));
  66. frame.add(stopminecraft);
  67. stopminecraft.setVisible(false);
  68.  
  69. consoleminecraft.setBounds(40, 320, 150, 40);
  70. consoleminecraft.setFont(font);
  71. consoleminecraft.setForeground(Color.decode("#f1c40f"));
  72. frame.add(consoleminecraft);
  73. consoleminecraft.setVisible(false);
  74.  
  75. //add text fields
  76. String file = "/Applications/Console/v7/latest.log";
  77.  
  78. JTextArea area = new JTextArea();
  79. area.setBounds(250, 25, 400, 350);
  80.  
  81. JScrollPane scrollPane = new JScrollPane(area);
  82. scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
  83. frame.add(scrollPane);
  84.  
  85. @SuppressWarnings("resource")
  86. BufferedReader in = new BufferedReader(new FileReader(file));
  87. String line = in.readLine();
  88. while(line != null){
  89. area.append(line + "\n");
  90. line = in.readLine();
  91. }
  92. frame.add(area);
  93.  
  94. //other
  95. frame.setResizable(false);
  96. frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
  97. frame.getContentPane().add (new Panel());
  98.  
  99. //other
  100. frame.pack();
  101. frame.setSize(700, 500);
  102. frame.setVisible (true);
  103.  
  104. //Main.activate("start", "main");
  105.  
  106. try {
  107. Thread.sleep(300);
  108. } catch(InterruptedException ex) {
  109. Thread.currentThread().interrupt();
  110. }
  111.  
  112. welcome.setText("<html>Loading.</html>");
  113.  
  114. try {
  115. Thread.sleep(300);
  116. } catch(InterruptedException ex) {
  117. Thread.currentThread().interrupt();
  118. }
  119.  
  120. welcome.setText("<html>Loading..</html>");
  121.  
  122. try {
  123. Thread.sleep(300);
  124. } catch(InterruptedException ex) {
  125. Thread.currentThread().interrupt();
  126. }
  127.  
  128. welcome.setText("<html>Loading...</html>");
  129.  
  130. try {
  131. Thread.sleep(300);
  132. } catch(InterruptedException ex) {
  133. Thread.currentThread().interrupt();
  134. }
  135.  
  136. welcome.setText("<html>Loading</html>");
  137.  
  138. try {
  139. Thread.sleep(300);
  140. } catch(InterruptedException ex) {
  141. Thread.currentThread().interrupt();
  142. }
  143.  
  144. welcome.setText("<html>Loading.</html>");
  145.  
  146. try {
  147. Thread.sleep(300);
  148. } catch(InterruptedException ex) {
  149. Thread.currentThread().interrupt();
  150. }
  151.  
  152. welcome.setText("<html>Loading..</html>");
  153.  
  154. try {
  155. Thread.sleep(300);
  156. } catch(InterruptedException ex) {
  157. Thread.currentThread().interrupt();
  158. }
  159.  
  160. welcome.setVisible(false);
  161. startminecraft.setVisible(true);
  162. stopminecraft.setVisible(true);
  163. consoleminecraft.setVisible(true);
  164. minecraft.setVisible(true);
  165. server1.setVisible(true);
  166.  
  167. startminecraft.addActionListener(new ActionListener() {
  168.  
  169. public void actionPerformed(ActionEvent event) {
  170. Main.activate("start", "minecraft");
  171. }
  172.  
  173. });
  174.  
  175. stopminecraft.addActionListener(new ActionListener() {
  176.  
  177. public void actionPerformed(ActionEvent event) {
  178. Main.activate("stop", "minecraft");
  179. }
  180.  
  181. });
  182. }
  183.  
  184. @Override
  185. public void actionPerformed(ActionEvent e) {
  186. // TODO Auto-generated method stub
  187.  
  188. }
  189.  
  190. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement