From 6617eddc1f1b0b993920ca5b74a24c6828fe6bad Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 1 Apr 2005 16:43:42 +0000 Subject: [PATCH] anti_aliasing on --- src/jalview/gui/ScalePanel.java | 7 ++++++- src/jalview/gui/SeqCanvas.java | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index 37cfcaf..01ba119 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -61,6 +61,8 @@ public class ScalePanel extends JPanel sg.setStartRes(res); sg.setEndRes(res); + + ap.annotationPanel.addEditableColumn(res); } av.setSelectionGroup(sg); ap.RefreshPanels(); @@ -102,6 +104,7 @@ public class ScalePanel extends JPanel else if (res < sg.getStartRes()) sg.setStartRes(res); + ap.annotationPanel.addEditableColumn(res); ap.RefreshPanels(); } } @@ -112,8 +115,10 @@ public class ScalePanel extends JPanel } // scalewidth will normally be screenwidth, - public void drawScale(Graphics gg, int startx, int endx, int scaleWidth) + public void drawScale(Graphics g, int startx, int endx, int scaleWidth) { + Graphics2D gg = (Graphics2D)g; + gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); int charWidth = av.getCharWidth(); gg.setFont(av.getFont()); diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index f9ab015..d3e5d6d 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -10,7 +10,7 @@ public class SeqCanvas extends JPanel { FeatureRenderer fr; Image img; - Graphics gg; + Graphics2D gg; int imgWidth; int imgHeight; @@ -72,8 +72,9 @@ public class SeqCanvas extends JPanel imgWidth = getWidth(); imgHeight = getHeight(); img = createImage(imgWidth,imgHeight); - gg = img.getGraphics(); + gg = (Graphics2D)img.getGraphics(); gg.setFont(av.getFont()); + gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); paintFlag = false; } @@ -84,7 +85,8 @@ public class SeqCanvas extends JPanel av.setChunkHeight(chunkHeight); av.setChunkWidth(chunkWidth); - fillBackground(gg,Color.WHITE,0,0,imgWidth,imgHeight); + gg.setColor(Color.WHITE); + gg.fillRect(0,0,imgWidth,imgHeight); if (av.getWrapAlignment()) drawWrappedPanel(gg, getWidth(), getHeight(), av.startRes); @@ -122,9 +124,10 @@ public class SeqCanvas extends JPanel } - public void drawPanel(Graphics g,int x1,int x2, int y1, int y2,int startx, int starty,int offset) { + public void drawPanel(Graphics g1,int x1,int x2, int y1, int y2,int startx, int starty,int offset) { + Graphics2D g = (Graphics2D)g1; g.setFont(av.getFont()); RendererI sr = av.getRenderer(); @@ -213,9 +216,15 @@ public class SeqCanvas extends JPanel oldY = sy; inGroup = true; if (group == av.getSelectionGroup()) - g.setColor(Color.RED.brighter()); + { + g.setStroke(new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 3f, new float[]{5f,2f,2f}, 0f )); + g.setColor(Color.RED); + } else + { + g.setStroke(new BasicStroke()); g.setColor(group.getOutlineColour()); + } } } else @@ -272,10 +281,6 @@ public class SeqCanvas extends JPanel } - public void fillBackground(Graphics g,Color c, int x1,int y1,int width,int height) { - g.setColor(c); - g.fillRect(x1,y1,width,height); - } public int getChunkWidth() { return chunkWidth; -- 1.7.10.2