Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.Redstone_Pro_73.CV7;
- import java.awt.*;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.io.BufferedReader;
- import java.io.FileReader;
- import java.net.URL;
- import javax.swing.*;
- @SuppressWarnings("serial")
- public class Panel extends JPanel implements ActionListener {
- public static JFrame frame = new JFrame ("RedCraft Network");
- public static JButton startminecraft = new JButton("Start");
- public static JButton stopminecraft = new JButton("Stop");
- public static JButton consoleminecraft = new JButton("Console");
- public static void main (String[] args) throws Exception {
- build();
- }
- public static void build() throws Exception {
- //font
- URL fontUrl = new URL("http://www.WebpagePublicity.com/free-fonts/a/Amiga%20Forever.ttf");
- Font font = Font.createFont(Font.TRUETYPE_FONT, fontUrl.openStream());
- font = font.deriveFont(Font.PLAIN,20);
- GraphicsEnvironment ge =
- GraphicsEnvironment.getLocalGraphicsEnvironment();
- ge.registerFont(font);
- //add labels
- JLabel welcome = new JLabel("<html>Loading</html>", JLabel.CENTER);
- welcome.setBounds(250, 150, 200, 100);
- welcome.setFont(font);
- welcome.setForeground(Color.decode("#9b59b6"));
- frame.add(welcome);
- welcome.setVisible(true);
- JLabel minecraft = new JLabel("<html>Minecraft</html>", JLabel.CENTER);
- minecraft.setBounds(20, 20, 200, 100);
- minecraft.setFont(font);
- minecraft.setForeground(Color.decode("#3498db"));
- frame.add(minecraft);
- minecraft.setVisible(false);
- JLabel server1 = new JLabel("<html>Server</html>", JLabel.CENTER);
- server1.setBounds(20, 40, 200, 100);
- server1.setFont(font);
- server1.setForeground(Color.decode("#2980b9"));
- frame.add(server1);
- server1.setVisible(false);
- //add buttons
- startminecraft.setBounds(40, 120, 150, 40);
- startminecraft.setFont(font);
- startminecraft.setForeground(Color.decode("#2ecc71"));
- frame.add(startminecraft);
- startminecraft.setVisible(false);
- stopminecraft.setBounds(40, 220, 150, 40);
- stopminecraft.setFont(font);
- stopminecraft.setForeground(Color.decode("#e74c3c"));
- frame.add(stopminecraft);
- stopminecraft.setVisible(false);
- consoleminecraft.setBounds(40, 320, 150, 40);
- consoleminecraft.setFont(font);
- consoleminecraft.setForeground(Color.decode("#f1c40f"));
- frame.add(consoleminecraft);
- consoleminecraft.setVisible(false);
- //add text fields
- String file = "/Applications/Console/v7/latest.log";
- JTextArea area = new JTextArea();
- area.setBounds(250, 25, 400, 350);
- JScrollPane scrollPane = new JScrollPane(area);
- scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
- frame.add(scrollPane);
- @SuppressWarnings("resource")
- BufferedReader in = new BufferedReader(new FileReader(file));
- String line = in.readLine();
- while(line != null){
- area.append(line + "\n");
- line = in.readLine();
- }
- frame.add(area);
- //other
- frame.setResizable(false);
- frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().add (new Panel());
- //other
- frame.pack();
- frame.setSize(700, 500);
- frame.setVisible (true);
- //Main.activate("start", "main");
- try {
- Thread.sleep(300);
- } catch(InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- welcome.setText("<html>Loading.</html>");
- try {
- Thread.sleep(300);
- } catch(InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- welcome.setText("<html>Loading..</html>");
- try {
- Thread.sleep(300);
- } catch(InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- welcome.setText("<html>Loading...</html>");
- try {
- Thread.sleep(300);
- } catch(InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- welcome.setText("<html>Loading</html>");
- try {
- Thread.sleep(300);
- } catch(InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- welcome.setText("<html>Loading.</html>");
- try {
- Thread.sleep(300);
- } catch(InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- welcome.setText("<html>Loading..</html>");
- try {
- Thread.sleep(300);
- } catch(InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- welcome.setVisible(false);
- startminecraft.setVisible(true);
- stopminecraft.setVisible(true);
- consoleminecraft.setVisible(true);
- minecraft.setVisible(true);
- server1.setVisible(true);
- startminecraft.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- Main.activate("start", "minecraft");
- }
- });
- stopminecraft.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- Main.activate("stop", "minecraft");
- }
- });
- }
- @Override
- public void actionPerformed(ActionEvent e) {
- // TODO Auto-generated method stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement