This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gui] Patch: javax.swing.plaf.basic.BasicTextUI


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I just commited the attached patch to make BasicTextUI handle 
PropertyChangeEvents, e.g. when the document of the JTextComponent 
changes.


Michael


2004-08-12  Michael Koch  <konqueror@gmx.de>

	* javax/swing/plaf/basic/BasicTextUI.java
	(installUI): Add eventHandler as property listener.
	(uninstallUI): remove eventHandler as propert listener.
	(installDefaults): Added comment.
	(installListeners): Likewise.
	(installKeyboardActions): Likewise.
	(uninstallDefaults): Likewise.
	(uninstallListeners): Likewise.
	(uninstallKeyboardActions): Likewise.


- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBG04BWSOgCCdjSDsRAiGgAJ4h0Vhzj8kY3G393MVPBtLYXyGxjACfdUM2
tDw3dcKH1Yi8VLYVMVOyAJg=
=6o/z
-----END PGP SIGNATURE-----
Index: javax/swing/plaf/basic/BasicTextUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicTextUI.java,v
retrieving revision 1.4.16.9
diff -u -r1.4.16.9 BasicTextUI.java
--- javax/swing/plaf/basic/BasicTextUI.java	12 Aug 2004 10:02:46 -0000	1.4.16.9
+++ javax/swing/plaf/basic/BasicTextUI.java	12 Aug 2004 10:46:07 -0000
@@ -185,6 +185,7 @@
 	textComponent.setDocument(doc);
       }
     
+    textComponent.addPropertyChangeListener(eventHandler);
     modelChanged();
     
     installDefaults();
@@ -194,20 +195,26 @@
 
   protected void installDefaults()
   {
+    // Do nothing here.
   }
 
   protected void installListeners()
   {
+    // Do nothing here.
   }
 
   protected void installKeyboardActions()
   {
+    // Do nothing here.
   }
   
-  public void uninstallUI(final JComponent c)
+  public void uninstallUI(final JComponent component)
   {
-    super.uninstallUI(c);
-    rootView = null;
+    super.uninstallUI(component);
+    rootView.setView(null);
+
+    textComponent.removePropertyChangeListener(eventHandler);
+    textComponent = null;
 
     uninstallDefaults();
     uninstallListeners();
@@ -216,14 +223,17 @@
 
   protected void uninstallDefaults()
   {
+    // Do nothing here.
   }
 
   protected void uninstallListeners()
   {
+    // Do nothing here.
   }
 
   protected void uninstallKeyboardActions()
   {
+    // Do nothing here.
   }
   
   protected abstract String getPropertyPrefix();

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]