Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37971

Re: How do you scale a JCheckBox?

From j4n bur53 <janburse@fastmail.fm>
Newsgroups comp.lang.java.programmer
Subject Re: How do you scale a JCheckBox?
Date 2018-01-22 22:37 +0100
Organization albasani.net
Message-ID <p45lj8$hfb$1@news.albasani.net> (permalink)
References <316fc0bc-d954-41c1-b913-3dd6e52e902a@googlegroups.com>

Show all headers | View raw


What Look & Feel, and what platform do you use?
I found that in JDK 8, only the windows classic
and the windows Look & Feel was scaled to the monitor.

But then in JDK 10, it is that also the following
Look & Feels Metal, Nimbus and CDE/Motif are scaled.
At least this is what a quick testing

on Windows 10 machine showed, that has a 2K display:

https://gist.github.com/jburse/c3362733ed08ee2e92db58723d529ad2#file-empty-p

I dunno how they do it inder the hood. On the
Mac plattform, they have the class sun.awt.CGraphicsDevice,
which has a field resp. method getScaleFactor(),

and this is used on the Mac plattform in JDK 8.
Maybe JDK 10 uses another strategy, on both the
Windows and Mac plattform. I could only

identify one further difference between JDK 8
and JDK 10 on the Windows platform, with some
guess work:

1) JDK 8, Windows 10, dragging a window:
    If a different monitor is used, the dragged window
    changes resolution, as soon as the mouse lands
    in the different monitor.

    It seems that the resolution change is based
    on some buffer scaling, or somesuch. Not
    sure, fonts are not fine grained, blured, like
    if some interpolation bitmap scaling.

2) JDK 10, Windows 10, dragging a window:
    If a different monitor is used, the dragged window
    changes resolution, as soon as the mouse is
    released.

    It seems that the window is re-validated and/or
    re-painted, or somsesuch. Not sure, fonts are
    much finer. Actually a little bit too fine, as
    if antialiasing would missing.

I consider the mouse behaviour in 2) either a bug
or a compromise. Also I need to adapt to the font
display in 2), not used to that fine fonts.

Eric Douglas schrieb:
> I've tried searching and found others had the same problem but no clear solution.  I tried digging into the code that draws it but it doesn't look good.  I resize a window ie pull up a window on a Surface Pro and set view to 300% and all JComponents change size, except for the box portion of the JCheckBoxes.
> 
> This guy had the same problem
> https://arstechnica.com/civis/viewtopic.php?f=20&t=123408
> 
> This guy made a hack solution to generate a custom icon instead of using the ones Oracle provided.
> https://stackoverflow.com/questions/22691353/scale-a-jcheckbox-box
> 
> Here's another possible hack solution.
> https://stackoverflow.com/questions/4770022/make-jcheckbox-bigger
> 
> Every other control is truly dynamic and simply scales when Windows tells it to, why are checkboxes (and apparently radiobuttons) so difficult?
> 

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How do you scale a JCheckBox? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-19 05:28 -0800
  Re: How do you scale a JCheckBox? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-19 13:13 -0800
    Re: How do you scale a JCheckBox? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-01-20 09:49 +0100
      Re: How do you scale a JCheckBox? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-22 04:56 -0800
    Re: How do you scale a JCheckBox? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-22 08:54 -0800
  Re: How do you scale a JCheckBox? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2018-01-21 14:05 -0600
    Re: How do you scale a JCheckBox? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-22 07:25 -0800
      Re: How do you scale a JCheckBox? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2018-01-22 11:38 -0600
        Re: How do you scale a JCheckBox? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-22 10:17 -0800
        Re: How do you scale a JCheckBox? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-22 12:49 -0800
          Re: How do you scale a JCheckBox? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2018-01-22 15:31 -0600
  Re: How do you scale a JCheckBox? j4n bur53 <janburse@fastmail.fm> - 2018-01-22 22:37 +0100
    Re: How do you scale a JCheckBox? bursejan@gmail.com - 2018-01-22 14:16 -0800
      Re: How do you scale a JCheckBox? bursejan@gmail.com - 2018-01-22 14:18 -0800

csiph-web