harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Kishenko (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2369) [classlib][swing] javax.swing.text.ComponentView calculates span wrong way
Date Thu, 30 Nov 2006 08:40:21 GMT
[classlib][swing] javax.swing.text.ComponentView calculates span wrong way
--------------------------------------------------------------------------

                 Key: HARMONY-2369
                 URL: http://issues.apache.org/jira/browse/HARMONY-2369
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Denis Kishenko


Methods
  javax.swing.text.ComponentView.getPreferredSpan(),
  javax.swing.text.ComponentView.getMinimumSpan(),
  javax.swing.text.ComponentView.getMaximumSpan() 
calculate span wrong way. If parent of view is null this methods should return corresponding
size of ComponentView component.

============= Test ============
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JTextPane;
import javax.swing.text.ComponentView;
import javax.swing.text.Element;
import javax.swing.text.StyledDocument;
import javax.swing.text.View;

public class Test {

    public static void main(String[] args) {
        JComponent insertedComponent = new JButton("Hello word");
        JTextPane textPane = new JTextPane();
        StyledDocument document = textPane.getStyledDocument();
        textPane.insertComponent(insertedComponent);
        Element componentElement = document.getDefaultRootElement().getElement(0).getElement(0);
        ComponentView view = new ComponentView(componentElement);
        view.setParent(textPane.getUI().getRootView(textPane));

        System.out.println(view.getPreferredSpan(View.X_AXIS));
        System.out.println(view.getPreferredSpan(View.Y_AXIS));        
        System.out.println(view.getMaximumSpan(View.X_AXIS));
        System.out.println(view.getMaximumSpan(View.Y_AXIS));        
        System.out.println(view.getMinimumSpan(View.X_AXIS));
        System.out.println(view.getMinimumSpan(View.Y_AXIS));
    }
    
}

============ RI =============
0.0
0.0
0.0
0.0
0.0
0.0

========= Harmony ===========
96.0
25.0
96.0
25.0
96.0
25.0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message