From: amwaterhouse Date: Tue, 2 May 2006 12:23:28 +0000 (+0000) Subject: Remove unnecessary panel, also nullFrame created only once X-Git-Tag: Release_2_08_1~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=739be60490b5c6efe5237ff12605baa6b38035f4;p=jalview.git Remove unnecessary panel, also nullFrame created only once --- diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index ed88418..b1a8b8b 100755 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -63,13 +63,15 @@ public class AlignmentPanel extends Panel implements AdjustmentListener scalePanel = new ScalePanel(av, this); idwidthAdjuster = new IdwidthAdjuster(this); annotationPanel = new AnnotationPanel(this); + + sequenceHolderPanel.add(annotationPanel, BorderLayout.SOUTH); + alabels = new AnnotationLabels(this); setAnnotationVisible(av.showAnnotation); idPanelHolder.add(idPanel, BorderLayout.CENTER); idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER); - annotationScroller.add(annotationPanel); annotationSpaceFillerHolder.add(alabels, BorderLayout.CENTER); scalePanelHolder.add(scalePanel, BorderLayout.CENTER); seqPanelHolder.add(seqPanel, BorderLayout.CENTER); @@ -93,7 +95,6 @@ public class AlignmentPanel extends Panel implements AdjustmentListener idPanel.idCanvas.setSize(d); hscrollFillerPanel.setSize(d.width, annotationPanel.getSize().height); - annotationScroller.setSize(annotationPanel.getSize()); idPanel.idCanvas.setSize(d.width, seqPanel.seqCanvas.getSize().height); annotationSpaceFillerHolder.setSize(d.width, @@ -107,13 +108,13 @@ public class AlignmentPanel extends Panel implements AdjustmentListener { // set idCanvas bufferedImage to null // to prevent drawing old image - idPanel.idCanvas.image =null; + idPanel.idCanvas.image = null; FontMetrics fm = getFontMetrics(av.getFont()); scalePanel.setSize(new Dimension(10, av.charHeight + fm.getDescent())); idwidthAdjuster.setSize(new Dimension(10, av.charHeight + fm.getDescent())); -annotationPanel.image = null; + annotationPanel.image = null; int ap = annotationPanel.adjustPanelHeight(); annotationPanel.repaint(); Dimension d = calculateIdWidth(); @@ -139,16 +140,14 @@ annotationPanel.image = null; Dimension calculateIdWidth() { - Frame frame = new Frame(); - frame.addNotify(); - Graphics g = frame.getGraphics(); - if (g == null) + if (av.nullFrame == null) { - Frame f = new Frame(); - f.addNotify(); - g = f.getGraphics(); + av.nullFrame = new Frame(); + av.nullFrame.addNotify(); } + Graphics g = av.nullFrame.getGraphics(); + FontMetrics fm = g.getFontMetrics(av.font); AlignmentI al = av.getAlignment(); @@ -171,7 +170,7 @@ annotationPanel.image = null; i = 0; if (al.getAlignmentAnnotation() != null) { - fm = g.getFontMetrics(frame.getFont()); + fm = g.getFontMetrics(av.nullFrame.getFont()); while (i < al.getAlignmentAnnotation().length) { String label = al.getAlignmentAnnotation()[i].label; @@ -253,7 +252,7 @@ annotationPanel.image = null; if (!av.wrapAlignment) { annotationSpaceFillerHolder.setVisible(b); - annotationScroller.setVisible(b); + annotationPanel.setVisible(b); } validate(); repaint(); @@ -270,12 +269,12 @@ annotationPanel.image = null; if (wrap) { - annotationScroller.setVisible(false); + annotationPanel.setVisible(false); annotationSpaceFillerHolder.setVisible(false); } else if (av.showAnnotation) { - annotationScroller.setVisible(true); + annotationPanel.setVisible(true); annotationSpaceFillerHolder.setVisible(true); } @@ -522,7 +521,6 @@ annotationPanel.image = null; BorderLayout borderLayout10 = new BorderLayout(); protected Panel hscrollFillerPanel = new Panel(); BorderLayout borderLayout11 = new BorderLayout(); - public Panel annotationScroller = new Panel(); BorderLayout borderLayout4 = new BorderLayout(); BorderLayout borderLayout2 = new BorderLayout(); @@ -557,11 +555,9 @@ annotationPanel.image = null; // this.setPreferredSize(new Dimension(220, 166)); seqPanelHolder.setBackground(Color.white); idPanelHolder.setBackground(Color.white); - annotationScroller.setLayout(borderLayout2); sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH); sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER); seqPanelHolder.add(vscroll, BorderLayout.EAST); - sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH); // Panel3.add(secondaryPanelHolder, BorderLayout.SOUTH); this.add(idPanelHolder, BorderLayout.WEST);