/** * Metoda wyswietlajaca pasek postepu nad przyciskami * * @param g Referencja do obiektu klasy Graphics, ktory pozwala na narysowanie pasku postepu * @param current Aktualny czas trwania piosenki, 0 <= progress <= max * @param max Calkowity czas trwania piosenki */ public void showProgressBar(Graphics g, int current, int max) { int color = g.getColor(); // przechowanie uzywanego koloru int progressBarWidth = screenWidth - 25; // szerokosc paska postepu int progress = (progressBarWidth * current) / max; if (current == -1) // jesli timer jest wylaczony progress = 0; g.setColor(110, 110, 110); // narysowanie szarej obwodki g.drawRect(10, screenHeight - 29 + buttonsLocation, progressBarWidth + 3, 17); g.setColor(90, 90, 90); // narysowanie ciemnej obwodki g.drawRect(11, screenHeight - 28 + buttonsLocation, progressBarWidth + 1, 15); g.setColor(BACKGROUND_COLOR); g.fillRect(12, screenHeight - 27 + buttonsLocation, progressBarWidth, 14); g.setColor(230, 230, 230); g.fillRect(12, screenHeight - 27 + buttonsLocation, progress, 14); g.setColor(70, 70, 70); if (this.displayedScreen == MainCanvas.PLAYER_SCREEN) g.drawString( bluetoothPlayer.getCurrentTimeString(), screenWidth / 2 - 17, screenHeight - 26 + buttonsLocation, Graphics.TOP | Graphics.LEFT); g.setColor(color); }