JDK-7158712 : Synth Property "ComboBox.popupInsets" is ignored
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86
  • Submitted: 2012-04-03
  • Updated: 2013-04-22
  • Resolved: 2012-04-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u6Fixed 8 b36Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
Java 7u4

ADDITIONAL OS VERSION INFORMATION :
Windows 7 64Bit

A DESCRIPTION OF THE PROBLEM :
The Synth property "ComboBox.popupInsets" is ignored in Java 7 - it works fine with Java 6.

REGRESSION.  Last worked in version 6u31

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the test case and click into the comboBox. The popup appears - the popup size is 10 pixels wider than the comboBox width and the popup overlaps the comboBox by 5 pixels.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The popup size should be 10 pixels wider than the comboBox width and the popup should overlap the comboBox by 5 pixels (negative y-offset)
ACTUAL -
The width is equal to the comboBox width and the popup does not overlap the comboBox.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.io.ByteArrayInputStream;
import java.io.InputStream;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.border.LineBorder;
import javax.swing.plaf.synth.SynthLookAndFeel;

public class SynthComboBoxPopupInsetsTest extends JFrame
{
  private static String synthXml = "<synth>" +
  "    <style id=\"all\">" +
  "      <font name=\"Dialog\" size=\"12\"/>" +
  "    </style>" +
  "    <bind style=\"all\" type=\"REGION\" key=\".*\"/>" +
  "    <style id=\"arrowButton\">" +
  "      <property key=\"ArrowButton.size\" type=\"integer\" value=\"18\"/>" +
  "    </style>" +
  "    <bind style=\"arrowButton\" type=\"region\" key=\"ArrowButton\"/>" +
  "    <style id=\"comboBox\">" +
  "      <property key=\"ComboBox.popupInsets\" type=\"insets\" value=\"-5 -5 5 -5\"/>" +
  "    </style>" +
  "    <bind style=\"comboBox\" type=\"region\" key=\"ComboBox\"/>" +
  "</synth>";
  
  public static void main(String[] args)
  {
    EventQueue.invokeLater(new Runnable(){
      public void run()
      {
        try
        {
          new SynthComboBoxPopupInsetsTest();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
      }
    });
  }

  public SynthComboBoxPopupInsetsTest() throws Exception
  {
    InputStream is = new ByteArrayInputStream(synthXml.getBytes("UTF8"));
    SynthLookAndFeel laf = new SynthLookAndFeel();
    laf.load(is, SynthComboBoxPopupInsetsTest.class);
    UIManager.setLookAndFeel(laf);

    String[] data = {"Very Looooooooooooooooooooong Text Item 1", "Item 2"};
    JComboBox combo = new JComboBox(data);
    combo.setBorder(new LineBorder(Color.BLUE));
    add(combo, BorderLayout.NORTH);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(new Dimension(400, 300));
    setLocationRelativeTo(null);
    setVisible(true);
  }
}  

---------- END SOURCE ----------

Comments
EVALUATION The forwardport 6591875 (webrev here http://sa.sfbay.sun.com/projects/swing_data/7/6591875.5/) doesn't contain changes in the SynthComboPopup.java file, that was made by CR 6605941 (see webrev here http://sa.sfbay.sun.com/projects/swing_data/6u5/6605941.1/). So we should forwardport the rest file SynthComboPopup.java of CR 6605941 (others SynthComboBoxUI.java and skin.laf are in jdk 8). May be CR 6605941 was skipped in CR 6591875 because CR 6605941 is marked as Not Reproducible, but in fact there was the pushed fix.
09-04-2012