From e3715a084085a731522ce45bc3feae034d771a84 Mon Sep 17 00:00:00 2001 From: kiritoAlex <12210607@mail.sustech.edu.cn> Date: Sun, 18 May 2025 17:41:42 +0800 Subject: [PATCH] Fix the problem of unvisible edge weights --- src/graphtea/graph/graph/Edge.java | 7 +++---- src/graphtea/graph/graph/GraphModel.java | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/graphtea/graph/graph/Edge.java b/src/graphtea/graph/graph/Edge.java index 0e910b6f..24f92137 100755 --- a/src/graphtea/graph/graph/Edge.java +++ b/src/graphtea/graph/graph/Edge.java @@ -345,12 +345,11 @@ public String getLabel() { private void updateText() { String _label; - if (!isShowWeight()) + if (!isShowWeight()) { _label = label; - else if (isShowWeight()) + } else { _label = String.valueOf(super.getWeight()); - else - _label = label + "," + super.getWeight(); + } this.text = _label; repaintView(); } diff --git a/src/graphtea/graph/graph/GraphModel.java b/src/graphtea/graph/graph/GraphModel.java index af7a21d5..6599fc6c 100755 --- a/src/graphtea/graph/graph/GraphModel.java +++ b/src/graphtea/graph/graph/GraphModel.java @@ -32,7 +32,7 @@ public class GraphModel extends ListGraph implements StorableOnExi private Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 14); @UserModifiableProperty(displayName = "Show Edge Labels") - public static boolean showEdgeWeights = false; + public static boolean showEdgeWeights = true; @UserModifiableProperty(displayName = "Show Vertex Labels") public static boolean vertexLabelsEnabled = true; private boolean drawVertexLabels = vertexLabelsEnabled;