How to set FloorTabbedPane tab Color

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

How to set FloorTabbedPane tab Color

Postby aryanarvind » Thu Oct 23, 2008 5:45 am

Hi,

When I use the FloorTabbedPane I get the tab color set to white, I tried to getButtons and set the color over these buttons, but unfortunately there was no result.
I am running the application on a Windows machine and the lookAndFeel is set to the following.
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
LookAndFeelFactory.installJideExtension(LookAndFeelFactory.OFFICE2003_STYLE);

Expected Result: The buttons color must be just like the default panel color in windows.

Note:
1. We are using multiple classLoaders.
2. Spring OSGi frame work.


Thanks & Regards,
Aryan Aravind
aryanarvind
 
Posts: 108
Joined: Mon May 14, 2007 12:37 pm

Re: How to set FloorTabbedPane tab Color

Postby JIDE Support » Thu Oct 23, 2008 10:29 am

The buttons are JideButtons. They look different from the default Swing JButton on all L&Fs. But if you want the same look as JButton, you can override createButton method in FloorTabbedPane and return JButton instead. But make sure you subclass JButton and implement UIResource. Otherwise a runtime IllegalArgumentException will be thrown. The javadoc of createButton method mentioned this.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37263
Joined: Sun Sep 14, 2003 10:49 am

Re: How to set FloorTabbedPane tab Color

Postby aryanarvind » Thu Oct 23, 2008 1:04 pm

Hi,

Normal usage of FloorTabbedPane:
normalFloorTabbedPane.JPG
normalFloorTabbedPane.JPG (7.21 KiB) Viewed 22379 times

Usage of FloorTabbedPane in our application
applicationFloorTabbedPane.JPG
applicationFloorTabbedPane.JPG (5.46 KiB) Viewed 22379 times



If you see the above attachments its clear that the normal behaviour is what we want, but unfortunately with in our application it changes to white colored tabs, no matter what ever we do the color of the tab does not get changed to the normal color, do you know what exactly could be the problem.

If I consider your approach of overriding the createButton, I would like to know what is the "Border", "onFocus color" set over the normal FloorTabbedPane.Buttons.


Thanks & Regards,
Aryan Aravind
aryanarvind
 
Posts: 108
Joined: Mon May 14, 2007 12:37 pm

Re: How to set FloorTabbedPane tab Color

Postby JIDE Support » Thu Oct 23, 2008 1:41 pm

That's strange. Can you reproduce the second screenshot in a separate test case? I suspect in your application, someone is setting the button opaque property to false.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37263
Joined: Sun Sep 14, 2003 10:49 am

Re: How to set FloorTabbedPane tab Color

Postby aryanarvind » Fri Oct 24, 2008 7:38 am

Hi,

One thing that I noticed is the default behaviour of the tabbedPane buttons is set to opaque false.
In the image 1 that i attached thats a simple java program which has the buttons color set to the panel color, i thought it was the default behaviour of the tabbedPane buttons.

now i set the opaque to true, i see the real color of the buttons and they are the JideButton colors. I have attached the sample code below which does the same.

Can we set the default proeprty for the application, so that where ever the JideButton is created in FloorTabbedPane set the opaque to true? This would make my application to have the same button color through out, so that it does not depend on the background color on which it is placed, I am not good at framing sentences, Please let me know if the above is not clear.

Code: Select all
import java.awt.Dimension;

import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.UIManager;

import com.jidesoft.pane.FloorTabbedPane;
import com.jidesoft.plaf.LookAndFeelFactory;
import com.jidesoft.swing.ButtonStyle;
import com.jidesoft.swing.JideButton;
import com.jidesoft.utils.SystemInfo;

public class Test {
   static {
      try {
         if (SystemInfo.isLinux() || SystemInfo.isUnix()) {
            UIManager.setLookAndFeel(LookAndFeelFactory.METAL_LNF);
         } else {
            UIManager.setLookAndFeel(UIManager
                  .getSystemLookAndFeelClassName());
         }
      } catch (final Exception e) {
      }

      // Extend the L&F for JIDE components
      LookAndFeelFactory
            .installJideExtension(LookAndFeelFactory.OFFICE2003_STYLE);
   }

   public static void main(final String[] args) {
      final JFrame frame = new JFrame();
      final JPanel panel = new JPanel();
      final FloorTabbedPane tabs = new FloorTabbedPane() {
         @Override
         protected AbstractButton createButton(final Action arg0) {
            final JideButton button = (JideButton) super.createButton(arg0);
            button.setOpaque(true);
            return button;
         }
      };
      tabs.setSteps(2);
      tabs.setPreferredSize(new Dimension(100, 300));
      panel.add(tabs);
      tabs.addTab("Networks", new JTree());
      tabs.addTab("Locations", new JTree());
      frame.add(panel);
      frame.pack();
      frame.setVisible(true);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   }
}
aryanarvind
 
Posts: 108
Joined: Mon May 14, 2007 12:37 pm

Re: How to set FloorTabbedPane tab Color

Postby aryanarvind » Fri Oct 24, 2008 8:03 am

Hi,

I think I figured out what the issue was with the color ofthe tabs, I was adding the tabbedPane directly to the DockableFrame, which had a background color as while and unfortunately all other tabbedPanes in our application were added to a JPanel, now here i saw the difference and made the change accordingly. Now the tab colors are same as others with in the application.

I would think that the default behavior must not be dependent on the parent panel but unfortunately its behaving that way now, I think its a good idea to turn on the opaque property over the JideButton while creating the FloorTabbedPane.

Any ways thanks for the early response.

Regards,
Aryan Aravind
aryanarvind
 
Posts: 108
Joined: Mon May 14, 2007 12:37 pm

Re: How to set FloorTabbedPane tab Color

Postby JIDE Support » Fri Oct 24, 2008 12:30 pm

I will make the JideButton opaque. You can do that for now by overriding createButton method.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37263
Joined: Sun Sep 14, 2003 10:49 am

Re: How to set FloorTabbedPane tab Color

Postby JIDE Support » Fri Oct 31, 2008 6:08 pm

Just so you know, this bug is fixed in 2.4.4 release.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37263
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 7 guests