예제 #1
0
  @Override
  public void mouseMoved(MouseEvent e) {
    mainMenu.computeMouseEntered(e.getX(), e.getY());
    mainMenu.computeMouseExited(e.getX(), e.getY());

    keyboard.mouseMoved(e);
    this.repaint();
  }
예제 #2
0
  public void mouseClicked(MouseEvent e) {
    keyboard.mouseClicked(e);

    if (mainMenu.setMouseClicked(e.getX(), e.getY())) {
      JFrameStack.popPanel();
    }
  }
예제 #3
0
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    // Clear screen.
    g.setColor(Color.white);
    g.fillRect(0, 0, getWidth(), getHeight());

    // draw entire component grey
    g.setColor(Fonts.sub_color);
    g.fillRect(0, 0, getWidth(), getHeight());

    // Write title.
    g.setColor(Color.BLACK);
    g.setFont(Fonts.big);
    g.drawString("Ear", 20, 150);
    g.drawString("Training", 20, 200);

    // Write "Choose Difficulty".
    g.setFont(Fonts.italic);
    g.drawString("Choose Difficulty", 20, 300);

    // Draw piano image
    keyboard.setDimensions(250, 0, getWidth(), getHeight());
    keyboard.paintComponent(g);
    mainMenu.paintComponent(g);
  }