by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 01 08:35
    husker-dev closed #623
  • Jun 30 23:29
    dependabot[bot] labeled #634
  • Jun 30 23:29
    dependabot[bot] opened #634
  • Jun 30 23:29

    dependabot[bot] on maven

    Bump xstream from 1.4.9 to 1.4.… (compare)

  • Jun 26 10:14
    mgarin commented #623
  • Jun 26 09:30
    mgarin commented #623
  • Jun 26 06:24
    husker-dev commented #623
  • Jun 26 06:05
    husker-dev commented #623
  • Jun 26 06:01
    husker-dev reopened #623
  • Jun 26 06:01
    husker-dev commented #623
  • Jun 19 17:11
    mgarin commented #632
  • Jun 19 17:07

    mgarin on master

    - README.md - Updated for lates… (compare)

  • Jun 19 17:02
    weisJ commented #130
  • Jun 19 17:00

    mgarin on v1.2.13

    (compare)

  • Jun 19 16:57
    UltimateYZ closed #632
  • Jun 19 16:57
    UltimateYZ commented #632
  • Jun 19 16:32
    mgarin commented #612
  • Jun 19 16:31
    mgarin commented #604
  • Jun 19 16:31
    mgarin commented #608
  • Jun 19 16:25
    mgarin commented #613
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
Mikle
@mgarin
Hi, unfortunately I've been at home ill since the last Thursday so the update is getting delayed a bit. I'll publish it myself by the end of this week if i'll be back in shape, otherwise I'll aks my colleague to do so (there are still a few minor touches to add before the release).
Abu-Abdullah
@Abu-Abdullah
thank you. I wish you a quick recovery
Abu-Abdullah
@Abu-Abdullah
Hi @mgarin , JScrollPane is not working as expected when defining the policy e.g.
new JScrollPane(JEditorPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)
Im expecting this will wrape the text but it did not.
Mikle
@mgarin
Did you try this without WebLaF to see if the result is the same?
I can say for sure that it might not behave as you'd expect with text components and that might be the default behavior.
Abu-Abdullah
@Abu-Abdullah
yes, it is working as expected in older version of the app where it was pure swing base
Mikle
@mgarin
Can you provide a small code example where the issue can be reproduced?
Abu-Abdullah
@Abu-Abdullah
i will look more into forcing text wrape
ok i will try to put sample code
Abu-Abdullah
@Abu-Abdullah
ok, i did very quick test and it seems i was wrong. this issue is from swing and only for other languages than latin. following is a sample. normal English text will work correctly. Arabic is not. but it is not related to webLaF. it is a bug in the backend swing
import com.alee.laf.WebLookAndFeel;

import javax.swing.*;

public class Test extends JFrame
{
    Test()
    {
        JEditorPane p = new JEditorPane();
        p.setText(
                //"sdfsdfsdf sdfsdfsdf sssss s ss s s s s s s s s s ssssssssssssssssssssssss s s ss s sssssssssssssssssssss"
                "للهِ تَعالى- لِتَعْمِيمِ النَّفْع بتِلْكَ الجُهُود المُبارَكة فِي هَذا المَيدَان العَظِيم باشَر القِسْمُ العِلْمِيُّ بِمُؤسَّسةِ الشَّيخِ محُمَّد بنِ صالِحٍ العُثَيمِين الخَيريَّةِ واجِباتِه فِي شَرَفِ الإِعْدادِ والتَّجْهِيز للطِّباعةِ والنَّشْر لإِخْراجِ ذَلِكَ التُّراث العِلمِي؛ إنفاذًا للقَواعِدِ والضَّوابِط والتَّوْجِيهاتِ الَّتِي قَرَّرها فَضيلةُ الشَّيخِ رَحِمَهُ اللهُ تَعالى في هَذا الشَّأْنِ.\n" +
                        "نَسْأل اللهَ تعالى أنْ يَجْعلَ هَذا العَمَلَ خالصًا لِوجهِه الكَريمِ؛ نافِعًا لعِبادِه، وأنْ يَجزِيَ فَضِيلةَ شيخِنا عَنِ الإسلامِ والمسلمِينَ خَيرَ الجزَاء، ويُضَاعِفَ لهُ المثُوبَةَ والأَجْرَ، ويُعليَ دَرَجَتَهُ في المَهْدِيِّينَ، إِنَّه سَمِيعٌ قَرِيبٌ مجُيبٌ."
        );
        WebLookAndFeel.setLeftToRightOrientation(true);
        getContentPane().add(new JScrollPane(p, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER));
        setSize(150, 100);
        setVisible(true);
    }

    public static void main(String[] args)
    {
        WebLookAndFeel.install();
        new Test();
    }
}
it was working in older version for some reason. i will check it thoroughly
Mikle
@mgarin

Well, there are a few things with the wrapping - if you try the English variant it will also not wrap once you increase the size of the window and then shrink it, but that's a specific of how text layouting works within text areas, it is really hard to workaround that properly.

But yes, Arabic text doesn't seem to be wrapped at all on newest WebLaF version or with Metal with any Java version.

I'd say if it ever was wrapped before with WebLaF - that was probably at the time when we changed scrollpane layout implementation and there were still some issues floating around it, so the behavior wasn't consistent with default Swing behavior.
Abu-Abdullah
@Abu-Abdullah

Hi @mgarin
Another question. i have this code

searchTree.addCheckStateChangeListener(new CheckStateChangeListener<DefaultMutableTreeNode>()
{
    @Override
    public void checkStateChanged(WebCheckBoxTree<DefaultMutableTreeNode> searchTree, List<CheckStateChange<DefaultMutableTreeNode>> checkStateChanges)
    {
        final java.util.List<DefaultMutableTreeNode> checkedNodes = searchTree.getNodes(CheckState.checked);
        ....

it throws the following exceptio:

java.lang.NullPointerException
    at com.alee.extended.tree.NodesPositionComparator.compare(NodesPositionComparator.java:90)
    at com.alee.extended.tree.NodesPositionComparator.compare(NodesPositionComparator.java:36)
    at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:356)
    at java.base/java.util.TimSort.sort(TimSort.java:220)
    at java.base/java.util.Arrays.sort(Arrays.java:1306)
    at java.base/java.util.ArrayList.sort(ArrayList.java:1720)
    at java.base/java.util.Collections.sort(Collections.java:179)
    at com.alee.extended.tree.DefaultTreeCheckingModel.getNodes(DefaultTreeCheckingModel.java:137)
    at com.alee.extended.tree.WebCheckBoxTree.getNodes(WebCheckBoxTree.java:454)
    at com.alee.extended.tree.WebCheckBoxTree.getNodes(WebCheckBoxTree.java:441)
    at com.myapp.Indexer$2.checkStateChanged(Indexer.java:489)
    at com.alee.extended.tree.DefaultTreeCheckingModel.fireCheckStateChanged(DefaultTreeCheckingModel.java:683)
    at com.alee.extended.tree.DefaultTreeCheckingModel.setChecked(DefaultTreeCheckingModel.java:167)
    at com.alee.extended.tree.WebCheckBoxTree.setChecked(WebCheckBoxTree.java:467)
    at com.myapp.Indexer$22.actionPerformed(Indexer.java:3448)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
    at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
    at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369)
    at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:349)
    at com.myapp.Indexer$8$1.run(Indexer.java:1799)

any hint is appreciated. i cannot build a sample case. it is a bit complicated. but the point is that getNodes(CheckState.checked) throws internal NullPointerException

Mikle
@mgarin
Do you have null nodes in your tree?
Because that's the only reason why that part could throw a NPE
Abu-Abdullah
@Abu-Abdullah

thank you, the exception happens when deleting the nodes. for some reason it is solved by replacing:

WebCheckBoxTree<DefaultMutableTreeNode> searchTree = new WebCheckBoxTree<>(searchRoot);

with

WebCheckBoxTree<DefaultMutableTreeNode> searchTree = new WebCheckBoxTree<>(new DefaultTreeModel(searchRoot));

really no clue what is happening (and i do not recall if the old code was working with swing laf or not) . so please just ignore this case and thank you

Mikle
@mgarin
@Abu-Abdullah
I did check some test cases, but didn't find the NPE yet. Although I'm pretty sure it's a legitimate bug so I've added an issue for it: #633
The reason why you don't get the same exception with DefaultTreeModel is because WebCheckBoxTree uses custom WebTreeModel by default which is somewhat different and might not tolerate some cases that default Swing model does. I'll try to find and fix the bug for the v1.2.14 update.
Mikle
@mgarin
Also, WebLaF v1.2.13 is now available on GitHub: https://github.com/mgarin/weblaf/releases/tag/v1.2.13
And will shortly become available on Maven (once caches are gone).
I wanted to push a few more changes in that release, but it's been taking time so I decided not to delay it even further.
Meanwhile I'm still working on the large performance improvement that is coming in v1.3.0 along with some other changes.
Lukasz S
@strzeszku_gitlab
I found some issues regarding caret position in text fields when using custom fonts. I changed the font to Lato-Regular.ttf which is loaded and registered in GraphicsEnvironment (not a system font). With such font the caret is not positioned properly in all text fields where offset is growing when cursor approaches right margin. It it possible to correct this offset using some WebLaF built in method?
Mikle
@mgarin
@strzeszku_gitlab I'll try it out to see what's happening, but meanwhile - is that behavior consistent with other L&Fs?
As best test sample - Metal Look and Feel. Also behavior might differ in the native look and feel.
Mikle
@mgarin

I've tried the Lato-Regular.ttf (taken from here: https://github.com/google/fonts/blob/master/ofl/lato/Lato-Regular.ttf ) and it works just fine for me. I've tested it on different JDK versions (6, 8, 9, 11 and 13) and different L&F (Metal and WebLaF) under Windows OS - behavior seems to be exactly the same across all tests - caret is properly positioned on the text in JTextField with both short and long texts at any index in that text.

So I'll need more details about cases when you see the issue:

  • Java version you're running
  • OS type/version
  • WebLaF version you're using
  • Small code example representing the issue
Lukasz S
@strzeszku_gitlab
I run app on mac os 10.15.5 with oracle jdk 1.8u252 and adopt openjdk 1.8u252, WebLaF 1.2.13. Tried to change component font using
Font fontLatoRegular = loadFontLatoRegular();
FontUtils.replaceFontUIResource(jTextField2, fontLatoRegular.deriveFont(13f));
and
WebLookAndFeel.globalTextFont =latoFont;
The second one method before WebLookAndFeel.install();
Mikle
@mgarin

This part:

Font fontLatoRegular = loadFontLatoRegular();

Doesn't really tell much unfortunately, how exactly is the Font created?
And do you see the same issue with the font I've linked above?

Also, does that issue appear for you under MetalLookAndFeel?
Lukasz S
@strzeszku_gitlab
@mgarin
public static final Font loadFontLatoRegular() {
try {
InputStream fontStream = FontTests.class.getResourceAsStream("/resources/fonts/Lato/Lato-Regular.ttf");
Font font = Font.createFont(Font.TRUETYPE_FONT, fontStream);
return font.deriveFont(13f);
} catch (IOException | NullPointerException | FontFormatException ex) {
java.util.logging.Logger.getLogger(FontTests.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
return null;
}
}
I must load the font from resources not as a system font. I will check the same app on windows 8.1 machine in few minutes.
Mikle
@mgarin

Yep, exactly the same code I've used in my test class:

public class FontTest
{
    public static void main ( final String[] args )
    {
        SwingUtilities.invokeLater ( new Runnable ()
        {
            @Override
            public void run ()
            {
                try
                {
                    UIManager.setLookAndFeel ( WebLookAndFeel.class.getCanonicalName () );
                    // UIManager.setLookAndFeel ( MetalLookAndFeel.class.getCanonicalName () );

                    final Font font = Font.createFont (
                            Font.TRUETYPE_FONT,
                            FontTest.class.getResourceAsStream ( "Lato-Regular.ttf" )
                    ).deriveFont ( 16f );

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

                    final JTextField textField = new JTextField ( 50 );
                    textField.setFont ( font );
                    frame.add ( textField );

                    frame.setSize ( 800, 600 );
                    frame.setLocationRelativeTo ( null );
                    frame.setDefaultCloseOperation ( WindowConstants.EXIT_ON_CLOSE );
                    frame.setVisible ( true );
                }
                catch ( final Exception e )
                {
                    e.printStackTrace ();
                }
            }
        } );
    }
}

I recommend you to try this small example and see if the same issue occurs or not, once with WebLaF and once with the MetalLookAndFeel.

If it doesn't appear on this example - it might have something to do with other settings in your application.
If it does - then it could be a Java issue on Mac OS, especially if it appears for you on both L&Fs.

Lukasz S
@strzeszku_gitlab
@mgarin the same issue occurs with your example both with WebLaF and Metal, but only on Mac OS. There is no such issue on Windows 8.1 without hidpi display. Could it have something in common the hidpi display? I have no older mac to check how it looks on fullhd display.
Mikle
@mgarin

I'd say it's a 50/50, it might be caused by hidpi display, but on hidpi I would expect caret in text field to be visually offset by a fixed amount of pixels. The fact that offset increases with larger index means that there is a difference in caret position calculation and font rendering - caret position calculation either uses old font or has some deeper issues.

If it's the same on MetalLookAndFeel that means it's just a general Java issue, potentially with particular font (or all non-system/custom fonts?) - hard to tell really.

After a quick search on the matter I found this issue: https://bugs.openjdk.java.net/browse/JDK-8014069
It does seem to be resolved long ago though, but it sure does resemble your description of the problem.

Overall - I can't really do anything about font-related issues like this one because both font rendering and font-related calculations aren't done by L&F code and are simply retrieved from public APIs (like FontMetrics for instance). There could definitely be cases where WebLaF is at fault, but that would usually be reproducible against other L&Fs and would mostly cause the same issues across different OS versions.

Mikle
@mgarin

What I could recommend doing - try the same example with newer Java versions (9+) and see if the same issue appears there. If newer Java version fixes it - it might be worth switching your application over to newer version if it is possible.

Alternatively - the issue seem to be caused by custom font's size being different from the default font size of the component. Maybe it would work correctly if you use the same font size as the component has by default for your custom font. That's just an idea for a possible workaround.

Also if the issue is still there for you on latest Java 8 updates or even newer Java versions - it might be worth submitting a JDK bug report. I've found quite a few JDK bugs over the years and submitted most of them. Some have been fixed since and some unfortunately are still not resolved, so that could take a long while. Also fixes for reported bugs will most probably only be available on newer Java versions.

Lukasz S
@strzeszku_gitlab
@mgarin switching to java 11 resolves the problem, but will take lot of time to switch whole the app. For java 8 I have to install the font in system to resolve the problem. Simple registering in graphicalEnvironment in main does not help.
Mikle
@mgarin

Well, unfortunately I can't really do anything about it.
Core Java issues always suck and you just have to deal with them in the least "painful" way.

Does aligning the custom font's size with the default component font's size help?