You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vasily Zakharov (JIRA)" <ji...@apache.org> on 2007/09/07 00:49:28 UTC

[jira] Created: (HARMONY-4756) [classlib][swing] JFrame.pack() sets window size incorrectly

[classlib][swing] JFrame.pack() sets window size incorrectly
------------------------------------------------------------

                 Key: HARMONY-4756
                 URL: https://issues.apache.org/jira/browse/HARMONY-4756
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Vasily Zakharov


If JFrame.pack() is used to set window size, some contents remain hidden on Harmony, while RI sets the window size to fit content size.

Here's the simple reproducer:

import javax.swing.JEditorPane;
import javax.swing.JFrame;
public class Test {
    public static void main(String argv[]) {
        try {
            JFrame frame = new JFrame("Test");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.getContentPane().add(new JEditorPane("text/html", "1<br>2<br>3<br>4"));
            frame.pack();
            frame.setVisible(true);
        } catch (Exception e) {
            e.printStackTrace(System.out);
        }
    }
}

The attached screenshots demonstrate the problem.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-4756) [classlib][swing] JFrame.pack() sets window size incorrectly

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasily Zakharov updated HARMONY-4756:
-------------------------------------

    Attachment: RI.jpg

> [classlib][swing] JFrame.pack() sets window size incorrectly
> ------------------------------------------------------------
>
>                 Key: HARMONY-4756
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4756
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vasily Zakharov
>         Attachments: RI.jpg
>
>
> If JFrame.pack() is used to set window size, some contents remain hidden on Harmony, while RI sets the window size to fit content size.
> Here's the simple reproducer:
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
> public class Test {
>     public static void main(String argv[]) {
>         try {
>             JFrame frame = new JFrame("Test");
>             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>             frame.getContentPane().add(new JEditorPane("text/html", "1<br>2<br>3<br>4"));
>             frame.pack();
>             frame.setVisible(true);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> The attached screenshots demonstrate the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-4756) [classlib][swing] JFrame.pack() sets window size incorrectly

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasily Zakharov updated HARMONY-4756:
-------------------------------------

    Attachment: Harmony.jpg

> [classlib][swing] JFrame.pack() sets window size incorrectly
> ------------------------------------------------------------
>
>                 Key: HARMONY-4756
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4756
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vasily Zakharov
>         Attachments: Harmony.jpg, RI.jpg
>
>
> If JFrame.pack() is used to set window size, some contents remain hidden on Harmony, while RI sets the window size to fit content size.
> Here's the simple reproducer:
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
> public class Test {
>     public static void main(String argv[]) {
>         try {
>             JFrame frame = new JFrame("Test");
>             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>             frame.getContentPane().add(new JEditorPane("text/html", "1<br>2<br>3<br>4"));
>             frame.pack();
>             frame.setVisible(true);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> The attached screenshots demonstrate the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-4756) [classlib][swing] JFrame.pack() sets window size incorrectly

Posted by "Linbin Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12528690 ] 

Linbin Yu commented on HARMONY-4756:
------------------------------------

I have investigated this issue for some days. I found that it woks well after replacing "text/html" as "text/plain". So I think the issue is about HTMLEditorKit. I will continue to investigate it.

> [classlib][swing] JFrame.pack() sets window size incorrectly
> ------------------------------------------------------------
>
>                 Key: HARMONY-4756
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4756
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vasily Zakharov
>         Attachments: Harmony.jpg, RI.jpg
>
>
> If JFrame.pack() is used to set window size, some contents remain hidden on Harmony, while RI sets the window size to fit content size.
> Here's the simple reproducer:
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
> public class Test {
>     public static void main(String argv[]) {
>         try {
>             JFrame frame = new JFrame("Test");
>             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>             frame.getContentPane().add(new JEditorPane("text/html", "1<br>2<br>3<br>4"));
>             frame.pack();
>             frame.setVisible(true);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> The attached screenshots demonstrate the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-4756) [classlib][swing] JFrame.pack() sets window size incorrectly

Posted by "Alexey Petrenko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Petrenko resolved HARMONY-4756.
--------------------------------------

    Resolution: Fixed

The patch has been applied. Please verify.

> [classlib][swing] JFrame.pack() sets window size incorrectly
> ------------------------------------------------------------
>
>                 Key: HARMONY-4756
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4756
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vasily Zakharov
>            Assignee: Alexey Petrenko
>         Attachments: harmony-4756-fix.patch, Harmony.jpg, RI.jpg
>
>
> If JFrame.pack() is used to set window size, some contents remain hidden on Harmony, while RI sets the window size to fit content size.
> Here's the simple reproducer:
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
> public class Test {
>     public static void main(String argv[]) {
>         try {
>             JFrame frame = new JFrame("Test");
>             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>             frame.getContentPane().add(new JEditorPane("text/html", "1<br>2<br>3<br>4"));
>             frame.pack();
>             frame.setVisible(true);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> The attached screenshots demonstrate the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-4756) [classlib][swing] JFrame.pack() sets window size incorrectly

Posted by "Linbin Yu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Linbin Yu updated HARMONY-4756:
-------------------------------

    Attachment: harmony-4756-fix.patch

This patch can fix this issue. 
Just add "getUI().getRootView(this).setSize(0,0);" in the first line of JEditPane.getPreferredSize(),
I think it's about refreshing of the JEditPane view . Maybe it's related to other issue, just for reference.

> [classlib][swing] JFrame.pack() sets window size incorrectly
> ------------------------------------------------------------
>
>                 Key: HARMONY-4756
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4756
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vasily Zakharov
>         Attachments: harmony-4756-fix.patch, Harmony.jpg, RI.jpg
>
>
> If JFrame.pack() is used to set window size, some contents remain hidden on Harmony, while RI sets the window size to fit content size.
> Here's the simple reproducer:
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
> public class Test {
>     public static void main(String argv[]) {
>         try {
>             JFrame frame = new JFrame("Test");
>             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>             frame.getContentPane().add(new JEditorPane("text/html", "1<br>2<br>3<br>4"));
>             frame.pack();
>             frame.setVisible(true);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> The attached screenshots demonstrate the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HARMONY-4756) [classlib][swing] JFrame.pack() sets window size incorrectly

Posted by "Alexey Petrenko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Petrenko reassigned HARMONY-4756:
----------------------------------------

    Assignee: Alexey Petrenko

> [classlib][swing] JFrame.pack() sets window size incorrectly
> ------------------------------------------------------------
>
>                 Key: HARMONY-4756
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4756
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vasily Zakharov
>            Assignee: Alexey Petrenko
>         Attachments: harmony-4756-fix.patch, Harmony.jpg, RI.jpg
>
>
> If JFrame.pack() is used to set window size, some contents remain hidden on Harmony, while RI sets the window size to fit content size.
> Here's the simple reproducer:
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
> public class Test {
>     public static void main(String argv[]) {
>         try {
>             JFrame frame = new JFrame("Test");
>             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>             frame.getContentPane().add(new JEditorPane("text/html", "1<br>2<br>3<br>4"));
>             frame.pack();
>             frame.setVisible(true);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> The attached screenshots demonstrate the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-4756) [classlib][swing] JFrame.pack() sets window size incorrectly

Posted by "Linbin Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12529068 ] 

Linbin Yu commented on HARMONY-4756:
------------------------------------

Notice that it shouldn't be a "patch". It just makes pack() function works. 
I will keep to investigate it. Thanks for Dmitry's advices.

> [classlib][swing] JFrame.pack() sets window size incorrectly
> ------------------------------------------------------------
>
>                 Key: HARMONY-4756
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4756
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vasily Zakharov
>            Assignee: Alexey Petrenko
>         Attachments: harmony-4756-fix.patch, Harmony.jpg, RI.jpg
>
>
> If JFrame.pack() is used to set window size, some contents remain hidden on Harmony, while RI sets the window size to fit content size.
> Here's the simple reproducer:
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
> public class Test {
>     public static void main(String argv[]) {
>         try {
>             JFrame frame = new JFrame("Test");
>             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>             frame.getContentPane().add(new JEditorPane("text/html", "1<br>2<br>3<br>4"));
>             frame.pack();
>             frame.setVisible(true);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> The attached screenshots demonstrate the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.