From 9cf25102bb8113bc586739ae8e24f166d16fa6a0 Mon Sep 17 00:00:00 2001
From: Tim Molter <tim.molter@gmail.com>
Date: Fri, 21 Mar 2014 22:42:29 +0100
Subject: [PATCH] new feature - allow customization of SwingWrapper Window
 Title

---
 .../java/com/xeiam/xchart/SwingWrapper.java   | 31 +++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/xchart/src/main/java/com/xeiam/xchart/SwingWrapper.java b/xchart/src/main/java/com/xeiam/xchart/SwingWrapper.java
index 5f51cf89..14d2ae08 100644
--- a/xchart/src/main/java/com/xeiam/xchart/SwingWrapper.java
+++ b/xchart/src/main/java/com/xeiam/xchart/SwingWrapper.java
@@ -29,6 +29,8 @@ import javax.swing.JPanel;
  */
 public class SwingWrapper {
 
+  private String windowTitle = "XChart";
+
   private List<Chart> charts = new ArrayList<Chart>();
   private int numRows;
   private int numColumns;
@@ -70,13 +72,25 @@ public class SwingWrapper {
     this.numColumns = numColumns;
   }
 
+  /**
+   * Display the chart in a Swing JFrame
+   * 
+   * @param windowTitle the title of the window
+   */
+  public JFrame displayChart(String windowTitle) {
+
+    this.windowTitle = windowTitle;
+
+    return displayChart();
+  }
+
   /**
    * Display the chart in a Swing JFrame
    */
   public JFrame displayChart() {
 
     // Create and set up the window.
-    final JFrame frame = new JFrame("XChart");
+    final JFrame frame = new JFrame(windowTitle);
 
     // Schedule a job for the event-dispatching thread:
     // creating and showing this application's GUI.
@@ -98,13 +112,26 @@ public class SwingWrapper {
     return frame;
   }
 
+  /**
+   * Display the charts in a Swing JFrame
+   * 
+   * @param windowTitle the title of the window
+   * @return the JFrame
+   */
+  public JFrame displayChartMatrix(String windowTitle) {
+
+    this.windowTitle = windowTitle;
+
+    return displayChartMatrix();
+  }
+
   /**
    * Display the chart in a Swing JFrame
    */
   public JFrame displayChartMatrix() {
 
     // Create and set up the window.
-    final JFrame frame = new JFrame("XChart");
+    final JFrame frame = new JFrame(windowTitle);
 
     // Schedule a job for the event-dispatching thread:
     // creating and showing this application's GUI.
-- 
GitLab