/** * Created with IntelliJ IDEA. * Created by: gikid * Date: Jun 29, 2007 * Time: 2:44:53 PM * Description: This program trys to connect to lawl.kicks-ass.net:10000 (PokemOnline) and it says if it is online or not */import javax.swing.*;import java.awt.*;import java.net.*;import static java.lang.Thread.sleep;public class PokeServerStatusGUI { public JTextPane statusDisplay; public JPanel PSS; Color green = new Color(0, 204, 0); Color red = new Color(204, 0, 0); JFrame frame = new JFrame("PokeServerStatusGUI"); public PokeServerStatusGUI() { while (true) { Socket sock = new Socket(); try { sock.connect(new InetSocketAddress(InetAddress.getByName("lawl.kicks-ass.net"), 10000), 3000); PSS.setBackground(green); statusDisplay.setText("The PokeServer is ONLINE!"); //System.out.println("The PokeServer is ONLINE!"); } catch (Exception e) { PSS.setBackground(red); statusDisplay.setText("The PokeServer is OFFLINE!"); //System.out.println("The PokeServer is OFFLINE!"); } try { sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } public static void main(String[] args) { JFrame frame = new JFrame("PokeServerStatusGUI"); frame.setContentPane(new PokeServerStatusGUI().PSS); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } /*public static void main(String[] args) throws InterruptedException { new PokeServerStatusGUI(); JFrame frame = new JFrame("PokeServerStatusGUI"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }*/}