United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7158712 Synth Property "ComboBox.popupInsets" is ignored
JDK-7158712 : Synth Property "ComboBox.popupInsets" is ignored

Details
Type:
Bug
Submit Date:
2012-04-03
Status:
Resolved
Updated Date:
2013-04-22
Project Name:
JDK
Resolved Date:
2012-04-24
Component:
client-libs
OS:
windows_7
Sub-Component:
javax.swing
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Relates:
Relates:
Relates:

Sub Tasks

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.
                                     
2012-04-09



Hardware and Software, Engineered to Work Together