Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #32194
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2015-07-29 05:35 -0700 |
| References | (1 earlier) <mmv7cc$l2$1@dont-email.me> <31e57656-27e3-46a4-abbd-a793c463adba@googlegroups.com> <mp6pbo$19j$4@speranza.aioe.org> <4205e406-2568-4c74-a948-8fb425075b51@googlegroups.com> <mp91eg$6b7$2@speranza.aioe.org> |
| Message-ID | <ef946ad1-468d-4b02-bc0e-eeeed0aa5d55@googlegroups.com> (permalink) |
| Subject | Re: Image rotation part 2 |
| From | e.d.programmer@gmail.com |
On Tuesday, July 28, 2015 at 6:58:31 PM UTC-4, Arne Vajhøj wrote:
> Yes.
>
> And you chose not to modify that part.
>
> So I made a note so that readers do not get the wrong impression
> about what they should do.
>
> Arne
Disclaimer: That is not production code. That was a sample modified to solve a specific problem. Any reader who thinks you should create a JFrame and make it visible in the main method should probably take a Java class.
I didn't modify that part because it wasn't relevant to solving the problem. If it were a final program to put into production I would personally change a lot more than moving the JFrame to an event thread.
The simplest change to fix that one issue would be to write all main threads with GUI like this.
public static void main(final String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
// test program here
}
});
}
Personally I don't use JFrame. I like to write flexible applications. I like making a window with a button that can open a second window and disable the first window until you close the second window. I couldn't find an easy way to do that with a JFrame, so I made all windows extend JDialog, so I can make them DOCUMENT_MODAL and pass one into another as it's owner. I also don't use EXIT_ON_CLOSE. I set DO_NOTHING_ON_CLOSE, then assign a WindowListener linked to a KeyStroke on the InputMap that can allow them to also close with an F# key and prompt when they try to close and do some cleanup ie identify if a control is modified and prompt them to save.
So anyway, don't nitpick a sample. If you want to make sure readers who are new to Java don't get the idea they should do something everyone ought to know not to do, you might as well point those readers to the Java tutorial.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
Image rotation part 2 Martin Gregorie <martin@address-in-sig.invalid> - 2015-06-30 16:55 +0000
Re: Image rotation part 2 Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-06-30 14:03 -0400
Re: Image rotation part 2 Martin Gregorie <martin@address-in-sig.invalid> - 2015-06-30 20:04 +0000
Re: Image rotation part 2 Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-06-30 16:20 -0400
Re: Image rotation part 2 Martin Gregorie <martin@address-in-sig.invalid> - 2015-06-30 20:52 +0000
Re: Image rotation part 2 e.d.programmer@gmail.com - 2015-06-30 12:07 -0700
Re: Image rotation part 2 Martin Gregorie <martin@address-in-sig.invalid> - 2015-06-30 20:18 +0000
Re: Image rotation part 2 Jeff Higgins <jeff@invalid.invalid> - 2015-06-30 19:04 -0400
Re: Image rotation part 2 Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-06-30 16:36 -0700
Re: Image rotation part 2 Jeff Higgins <jeff@invalid.invalid> - 2015-06-30 20:17 -0400
Re: Image rotation part 2 Jeff Higgins <jeff@invalid.invalid> - 2015-06-30 20:09 -0400
Re: Image rotation part 2 e.d.programmer@gmail.com - 2015-07-01 06:06 -0700
Re: Image rotation part 2 FredK <fred.l.kleinschmidt@gmail.com> - 2015-07-01 10:57 -0700
Re: Image rotation part 2 Jeff Higgins <jeff@invalid.invalid> - 2015-07-01 18:13 -0400
Re: Image rotation part 2 Arne Vajhøj <arne@vajhoej.dk> - 2015-07-27 22:28 -0400
Re: Image rotation part 2 e.d.programmer@gmail.com - 2015-07-28 04:58 -0700
Re: Image rotation part 2 Arne Vajhøj <arne@vajhoej.dk> - 2015-07-28 18:58 -0400
Re: Image rotation part 2 e.d.programmer@gmail.com - 2015-07-29 05:35 -0700
csiph-web