我的一个JApplet再JCreator中运行非常正常,没有任何异常。
但是把该JApplet加入一个html文件
运行该html文件
再java控制台有如下错误提示:
java.sq.SQLException:unable to connect to any hosts due to exception:
java.security.AccessControlException:access denied(java.util.Property
Permission file.encoding read)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1797)
at com.mysql.jdbc.Connection.(Connection.java:562)
at com.mysql.jdbc.Connection.NonRegisteringDriver.connect(NonRegisteringDriv
er.java:361)
at java.sql.DriverManager.getConne
之前说过我对abstract class的看法,倒是引来不少非议
尤其是有些人居然举出了例子,好,我们就从这个例子开始
有人说在这种情况下要使用abstract class
比如一个animal,有walk和sing方法
那么代码就是
public abstract class Animal{
public void walk(){System.out.println("walk")};
public abstract void sing();
}
然后对于具体的实现类,比如Cat,有如下实现
public class Cat extends Animal{
public void sing(){
System.out.println("cat sing");
}
}
这样一个类,好处就是“便于扩展”等等
OK,那么我们就从这个例子出发,说说为什么在j2ee环境中,我们不这么做
然后说说会怎么做
首先,在j2ee的环境中,关于animal这种实体
我们会在各个层面建立entity
比如在db层面建立一个表,叫做animal,然后有一个cat记录
然后通过orm,建立起一个dto之类的玩... 阅读全帖
之前说过我对abstract class的看法,倒是引来不少非议
尤其是有些人居然举出了例子,好,我们就从这个例子开始
有人说在这种情况下要使用abstract class
比如一个animal,有walk和sing方法
那么代码就是
public abstract class Animal{
public void walk(){System.out.println("walk")};
public abstract void sing();
}
然后对于具体的实现类,比如Cat,有如下实现
public class Cat extends Animal{
public void sing(){
System.out.println("cat sing");
}
}
这样一个类,好处就是“便于扩展”等等
OK,那么我们就从这个例子出发,说说为什么在j2ee环境中,我们不这么做
然后说说会怎么做
首先,在j2ee的环境中,关于animal这种实体
我们会在各个层面建立entity
比如在db层面建立一个表,叫做animal,然后有一个cat记录
然后通过orm,建立起一个dto之类的玩... 阅读全帖
I have two java applets which are listed here.
Program 1:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class MouseDetails extends JApplet {
private String s = "";
private int xPos, yPos;
private int newX, newY;
public void init(){
newX = 0;
newY = 0;
xPos = -1;
yPos = -1;
addMouseMotionListener( new MouseMotionHandler() );
setBackground(Color.black);
setSize( 350, 150 );
}
public void paint( Graphics g )
{
after u add the new component, call the method validate() of the japplet
refer to dynamic tree demo in java tutorial at http://java.sun.com/docs/books/tutorial
The SwingApplet.html file does not invoke the Plug-in. It
displays the applet in browsers that support Java1.2
natively (eg: appletviewer).
You must replace the
Do not understand. JApplet is just a awt.container with some security
constraint. It supports graphic drawing but it doesn't directly support text
components.
I'm following this java tutorials- Getting Started WIth Applets
here are my files:
======================================
HelloWorld.java
import javax.swing.*;
import java.lang.reflect.InvocationTargetException;
public class HelloWorld extends JApplet{
public void init(){
try {
SwingUtilities.invokeAndWait(new Runnable(){
public void run(){
JLabel label = new JLabel("Hello World!");
add(label);
}
... 阅读全帖
LOL. What part of "RICH & INTERACTIVE" do you not understand really?
Tell me what is so "RICH" about a TEXT-based email client. Where's the
multimedia element in an email client? Why do so many stock charting
web sites use Flash, Silverlight, JApplet to present charts to their
clients? You are not making any sense.