Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #32589
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Knute Johnson <nospam@rabbitbrush.frazmtn.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Applets? |
| Date | Tue, 15 Sep 2015 17:56:45 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 73 |
| Message-ID | <mtaeks$mbq$1@dont-email.me> (permalink) |
| References | <a3f016f7-b5fa-4c80-8cb0-5ebf0a533298@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Wed, 16 Sep 2015 00:54:52 +0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="e4bb2c7dad0e79edbbf184ec68513a50"; logging-data="22906"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+gmqpf0WEeJpE8mcYCyoV5" |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
| In-Reply-To | <a3f016f7-b5fa-4c80-8cb0-5ebf0a533298@googlegroups.com> |
| Cancel-Lock | sha1:BToqXD9BftVqbNeJWR1HnuMPg0s= |
| Xref | csiph.com comp.lang.java.programmer:32589 |
Show key headers only | View raw
My best guess is you are using a 64bit Windows system and don't have
32bit Java installed. You need the i586 JRE if you have a 64bit Windows
OS because Firefox is only 32bit.
You are going to have other problems though too. Applets are very
difficult to run anymore without code signing them. You will need to
use the Configure Java program to allow Applets to run. If you want to
run them from your local file system (and you have a Windows machine),
add file:/ to the exceptions list.
If you are just learning Java, stick with applications. They are much
easier to deal with.
In any case, building a Swing GUI must be done on the Event Dispatch
Thread (EDT). To do that you need to use EventQueue.invokeLater() to
wrap all your calls that create Swing GUI components. Applet.init() is
not running on the EDT.
Example;
public class MyApplet extends JApplet {
public void init() {
EventQueue.invokeLater(() -> {
JTextArea area = new JTextArea("area");
add(area);
});
}
}
So the above code does run but with all the discussed caveats.
knute...
On 9/15/2015 17:07, SpreadTooThin wrote:
> I tried writing a small applet that used swing.
> However when I try to run it in my browswer, (firefox, chrome) I get a message saying
> "This plugin is not supported."
>
> It's a really simple swing listbox....
>
>
> // This is the html file
> <html>
> <head>
> <title>"my dpa class"</title>
> </head>
> <body>
> <applet code="dpa.class" widht="45" height="100"></applet>
> </body>
> </html>
>
> // This is the java file which i compiled into a class...
> import javax.swing.JApplet;
> import javax.swing.JTextArea;
>
> public class dpa extends JApplet {
> @Override
> public void init() {
> JTextArea area = new JTextArea("Hello World");
> this.add(area);
> }
> }
>
> What have I done wrong?
> I looked for some security setting but maybe I'm missing something more fundamental.
>
>
--
Knute Johnson
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Applets? SpreadTooThin <bjobrien62@gmail.com> - 2015-09-15 17:07 -0700
Re: Applets? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-09-15 17:56 -0700
Re: Applets? Jeff Higgins <jeff@invalid.invalid> - 2015-09-15 21:00 -0400
Re: Applets? SpreadTooThin <bjobrien62@gmail.com> - 2015-09-16 07:21 -0700
Re: Applets? e.d.programmer@gmail.com - 2015-09-16 07:28 -0700
Re: Applets? Arne Vajhøj <arne@vajhoej.dk> - 2015-09-16 21:10 -0400
Re: Applets? Arne Vajhøj <arne@vajhoej.dk> - 2015-09-16 21:16 -0400
csiph-web