jidesoft / jide-oss

JIDE Common Layer
Other
187 stars 81 forks source link

Weird look of JideTabbedPane using PlasticXPLookAndFeel #11

Closed blerins closed 9 years ago

blerins commented 9 years ago

Hi,

I'm using JideTabbedPane in a application with PlasticXPLookAndFeel, I would like to use flat shape for tabs but when you set JideTabbedPane.defaultTabShape to SHAPE_FLAT the result is really weird:

bad_jide

If JideTabbedPane.defaultTabShape isn't set, it gets well rendered:

good_jide

I'm using jide-oss 3.6.10 and jgoodies-looks 2.7.0

Thanks!!

jidesoft commented 9 years ago

The screenshot doesn't look like SHAPE_FLAT. The flat style has a rectangular shape, no curve.

blerins commented 9 years ago

Thats just the problem, tabs are padded to the left, but they still are painted with round corners. And borders get fat and black.

Can you know watching the picture what may I be doing wrong?

My code is currently JRuby, but I may try to provide some Java failing code.

Thanks! El 18/9/2015 18:01, "jidesoft" notifications@github.com escribió:

The screenshot doesn't look like SHAPE_FLAT. The flat style has a rectangular shape, no curve.

— Reply to this email directly or view it on GitHub https://github.com/jidesoft/jide-oss/issues/11#issuecomment-141493562.

jidesoft commented 9 years ago

This site doesn't allow me to attached picture. Or I will attach a picture of what flat style looks like. However you can run JideTabbedPaneDemo to see it yourself. It is part of the JIDE evaluation that is available to download for free from our website.

blerins commented 9 years ago

Excuse me if I'm not able to explain me too well. I know what flat style looks, if I inherit PlasticXPLookAndFeel jide tabbed pane behaves well, but if I use it directly, it looks like the attached picture and I want flat style tabs. It seems that jide does a extrange management of plastic look and feel.

Thanks! El 18/9/2015 7:51 p. m., "jidesoft" notifications@github.com escribió:

This site doesn't allow me to attached picture. Or I will attach a picture of what flat style looks like. However you can run JideTabbedPaneDemo to see it yourself. It is part of the JIDE evaluation that is available to download for free from our website.

— Reply to this email directly or view it on GitHub https://github.com/jidesoft/jide-oss/issues/11#issuecomment-141518870.

jidesoft commented 9 years ago

I am sorry but I still didn't get your question. Please include a test case so that I can reproduce the issue. Please also email support@jidesoft.com for technical support from now on.

blerins commented 9 years ago

It happens that setting the default shape through UIManager doesn't works with JRuby.

That Java code behaves well:

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import com.jgoodies.looks.plastic.PlasticXPLookAndFeel;
import com.jidesoft.swing.JideTabbedPane;

public class JideBug {
  public static void main(final String[] args) {
    try {
      UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
    }
    catch ( UnsupportedLookAndFeelException e) {
    }
    UIManager.getDefaults().put("JideTabbedPane.defaultTabShape", JideTabbedPane.SHAPE_FLAT);
    JFrame window = new JFrame();
    JideTabbedPane tabs = new JideTabbedPane();
    tabs.addTab("Bug", new JPanel());
    tabs.addTab("Bug2", new JPanel());
    window.add(tabs);
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    window.setSize(400, 400);
    window.setVisible(true);
  }
}

While that JRuby code doesn't:

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import com.jgoodies.looks.plastic.PlasticXPLookAndFeel;
import com.jidesoft.swing.JideTabbedPane;

UIManager.setLookAndFeel(PlasticXPLookAndFeel.new());
UIManager.getDefaults().put("JideTabbedPane.defaultTabShape", JideTabbedPane::SHAPE_FLAT);
window = JFrame.new();
tabs = JideTabbedPane.new();
tabs.addTab("Bug", JPanel.new());
tabs.addTab("Bug2", JPanel.new());
window.add(tabs);
window.setDefaultCloseOperation(JFrame::EXIT_ON_CLOSE);
window.setSize(400, 400);
window.setVisible(true);

Finally I discovered that JideTabbedPane.setTabShape behaves always fine.

Thanks!!

jidesoft commented 9 years ago

I see. You should always use setTabShape in this case. You could change UIDefault but it should be done using a different way by using UIDefaultCustomizer.

LookAndFeelFactory.addUIDefaultCustomizer(...); UIManager.setLookAndFeel LookAndFeelFactory.installJideExtension();