# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /usr/local/dafe_home/Sources/MainTrunk/openide/awt # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: src/org/openide/awt/JDKBug_6505565_WorkaroundRenderer.java *** /usr/local/dafe_home/Sources/MainTrunk/openide/awt/src/org/openide/awt/JDKBug_6505565_WorkaroundRenderer.java No Base Revision --- /usr/local/dafe_home/Sources/MainTrunk/openide/awt/src/org/openide/awt/JDKBug_6505565_WorkaroundRenderer.java Locally New *************** *** 1,0 **** --- 1,64 ---- + /* + * JDKBugxxxWorkaroundRenderer.java + * + * Created on December 14, 2006, 6:23 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + + package org.openide.awt; + + import java.awt.Component; + import javax.swing.JLabel; + import javax.swing.JList; + import javax.swing.ListCellRenderer; + import javax.swing.plaf.UIResource; + + /** Workaround for JDK bug causing combo boxes with custom renderer to have no + * border and incorrect smaller size in GTK look and feel. + * Details at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6505565. + * + * Use if you have combo box with custom renderer and could run under GTK LF. + * + * Usage: Subclass your combo box renderer with JDKBug_6505565_WorkaroundRenderer + * and render using method renderCell(...), as follows: + * + *
+ * private static class MyCustomRenderer extends JDKBug_6505565_WorkaroundRenderer { + * + * public void renderCell (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + * + * // replace with your rendering code here and render into 'this' (JLabel) + * // setText(...); + * // setIcon(...); + * } + * } + * + * .... + * + * myCombo = new JComboBox(); + * myCombo.setRenderer(new MyCustomRenderer()); + * + *+ * + * @author Dafe Simonek + */ + abstract public class JDKBug_6505565_WorkaroundRenderer extends JLabel implements ListCellRenderer, UIResource { + + /** Overriden as GTK LF needs name to render cell renderer "natively". + */ + public String getName() { + String name = super.getName(); + return name == null ? "ComboBox.renderer" : name; // NOI18N + } + + public final Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + setName("ComboBox.listRenderer"); + renderCell(list, value, index, isSelected, cellHasFocus); + return this; + } + + protected abstract void renderCell (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus); + + } Index: apichanges.xml *** /usr/local/dafe_home/Sources/MainTrunk/openide/awt/apichanges.xml Base (1.8) --- /usr/local/dafe_home/Sources/MainTrunk/openide/awt/apichanges.xml Locally Modified (Based On 1.8) *************** *** 23,28 **** --- 23,46 ----