/net/minecraft/server/ServerGUI.java
https://bitbucket.org/agaricusb/mc-dev · Java · 93 lines · 75 code · 18 blank · 0 comment · 0 complexity · 416ae38f116e51de9a37be89ce6c0c56 MD5 · raw file
- package net.minecraft.server;
- import java.awt.BorderLayout;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.util.logging.Logger;
- import javax.swing.JComponent;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.JScrollPane;
- import javax.swing.JTextArea;
- import javax.swing.JTextField;
- import javax.swing.UIManager;
- import javax.swing.border.EtchedBorder;
- import javax.swing.border.TitledBorder;
- public class ServerGUI extends JComponent {
- public static Logger a = Logger.getLogger("Minecraft");
- private static boolean b = false;
- private DedicatedServer c;
- public static void a(DedicatedServer dedicatedserver) {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (Exception exception) {
- ;
- }
- ServerGUI servergui = new ServerGUI(dedicatedserver);
- b = true;
- JFrame jframe = new JFrame("Minecraft server");
- jframe.add(servergui);
- jframe.pack();
- jframe.setLocationRelativeTo((Component) null);
- jframe.setVisible(true);
- jframe.addWindowListener(new ServerWindowAdapter(dedicatedserver));
- }
- public ServerGUI(DedicatedServer dedicatedserver) {
- this.c = dedicatedserver;
- this.setPreferredSize(new Dimension(854, 480));
- this.setLayout(new BorderLayout());
- try {
- this.add(this.d(), "Center");
- this.add(this.b(), "West");
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- }
- private JComponent b() {
- JPanel jpanel = new JPanel(new BorderLayout());
- jpanel.add(new GuiStatsComponent(this.c), "North");
- jpanel.add(this.c(), "Center");
- jpanel.setBorder(new TitledBorder(new EtchedBorder(), "Stats"));
- return jpanel;
- }
- private JComponent c() {
- PlayerListBox playerlistbox = new PlayerListBox(this.c);
- JScrollPane jscrollpane = new JScrollPane(playerlistbox, 22, 30);
- jscrollpane.setBorder(new TitledBorder(new EtchedBorder(), "Players"));
- return jscrollpane;
- }
- private JComponent d() {
- JPanel jpanel = new JPanel(new BorderLayout());
- JTextArea jtextarea = new JTextArea();
- a.addHandler(new GuiLogOutputHandler(jtextarea));
- JScrollPane jscrollpane = new JScrollPane(jtextarea, 22, 30);
- jtextarea.setEditable(false);
- JTextField jtextfield = new JTextField();
- jtextfield.addActionListener(new ServerGuiCommandListener(this, jtextfield));
- jtextarea.addFocusListener(new ServerGuiFocusAdapter(this));
- jpanel.add(jscrollpane, "Center");
- jpanel.add(jtextfield, "South");
- jpanel.setBorder(new TitledBorder(new EtchedBorder(), "Log and chat"));
- return jpanel;
- }
- static DedicatedServer a(ServerGUI servergui) {
- return servergui.c;
- }
- }