Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Base 8 is just like base 10, if you are missing two fingers. -- Tom Lehrer


devel / comp.lang.java.programmer / Default Button Doesn't Follow Focused Button

SubjectAuthor
* Default Button Doesn't Follow Focused ButtonAndreas Leitgeb
`* Re: Default Button Doesn't Follow Focused Buttone.d.pro...@gmail.com
 `* Re: Default Button Doesn't Follow Focused ButtonAndreas Leitgeb
  `* Re: Default Button Doesn't Follow Focused ButtonAndreas Leitgeb
   `- Re: Default Button Doesn't Follow Focused Buttone.d.pro...@gmail.com

1
Default Button Doesn't Follow Focused Button

<slrnuc2hl0.vik.avl@logic.at>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=271&group=comp.lang.java.programmer#271

  copy link   Newsgroups: comp.lang.java.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: avl@logic.at (Andreas Leitgeb)
Newsgroups: comp.lang.java.programmer
Subject: Default Button Doesn't Follow Focused Button
Date: Wed, 26 Jul 2023 16:15:28 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <slrnuc2hl0.vik.avl@logic.at>
Reply-To: avl@logic.at
Injection-Date: Wed, 26 Jul 2023 16:15:28 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="34b340a488b81bbb5fb042801439960f";
logging-data="1629691"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18AGkQY3SdHWT5uNnoI23J9"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:IsL+9bot2h97dZrtbfrW5FwYpzA=
 by: Andreas Leitgeb - Wed, 26 Jul 2023 16:15 UTC

Imagine a simple Dialog (SSCCE at the bottom of this post)
with just two buttons, one of which is initially set up as
Default-button, such that a simple <Return>-key press would
invoke it.

In Windows, it seems to be "usual behaviour" that if I now
use the Tab-key to set focus on any other button, then the
focused button should temporally become the new "default"-
button, until focus goes to something not-a-button, then the
original default button would receive the blue frame again
and become default again.

As it seems, Java does not follow this principle: instead,
one button is declared as default, and regardless of whether
the focus is on a different button or not, <Return>-key would
always invoke the initially set default button.

Has anyone here ever needed to change his Java program to be
less alien on Windows in that matter?

Will I need to install Focus listeners on each component, and
set the defaultButton to either the focused component (if it
is a button), or the dialogs initial default (otherwise)?

--- SSCCE ---

Even when running it on Windows, the blue frame of the default
button doesn't follow the focus when Tabbing. When Focus is moved
to the Ok-button, the blue frame stays around the Cancel button.

--- begin - Test.java ---
import javax.swing.JOptionPane;

public class Test
{ public static void main(String[] args)
{
JOptionPane.showOptionDialog(null,
"My Message", "My Message Dialog",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null, new String[]{"Ok", "Cancel"},
"Cancel");
System.exit(0);
}
} --- end ---

Re: Default Button Doesn't Follow Focused Button

<be066062-bd4d-4d49-ad7d-bf5f02e132dcn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=272&group=comp.lang.java.programmer#272

  copy link   Newsgroups: comp.lang.java.programmer
X-Received: by 2002:a05:6214:4c10:b0:63d:67b:ec21 with SMTP id qh16-20020a0562144c1000b0063d067bec21mr8296qvb.6.1690394377810;
Wed, 26 Jul 2023 10:59:37 -0700 (PDT)
X-Received: by 2002:a05:6870:5aaf:b0:1bb:48fa:f5a9 with SMTP id
dt47-20020a0568705aaf00b001bb48faf5a9mr273820oab.9.1690394377403; Wed, 26 Jul
2023 10:59:37 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.java.programmer
Date: Wed, 26 Jul 2023 10:59:37 -0700 (PDT)
In-Reply-To: <slrnuc2hl0.vik.avl@logic.at>
Injection-Info: google-groups.googlegroups.com; posting-host=98.237.40.232; posting-account=2czF5goAAAD4GBMPIGV4KcD2K4PhoB_H
NNTP-Posting-Host: 98.237.40.232
References: <slrnuc2hl0.vik.avl@logic.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <be066062-bd4d-4d49-ad7d-bf5f02e132dcn@googlegroups.com>
Subject: Re: Default Button Doesn't Follow Focused Button
From: e.d.programmer@gmail.com (e.d.pro...@gmail.com)
Injection-Date: Wed, 26 Jul 2023 17:59:37 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3241
 by: e.d.pro...@gmail.com - Wed, 26 Jul 2023 17:59 UTC

On Wednesday, July 26, 2023 at 12:15:42 PM UTC-4, Andreas Leitgeb wrote:
> Imagine a simple Dialog (SSCCE at the bottom of this post)
> with just two buttons, one of which is initially set up as
> Default-button, such that a simple <Return>-key press would
> invoke it.
>
> In Windows, it seems to be "usual behaviour" that if I now
> use the Tab-key to set focus on any other button, then the
> focused button should temporally become the new "default"-
> button, until focus goes to something not-a-button, then the
> original default button would receive the blue frame again
> and become default again.
>
> As it seems, Java does not follow this principle: instead,
> one button is declared as default, and regardless of whether
> the focus is on a different button or not, <Return>-key would
> always invoke the initially set default button.
>
>
> Has anyone here ever needed to change his Java program to be
> less alien on Windows in that matter?
>
> Will I need to install Focus listeners on each component, and
> set the defaultButton to either the focused component (if it
> is a button), or the dialogs initial default (otherwise)?
>
>
>
> --- SSCCE ---
>
> Even when running it on Windows, the blue frame of the default
> button doesn't follow the focus when Tabbing. When Focus is moved
> to the Ok-button, the blue frame stays around the Cancel button.
>
> --- begin - Test.java ---
> import javax.swing.JOptionPane;
>
> public class Test
> {
> public static void main(String[] args)
> {
> JOptionPane.showOptionDialog(null,
> "My Message", "My Message Dialog",
> JOptionPane.OK_CANCEL_OPTION,
> JOptionPane.INFORMATION_MESSAGE,
> null, new String[]{"Ok", "Cancel"},
> "Cancel");
> System.exit(0);
> }
> }
> --- end ---
There is only supposed to be one default button. Focused button is a different matter. Use space bar to select focused button with keyboard.

Re: Default Button Doesn't Follow Focused Button

<slrnuc2rcu.22p.avl@logic.at>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=273&group=comp.lang.java.programmer#273

  copy link   Newsgroups: comp.lang.java.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: avl@logic.at (Andreas Leitgeb)
Newsgroups: comp.lang.java.programmer
Subject: Re: Default Button Doesn't Follow Focused Button
Date: Wed, 26 Jul 2023 19:01:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <slrnuc2rcu.22p.avl@logic.at>
References: <slrnuc2hl0.vik.avl@logic.at>
<be066062-bd4d-4d49-ad7d-bf5f02e132dcn@googlegroups.com>
Reply-To: avl@logic.at
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 26 Jul 2023 19:01:50 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ef5fe657ea14aac30bf732c6356e55e4";
logging-data="1664418"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/zpsH1WLfCup862iycWPPC"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:tuKetLcypXj3XUWM2Vica/JwdhI=
 by: Andreas Leitgeb - Wed, 26 Jul 2023 19:01 UTC

e.d.pro...@gmail.com <e.d.programmer@gmail.com> wrote:
> On Wednesday, July 26, 2023 at 12:15:42 PM UTC-4, Andreas Leitgeb wrote:
>> In Windows, it seems to be "usual behaviour" that if I now
>> use the Tab-key to set focus on any other button, then the
>> focused button should temporally become the new "default"-
>> button, until focus goes to something not-a-button, then the
>> original default button would receive the blue frame again
>> and become default again.

> There is only supposed to be one default button. Focused button
> is a different matter. Use space bar to select focused button
> with keyboard.

Yeah, count me in the choir for that preaching...

Unfortunately, the customers refuse to sing along with us.

Re: Default Button Doesn't Follow Focused Button

<slrnuc4672.23l.avl@logic.at>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=274&group=comp.lang.java.programmer#274

  copy link   Newsgroups: comp.lang.java.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: avl@logic.at (Andreas Leitgeb)
Newsgroups: comp.lang.java.programmer
Subject: Re: Default Button Doesn't Follow Focused Button
Date: Thu, 27 Jul 2023 07:12:34 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <slrnuc4672.23l.avl@logic.at>
References: <slrnuc2hl0.vik.avl@logic.at>
<be066062-bd4d-4d49-ad7d-bf5f02e132dcn@googlegroups.com>
<slrnuc2rcu.22p.avl@logic.at>
Reply-To: avl@logic.at
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 27 Jul 2023 07:12:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="683247f685e30b6406bd64a5cf8a822d";
logging-data="1925870"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3mcOgs8SMIvtYEVNCs9B1"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:WTCGkrQLnI+SGa2SUEE0l3v0VIk=
 by: Andreas Leitgeb - Thu, 27 Jul 2023 07:12 UTC

Problem is solved!

The culprit was in very old parts of the code, where my predecessor-
programmers explicitly thwarted Windows laf default behaviour, by
defining all (except the chosen one) as non-defaultCapable.
They were the same who explicitly selected windows laf, but really
only wanted the look, not the feel - well, not all of it, at least.

The reason, I fooled myself into thinking my SSCCE would be relevant
is, that Java here isn't locally configured for windows l&f, so my
SSCCE picked some other laf, and that other laf just didn't have
the "default follows focused buttons"-behaviour in the first place.

Andreas Leitgeb <avl@logic.at> wrote:
> e.d.pro...@gmail.com <e.d.programmer@gmail.com> wrote:
>> On Wednesday, July 26, 2023 at 12:15:42 PM UTC-4, Andreas Leitgeb wrote:
>>> In Windows, it seems to be "usual behaviour" that if I now
>>> use the Tab-key to set focus on any other button, then the
>>> focused button should temporally become the new "default"-
>>> button, until focus goes to something not-a-button, then the
>>> original default button would receive the blue frame again
>>> and become default again.
>
>> There is only supposed to be one default button. Focused button
>> is a different matter. Use space bar to select focused button
>> with keyboard.
>
> Yeah, count me in the choir for that preaching...
>
> Unfortunately, the customers refuse to sing along with us.
>

Re: Default Button Doesn't Follow Focused Button

<aec1a9f3-80de-4528-865d-6617eb792525n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=276&group=comp.lang.java.programmer#276

  copy link   Newsgroups: comp.lang.java.programmer
X-Received: by 2002:ac8:7f02:0:b0:401:dfc4:6f8f with SMTP id f2-20020ac87f02000000b00401dfc46f8fmr469qtk.13.1690480681869;
Thu, 27 Jul 2023 10:58:01 -0700 (PDT)
X-Received: by 2002:a05:6870:c799:b0:1ba:a5d1:a579 with SMTP id
dy25-20020a056870c79900b001baa5d1a579mr132149oab.4.1690480681176; Thu, 27 Jul
2023 10:58:01 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.java.programmer
Date: Thu, 27 Jul 2023 10:57:59 -0700 (PDT)
In-Reply-To: <slrnuc4672.23l.avl@logic.at>
Injection-Info: google-groups.googlegroups.com; posting-host=98.237.40.232; posting-account=2czF5goAAAD4GBMPIGV4KcD2K4PhoB_H
NNTP-Posting-Host: 98.237.40.232
References: <slrnuc2hl0.vik.avl@logic.at> <be066062-bd4d-4d49-ad7d-bf5f02e132dcn@googlegroups.com>
<slrnuc2rcu.22p.avl@logic.at> <slrnuc4672.23l.avl@logic.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <aec1a9f3-80de-4528-865d-6617eb792525n@googlegroups.com>
Subject: Re: Default Button Doesn't Follow Focused Button
From: e.d.programmer@gmail.com (e.d.pro...@gmail.com)
Injection-Date: Thu, 27 Jul 2023 17:58:01 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: e.d.pro...@gmail.com - Thu, 27 Jul 2023 17:57 UTC

On Thursday, July 27, 2023 at 3:12:48 AM UTC-4, Andreas Leitgeb wrote:
> Problem is solved!
>
> The culprit was in very old parts of the code, where my predecessor-
> programmers explicitly thwarted Windows laf default behaviour, by
> defining all (except the chosen one) as non-defaultCapable.
> They were the same who explicitly selected windows laf, but really
> only wanted the look, not the feel - well, not all of it, at least.
>
I normally just set the L&F for the graphics. You can override key behavior with listeners. I wouldn't recommend it.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor