X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDesktop.java;h=9588cf4c2c575260e9f736930b359ba3d150bdc3;hb=c4fe29146bd25f9b70603e62ab97422088fb71ff;hp=aafd8c0f676307bac0c3b4ed77f774c74a4d2245;hpb=b1bc2a997b0620a85818ed5f6813326c1faae9d3;p=jalview.git diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index aafd8c0..9588cf4 100755 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -22,14 +22,16 @@ public class Desktop extends jalview.jbgui.GDesktop public static JDesktopPane desktop; static int openFrameCount = 0; static final int xOffset = 30, yOffset = 30; + static boolean splashScreenVisible = false; public Desktop() { + Image image =null; try{ java.net.URL url = getClass().getResource("/BartonGroupBanner.gif"); if(url!=null) { - Image image = java.awt.Toolkit.getDefaultToolkit().createImage(url); + image = java.awt.Toolkit.getDefaultToolkit().createImage(url); MediaTracker mt = new MediaTracker(this); mt.addImage(image, 0); mt.waitForID(0); @@ -44,16 +46,35 @@ public class Desktop extends jalview.jbgui.GDesktop desktop = new JDesktopPane(); setContentPane(desktop); desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); - int inset = 150; + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - setBounds(inset, inset, - screenSize.width - inset*2, - screenSize.height - inset*2); + setBounds( (int)(screenSize.getWidth()-1200)/2, + (int)(screenSize.getHeight()-800)/2, + 1200 , + 800); + + + /////////Add a splashscreen on startup + JInternalFrame frame = new JInternalFrame(); + + SplashScreen splash = new SplashScreen(frame, image); + frame.setContentPane(splash); + addInternalFrame(frame, "",820,200); + splashScreenVisible = true; + + frame.setLocation( (int)((getWidth()-820) /2), (int)((getHeight()-240) /2)); + frame.setClosable(false); + frame.setIconifiable(false); + frame.setMaximizable(false); + frame.setFrameIcon(null); + splashScreenVisible = false; + } public static void addInternalFrame(final JInternalFrame frame, String title, int w, int h) { - frame.setVisible(true); //necessary as of 1.3 + if(!splashScreenVisible) + frame.setVisible(true); //necessary as of 1.3 desktop.add(frame); openFrameCount++; try { @@ -109,7 +130,6 @@ public class Desktop extends jalview.jbgui.GDesktop { SequenceI [] sequences = null; - if (FormatProperties.contains(format)) sequences = FormatAdapter.read(file, protocol, format); @@ -122,7 +142,7 @@ public class Desktop extends jalview.jbgui.GDesktop } else - JOptionPane.showMessageDialog(this, "Couldn't open file.\n" + JOptionPane.showInternalMessageDialog(this, "Couldn't open file.\n" + "Formats currently supported are\n" + "Fasta, MSF, Clustal, BLC, PIR, MSP or PFAM" ,"Error loading file", @@ -132,7 +152,7 @@ public class Desktop extends jalview.jbgui.GDesktop public void inputURLMenuItem_actionPerformed(ActionEvent e) { - String url = JOptionPane.showInputDialog(this,"Enter url of input file", + String url = JOptionPane.showInternalInputDialog(this,"Enter url of input file", "Input alignment from URL", JOptionPane.QUESTION_MESSAGE); if (url == null) @@ -143,7 +163,7 @@ public class Desktop extends jalview.jbgui.GDesktop System.out.println(format +" format"); if (format.equals("URL NOT FOUND")) { - JOptionPane.showMessageDialog(this,"Couldn't locate " + url, + JOptionPane.showInternalMessageDialog(this,"Couldn't locate " + url, "URL not found", JOptionPane.WARNING_MESSAGE); return; @@ -178,7 +198,7 @@ public class Desktop extends jalview.jbgui.GDesktop af.statusBar.setText("Successfully pasted alignment file"); } else - JOptionPane.showMessageDialog(this, "Couldn't read the pasted text.\n" + JOptionPane.showInternalMessageDialog(this, "Couldn't read the pasted text.\n" +"Formats currently supported are\n" +"Fasta, MSF, Clustal, BLC, PIR, MSP or PFAM", "Error parsing text", JOptionPane.WARNING_MESSAGE);