Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 28 2022 20:20
    tullisar opened #707
  • Nov 10 2022 20:20
    UlisesRN01 opened #706
  • Oct 26 2022 13:07
    daWoife commented #460
  • Oct 03 2022 21:27
    JLLeitschuh edited #705
  • Oct 03 2022 21:27
    JLLeitschuh edited #705
  • Oct 03 2022 21:26
    JLLeitschuh synchronize #705
  • Sep 23 2022 00:19
    tullisar commented #704
  • Sep 08 2022 22:49
    JLLeitschuh synchronize #705
  • Sep 08 2022 21:48
    JLLeitschuh opened #705
  • Sep 05 2022 01:15
    4SFED edited #704
  • Sep 05 2022 01:07
    4SFED opened #704
  • Sep 05 2022 01:07
    4SFED labeled #704
  • Sep 05 2022 01:07
    4SFED assigned #704
  • Aug 12 2022 14:04
    mgarin commented #702
  • Aug 12 2022 14:04
    mgarin assigned #703
  • Aug 12 2022 14:04
    mgarin labeled #703
  • Aug 12 2022 14:04
    mgarin labeled #703
  • Aug 12 2022 14:04
    mgarin milestoned #703
  • Aug 12 2022 14:04
    mgarin opened #703
  • Aug 11 2022 09:11
    wyj3531 commented #702
Mikle
@mgarin
I've pushed fix for this, it will be available in 1.2.13 update and snapshot build is also available for it.
Abu-Abdullah
@Abu-Abdullah
i hope #612 is included in this release 1.2.13
Mikle
@mgarin
Yep, missed that one when I was marking issues for 1.2.13 update
Htet Aung Khant
@htetaungkhant
JTabbedPane.setFont() does not work.
Mikle
@mgarin
@htetaungkhant
Thanks for reporting, I've added an issue for reference: #631
I also already pushed the fix for it which will shortly be available in snapshot builds and will be included in v1.2.13 update coming this week.
Htet Aung Khant
@htetaungkhant
JProgressBar.setForground(Color.black) does not work.
Mikle
@mgarin
That is weird, I have adjusted most of the components to inherit custom foreground Color if it is set, including JProgressBar text.
I'll double check it.

I've tried it and it does seem to work correctly:

public class Test
{
    public static void main ( final String[] args )
    {
        SwingUtilities.invokeLater ( new Runnable ()
        {
            @Override
            public void run ()
            {
                WebLookAndFeel.install ();

                final JFrame frame = new JFrame ();
                frame.setLayout ( new BorderLayout () );

                final JProgressBar progressBar = new JProgressBar ( 0, 100 );
                progressBar.setValue ( 50 );
                progressBar.setStringPainted ( true );
                progressBar.setString ( "Sample text" );
                progressBar.setForeground ( Color.RED );
                frame.add ( progressBar );

                frame.setDefaultCloseOperation ( WindowConstants.EXIT_ON_CLOSE );
                frame.setSize ( 500, 100 );
                frame.setLocationRelativeTo ( null );
                frame.setVisible ( true );
            }
        } );
    }
}

If you're using latest (v1.2.12) update it should be working properly for you.

Mikle
@mgarin
image.png
Htet Aung Khant
@htetaungkhant
Sorrry, I would like to change the JProgressBar selection color. Not text color.
Mikle
@mgarin
What is a selection color?
Htet Aung Khant
@htetaungkhant
Picture1.png
Mikle
@mgarin
That color is defined in the progress bar style, you'd have to change it through the style, not the code.
Htet Aung Khant
@htetaungkhant
How?
I'm not clear.
Mikle
@mgarin
I recommend reading styling introduction article on the wiki:
https://github.com/mgarin/weblaf/wiki/Styling-introduction
Once you have the general idea about how to use styling - you can look at default light style for JProgressBar here : progressbar.xml
You can adjust any parts of it in your custom skin or skin extension.
Htet Aung Khant
@htetaungkhant
I can’t truely understand yet. How can I create custom skin xml for ProgressBar and how to set that custom xml to my progressbar. If you can, show me complete example.
Mikle
@mgarin

The wiki guide explains the general idea on how skins and styles can be created. You need to do two things:

  1. Make a custom skin XML that includes existing default skin - it is shown in this section

  2. Add a custom default style for JProgressBar that would adjust the background:

     <!-- Progress bar -->
     <style type="progressbar">
         <painter>
    
             <!-- Progress line -->
             <progressPainter>
                 <decorations>
                     <decoration states="progress">
                         <GradientBackground>
                             <color>233,233,233</color>
                             <color>223,223,223</color>
                         </GradientBackground>
                     </decoration>
                 </decorations>
             </progressPainter>
    
         </painter>
     </style>

    The background part can be changed to any IBackground implementation usage there (you can check them in the library). In the example above I've left the default GradientBackground use.

Htet Aung Khant
@htetaungkhant
I created customProgressbar.xml like that.
<skin xmlns="http://weblookandfeel.com/XmlSkin">
    <!-- com.alee.laf.progressbar.WebProgressBar -->
    <id>progressbar.skin</id>
    <class>com.alee.laf.progressbar.WebProgressBar</class>
    <supportedSystems>all</supportedSystems>

    <include nearClass= "com.alee.laf.progressbar.WebProgressBar">
        <!-- Progress bar -->
        <style type="progressbar" id="customProgressbarSkin">
            <painter>    
                <!-- Progress line -->
                <progressPainter>
                    <decorations>
                        <decoration states="progress">
                            <GradientBackground>
                                <color>16,194,20</color>
                                <color>16,194,20</color>
                            </GradientBackground>
                        </decoration>
                    </decorations>
                </progressPainter>    
            </painter>
        </style>
    </include>

</skin>
And I created progressBarSkin.java like that.
package external_classes;

import com.alee.api.resource.ClassResource;
import com.alee.managers.style.XmlSkin;

public class ProgressBarSkin extends XmlSkin{
        public ProgressBarSkin() {
                super(new ClassResource(ProgressBarSkin.class, "customProgressbar.xml"));
        }
}
And I use like that
WebLookAndFeel.install(ProgressBarSkin.class); WebProgressBar progressBar = new WebProgressBar(StyleId.of("customProgressbarSkin"));
And I got this error. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
And nothing changes.
kovadam69
@kovadam69
You have to add your custom XML files when initializing the WebLaf. Like this
StyleManager.addExtensions(
                    new XmlSkinExtension(new ClassResource(Main.class, "/styling/customSkins.xml")),
                    new XmlSkinExtension(new ClassResource(Main.class, "/styling/customSkins-dark.xml")));
but I don't think you need that PrograssBarSkin class you created.
just add with StyleManager your custom skin xml, and you can use it with the StyleId.of("")
Mikle
@mgarin

@kovadam69
You're a bit wrong though, he is creating skin, not an extensions, so he needs XmlSkin not XmlSkinExtension.

@htetaungkhant
As for what the issue is - you have put the style inside the include tag - why? All include does is it imports all styles from another XML skin file. For your case - you want to include the default light skin so you don't have to define all styles for all components. The include you need is:

    <!-- Including WebLaF default skin, will use its style as a base -->
    <include nearClass="com.alee.skin.light.WebLightSkin">resources/web-light-skin.xml</include>

(copy-pasted straight from example)

And simply place your custom progressbar style nearby, you can look at some other skin/extension files available in the project if you aren't sure, like this one: demo-light-extension.xml


The error you see in the log is happening because you have no SLF4J implementation included in your project. It doesn't come with WebLaF by default because everyone have their own logging implementations in their projects and WebLaF uses SLF4J simply as an API for logging, it stil needs the actual implementation. You can read about SLF4J here: http://www.slf4j.org/

The most simple option - use SLF4J simple logger implementation, you can find it on Maven: https://search.maven.org/search?q=g:org.slf4j
Or you can use any other implementation available, for instance Log4j one if you're using it in your project for logging.

Once you have any implementation for SLF4J in your project - you will see the actual errors that occur in the styling with your example.

In WebLaF demo application I'm using SLF4J simple implementation:
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.27</version>
</dependency>
Htet Aung Khant
@htetaungkhant
no error when adding that dependency.
Mikle
@mgarin
Well, if you adjusted your XML with the fixes* I mentioned - there shouldn't be one :)

Also, if you're providing a style identifier like this:

<style type="progressbar" id="customProgressbarSkin">

You're creating a custom style based on default style and you will have to apply it manually to each specific progress bar you want to use that style on.

And if you remove the identifier - you will be adjusting the default style and it will apply to all newly created progress bars.

Htet Aung Khant
@htetaungkhant
<skin xmlns="http://weblookandfeel.com/XmlSkin">
    <!-- com.alee.laf.progressbar.WebProgressBar -->
    <id>progressbar.skin</id>
    <class>com.alee.skin</class>
    <supportedSystems>all</supportedSystems>

     <include nearClass="com.alee.skin.light.WebLightSkin">resources/web-light-skin.xml</include>
        <!-- Progress bar -->
        <style type="progressbar">
            <painter>    
                <!-- Progress line -->
                <progressPainter>
                    <decorations>
                        <decoration states="progress">
                            <GradientBackground>
                                <color>16,194,20</color>
                                <color>16,194,20</color>
                            </GradientBackground>
                        </decoration>
                    </decorations>
                </progressPainter>    
            </painter>
        </style>

</skin>
like that?
or
Mikle
@mgarin
Yep
All that is explained in the wiki article though
I'll probably add another one with some step-by-step instructions for creating skin & skin extension later for customizing some component as an example
Htet Aung Khant
@htetaungkhant
Good. :-) :-P
My Progressbar still not changes UI when I create like this.
WebLookAndFeel.install (); WebLookAndFeel.install(ProgressBarSkin.class); JProgressBar jpb = new JProgressBar();
Mikle
@mgarin
Why are you calling install twice though?
Second one obviously does nothing because L&F is already installed.
Just remove the first install call and it should work correctly.
Htet Aung Khant
@htetaungkhant
Wow. Nice. Now, work. Thanks again, Mr. Mikle.
I installed two because I thought first is installing whole WebLaf and second is installing ProgressBarSkin.
Mikle
@mgarin
Nah, it does both. But if you don't specify a custom skin - it simply installs the default one as there always should be an active skin.
Htet Aung Khant
@htetaungkhant
Ok, I know. Today, my project completely finishes. :-)
So, no more give you trouble. :-P
Abu-Abdullah
@Abu-Abdullah
Hi @mgarin, any hint when the next update will be available in maven v1.2.13