git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a19aa5e
)
JAL-244 Avoid working on the Ids Graphics object when we don't mean to
author
Ben Soares
<b.soares@dundee.ac.uk>
Mon, 7 Aug 2023 11:28:53 +0000
(12:28 +0100)
committer
Ben Soares
<b.soares@dundee.ac.uk>
Mon, 7 Aug 2023 11:28:53 +0000
(12:28 +0100)
src/jalview/gui/AnnotationLabels.java
patch
|
blob
|
history
diff --git
a/src/jalview/gui/AnnotationLabels.java
b/src/jalview/gui/AnnotationLabels.java
index
255e1ff
..
56efe53
100755
(executable)
--- a/
src/jalview/gui/AnnotationLabels.java
+++ b/
src/jalview/gui/AnnotationLabels.java
@@
-1244,10
+1244,7
@@
public class AnnotationLabels extends JPanel
}
else
{
}
else
{
- Graphics2D g2d = (Graphics2D) g;
- Graphics dummy = g2d.create();
- int newAnnotationIdWidth = drawLabels(dummy, clip, width, false,
- null);
+ int newAnnotationIdWidth = drawLabels(g, clip, width, false, null);
width = Math.max(newAnnotationIdWidth, givenWidth);
}
drawLabels(g, clip, width, true, null);
width = Math.max(newAnnotationIdWidth, givenWidth);
}
drawLabels(g, clip, width, true, null);
@@
-1271,7
+1268,7
@@
public class AnnotationLabels extends JPanel
* @param fmetrics
* FontMetrics if Graphics object g is null
*/
* @param fmetrics
* FontMetrics if Graphics object g is null
*/
- public int drawLabels(Graphics g, boolean clip, int width,
+ public int drawLabels(Graphics g0, boolean clip, int width,
boolean actuallyDraw, FontMetrics fmetrics)
{
if (clip)
boolean actuallyDraw, FontMetrics fmetrics)
{
if (clip)
@@
-1279,6
+1276,20
@@
public class AnnotationLabels extends JPanel
clip = Cache.getDefault("MOVE_SEQUENCE_ID_WITH_VISIBLE_ANNOTATIONS",
true);
}
clip = Cache.getDefault("MOVE_SEQUENCE_ID_WITH_VISIBLE_ANNOTATIONS",
true);
}
+ Graphics g = null;
+ // create a dummy Graphics object if not drawing and one is supplied
+ if (g0 != null)
+ {
+ if (!actuallyDraw)
+ {
+ Graphics2D g2d = (Graphics2D) g0;
+ g = g2d.create();
+ }
+ else
+ {
+ g = g0;
+ }
+ }
int actualWidth = 0;
if (g != null)
{
int actualWidth = 0;
if (g != null)
{