harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r575606 - in /harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing: JTable.java plaf/basic/BasicComboBoxUI.java
Date Fri, 14 Sep 2007 10:19:37 GMT
Author: apetrenko
Date: Fri Sep 14 03:19:31 2007
New Revision: 575606

URL: http://svn.apache.org/viewvc?rev=575606&view=rev
Log:
Patch for HARMONY-4787 "[classlib][swing] To reduce NullPointerException in swing"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTable.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTable.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTable.java?rev=575606&r1=575605&r2=575606&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTable.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTable.java
Fri Sep 14 03:19:31 2007
@@ -1264,7 +1264,11 @@
     }
 
     public int columnAtPoint(Point p) {
-        return getTableHeader().columnAtPoint(p);
+        int x = p.x;
+        if( !getComponentOrientation().isLeftToRight() ) {
+          x = getWidth() - x;
+        }
+        return getColumnModel().getColumnIndexAtX(x);
     }
 
     public int rowAtPoint(Point p) {
@@ -1645,7 +1649,7 @@
         if (getAutoResizeMode() == AUTO_RESIZE_OFF) {
             return;
         }
-        TableColumn resizingColumn = getTableHeader().getResizingColumn();
+        TableColumn resizingColumn = (getTableHeader() == null) ? null : getTableHeader().getResizingColumn();
         if (resizingColumn == null) {
             ResizableElements resizable = new ResizableElements() {
                 public int getElementsCount() {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java?rev=575606&r1=575605&r2=575606&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java
Fri Sep 14 03:19:31 2007
@@ -172,18 +172,24 @@
     public class PropertyChangeHandler implements PropertyChangeListener {
         public void propertyChange(final PropertyChangeEvent event) {
             if (StringConstants.ENABLED_PROPERTY_CHANGED.equals(event.getPropertyName()))
{
+                if (arrowButton != null) {
                 arrowButton.setEnabled(((Boolean)event.getNewValue()).booleanValue());
-                if (comboBox.isEditable()) {
+                }
+                if (comboBox.isEditable() && (editor != null)) {
                     editor.setEnabled(((Boolean)event.getNewValue()).booleanValue());
                 }
             } else if (StringConstants.TOOLTIP_PROPERTY_CHANGED.equals(event.getPropertyName()))
{
+                if (arrowButton != null) {
                 arrowButton.setToolTipText((String)event.getNewValue());
+                }
                 if (comboBox.isEditable() && (editor instanceof JComponent)) {
                     ((JComponent)editor).setToolTipText((String)event.getNewValue());
                 }
             } else if (StringConstants.FONT_PROPERTY_CHANGED.equals(event.getPropertyName()))
{
+                if (arrowButton != null) {
                 arrowButton.setFont((Font)event.getNewValue());
-                if (comboBox.isEditable()) {
+                }
+                if (comboBox.isEditable() && (editor != null)) {
                     editor.setFont((Font)event.getNewValue());
                 }
             } else if (StringConstants.EDITABLE_PROPERTY_CHANGED.equals(event.getPropertyName()))
{



Mime
View raw message