This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 235923 - Custom jcomponent editor window opens oversized hiding buttons
Summary: Custom jcomponent editor window opens oversized hiding buttons
Status: RESOLVED WORKSFORME
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-13 09:27 UTC by MackSix
Modified: 2014-01-16 15:01 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot (291.34 KB, image/png)
2013-09-13 09:27 UTC, MackSix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MackSix 2013-09-13 09:27:14 UTC
Created attachment 140026 [details]
Screenshot

1. Open a form with a JList and put focus on it in the editor.
2. Go to Properties >> Code and select a location to enter custom code for the JList, like "Post-Init code".
3. Put in this code:


jList1.setCellRenderer(new DefaultListCellRenderer() {
    @Override
    public Component getListCellRendererComponent(JList<?> list, Object value,
              int index, boolean isSelected, boolean cellHasFocus) {
        super.getListCellRendererComponent(list, value,
                index, isSelected, cellHasFocus);
        setIcon(cellIcon);
         
        Color bg;
        Color fg;
        JList.DropLocation dropLocation = list.getDropLocation();
        if (dropLocation != null
                && !dropLocation.isInsert()
                && dropLocation.getIndex() == index) {

            bg = Color.BLUE;
            fg = Color.WHITE;
            isSelected = true;
        }

        if (isSelected) {
            bg = Color.RED;
            fg = Color.WHITE;
        } else {
            bg = list.getBackground();
            fg = list.getForeground();
        }
        setBackground(bg);
        setForeground(fg);
        
        Border ob = BorderFactory.createLineBorder(Color.BLACK, 1);
        Border ib = BorderFactory.createEmptyBorder(3, 3, 3, 3);
        Border sb = BorderFactory.createEmptyBorder(4, 4, 4, 4);
        Border border = null;
        if (cellHasFocus) {
            border = BorderFactory.createCompoundBorder(ob, ib);
        }
        if (border == null) {
            border = sb;
        }                                         
        setBorder(border);
        return this;
    }
});


4. Click OK to save it.
5. Click on the "..." button again and open the code. 

Results: The window opens full screen vertically, hiding the buttons behind the Windows Task Bar.

Expected: The buttons are not hidden and are accessible. See screenshot.

Workaround: Grab editor window at the top and resize down. Then move window up to access buttons.

This does not happen with JDK 8, so it may be a JDK 7 bug.

Product Version: NetBeans IDE 7.4 RC1 (Build 201309112301)
Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b55
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b40
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 Tomas Pavek 2014-01-16 15:01:25 UTC
I'm not seeing this, I always get a small dialog size. The panel provided by GUI builder to property sheet to show it in a dialog has preferred size as [465,233].

NetBeans IDE Dev (Build 201401160001), JDK 1.7.0_25, Windows 7