Thanateros

Untitled

Apr 11th, 2015
203
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Alex Ackerlund
  2. Escape is a 2D adventure game
  3. 4/6/15*/
  4.  
  5. import java.awt.*;
  6. import java.awt.event.*;
  7. import javax.swing.*;
  8. import javax.swing.text.*;
  9.  
  10. public class Escape extends JFrame implements ActionListener
  11. {
  12. int x=2, y=2;
  13. String ctp;
  14. JFrame map = new JFrame();
  15. JPanel commandP = new JPanel();//this panel holds the commandB and TP
  16. JPanel mainP = new JPanel();//this panel will hold the roomDesc[], commandB, and commandTP
  17. Rooms[][] roomDesc = new Rooms[x][y];//the description of the room your in will be displayed in this textpane
  18. // Rooms.build(room, x, y);//I dont know where this line of code goes
  19. JButton commandB = new JButton("Send Command");//the button that is pressed when you want to send a command
  20. JTextField commandTP = new JTextField(10);//where commands will be typed
  21.  
  22. public Escape()
  23. {
  24.  
  25.  
  26. setLayout(new BorderLayout());
  27. add(mainP, BorderLayout.CENTER);
  28. // mainP.add(room[0][0]);//I dont know how to get room[0][0]
  29. add(commandP, BorderLayout.SOUTH);
  30. commandP.add(commandTP);
  31. commandP.add(commandB);
  32. commandB.addActionListener(this);
  33. commandB.setActionCommand("Send Command");
  34.  
  35. new commandList();
  36.  
  37. }
  38.  
  39. public void actionPerformed(ActionEvent e)
  40. {
  41. String arg = e.getActionCommand();
  42. if(arg == "Send Command")
  43. {
  44. ctp = commandTP.getText();
  45. System.out.println(ctp);
  46. if(ctp == "go")
  47. {
  48. System.out.println("boo");
  49. }
  50.  
  51. if(ctp == "Go")
  52. {
  53. System.out.println("boo");
  54. }
  55. }
  56. commandTP.setText("");//must be last
  57. }
  58.  
  59. public static void main(String[] args)
  60. {
  61. Escape f = new Escape();
  62. f.setSize(600,375);
  63. f.setVisible(true);
  64. f.setTitle("Escape v0.0.3");
  65. f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  66.  
  67. /*map m = new map();//is having problems displaying all rooms ****do this last
  68. m.setBounds(600,0,600,375);
  69. m.setVisible(true);
  70. m.setTitle("Known World");*/
  71. }
  72. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×