package boondock.holdem.Gui; import javax.swing.*; import boondock.holdem.Sound.waveObj; import java.awt.*; import java.awt.event.*; public class helpGui extends JFrame implements ActionListener, WindowListener{ //private static final helpGui INSTANCE = new helpGui(); private JPanel mainPanel = new JPanel(); private JButton rulesButton = new JButton("Rules"); private JButton descButton = new JButton("Description of the Game"); private JButton infoButton = new JButton("How to use our game"); private JButton comboButton = new JButton("Winning Hands"); private JLabel comboLabel = new JLabel(new ImageIcon("images/combo_Icon.jpg")); private JFrame combos = new JFrame("Hand Combinations"); private JFrame rules = new JFrame("Rules of the Game"); private JTextArea rulesArea; static JFrame frame = new JFrame("Help"); public void windowOpened(WindowEvent e){} public void windowIconified(WindowEvent e) {} public void windowDeiconified(WindowEvent e) {} public void windowActivated(WindowEvent e) {} public void windowDeactivated(WindowEvent e) {} public void windowGainedFocus(WindowEvent e) {} public void windowLostFocus(WindowEvent e) {} public void windowStateChanged(WindowEvent e) {} public void windowClosed(WindowEvent e) {} public void windowClosing(WindowEvent e) {} public helpGui(){ frame.addWindowListener(this); rulesButton.setBounds(new Rectangle(100, 100, 100, 30)); rulesButton.addActionListener(this); descButton.setBounds(new Rectangle(100, 100, 100, 30)); descButton.addActionListener(this); infoButton.setBounds(new Rectangle(100, 100, 100, 30)); infoButton.addActionListener(this); comboButton.setBounds(new Rectangle(100, 100, 100, 30)); comboButton.addActionListener(this); mainPanel.setMinimumSize(new Dimension(300, 200)); mainPanel.setPreferredSize(new Dimension(300, 200)); mainPanel.add(infoButton); mainPanel.add(descButton); mainPanel.add(rulesButton); mainPanel.add(comboButton); mainPanel.setBackground(Color.white); frame.getContentPane().add(mainPanel); frame.pack(); frame.setVisible(true); } public void actionPerformed(ActionEvent e) { waveObj song = new waveObj(); song.play("sounds/ButtonClick.wav"); if(e.getSource() == infoButton){ new howToUse(); } if(e.getSource() == descButton) { JOptionPane.showMessageDialog( new JFrame("Rules"),"In Holdem, players receive two downcards as their personal hand (hole cards),\n" + "after which there is a round of betting. Three boardcards are turned \n" + "simultaneously (called the \"flop\") and another round of betting occurs.\n" + "The next two boardcards are turned one at a time, with a round of betting \n" + "after each card. The boardcards are community cards, and a player may use \n" + "any five-card combination from the board and personal cards. A player may \n" + "even use all of the boardcards and no personal cards to form a hand (play \n" + "the board). A dealer button is used. The usual structure is to use two blinds, \n" + "which is what is used in this game, but it is possible to play with one blind, \n" + "multiple blinds, an ante, or combination of blinds plus an ante."); } if(e.getSource() == rulesButton){ rulesArea = new JTextArea(); rulesArea.setEditable(false); rulesArea.setWrapStyleWord(true); rulesArea.setLineWrap(true); rulesArea.append(" In Texas Holdem Poker, the player needs to finish with the best poker hand and win the pot. Although the Texas Hold'em rules are easily learned and deceptively simple, it is still a game that requires a certain amount of skill. Improve your chances, strategize and follow these tips to increase your chances of winning:\n\n" + " * Five of the total Seven-Cards can be seen after the flop. At this point, you will have a good indication of how strong your hand will be in the final round. Consider your cards and bets carefully. Staying for the Turn and the River demands that you either have a strong hand, a draw to a potentially winning hand, or good reason to believe that betting on a future round may cause your opponents to fold\n" + " * As a general rule, don't continue beyond the flop without diverse possibilities - a strong pair and a decent side-card, a kicker, a straight, or flush draw. If you flop a draw, stick with it as long as the pot promises a greater payoff than the odds against making your hand\n" + " * Although Ace-King is a terrific starting combination, it generally needs to catch a flop with either an Ace or King in it to play aggressively\n" + " * When you must act before most of your opponents, play few hands. Acting last in Hold'em is like batting last in baseball. It's a big advantage. In fact, hands that you'd routinely fold from early position might be raising hands if you are last to act\n"+ " * Carefully consider how the communal cards can interact with your two hidden pocket cards to create a winning hand\n"+ " * Call it quits when necessary. You haven't lost much if you have a worthless hand and fold early in the game. It's good practice to err on the side of caution. It costs less\n"+ " * Success at Texas Hold'em demands that you be patient, pay close attention to position, and take comfort in the knowledge that good hands are run down less often than the best seven-card stud hands \n"+ "\n Texas Holdem Poker Dictionary\n"+ " blind bet - a forced bet that is taken before the cards are dealt - made instead of an Ante. It is posted by the two Players to the left of the Dealer.\n"+ " A \"Small Blind\" is placed by the Player to the Dealer's left. The \"Big Blind\" is placed by the Player left of the Small Blind\n"+ " flop - the dealing of the first three communal cards\n"+ " puck/back/button - a moving disc which indicates the Dealer, and moves in a clockwise direction\n"+ " river - the fifth, and final, communal card dealt\n"+ " turn - the fourth communal card dealt\n"+ "\n Texas Holdem Poker Rules\n"+ " Sequence of Play\n"+ " 1.The Players to the left of the Dealer begin by posting the blind bets.\n"+ " 2.Two pocket cards are dealt to each Player - face-down\n"+ " 3.First round of betting - options are to fold, bet, or raise. Players cannot \"check\" in the first round, as Blinds are bets, and not antes. \n"+ " 4.Three communal cards (flop) are dealt face-up in the center of the table. All communal cards are active for all Players and can be used in combination with each Player's two cards.\n"+ " 5.Second round of betting - options are to check, fold, bet, or raise.\n"+ " 6.Fourth communal card (Turn) is dealt face-up.\n"+ " 7.Third round of betting - options are to check, fold, bet, or raise.\n"+ " 8.If, at this stage, there are still at least two vying Players, the fifth, and final communal card (River) is dealt face-up.\n"+ " 9.Final round of betting follows.\n"+ " 10.The Showdown! All remaining Players then create the best five-card hand possible. You can use: both pocket cards and three communal cards or one pocket card and four communal cards or all five communal cards\n"+ " 11.The best hand wins the pot! If two or more Players have the same winning hand, the pot is split equally between them.\n"+ " Betting Rules\n"+ " 1.As per normal poker rules - playing and betting proceeds in a clockwise direction.\n"+ " 2.The two Players to the left of the Dealer post the blind bets.\n"+ " 3.Small Blind (the Player who sits left of the Dealer) bets half the lower limit.\n"+ " 4.Big Blind (the Player who sits left of the Small Blind) bets equal to the lower limit.\n"+ " 5.Betting increments in the game determine the blinds. In a game of $2 and $4 betting increments, the small blind is $1, and the big blind is $2.\n"+ " 6.The blind bets in Texas Hold'em are considered as active bets, and therefore, Players have the option to check, fold, call, and raise when the betting action returns to their position. (Exception to first round betting). First round betting - options are to fold, bet, or raise. Only one bet, and three raises per Player are allowed on the first round. Players cannot \"check\" in the first round, as Blinds are bets, and not antes.\n"+ " 7.Second and subsequent betting rounds - options are to check, fold, bet, or raise.\n"+ " 8.All bets must be placed in conjunction with the game's betting increments.\n"+ " 9.There are four possible betting rounds in Texas Hold'em poker. Each bet and raise during the first two rounds is set at the lower limit of the stakes structure, and for the last two rounds at a higher limit structure. For example in a $1/$2 Texas Hold'em game, all bets and raises are $1 for the first two rounds (after pocket cards are dealt and after the flop). All bets and raises are $2 for the last two rounds (after the turn and after the river), following accepted poker rules.\n"+ " 10.In betting rounds where Players have folded, the first active Player left of the Disc/Dealer is first to act.\n"+ " 11.To ensure fairness for all online poker Players - new Players entering the Texas Hold'em game will be required to post the equivalent of the big blind. All Players have the option of sitting out and waiting for the actual big blind before starting play.\n"+ " 12.By preventing Players from constantly entering poker games in a late position and leaving before they're required to post, these rules stop potential abuse of the online environment"); JScrollPane rulesPane = new JScrollPane(rulesArea); rulesPane.setMinimumSize(new Dimension(400, 400)); rulesPane.setPreferredSize(new Dimension(400, 400)); JPanel myPanel = new JPanel(); myPanel.add(rulesPane); rules.addWindowListener(this); rules.getContentPane().add(myPanel); rules.pack(); rules.setVisible(true); } if(e.getSource() == comboButton) { combos.addWindowListener(this); combos.getContentPane().add(comboLabel); combos.pack(); combos.setVisible(true); } } }