Moved font settings from TreeNode to TreeBrowser.
authorberghofe
Mon, 22 Oct 2001 14:52:12 +0200
changeset 11873 38dc46b55d7e
parent 11872 4f24fd4dbcf5
child 11874 83c97febc828
Moved font settings from TreeNode to TreeBrowser.
lib/browser/GraphBrowser/TreeBrowser.java
lib/browser/GraphBrowser/TreeNode.java
--- a/lib/browser/GraphBrowser/TreeBrowser.java	Mon Oct 22 14:51:39 2001 +0200
+++ b/lib/browser/GraphBrowser/TreeBrowser.java	Mon Oct 22 14:52:12 2001 +0200
@@ -2,7 +2,7 @@
   Title:      GraphBrowser/TreeBrowser.java
   ID:         $Id$
   Author:     Stefan Berghofer, TU Muenchen
-  Copyright   1997  TU Muenchen
+  License:    GPL (GNU GENERAL PUBLIC LICENSE)
 
   This class defines the browser window which is used to display directory
   trees. It contains methods for handling events.
@@ -23,9 +23,10 @@
 	long timestamp;
 	Dimension size;
 	boolean parent_needs_layout;
+	Font font;
 
-	public TreeBrowser(TreeNode tn, GraphView gr) {
-		t=tn;gv=gr;
+	public TreeBrowser(TreeNode tn, GraphView gr, Font f) {
+		t = tn; gv = gr; font = f;
 		size = new Dimension(0, 0);
 		parent_needs_layout = true;
 		addMouseListener(this);
@@ -82,6 +83,7 @@
 
 	public void paint(Graphics g)
 	{
+		g.setFont(font);
 		Dimension d = t.draw(g,5,5,selected);
 		if (parent_needs_layout) {
 			size = new Dimension(5+d.width, 5+d.height);
--- a/lib/browser/GraphBrowser/TreeNode.java	Mon Oct 22 14:51:39 2001 +0200
+++ b/lib/browser/GraphBrowser/TreeNode.java	Mon Oct 22 14:52:12 2001 +0200
@@ -2,7 +2,7 @@
   Title:      GraphBrowser/TreeNode.java
   ID:         $Id$
   Author:     Stefan Berghofer, TU Muenchen
-  Copyright   1997  TU Muenchen
+  License:    GPL (GNU GENERAL PUBLIC LICENSE)
 
   This class contains methods for storing and manipulating directory
   trees (e.g. collapsing / uncollapsing directory branches).
@@ -33,7 +33,6 @@
 
 public class TreeNode
 {
-	static Font f=new Font("Helvetica", Font.PLAIN, 14);
 	int starty,endy,number;
 	String name,path;
 
@@ -140,8 +139,7 @@
 
 	public Dimension draw(Graphics g,int x,int y,TreeNode t)
 	{
-		FontMetrics fm=g.getFontMetrics(f);
-		g.setFont(f);
+		FontMetrics fm=g.getFontMetrics(g.getFont());
 		int h=fm.getHeight();
 		int e=(int) (h / 10) + 1;
 		int down_x[]={x + e, x + h - e, x + (int)(h / 2)};