harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry Irlyanov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4655) [classlib][swing]Setting null as margin to button don't cause to use the default margin
Date Wed, 29 Aug 2007 15:55:30 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-4655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523619
] 

Dmitry Irlyanov commented on HARMONY-4655:
------------------------------------------

Alexei,
These tests are incompatible with RI:

try this:

import java.awt.Insets;

import javax.swing.JMenuItem;
import javax.swing.UIManager;
import javax.swing.plaf.InsetsUIResource;
import javax.swing.plaf.basic.BasicMenuItemUI;

public class Test {

        public static void main(String argv[]) {
            JMenuItem item = new JMenuItem();
            BasicMenuItemUIT menuItemUI;
            String prefix ="MenuItem.";
            menuItemUI = new BasicMenuItemUIT();
            item.setUI(menuItemUI);
            Insets margin = new InsetsUIResource(1, 2, 3, 4);
            UIManager.getDefaults().put(prefix + "margin", margin);
            menuItemUI.installDefaults();
            menuItemUI.uninstallDefaults();
            System.err.println(item.getMargin());
       }
}

class BasicMenuItemUIT extends BasicMenuItemUI{
    
    @Override
    public void installDefaults(){
        super.installDefaults();
    }
    
    @Override
    public void uninstallDefaults(){
        super.uninstallDefaults();
    }
}

The result is:

Harmony:
null

RI:
javax.swing.plaf.InsetsUIResource[top=1,left=2,bottom=3,right=4]


But IMHO this is a bug (a little one, but anyway)

I ask your commiter's weighty opinion: should I either make the patch to UI's and be architectural
correct or patch to tests and be compatible 

> [classlib][swing]Setting null as margin to button don't cause to use the default margin
> ---------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4655
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4655
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Dmitry Irlyanov
>            Assignee: Alexei Zakharov
>            Priority: Minor
>         Attachments: H4655-AbstractButton.patch, H4655-AbstractButtonTest.patch
>
>
> According to spec, AbstractButton.setMargin(null) causes the button to use the default
margin (2,2,2,2) but Harmony doesn't obey this rule
> import java.awt.Insets;
> import javax.swing.JRadioButton;
> public class Test {
>     public static void main(String[] args) {
>         
>         JRadioButton rb = new JRadioButton();
>         System.err.println(rb.getMargin());
>         rb.setMargin(null);
>         System.err.println(rb.getMargin());
>         rb.setMargin(new Insets(10,10,10,10));
>         System.err.println(rb.getMargin());
>         rb.setMargin(null);
>         System.err.println(rb.getMargin());
>     }
> }
> Output(RI):
> javax.swing.plaf.InsetsUIResource[top=2,left=2,bottom=2,right=2]
> javax.swing.plaf.InsetsUIResource[top=2,left=2,bottom=2,right=2]
> java.awt.Insets[top=10,left=10,bottom=10,right=10]
> javax.swing.plaf.InsetsUIResource[top=2,left=2,bottom=2,right=2]
> Output(Harmony):
> javax.swing.plaf.InsetsUIResource[left=2,top=2,right=2,bottom=2]
> null
> java.awt.Insets[left=10,top=10,right=10,bottom=10]
> null

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


Mime
View raw message