From 0436f9a8463676b6b100a0a9d57cbb169dc366bf Mon Sep 17 00:00:00 2001 From: Philipp Spohr <spohr.philipp@web.de> Date: Fri, 18 Aug 2017 16:17:41 +0200 Subject: [PATCH] Still some issues with swing revalidating --- .../java/de/hhu/ba/yoshikoWrapper/gui/ClusterView.java | 8 ++++++-- .../java/de/hhu/ba/yoshikoWrapper/gui/SolutionTab.java | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ClusterView.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ClusterView.java index da5040e..9586f3e 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ClusterView.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ClusterView.java @@ -19,8 +19,8 @@ public class ClusterView extends ComfortPanel { public ClusterView() { this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS)); - this.title = new JLabel(); - this.clusterSize = new JLabel(); + this.title = new JLabel("CLUSTERTITLE"); + this.clusterSize = new JLabel("CLUSTERLABEL"); this.nodeList = new JList<String>(); this.addAll(title,clusterSize,nodeList); @@ -28,10 +28,14 @@ public class ClusterView extends ComfortPanel { public void setTitle(long x) { this.title.setText(LocalizationManager.get("cluster")+" "+x); + revalidate(); + repaint(); } public void setClusterSize(long x) { this.clusterSize.setText(LocalizationManager.get("clusterSize")+" "+x); + revalidate(); + repaint(); } public void addNode(CyNode node) { diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/SolutionTab.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/SolutionTab.java index 300a4f2..4245053 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/SolutionTab.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/SolutionTab.java @@ -1,5 +1,6 @@ package de.hhu.ba.yoshikoWrapper.gui; +import javax.swing.BoxLayout; import javax.swing.JLabel; import javax.swing.JScrollPane; @@ -10,6 +11,7 @@ public class SolutionTab extends ComfortPanel { private final JLabel testLabel; public SolutionTab() { + this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS)); //init swing components scrollPane = new JScrollPane(); testLabel = new JLabel("test"); @@ -20,6 +22,8 @@ public class SolutionTab extends ComfortPanel { public ClusterView addCluster(long k) { ClusterView clusterView = new ClusterView(); scrollPane.add(clusterView); + scrollPane.revalidate(); + scrollPane.repaint(); return clusterView; } -- GitLab