import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.net.URL.*;
import java.net.*;
public class GUI extends JPanel implements ActionListener
{
private JButton forumButton;
private JButton newsAndAnnouncementsButton;
private JButton knowledgeBaseButton;
private JButton accountManagementButton;
private JButton ruleBreakersButton;
private JButton endMusicButton;
public GUI()
{
forumButton = new JButton("Forums");
newsAndAnnouncementsButton = new JButton("News & Announcements");
knowledgeBaseButton = new JButton("Knowledge Base");
accountManagementButton = new JButton("Account Management");
ruleBreakersButton = new JButton("Rule Breakers");
endMusicButton = new JButton("Stop");
//add components
add(forumButton);
add(newsAndAnnouncementsButton);
add(knowledgeBaseButton);
add(accountManagementButton);
add(ruleBreakersButton);
add(endMusicButton);
forumButton.addActionListener(this);
forumButton.setActionCommand("forums");
newsAndAnnouncementsButton.addActionListener(this) ;
newsAndAnnouncementsButton.setActionCommand("n&b") ;
knowledgeBaseButton.addActionListener(this);
knowledgeBaseButton.setActionCommand("kBase");
accountManagementButton.addActionListener(this);
accountManagementButton.setActionCommand("accMan") ;
ruleBreakersButton.addActionListener(this);
ruleBreakersButton.setActionCommand("ruleB");
endMusicButton.addActionListener(this);
endMusicButton.setActionCommand("stop");
//set component bounds (only needed by Absolute Positioning)
//serverName.setBounds (5, 0, 137, 25);
//knowledgeBaseButton.setBounds (5, 30, 137, 25);
//forumsButton.setBounds (5, 60, 137, 25);
//itemsButton.setBounds (5, 90, 137, 25);
//versionNumber.setBounds (5, 120, 137, 25);
}
public void actionPerformed(ActionEvent e)
{
try
{
if ("kBase".equals(e.getActionCommand()))
{
URI url = new URI("http://google.com");
Desktop.getDesktop().browse(url);
}
else if ("forums".equals(e.getActionCommand()))
{
URI url = new URI("http://battlescape.no-ip.info/forum/index.php");
Desktop.getDesktop().browse(url);
}
else if ("n&b".equals(e.getActionCommand()))
{
URI url = new URI("http://battlescape.no-ip.info/forum/forumdisplay.php?f=4");
Desktop.getDesktop().browse(url);
}
else if ("accMan".equals(e.getActionCommand()))
{
URI url = new URI("http://battlescape.no-ip.info/forum/forumdisplay.php?f=30");
Desktop.getDesktop().browse(url);
}
else if ("ruleB".equals(e.getActionCommand()))
{
URI url = new URI("http://google.com");
Desktop.getDesktop().browse(url);
}
else if ("stop".equals(e.getActionCommand()))
{
if (client.mp != null && client.mp.musicPlayer != null)
{
client.mp.musicPlayer.stop();
}
}
}
catch(Exception err)
{
err.printStackTrace();
}
}
}