Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 12 14:04
    mgarin commented #702
  • Aug 12 14:04
    mgarin assigned #703
  • Aug 12 14:04
    mgarin labeled #703
  • Aug 12 14:04
    mgarin labeled #703
  • Aug 12 14:04
    mgarin milestoned #703
  • Aug 12 14:04
    mgarin opened #703
  • Aug 11 09:11
    wyj3531 commented #702
  • Aug 11 01:43
    wyj3531 commented #702
  • Aug 10 11:58
    mgarin commented #702
  • Aug 09 03:18
    wyj3531 assigned #702
  • Aug 09 03:18
    wyj3531 labeled #702
  • Aug 09 03:18
    wyj3531 opened #702
  • Jul 14 06:48
    wyj3531 commented #694
  • Jul 14 06:47
    wyj3531 closed #694
  • Jul 02 06:08
    xcfdszzr commented #701
  • Jul 01 15:06
    mgarin commented #701
  • Jul 01 15:02
    mgarin labeled #701
  • Jul 01 15:02
    mgarin commented #701
  • Jul 01 15:02
    mgarin labeled #629
  • Jul 01 15:02
    mgarin labeled #352
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?

kovadam69
@kovadam69
Hi! Short question. Is it possible to have in WebTable multi-line groupped column headers?
Mikle
@mgarin

@kovadam69 Right now - only if you use some 3rd-party solution or make one yourself. WebLaF currently provides close to none features on top of the basic JTable, so functionality-wise WebTable is pretty much the same as JTable with just a few convenience methods added on top.

We did have a similar task for one of our internal projects - to make a useable multi-line table header - but I wasn't the one working on it and the final solution was quite sloppy and only worked for that particular case, so it didn't make it into WebLaF in the end.

I do plan to eventually expand JTable to support multi-line header, cells merging, better sorting and some other features I really want to see myself, but it all requires quite an extensive rework of the basic table implementation (both UI and component), so that will most probably be a completely separate new component - something like WebExTable - and it will take a substantial amount of time to add, which I probably won' have this year.

There are already quite a few issues added for JTable: https://github.com/mgarin/weblaf/issues?q=is%3Aissue+is%3Aopen+table
I'll make a summary issue now that will list all the planned improvements that are split into separate issues and which you can track.

kovadam69
@kovadam69
@mgarin Thanks! I will wait for it than, unless I really need one, then I have to implement it myself. I already found some implementation, but it has to be fixed, since they miscalculate the cell width (cell width does not match column width) and also they are not draggable, clickable, etc.
kovadam69
@kovadam69
Hi Mikle! I faced a problem between 1.3.0 and 1.2.14. Recently I discovered, that 1.2.14 is newer and contains more fix, than 1.3.0, so I switched back to 1.2.14, however now I faced some problem with WebStyledLabel in Table Header. See image attached. For some reason with 1.2.14 it adds end ellipsis though the text would fit into the cell without any problems. What can I do about it? Thanks!
https://imgur.com/1G1Cxc6
The upper image is with 1.3.0 and the lower with 1.2.14... It's a bit annoying to have ... at the end.
Mikle
@mgarin

@kovadam69
If you meant 1.3.0 snapshot - it have been purely experimental and I wouldn't recommend using it.
Currently latest version is 1.2.13, and latest snapshot is 1.2.14.

There have been some important changes done to WebStyledLabel in one of 1.2.14 commits: mgarin/weblaf@0a39e8c
They might have affected the table title rendering, but I'll have to double-check that.

Judging by the screenshots - table header size calculations remained the same, but label doesn't fit into the available width anymore.
Can you give that specific title text or does this issue appear on any text?
Is this text containing HTML by any chance?
If it is an HTML with <br> tag, can you try using {br} (since renderer is a WebStyledLabel this should work) instead to see if it fixes the issue?

kovadam69
@kovadam69
It's simple text, there is no html or line break, wrapping is done by the WebStyledLabel. The text is just any simple two word text (like Szállító kelte or Teljesítés dátuma or Fizetési határidő or ÁFA teljesítés dátuma, etc.). Previously it also broke 3 word texts into 3 lines, now it also uses ... in the 2nd line, without braking it into 3 lines.
kovadam69
@kovadam69
Something is totally wrong with WebStyledLabel wrapping:
https://imgur.com/ysFSnQ0
this was produced by this code:
        WebLookAndFeel.install();

        final WebMemoryBar memoryBar = new WebMemoryBar ();
        memoryBar.setPreferredWidth ( 200 );

        WebPanel panel = new WebPanel();
        panel.setPreferredSize(400, 28);

        WebStyledLabel label = new WebStyledLabel();
        label.setWrap(TextWrap.word);

        label.setText("Asdfasdf 12345678-12345678-12345667 AA123456781234556767");
        label.setBoldFont();

        panel.add(label);

        TestFrame frame = TestFrame.show(5, false, panel, memoryBar);
The text should have been wrapped like this:
Asdfasdf 12345678-12345678-12345667
AA123456781234556767
Instead of:
Asdfasdf
12345678-12345678-12345667 AA123...
Also tried to remove the setBoldFont() call, but it made no difference
kovadam69
@kovadam69
I did debug a little bit, and I found out, that for some reason at painting the bounds of the painting area is reduced. With my test the getPreferredTextSize gave bounds of 427x77pix, and it passed also this bounds to the painting, but at some point something reduced the bounds size to 268x28px, which caused the text to be wrapped at a different point... It happened in the AbstractContentLayout.layoutContent method. It gets the correct bounds of 427x77, but at the call to final ContentLayoutData layoutData = layoutContent ( c, d, bounds ); it gets back a smaller rectangle. It happens in IconTextLayout for some reason it reduces the size...
Mikle
@mgarin

Thanks for code example, I'll look into that.
It is really weird though, maybe the issue is tied to the particular wrapping method or something else very specific.
I have thoroughly tested WebStyledLabel changes when they were pushed and it didn't seem to have such glaring problems.

One more thing - what Java version are you using for the test?

And I suppose that screenshot was from example running using WebLaF v1.2.14-SNAPSHOT version?
Mikle
@mgarin
Either way, I can certainly reproduce it on the latest version, so something is certainly wrong. I'll see if it's possible to fix it quickly, for now I would recommend using last released v1.2.13 version - it doesn't have these changes, so it should be at the very least behave the same way older versions did.
kovadam69
@kovadam69
Thanks, Java version was 1.8.0_171 I think, and it was 1.2.14 latest snapshot.
Mikle
@mgarin

@kovadam69
Just a small update - I've passed this issue to my colleague who made the recent changes, he will look into it once he has a bit more free time. There are certainly some issues with internal size calculations. It's been a wack-a-mole game for a while with the styled label layouting code as there are just too many cases (especially edge cases) which it needs to account for and the code itself is a bloody mess. Fixing one issue in that part almost always caused a few new ones, just like this time, so we'll need to be very careful.

So as I mentioned earlier - I recommend using more stable public v1.2.13 release for now, at least until v1.2.14 is patched up and finally released.

kovadam69
@kovadam69
Thanks! I will wait for the 1.2.14 update. I've found another issue with popup menu (or similar popup windows):
https://imgur.com/ZnjMNk6
It was the same a long time ago, then later some version fixed it, but now I have it again in 1.2.13 and 1.2.14 also (I don't remember now in 1.3.0-snapshot). But certainly it was fixed before. I don't know if it is a problem on windows, but certainly problem with Ubuntu 20.04.
kovadam69
@kovadam69
I tried now 1.3.0-SNAPSHOT and it seems there is no problem (glitch) with popup menu, so it is 1.2.x related.
Mikle
@mgarin
@kovadam69
I doubt that this issue was fixed in any of the versions, even 1.3.0 - most probably it's reproduction simply depends on the order in which you open popup menus. Unless there were some other changes that affected this somehow. The problem with the shadow stretching like this is simply an incorrect caching/retrieval of the generated shadow image and I don't think I touched that code yet due to some related difficulties.
kovadam69
@kovadam69
ah, OK, just with 1.3.0-SNAPSHOT it was gone, and I was using 1.3.0-SN since April or so, and now I switched back to 1.2.14-SN and then to 1.2.13 and I immediately noticed the problem again.
Mikle
@mgarin
@kovadam69
Styled label wrapping issues were potentially fixed with the latest commit.
I'll still need some time before I release v1.2.14, but you can give it a try to see if it works correctly for you - snapshot version is already available.
kovadam69
@kovadam69
@mgarin Hi! I tried, and the wrapping issue seems to be gone now :) Great job! Thanks!
Javier Coindreau
@javster101
Hello! I was wondering if weblaf officially supports using java 9+ modules? I am having an issue with repeated packages between weblaf.ui and weblaf.core that are preventing a build with Gradle and Java 14
Javier Coindreau
@javster101
Actually nevermind, I got it figured out
Mikle
@mgarin
@javster101
Unfortunately not yet, different WebLaF modules indeed have similar packages which can cause issues on later Java versions but it's a huge change I can't afford right now. I will be changing packages once I'll move on from supporting Java 6+ along with lots of code adjustments for all new language features introduced in later Java versions.
Lord Moon
@bgmoon
I'm currently developing a fairly extensive desktop application and have been using JFormDesigner (in intelliJ) with flatFlaf. I'm considering switching to your framework because of several of your better components but have some questions: 1) Is there a similar GUI based UI designer like JFormDesigner that I can use? 2) Why can't I just buy your LAF through the jetbrains store? 3) I found two projects that seem to both be "webLaf" on maven central, which is yours? 4) I found a video on youtube (https://www.youtube.com/watch?v=CiTXm7wlgZE) that seems to be webLaf, but the demo is quite different than the one I downloaded form gitHub in functionality. In particular, there are things in that video I would like to have, especially the image gallery and image cropping, but don't find them in the git hub repo. Are these the same product? Do you support those image capabilities?
BTW, I'm able to build and run a simple demo under Java 14/15 with no issues other than warnings.
Mikle
@mgarin

@bgmoon

  1. Theoretically you can use WebLaF inside existing UI designers like JFormDesigner, but practically there is an issue - WebLaF has to be initialized to work properly and unfortunately, as far as I know, none of the existing designers support that. And overall - I was developing WebLaF with mostly coding convenience in mind as I haven't really ever used UI designers as a tool to create UI code for any real-life projects. I do want to make WebLaF usable within UI designers without initialization but that will require some work and it is a bit further on the todo list.

  2. WebLaF is not affiliated with JetBrains anyhow and isn't a plugin for any of their IDEs - it's just a standalone L&F library for Swing framework on Java, so I'm not sure how it can be available on JetBrains store (or marketplace? whichever you meant).

  3. These are official artifacts published by me: https://search.maven.org/search?q=g:com.weblookandfeel
    Other ones that may be available on Maven might simply be published by other WebLaF users and may be compiled from modified sources.

  4. That video is from a very old demo that was available before the major styling revamp in WebLaF (pre-1.2.9 versions). Not sure what you meant under image cropping, but the image gallery component is still available and it's component class is called WebImageGallery. It haven't been added into new demo though because new demo only contains fully revamped and "cleaned up" components. It is still functional, but it will receive a rework in the future to be more customizable via new styling system.

And about the warnings - I recommend reading this wiki article: https://github.com/mgarin/weblaf/wiki/Java-9-and-higher
It should explain why those happen and how to configure your projects to avoid them.

Mike Hearn
@mikehearn
I'm curious if there's a way to change the default font size, for zooming? I often like to zoom text in web browsers and this is a common lack in desktop apps.
Mikle
@mgarin

@mikehearn
In runtime - currently no, but as a temporary solution I've added public static fields in WebLookAndFeel class that you can change to adjust global or specific component fonts, here are some examples:

WebLookAndFeel.globalControlFont // global font for ControlType.CONTROL
WebLookAndFeel.buttonFont // specific font for button components
WebLookAndFeel.checkBoxFont // specific font for check box components

There are a few issues with adjusting fonts in runtime, so that would still require some work to be done, but ultimately that's the goal of #331 and #352 issues

Mike Hearn
@mikehearn
Thanks. Also, I noticed in the text inputs that a lot of hotkeys don't seem to work (on Mac). For instance cmd-left, cmd-right, cmd-a to select all etc. Is that also a known issue?
Ctrl-A does work. Seems like the keymap doesn't realise i'm on a Mac. This is with Java 15.
Mikle
@mgarin
I think there is an issue with the cmd key specifically, yes.
I really need to get some test mac os running and fix it, these might be related as well: #117 #176
I bumped these issues to the next update v1.2.14 update and will look into them.
Most probably - it's just a global key mapping issue as I'm mostly testing under Windows & Unix where cmd key isn't really a thing.
I'll see if I can make a quick fix tomorrow as it is actually a deal-breaker bug for Mac users.
Mike Hearn
@mikehearn
Cool
Mikle
@mgarin

@mikehearn
I've looked at the issue with hotkeys on Mac and I found that there is indeed a separate class in AquaLookAndFeel that overrides default mapping:
https://github.com/openjdk/jdk/blob/702ca6228c7bcfaff6fa72e2f580daa7bb12f69a/src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java

To fix this issue and avoid further inconsistencies with hotkeys I will need to create proper OS-specific mappings for all hotkeys registered within L&F. It's not a complicated solution but it will take more time than I expected, so the fix most probably won't be available until next week.

It also seems that #117 is an unrelated issue and will need further investigation and a potential fix (or a workaround, depending on what the problem is exactly).

mattpymm
@mattpymm
@mgarin You mentioned a snapshot build on #651 where could I find that?
Mikle
@mgarin

@mattpymm You can include current snapshot version (v1.2.14) in your Maven project like this:

    <dependencies>
        <dependency>
            <groupId>com.weblookandfeel</groupId>
            <artifactId>weblaf-ui</artifactId>
            <version>1.2.14-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>sonatype-snapshot-rep</id>
            <name>Sonatype snapshot repository</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
    </repositories>

Or just download artifacts directly -
https://oss.sonatype.org/content/repositories/snapshots/com/weblookandfeel/

mattpymm
@mattpymm
Thanks! @mgarin
mattpymm
@mattpymm
@mgarin Is there an estimated release date for v1.2.14?