> thanks but
> void type not allowed here is the message I get when I tried
> java.awt.EventQueue.invokeLater(jtextfiledFIleNbr.requestFocus())
What Knute meant was something along these lines.
<snippet>
Runnable r = new Runnable() {
public void run() {
jtextfiledFIleNbr.requestFocus()
}
};
EventQueue.invokeLater(r);
</snippet>
BTW. Is that attribute really called..
'jtextfiledFIleNbr'?
That is not the correct nomenclature for an
attribute name, and has spelling errors besides.
jtextfieldFIleNbr
..corrects the spelling error..
jTextFieldFileNbr
..corrects the capitalisation, but even then
the 'Nbr' should logically be either 'Number'
or (if abbreviated) 'N'
jTextFieldFileNumber
Of course, there are others who will jump in and
suggest that prepending the 'jTextField' part is..
some grievous sin, because ..I forget why, actually
(I've never completely understood that advice, and
those that suggest it never seem to fess up some
suggestions for what to do in peculiar* situations).
* E.G.
<snippet>
String pathToImageString =
"http://the.url/pretty.jpg";
URL pathToImageURL ...
</snippet>
Anybody?
--
Andrew Thompson
http://pscode.org/
gg - 22 Jun 2008 06:04 GMT
thanks, you are right there was typo in the prev. post
the actual name in the application was jtfFileCreationNumber
The application is using for the most part if possible 3 letter prefix of
JComponents
I tried to spelled the Component so people what I am talking about but I
goofed.
gg - 22 Jun 2008 06:25 GMT
too bad that I can't have
Runnable runFocus = new Runnable() {
public void run(JComponents jc) {
jc.requestFocus();
}
};
and use it in invokeLater
Also any added public method to run would get ignore and not accesible. I
guess that is java way.
Knute Johnson - 22 Jun 2008 16:02 GMT
> too bad that I can't have
> Runnable runFocus = new Runnable() {
[quoted text clipped - 7 lines]
> Also any added public method to run would get ignore and not accesible. I
> guess that is java way.
Inside an event handler put this code:
EventQueue.invokeLater(new Runnable() {
whatEverYourComponentsNameIs.requestFocusInWindow();
});

Signature
Knute Johnson
email s/nospam/knute2008/
RedGrittyBrick - 23 Jun 2008 15:06 GMT
>> too bad that I can't have
>> Runnable runFocus = new Runnable() {
[quoted text clipped - 14 lines]
> whatEverYourComponentsNameIs.requestFocusInWindow();
> });
I think you mean:
final whatEverYourComponentsNameIs;
...
EventQueue.invokeLater(new Runnable() {
public void run() {
whatEverYourComponentsNameIs.requestFocusInWindow();
}
});

Signature
RGB
Knute Johnson - 23 Jun 2008 17:13 GMT
>>> too bad that I can't have
>>> Runnable runFocus = new Runnable() {
[quoted text clipped - 24 lines]
> }
> });
It doesn't have to be final it can be a class variable.

Signature
Knute Johnson
email s/nospam/knute2008/
RedGrittyBrick - 23 Jun 2008 17:25 GMT
>>>> too bad that I can't have
>>>> Runnable runFocus = new Runnable() {
[quoted text clipped - 26 lines]
>
> It doesn't have to be final it can be a class variable.
OK.
Maybe I should have just said "In my experience, it is necessary to
define a "run()" method for the anonymous Runnable" :-)

Signature
RGB
Knute Johnson - 23 Jun 2008 18:05 GMT
>>>>> too bad that I can't have
>>>>> Runnable runFocus = new Runnable() {
[quoted text clipped - 31 lines]
> Maybe I should have just said "In my experience, it is necessary to
> define a "run()" method for the anonymous Runnable" :-)
Oh :-). I see what you are saying. You don't need to be so polite.
You should just say you left out the run() method you idiot.

Signature
Knute Johnson
email s/nospam/knute2008/
RedGrittyBrick - 23 Jun 2008 15:04 GMT
> jTextFieldFileNumber
>
[quoted text clipped - 13 lines]
>
> Anybody?
I pretty much do what you do in your example.
Foo foo;
JString fooName;
JTextField fooField;
JComboBox fooCombo;
JList<Foo> fooList;
I try to avoid abbreviations. I try to make foo descriptive.
ISO/IEC 11179-5 is relevant.
http://standards.iso.org/ittf/PubliclyAvailableStandards/c035347_ISO_IEC_11179-5
_2005(E).zip

Signature
RGB
gg - 23 Jun 2008 16:51 GMT
thank you.
the attribute is actually jtfFileCreationNumber
I am sure it does not meet some govt standard but is good enough for this
private sponsoring customer.
In come organizations I would have to use jtfFileCreatnNbr instead. from
some root word abbrev standard dictionary
Just a bit curious, some object oriented language they would simply has an
event object/scheduler you can call upon to execute a block of statement
after the current event completes.
event.post {
// a block of executable statements
}
But Java would requires us to explicitly create a runnable. why not the
other way and let the compiler do the work instead of programmer?
fro those arguing for purity of object orientation and packaging, why not
let there a compiler directive/macro type of package and let compiler do the
work?. less lines programmer code, less debug and maintenance time. cpu
power time is cheap for compiler nowadays
On Jun 22, 10:22 am, "gg" <g...@Edm.noMail.net> wrote:
> thanks but
> void type not allowed here is the message I get when I tried
> java.awt.EventQueue.invokeLater(jtextfiledFIleNbr.requestFocus())
What Knute meant was something along these lines.
<snippet>
Runnable r = new Runnable() {
public void run() {
jtextfiledFIleNbr.requestFocus()
}
};
EventQueue.invokeLater(r);
</snippet>
BTW. Is that attribute really called..
'jtextfiledFIleNbr'?
That is not the correct nomenclature for an
attribute name, and has spelling errors besides.
jtextfieldFIleNbr
..corrects the spelling error..
jTextFieldFileNbr
..corrects the capitalisation, but even then
the 'Nbr' should logically be either 'Number'
or (if abbreviated) 'N'
jTextFieldFileNumber
Of course, there are others who will jump in and
suggest that prepending the 'jTextField' part is..
some grievous sin, because ..I forget why, actually
(I've never completely understood that advice, and
those that suggest it never seem to fess up some
suggestions for what to do in peculiar* situations).
* E.G.
<snippet>
String pathToImageString =
"http://the.url/pretty.jpg";
URL pathToImageURL ...
</snippet>
Anybody?
--
Andrew Thompson
http://pscode.org/
Lew - 24 Jun 2008 00:40 GMT
> Just a bit curious, some object oriented language they would simply has an
> event object/scheduler you can call upon to execute a block of statement
[quoted text clipped - 5 lines]
> But Java would requires us to explicitly create a runnable. why not the
> other way and let the compiler do the work instead of programmer?
Welcome to the closures debate.
The answer to "Why not?" is, "Because." The language is what it is.
There's nothing wrong with the idiom of passing implementing classes instead
of closures, except that it makes lazy programmers whine.

Signature
Lew
Daniel Pitts - 24 Jun 2008 02:01 GMT
>> Just a bit curious, some object oriented language they would simply
>> has an
[quoted text clipped - 14 lines]
> There's nothing wrong with the idiom of passing implementing classes
> instead of closures, except that it makes lazy programmers whine.
Lazy programmers (as opposed to lazy engineers) tend to make better
programs. The simpler a program is, the easier it is to write,
maintain, and extend.

Signature
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
Lew - 24 Jun 2008 04:52 GMT
Lew wrote:
>> There's nothing wrong with the idiom of passing implementing classes
>> instead of closures, except that it makes lazy programmers whine.
> Lazy programmers (as opposed to lazy engineers) tend to make better
> programs. The simpler a program is, the easier it is to write,
> maintain, and extend.
There's good laziness, and there's bad laziness. You're talking about a good
kind of "laziness", which actually is not laziness at all.
The kind of programmer you're talking about will put a lot of effort into
being lazy.
The kind of programmer I'm talking about will use highly abbreviated variable
names because it's "too much effort" to use a full compound word that explains
its own purpose. The kind that won't check all their method arguments because
it's easier just to let the program crash. The kind that recompiles and
releases code without checking that it still works. The kind that uses short
idioms that don't reveal their purpose, or eliminates indentation as too hard.
I worry about actual laziness, where the practitioner does not take the care
to make their program strong, extensible, correct, stable and useful.
Don't dilute the issue with cutesy misappropriations of terminology.

Signature
Lew