diff --git a/src/de/ctdo/crashtest/cardplayer/MainFrame.java b/src/de/ctdo/crashtest/cardplayer/MainFrame.java index 6fbaa2a..76d6388 100644 --- a/src/de/ctdo/crashtest/cardplayer/MainFrame.java +++ b/src/de/ctdo/crashtest/cardplayer/MainFrame.java @@ -10,40 +10,77 @@ import java.util.Vector; public class MainFrame extends JFrame { private IrcClient irc; - private JList jList; + private JList jListWall; + private JList jListStates; public MainFrame() { setDefaultCloseOperation(EXIT_ON_CLOSE); setTitle("CrastestCardPlayer"); - setPreferredSize(new Dimension(600,500)); - irc = new IrcClient(HostHelper.getHostName().toLowerCase(), "#crashtest", "irc.ctdo.de", 6667); + setPreferredSize(new Dimension(800,500)); + irc = new IrcClient(HostHelper.getHostName().toLowerCase(), "#crashtest", "localhost", 8888); initGui(); setVisible(true); } private void initGui() { - jList = new JList(readData()); - jList.setLayoutOrientation(JList.VERTICAL); - jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + Container contentPane = this.getContentPane(); - jList.addMouseListener(new MouseAdapter() { + jListWall = new JList(readData()); + jListWall.setLayoutOrientation(JList.VERTICAL); + jListWall.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + jListWall.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - if(e.getClickCount() == 2){ - int index = jList.locationToIndex(e.getPoint()); - ListModel dlm = jList.getModel(); + if (e.getClickCount() == 2) { + int index = jListWall.locationToIndex(e.getPoint()); + ListModel dlm = jListWall.getModel(); Object item = dlm.getElementAt(index); - jList.ensureIndexIsVisible(index); - if(irc != null) irc.say("crashtest: wall " + item); + jListWall.ensureIndexIsVisible(index); + if (irc != null) irc.say(">wall " + item); } } }); - JScrollPane listScroller = new JScrollPane(jList); + JScrollPane listScroller = new JScrollPane(jListWall); listScroller.setPreferredSize(new Dimension(600, 500)); - add(listScroller); + contentPane.setLayout(new BorderLayout()); + contentPane.add(listScroller, BorderLayout.WEST); + + Vector states = new Vector(); + states.add("IDLE"); + states.add("ENTERED_ROOM"); + states.add("TABLE_GAME_ONE"); + states.add("TABLE_GAME_TWO"); + states.add("TABLE_GAME_THREE"); + states.add("TABLE_GAME_FOUR"); + states.add("TABLE_GAME_FIVE"); + states.add("TABLE_GAME_SIX"); + states.add("TABLE_GAME_DONE"); + states.add("ROKET_STARTED"); + states.add("ROKET_DONE"); + states.add("NEUTRAL"); + + jListStates = new JList(states); + jListStates.setLayoutOrientation(JList.VERTICAL); + jListStates.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + jListStates.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() == 2) { + int index = jListStates.locationToIndex(e.getPoint()); + ListModel dlm = jListStates.getModel(); + Object item = dlm.getElementAt(index); + jListStates.ensureIndexIsVisible(index); + if (irc != null) irc.say(">state " + item); + } + } + }); + + listScroller = new JScrollPane(jListStates); + contentPane.add(listScroller); + pack(); }