@Override public void update(Observable arg0, Object arg1) { DownloadInfo info = (DownloadInfo) arg1; window.setTitle(info.prg + " % " + info.file); url.setText(info.url); if (info.state == IXDMConstants.FAILED) status.setText("Error"); else status.setText(info.status); filesize.setText(info.length); downloaded.setText(info.downloaded + " (" + info.progress + "%)"); rate.setText(info.speed); time.setText(info.eta); resume.setText(info.resume); p.setValues(info.startoff, info.len, info.dwn, info.rlen); prg.setValue(info.prg); model.update(info.dwnld, info.stat); file = info.path; // if (info.resume.equalsIgnoreCase("yes")) { // pause.setEnabled(true); // } else { // pause.setEnabled(false); // } if (info.state == IXDMConstants.FAILED) { // pause.setEnabled(false); ConnectionManager c = (ConnectionManager) arg0; if (!c.stop) { if (!(c.state == ConnectionManager.COMPLETE)) { if (!showed) { JOptionPane.showMessageDialog(window, info.msg); window.setVisible(false); window.dispose(); showed = true; } } } } if (info.state == IXDMConstants.COMPLETE) { System.out.println("%%%%%%%%%%%%%%%%%%DOWNLOAD COMPLETE"); bg.setEnabled(false); // pause.setEnabled(false); window.setVisible(false); window.dispose(); } if (info.state == IXDMConstants.STOPPED) { System.out.println("%%%%%%%%%%%%%%%%%%DOWNLOAD STOPPED"); bg.setEnabled(false); // pause.setEnabled(false); window.setVisible(false); window.dispose(); } }
public void paintComponent(Graphics g) { super.paintComponent(g); int maxVelocity = ((VelocitySegment) this.segment).getMaxVelocity(); int xPosition = MetricToPixel.scale(this.segment.start()); int yPosition = MetricToPixel.scale(this.trackOffset + Lane.WIDTH * this.fastLaneOffset); // Zeichnet ein Verkehrsschild mit der Höchstgeschwindigkeit g.drawImage( MAX, xPosition, yPosition, MetricToPixel.getImageSize(), MetricToPixel.getImageSize(), this); int xStringPosition = xPosition + MetricToPixel.SCALING_FACTOR; int yStringPosition = yPosition + (int) ((float) 2.75 * (float) MetricToPixel.SCALING_FACTOR); g.setColor(Color.BLACK); g.drawString(Integer.toString(maxVelocity), xStringPosition, yStringPosition); }