{"id":942,"date":"2012-02-08T02:05:00","date_gmt":"2012-02-08T02:05:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/java-swing-tic-tac-toe.html"},"modified":"2012-10-21T23:04:59","modified_gmt":"2012-10-21T23:04:59","slug":"java-swing-tic-tac-toe","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html","title":{"rendered":"Java Swing Tic-Tac-Toe"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">Hello people! Wow its been a while since I posted something here\u2026! I must say I really miss writing stuff and I promise I wont get into a \u2018writer\u2019s block\u2019 again. Hopefully <img decoding=\"async\" alt=\":)\" class=\"wp-smiley\" src=\"http:\/\/s0.wp.com\/wp-includes\/images\/smilies\/icon_smile.gif?m=1317430853g\" \/> .. A helluva lot of things happened in the last two months and I\u2019ve got loads to say. But in this post Im just gonna publish a small application that I wrote sometime ago. Its a TicTacToe game application. There\u2019s not much to be learnt from this particular program but I really want to get outta this impasse and hence Im posting this today.<\/p>\n<p>I actually wrote this code to show off some of the really cool features of Java to one of my friends who also wrote the same application in a \u201cC++\u201d-esque style. And btw that friend of mine even developed code for the computer player. But after completing his code he sadly realized the basic fact that you cannot win in TicTacToe if you play perfectly!! Hehe <img decoding=\"async\" alt=\":D\" class=\"wp-smiley\" src=\"http:\/\/s0.wp.com\/wp-includes\/images\/smilies\/icon_biggrin.gif?m=1317430853g\" \/>  So I did not venture into that area. Well to be honest, Im not really interested in writing AI apps. But I thought of adding Network Multiplayer functionality to this application since I love network programming. But unfortunately I havent had the time to do so.<br \/>\nAnywaiz the application works like this \u2013 the game is autostarted once launched and the status bar indicates which player\u2019s turn its now and rest is just simple tictactoe! And at the end of the game the app is automatically reset.<br \/>\nOnto the code..<\/p>\n<pre class=\"brush: java;\">import javax.swing.*;\r\n\r\nimport java.awt.*;\r\nimport java.awt.event.*;\r\nimport java.util.logging.Logger;\r\n\r\n\/**\r\n* TicTacToe Application\r\n* @author Steve Robinson\r\n* @version 1.0\r\n*\/\r\n\r\nclass TicTacToeFrame extends JFrame\r\n{\r\n\r\n JButton [][] buttons= new JButton[3][3];\r\n JTextField statusBar;\r\n GamePanel panel;\r\n Integer turn;\r\n GameListener listener=new GameListener();\r\n Integer count;\r\n\r\n public TicTacToeFrame()\r\n {\r\n  setLayout(new BorderLayout());\r\n\r\n  panel=new GamePanel();\r\n  add(panel,BorderLayout.CENTER);\r\n\r\n  statusBar=new JTextField(\"Player1's Turn\");\r\n  statusBar.setEditable(false);\r\n  add(statusBar,BorderLayout.SOUTH);\r\n\r\n  setTitle(\"Tic Tac Toe!\");\r\n  setVisible(true);\r\n  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n  setBounds(400,400,300,300);\r\n }\r\n\r\n class GamePanel extends JPanel\r\n {\r\n\r\n  public GamePanel()\r\n  {\r\n   setLayout(new GridLayout(3,3));\r\n   turn =1;\r\n   count=0;\r\n   for(int i=0;i&lt;3;i++)\r\n    for(int j=0;j&lt;3;j++)   {\r\n     buttons[i][j]=new JButton();\r\n     buttons[i][j].putClientProperty(\"INDEX\", new Integer[]{i,j});\r\n     buttons[i][j].putClientProperty(\"OWNER\", null);\r\n     buttons[i][j].addActionListener(listener);\r\n     add(buttons[i][j]);\r\n    }\r\n  }\r\n }\r\n\r\n class GameListener implements ActionListener\r\n {\r\n  public void actionPerformed(ActionEvent e)\r\n  {\r\n   count++;\r\n   JButton b=(JButton)e.getSource();\r\n   Integer[]index=(Integer[]) b.getClientProperty(\"INDEX\");\r\n\r\n   \/\/System.out.println(turn); \/\/turn                  \/\/   \/\/System.out.println(\"[\"+index[0]+\"]\"+\"[\"+index[1]+\"]\");         \/\/\r\n   b.putClientProperty(\"OWNER\", turn);\r\n   Icon ico=new ImageIcon(turn.toString()+\".gif\");\r\n   b.setIcon(ico);\r\n   b.setEnabled(false);\r\n   boolean result=checkVictoryCondition(index);\r\n   if(result)\r\n   {\r\n    JOptionPane.showMessageDialog(null, \"Player \"+turn.toString()+\" Wins\");\r\n    initComponents();\r\n   }\r\n   else\r\n   {\r\n    if(turn==1)\r\n    {\r\n     turn=2;\r\n     statusBar.setText(\"Player2's Turn\");\r\n    }\r\n    else\r\n    {\r\n     turn=1;\r\n     statusBar.setText(\"Player1's Turn\");\r\n    }\r\n   }\r\n   if(count==9)\r\n   {\r\n    JOptionPane.showMessageDialog(null, \"Match is a draw!\");\r\n    initComponents();\r\n\r\n   }\r\n\r\n  }\r\n\r\n  Integer getOwner(JButton b)\r\n  {\r\n   return (Integer)b.getClientProperty(\"OWNER\");\r\n  }\r\n\r\n  \/\/PrintButtonMap for Diagnostics\r\n  void printbuttonMap(Integer [][]bMap)\r\n  {\r\n   for(int i=0;i    for(int j=0;j     System.out.print(bMap[i][j]+\" \");\r\n    System.out.println(\"\");\r\n   }\r\n  }\r\n\r\n  boolean checkVictoryCondition(Integer [] index)\r\n  {\r\n   \/*Integer[][]buttonMap=new Integer[][] {\r\n     { getOwner(buttons[0][0]),getOwner(buttons[0][1]),getOwner(buttons[0][2])},\r\n     { getOwner(buttons[1][0]),getOwner(buttons[1][1]),getOwner(buttons[1][2])},\r\n     { getOwner(buttons[2][0]),getOwner(buttons[2][1]),getOwner(buttons[2][2])}\r\n   };\r\n\r\n   printbuttonMap(buttonMap); *\/\r\n\r\n   Integer a=index[0];\r\n                Integer b=index[1];\r\n   int i;\r\n\r\n   \/\/check row\r\n   for(i=0;i&lt;3;i++)  {\r\n    if(getOwner(buttons[a][i])!=getOwner(buttons[a][b]))\r\n     break;\r\n   }\r\n   if(i==3)\r\n    return true;\r\n\r\n   \/\/check column\r\n   for(i=0;i&lt;3;i++)  {\r\n    if(getOwner(buttons[i][b])!=getOwner(buttons[a][b]))\r\n     break;\r\n   }\r\n   if(i==3)\r\n    return true;\r\n\r\n   \/\/check diagonal\r\n   if((a==2&amp;&amp;b==2)||(a==0&amp;&amp;b==0)||(a==1&amp;&amp;b==1)||(a==0&amp;&amp;b==2)||(a==2&amp;&amp;b==0))\r\n   {\r\n    \/\/left diagonal\r\n    for(i=0;i     if(getOwner(buttons[i][i])!=getOwner(buttons[a][b]))\r\n      break;\r\n    if(i==3)\r\n     return true;\r\n\r\n    \/\/right diagonal\r\n    if((getOwner(buttons[0][2])==getOwner(buttons[a][b]))&amp;&amp;(getOwner(buttons[1][1])==getOwner(buttons[a][b]))&amp;&amp;(getOwner(buttons[2][0])==getOwner(buttons[a][b])))\r\n     return true;\r\n\r\n    }\r\n\r\n   return false;\r\n\r\n  }\r\n }\r\n\r\n\r\n\r\n void initComponents()\r\n {\r\n  for(int i=0;i&lt;3;i++)   \r\n                         for(int j=0;j&lt;3;j++)  {\r\n    buttons[i][j].putClientProperty(\"INDEX\", new Integer[]{i,j});\r\n    buttons[i][j].putClientProperty(\"OWNER\",null);\r\n    buttons[i][j].setIcon(null);\r\n    buttons[i][j].setEnabled(true);\r\n    turn=1;\r\n    count=0;\r\n    statusBar.setText(\"Player1's Turn\");\r\n\r\n   }\r\n }\r\n\r\n}\r\n\r\nclass TicTacToe {\r\n\r\n public static void main(String[] args) {\r\n  EventQueue.invokeLater(new Runnable(){\r\n   public void run()\r\n   {\r\n    TicTacToeFrame frame=new TicTacToeFrame();\r\n   }\r\n  });\r\n\r\n }\r\n\r\n}\r\n<\/pre>\n<p>The code is rather straightforward. Ive used two properties in the Buttons to store some information used for checking the winning condition. One is the \u201cOWNER\u201d property which indicates which user currently owns the square and the \u201cINDEX\u201d property which indicates the square\u2019s index in the grid (ie [1,1], [1,2]\u2026 etc) Once any player clicks on a square, the OWNER property is updated and the victoryCondition is checked by using the OWNER properties of all the buttons. The rest of the code is self explanatory.<br \/>\nAnd adding keyboard support for the second player is a pretty easy job. As they say\u2026 \u201cI leave that as an exercise\u201d! Hahaha <img decoding=\"async\" alt=\":D\" class=\"wp-smiley\" src=\"http:\/\/s0.wp.com\/wp-includes\/images\/smilies\/icon_biggrin.gif?m=1317430853g\" \/>  Well I really hope I get some time so that I can add network functionality to this application.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>Cheers,<\/p>\n<p>Steve.<br \/>\n\u2014\u2013<br \/>\nI forgot to attach the image icon files that will be used by the application. You can download it from here<br \/>\n<span class=\"Apple-style-span\" style=\"font-family: monospace\"><a href=\"http:\/\/www.mediafire.com\/?d7d93v2342dxind\">http:\/\/www.mediafire.com\/?d7d93v2342dxind<\/a><\/span><br \/>\nJust extract the contents to the folder that contains the code. Thanks to my friend \u201cGur Png\u201d for telling me about this. <\/p>\n<p><strong><i>Reference: <\/i><\/strong><a href=\"http:\/\/footyntech.wordpress.com\/2012\/01\/22\/java-tictactoe\/\">Java TicTacToe<\/a>&nbsp;from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a><span class=\"Apple-style-span\" style=\"font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif\"><span class=\"Apple-style-span\" style=\"font-size: 14px;line-height: 18px\"><strong>&nbsp;<\/strong><\/span><\/span>Steve Robinson at the&nbsp;<a href=\"http:\/\/footyntech.wordpress.com\/\">Footy &#8216;n&#8217; Tech<\/a>&nbsp;blog. <\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello people! Wow its been a while since I posted something here\u2026! I must say I really miss writing stuff and I promise I wont get into a \u2018writer\u2019s block\u2019 again. Hopefully .. A helluva lot of things happened in the last two months and I\u2019ve got loads to say. But in this post Im &hellip;<\/p>\n","protected":false},"author":50,"featured_media":260,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[262],"class_list":["post-942","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-desktop-java","tag-swing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java Swing Tic-Tac-Toe - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Hello people! Wow its been a while since I posted something here\u2026! I must say I really miss writing stuff and I promise I wont get into a \u2018writer\u2019s block\u2019\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Swing Tic-Tac-Toe - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Hello people! Wow its been a while since I posted something here\u2026! I must say I really miss writing stuff and I promise I wont get into a \u2018writer\u2019s block\u2019\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2012-02-08T02:05:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-21T23:04:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-duke-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Steve Robinson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Steve Robinson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html\"},\"author\":{\"name\":\"Steve Robinson\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/39973a0a56c41ba0265e4edb18234b9f\"},\"headline\":\"Java Swing Tic-Tac-Toe\",\"datePublished\":\"2012-02-08T02:05:00+00:00\",\"dateModified\":\"2012-10-21T23:04:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html\"},\"wordCount\":455,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-duke-logo.jpg\",\"keywords\":[\"Swing\"],\"articleSection\":[\"Desktop Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html\",\"name\":\"Java Swing Tic-Tac-Toe - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-duke-logo.jpg\",\"datePublished\":\"2012-02-08T02:05:00+00:00\",\"dateModified\":\"2012-10-21T23:04:59+00:00\",\"description\":\"Hello people! Wow its been a while since I posted something here\u2026! I must say I really miss writing stuff and I promise I wont get into a \u2018writer\u2019s block\u2019\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-duke-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-duke-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/02\\\/java-swing-tic-tac-toe.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Desktop Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/desktop-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Java Swing Tic-Tac-Toe\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/39973a0a56c41ba0265e4edb18234b9f\",\"name\":\"Steve Robinson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7be4973fd452ea71e6e5943449823712c2fbf485dc7d001500e53e4ff8f8deb4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7be4973fd452ea71e6e5943449823712c2fbf485dc7d001500e53e4ff8f8deb4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7be4973fd452ea71e6e5943449823712c2fbf485dc7d001500e53e4ff8f8deb4?s=96&d=mm&r=g\",\"caption\":\"Steve Robinson\"},\"sameAs\":[\"http:\\\/\\\/footyntech.wordpress.com\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Steve-Robinson\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Swing Tic-Tac-Toe - Java Code Geeks","description":"Hello people! Wow its been a while since I posted something here\u2026! I must say I really miss writing stuff and I promise I wont get into a \u2018writer\u2019s block\u2019","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html","og_locale":"en_US","og_type":"article","og_title":"Java Swing Tic-Tac-Toe - Java Code Geeks","og_description":"Hello people! Wow its been a while since I posted something here\u2026! I must say I really miss writing stuff and I promise I wont get into a \u2018writer\u2019s block\u2019","og_url":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-02-08T02:05:00+00:00","article_modified_time":"2012-10-21T23:04:59+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-duke-logo.jpg","type":"image\/jpeg"}],"author":"Steve Robinson","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Steve Robinson","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html"},"author":{"name":"Steve Robinson","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/39973a0a56c41ba0265e4edb18234b9f"},"headline":"Java Swing Tic-Tac-Toe","datePublished":"2012-02-08T02:05:00+00:00","dateModified":"2012-10-21T23:04:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html"},"wordCount":455,"commentCount":2,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-duke-logo.jpg","keywords":["Swing"],"articleSection":["Desktop Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html","url":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html","name":"Java Swing Tic-Tac-Toe - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-duke-logo.jpg","datePublished":"2012-02-08T02:05:00+00:00","dateModified":"2012-10-21T23:04:59+00:00","description":"Hello people! Wow its been a while since I posted something here\u2026! I must say I really miss writing stuff and I promise I wont get into a \u2018writer\u2019s block\u2019","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-duke-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-duke-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2012\/02\/java-swing-tic-tac-toe.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Desktop Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/desktop-java"},{"@type":"ListItem","position":4,"name":"Java Swing Tic-Tac-Toe"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/39973a0a56c41ba0265e4edb18234b9f","name":"Steve Robinson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/7be4973fd452ea71e6e5943449823712c2fbf485dc7d001500e53e4ff8f8deb4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7be4973fd452ea71e6e5943449823712c2fbf485dc7d001500e53e4ff8f8deb4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7be4973fd452ea71e6e5943449823712c2fbf485dc7d001500e53e4ff8f8deb4?s=96&d=mm&r=g","caption":"Steve Robinson"},"sameAs":["http:\/\/footyntech.wordpress.com\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Steve-Robinson"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/942","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/50"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=942"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/942\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/260"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}