From b74e294a72e55800143248d8c3938d86dcf02a2f Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 8 Apr 2005 16:15:29 +0000 Subject: [PATCH] try out spinning logo --- src/jalview/gui/AlignFrame.java | 47 ++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 6170cf9..3123184 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1058,41 +1058,43 @@ if ( viewport.getConservationSelected() ) class ClustalThread extends JPanel implements Runnable { - Image [] image; - int imageIndex = 0; + Image image; + int angle = 0; boolean webServiceRunning = false; JInternalFrame frame; public ClustalThread(JInternalFrame frame) { this.frame = frame; - image = new Image[9]; - for(int i=0; i<9; i++) + + java.net.URL url = getClass().getResource("/images/logo.gif"); + if (url != null) { - java.net.URL url = getClass().getResource("/images/dna" + (i+1) + ".gif"); - if (url != null) + image = java.awt.Toolkit.getDefaultToolkit().createImage(url); + MediaTracker mt = new MediaTracker(this); + mt.addImage(image, 0); + try { - image[i] = java.awt.Toolkit.getDefaultToolkit().createImage(url); - MediaTracker mt = new MediaTracker(this); - mt.addImage(image[i], i); - try{mt.waitForID(i);} - catch(Exception ex){} + mt.waitForID(0); } + catch (Exception ex) + {} } - DNATwirler twirler = new DNATwirler(); - twirler.start(); + + ImageSpinner spinner = new ImageSpinner(); + spinner.start(); webServiceRunning = true; } - class DNATwirler extends Thread + class ImageSpinner extends Thread { public void run() { while(webServiceRunning) { try{ - Thread.sleep(100); - imageIndex++; - imageIndex %=9; + Thread.sleep(10); + angle+=1; + angle %=360; repaint(); } catch(Exception ex){} @@ -1136,17 +1138,22 @@ if ( viewport.getConservationSelected() ) }catch(Exception ex){} } - public void paintComponent(Graphics g) + public void paintComponent(Graphics g1) { + Graphics2D g = (Graphics2D)g1; g.setColor(Color.white); g.fillRect(0,0,getWidth(), getHeight()); if(image!=null) { - g.drawImage(image[imageIndex],10,10,this); + + g.rotate (Math.toRadians(angle), 28, 28); + + g.drawImage(image,10,10,this); + g.rotate (-Math.toRadians(angle), 28, 28 ); } g.setFont(new Font("Arial", Font.BOLD, 12)); g.setColor(Color.black); - g.drawString("Clustal Alignment Web Service running", 30,30); + g.drawString("Clustal Alignment Web Service running", 60,30); } } protected void jpred_actionPerformed(ActionEvent e) -- 1.7.10.2