Page 167 - MDP2022-3
P. 167

add(exitButton);


                            startButton.setBounds(400,  550,  400,  100);
                            startButton.setBorderPainted(false);
                            startButton.setContentAreaFilled(false);
                            startButton.setFocusPainted(false);
                            startButton.addMouseListener(new  MouseAdapter()  {
                                    @Override
                                    public  void  mouseEntered(MouseEvent  e)  {
                                            startButton.setIcon(startButtonEnteredImage);
                                            startButton.setCursor(new  Cursor(Cursor.HAND_CURSOR));
                                            Music            buttonEnteredMusic             =            new
            Music("buttonPressedMusic.mp3"  ,  false);
                                            buttonEnteredMusic.start();


                                    }
                                    @Override
                                    public  void  mouseExited(MouseEvent  e)  {
                                            startButton.setIcon(startButtonBasicImage);
                                            startButton.setCursor(new  Cursor(Cursor.DEFAULT_CURSOR));
                                    }
                                    @Override
                                    public  void  mousePressed(MouseEvent  e)  {
                                            Music            buttonEnteredMusic             =            new
            Music("buttonPressedMusic.mp3"  ,  false);
                                            buttonEnteredMusic.start();
                                            enterMain();
                                    }
                            });
                            add(startButton);


                            quitButton.setBounds(830,  550,  400,  100);
                            quitButton.setBorderPainted(false);
                            quitButton.setContentAreaFilled(false);
                            quitButton.setFocusPainted(false);
                            quitButton.addMouseListener(new  MouseAdapter()  {
                                    @Override
                                    public  void  mouseEntered(MouseEvent  e)  {
                                            quitButton.setIcon(quitButtonEnteredImage);
                                            quitButton.setCursor(new  Cursor(Cursor.HAND_CURSOR));
                                            Music            buttonEnteredMusic             =            new
            Music("buttonPressedMusic.mp3"  ,  false);
                                            buttonEnteredMusic.start();


                                    }
   162   163   164   165   166   167   168   169   170   171   172