示例#1
0
        public static void initGui(MinecraftServer minecraftserver)
        {
            try
            {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            }
            catch (Exception)
            {
            }
            var servergui = new ServerGUI(minecraftserver);
            var jframe    = new JFrame("Minecraft server");

            jframe.add(servergui);
            jframe.pack();
            jframe.setLocationRelativeTo(null);
            jframe.setVisible(true);
            jframe.addWindowListener(new ServerWindowAdapter(minecraftserver));
        }
示例#2
0
 public void imageBegin(int w, int h, int bucketSize)
 {
     lock (lockObj)
     {
         if (frame != null && image != null && w == image.getWidth() && h == image.getHeight())
         {
             // nothing to do
         }
         else
         {
             // allocate new framebuffer
             pixels = new int[w * h];
             image  = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
             // prepare frame
             if (frame == null)
             {
                 setPreferredSize(new Dimension(w, h));
                 frame = new JFrame("Sunflow v" + SunflowAPI.VERSION);
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//fixme: change to WinForms
                 //frame.addKeyListener(new KeyAdapter() {
                 //    @Override
                 //    public void keyPressed(KeyEvent e) {
                 //        if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
                 //            System.exit(0);
                 //    }
                 //});
                 frame.setContentPane(this);
                 frame.pack();
                 frame.setLocationRelativeTo(null);
                 frame.setVisible(true);
             }
         }
         // start counter
         t.start();
     }
 }
示例#3
0
 public void imageBegin(int w, int h, int bucketSize)
 {
     lock (lockObj)
     {
         if (frame != null && image != null && w == image.getWidth() && h == image.getHeight())
         {
             // nothing to do
         }
         else
         {
             // allocate new framebuffer
             pixels = new int[w * h];
             image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
             // prepare frame
             if (frame == null)
             {
                 setPreferredSize(new Dimension(w, h));
                 frame = new JFrame("Sunflow v" + SunflowAPI.VERSION);
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//fixme: change to WinForms
                 //frame.addKeyListener(new KeyAdapter() {
                 //    @Override
                 //    public void keyPressed(KeyEvent e) {
                 //        if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
                 //            System.exit(0);
                 //    }
                 //});
                 frame.setContentPane(this);
                 frame.pack();
                 frame.setLocationRelativeTo(null);
                 frame.setVisible(true);
             }
         }
         // start counter
         t.start();
     }
 }