Nuts and Bolts

Leap Panel is a java applet. It it is mainly a collection of Panels. The following attempts to explain the Panel hierarchy and arrangement.

The Hierarchy:

Three
  • TallyPanel
  • ScorePanel
  • BigPanel
    • buttonpannel
    • startpanel
    • clumppanel
      • center
        • TriPanel
        • BowPanel
        • TrapPanel
      • topp
      • bottomp


TallyPanel

TallyPanel is the class that contains and displays to the user which color buttons they have clicked. TallyPanel prints dots which match the color that the user has clicked on the leftmost side the screen.

ScorePanel

ScorePanel is the class that contains the current score information and displays it. It prints out the player's score and the best score possible. It also has the buttons which switch game boards.

BigPanel

BigPanel contains the gameboard and and the controls for each game.

It is divided into three panels: startpanel, buttonpanel, and clumppanel. These three panels are layed out using border layout buttonpanel on top, clumppanel in the center, and startpanel on the bottom.

It also contains all of the event handling for each individual game.

buttonpanel

buttonpanel contains the buttons which correspond to the levels of the game, or how many times the background has been recursed.

startPanel

startpanel contains the restart and retry buttons. Restart resets the game to the begining and then chooses a new target triangle. Retry resets to a new game but keeps the target triangle.

clumppanel

clumppanel contains three panels topp, bottomp, center. These are arranged accordingly using Boderlayout.

topp

topp contains the red button at the top of the game

bottomp

bottomp contains the blue and green buttons at the bottom corners of the game.

center

center contains onr of the three gameboards. it checks the value of the variable game_level, which is decided by the event handling in "Three", if the value is 0, it inserts TriPanel as the center panel. If the value is 1, it inserts TrapPanel as the center panel. If the value is 2, it inserts BowPanel as the center panel.

TriPanel

TriPanel is the Panel which draws the Sierpinki Triangle background.

The three main methods of TriPanel are myPaint, tri, and dots. myPaint paints the triangle and the dots on the screen as the game is played. tri creates the background sierpinki triangle image that is used as the gameboard. dots paints the red dots on the screen as the three buttons at the vertices are pressed.

TrapPanel

TrapPanel is the Panel which draws the variation of the Sierpinki Triangle where the top vertex is has a rotation of 180 degrees.

The three main methods of TrapPanel are myPaint, bow, and dots. myPaint paints the trapezoid and the dots on the screen as the game is played. trap creates the background bow shaped image that is used as the gameboard. dots paints the red dots on the screen as the three buttons at the vertices are pressed.

BowPanel

BowPanel is the Panel which draws the Sierpinki Triangle with a rotation of 180 degree.

The three main methods of BowPanel are myPaint, bow, and dots. myPaint paints the Hexagon and the dots on the screen as the game is played. bow creates the background bow shaped image that is used as the gameboard. dots paints the red dots on the screen as the three buttons at the vertices are pressed.



To Index Next Page