Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Submitted on July 15, 2016 at 08:46 PM

Section 1 (Java)

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import javax.swing.JButton;
import javax.swing.JFrame;

public class NovaClasse extends JFrame implements ActionListener {

    boolean iniciado = true;
    JButton jb = new JButton("Cancelado");

    public NovaClasse() {
        setVisible(true);
        setSize(610, 200);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setResizable(false);
        setLayout(null);
        jb.setBounds(240, 90, 120, 30);
        add(jb);
        jb.addActionListener(this);
        jb.addKeyListener(new KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent e) {
                if (e.getKeyCode() == java.awt.event.KeyEvent.VK_SCROLL_LOCK) {
                    Verificar();
                }
            };
        }); 
    }

    public void Verificar() {
        if (iniciado == true) {
            jb.setText("Inciado");
            loop();
            iniciado = false;
        } else {
            jb.setText("Cancelado");
            loop();
            iniciado = true;
        }
    }

    public void loop() {
        new Thread() {
            public void run() {
                if (iniciado == true) {
                    while (true) {
                        System.out.println("Looping");
                    }
                } else {
                    Thread.interrupted();
                }
            }
        }.start();
    }

    public static void main(String[] args) {
        new NovaClasse();
    }

    public void actionPerformed(ActionEvent e) {
        Verificar();
    }
}