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 42942 - [GTK] No turner icon in front of section caption in the property sheet
Summary: [GTK] No turner icon in front of section caption in the property sheet
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 4.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Martin Krauskopf
URL:
Keywords: GTK
Depends on:
Blocks:
 
Reported: 2004-05-07 14:38 UTC by _ ttran
Modified: 2008-12-22 17:53 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Property sheet on GTK LaF (42.95 KB, image/png)
2004-05-07 14:39 UTC, _ ttran
Details
gtk workaround (6.65 KB, patch)
2004-10-23 19:07 UTC, Martin Krauskopf
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ ttran 2004-05-07 14:38:06 UTC
IDE built from today's CVS, jdk 1.5.0 b50, Bluecurve

Usually the property sheet shows a small turner
icon  left to the caption of a section on the
property sheet.  When the user clicks on it, the
section is collapsed.  On GTK L&F that turner is
not visible
Comment 1 _ ttran 2004-05-07 14:39:34 UTC
Created attachment 14762 [details]
Property sheet on GTK LaF
Comment 2 _ tboudreau 2004-05-07 20:20:53 UTC
JDK bug 5043327, UIManager.get("Tree.collapsedIcon")/expandedIcon retruns null.  We'll 
probably have to create our own tree icon for it for 4.0.
Comment 3 _ ttran 2004-05-07 20:33:37 UTC
perhaps just stealing the triangle little icons from GTK tree control
ans use them when we get null would be good enough
Comment 4 _ tboudreau 2004-05-07 21:01:55 UTC
That's what we do for every other look and feel; for GTK the icon per se doesn't exist, at 
least not in a form we can access it :-/
Comment 5 _ ttran 2004-05-07 21:30:53 UTC
sorry I wasn't clear, by "stealing" I meant copying the images using
Gimp or something 
Comment 6 _ tboudreau 2004-06-27 01:19:39 UTC
FWIW, I'm advised by the JDK team that there is an icon there, it just
has a size of -1.  And indeed, it is.

So I've committed code to use it and paint it (wrapping it in a
wrapper icon that returns a reasonable value).  However, nothing
paints on b56.  Will try to figure out what the problem might be.
Comment 7 _ tboudreau 2004-07-21 13:35:33 UTC
GTK L&F will not be supported for promo D -> Future.
Comment 8 _ ttran 2004-07-21 14:49:03 UTC
-> P3
Comment 9 Martin Krauskopf 2004-10-23 19:06:46 UTC
As I've been investigating issue 50494 and using Linux as the main
platform I found workaround for this one :)

See the following patch. Code is based on the
com.sun.java.swing.plaf.gtk.GTKEngine. I know it's ugly workaround but
it works. Furthermore I'm not sure if we want another such a hack to
the Netbeans code as I found few of them in the current code. There
may be better solution but I don't understand everything in the JDK
code (yet :) ).

So consider the patch please (Tim or Dave) and eventually reassign the
issue.

I think, we should apply it and watch the JDK bug closely to switch
back to "clean" code when the JDK bug is fixed.
Comment 10 Martin Krauskopf 2004-10-23 19:07:33 UTC
Created attachment 18472 [details]
gtk workaround
Comment 11 Martin Krauskopf 2004-10-24 09:58:12 UTC
Ups, replace the lines for GTKLookAndFeel checking with

if ("com.sun.java.swing.plaf.gtk.GTKLookAndFeel".equals(
  UIManager.getLookAndFeel().getClass().getName())) {

as (e.g.) Windows know nothing about GTKLookAndFeel.

I'm assigning the bug to me as I should retake as much of Tim's UI
issues as I can. Take it back Tim, if you want :). But still I'll
appreciate yours comments - use or not?  I'm still new and not so sure
where is the level of code "ugliness" of netbeans.
Comment 12 _ tboudreau 2004-10-25 00:31:42 UTC
Looks fine to me.  Since we're not officially supporting GTK for 4.0 (last I heard), up to you 
whether to integrate it in 4.0 or wait for 4.1.  No harm integrating it now, given that the 
code there now doesn't work (it was supposed to eventually in some 1.5 build - I was told 
that the icon was there, but didn't have a correct size until it had been painted once).

I'd say go ahead and integrate it.
Comment 13 _ tboudreau 2004-10-25 00:35:07 UTC
Instead of
if ("com.sun.java.swing.plaf.gtk.GTKLookAndFeel".equals(
  UIManager.getLookAndFeel().getClass().getName())) {

try

if ("GTK".equals(UIManager.getLookAndFeel().getID())

Should be safer if they change the package or class name at some point.

BTW, the icon could be moved to 
org.netbeans.swing.plaf.gtk.GtkLFCustoms
and put into UIManager that way - the property sheet code would be a little cleaner.
Comment 14 Martin Krauskopf 2004-10-25 09:33:20 UTC
Ok, thanks for the suggestion.

What I found is that icon dissapear when the component is
"highlighted" (mouse over). Try this code:

import java.awt.FlowLayout;
import javax.swing.*;

public class TestGTKIcon extends javax.swing.JFrame {
    
    public TestGTKIcon() throws Exception {
       
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
        setLayout(new FlowLayout());
       
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        Icon exp = UIManager.getIcon("Tree.expandedIcon");
        add(new JButton(exp));
        add(new JLabel(exp));
        pack();
    }
    
    public static void main(String args[]) throws Exception {
        new TestGTKIcon().setVisible(true);
    }
}
Comment 15 Martin Krauskopf 2004-10-25 13:51:47 UTC
Checking in
core/swing/plaf/src/org/netbeans/swing/plaf/gtk/GtkLFCustoms.java;
/cvs/core/swing/plaf/src/org/netbeans/swing/plaf/gtk/GtkLFCustoms.java,v
 <--  GtkLFCustoms.java
new revision: 1.10; previous revision: 1.9
Comment 16 Tomas Danek 2005-07-19 13:59:38 UTC
closing