| Total Complexity | 9 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | package example.bubbleSortVisualization; |
||
| 12 | public class Visualizer extends AppWindow implements MouseListener { |
||
| 13 | private VisualSort bubbleSort; |
||
|
|
|||
| 14 | private boolean started; |
||
| 15 | |||
| 16 | protected void setup() { |
||
| 17 | bubbleSort = new BubbleSort(getDrawingPanel()); |
||
| 18 | started = false; |
||
| 19 | getDrawingPanel().addMouseListener(this); |
||
| 20 | getDrawingPanel().requestFocus(); |
||
| 21 | } |
||
| 22 | |||
| 23 | @Override |
||
| 24 | protected void loop() { |
||
| 25 | bubbleSort.update(); |
||
| 26 | sleep(1); |
||
| 27 | } |
||
| 28 | |||
| 29 | public static void main(String[] args) { |
||
| 30 | new Visualizer(); |
||
| 31 | } |
||
| 32 | |||
| 33 | @Override |
||
| 34 | public void mouseClicked(MouseEvent e) { |
||
| 35 | } |
||
| 36 | |||
| 37 | @Override |
||
| 38 | public void mousePressed(MouseEvent e) { |
||
| 39 | if (!started) { |
||
| 40 | started = true; |
||
| 41 | bubbleSort.begin(); |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | @Override |
||
| 46 | public void mouseReleased(MouseEvent e) { |
||
| 47 | } |
||
| 48 | |||
| 49 | @Override |
||
| 50 | public void mouseEntered(MouseEvent e) { |
||
| 51 | } |
||
| 52 | |||
| 53 | @Override |
||
| 54 | public void mouseExited(MouseEvent e) { |
||
| 55 | } |
||
| 57 |