scalePanelHolder.add(scalePanel, BorderLayout.CENTER);\r
scorePanelHolder.add(scorePanel, BorderLayout.CENTER);\r
seqPanelHolder.add(seqPanel, BorderLayout.CENTER);\r
- setScrollValues(0,0);\r
+\r
+\r
+ if(seqPanel.seqCanvas.getWidth()==0)\r
+ javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+ {\r
+ public void run()\r
+ {\r
+ setScrollValues(0,0);\r
+ Dimension d = calculateIdWidth();\r
+ d.setSize( d.width+4, d.height);\r
+ idPanel.idCanvas.setPreferredSize( d );\r
+ hscrollFillerPanel.setPreferredSize( d );\r
+ RefreshPanels();\r
+ }\r
+ });\r
+\r
\r
hscroll.addAdjustmentListener(this);\r
vscroll.addAdjustmentListener(this);\r
{\r
public void componentResized(ComponentEvent evt)\r
{\r
- if(seqPanel.getWidth()>0 && seqPanel.getHeight()>0)\r
RefreshPanels();\r
}\r
});\r
\r
-\r
- // hscroll.setFocusable(false);\r
- // vscroll.setFocusable(false);\r
setFocusable(true);\r
-\r
addKeyListener(new KeyAdapter()\r
{\r
public void keyPressed(KeyEvent evt)\r
\r
public void RefreshPanels()\r
{\r
+\r
requestFocus();\r
invalidate();\r
idPanelHolder.setPreferredSize(idPanel.idCanvas.getPreferredSize());\r
}\r
else\r
\r
- setScrollValues(av.getStartRes(), av.getStartSeq());\r
av.getConsensus(true);\r
if (overviewPanel != null)\r
overviewPanel.updateOverviewImage();\r
\r
validate();\r
+ setScrollValues(av.getStartRes(), av.getStartSeq());\r
repaint();\r
}\r
int hextent = 0;\r
\r
public void setScrollValues(int x, int y)\r
{\r
- hextent = seqPanel.seqCanvas.getWidth()/av.getCharWidth();\r
- vextent = seqPanel.seqCanvas.getHeight()/av.getCharHeight();\r
+ hextent = seqPanel.seqCanvas.getWidth()/av.charWidth;\r
+ vextent = seqPanel.seqCanvas.getHeight()/av.charHeight;\r
+\r
+ if(hextent > av.alignment.getWidth())\r
+ hextent = av.alignment.getWidth();\r
+ if(vextent > av.alignment.getHeight())\r
+ vextent = av.alignment.getHeight();\r
\r
if(hextent+x > av.getAlignment().getWidth())\r
x = av.getAlignment().getWidth()- hextent;\r
hscroll.setValues(x,hextent,0,av.getAlignment().getWidth());\r
vscroll.setValues(y,vextent,0,av.getAlignment().getHeight() );\r
\r
-\r
repaint();\r
\r
}\r