applet

How to relocate the applet viewer window?

馋奶兔 提交于 2020-01-22 18:52:30
问题 using Eclipse to make java Applet. Every time to run it from the IDE, the applet viewer is shown on left top corner at (0,0). How to programmably change it to the middle of screen during the development? I know when deploy in browser, we can't change the window from inside the applet since the html determines the location. 回答1: In contrast to the other poster, I think this is a pointless exercise and prefer their suggestion to make an hybrid application/applet to make development easier. OTOH

java计算机二级操作题有关swing题型

有些话、适合烂在心里 提交于 2020-01-22 11:22:08
题型一 import javax . swing . JOptionPane ; //导入JOptionPane类 public class a { public static void main ( String args [ ] ) { //*********Found******** JOptionPane . showMessageDialog ( null , "欢迎\n你\n参加\nJava\n考试!" ) ; System . exit ( 0 ) ; // 结束程序,量为0时表示正常退出,为非零时表示非正常退出 } } / * JOptionPane类的常用静态方法如下: showInputDialog ( ) //输入对话框 showConfirmDialog ( ) //确认对话框 showMessageDialog ( ) //消息对话框 showOptionDialog ( ) //选择对话框 * / 题型二 java代码 //*********Found******** import java . applet . * ; //导入applet包中的Applet类, 说明要写的是小程序,是固定的格式。小程序都是要嵌入到浏览器中运行的。写完之后要写个HTML文件。 import java . awt . Graphics ; /

Javacard Shareable Interface: lookupAID returns AID but getAppletShareableInterface returns null

安稳与你 提交于 2020-01-21 13:56:27
问题 edit 2: Found the mistake. I tried to initialize the Shareable object in the constructor. At that time the client's register method is not yet called, so the JCRE doesn't have its AID. While my server's getShareableInterfaceObject(AID clientaid, byte parameter) method doesn't require the client's AID to be != null the JCRE probably does, since it calls this method for my client. I now initialize my Shareable object when I process my first APDU and it now works. And btw, thank you owlstead for

How to solve java.security.AccessControlException?

和自甴很熟 提交于 2020-01-21 11:42:10
问题 I am trying to access client's temp directory through my applet on my web project. When I run the applet by itself, it gets the tempdir with no problem. When I try to get it on my project using javascript and calling the applet method, I am having accessControlException on my javascript console. Also I am getting the same exception when I try to read a file under the temp directory. This is what I see exactly: java.security.accesscontrolexception access denied (java.util.propertypermission

Viewing .doc file with java applet

耗尽温柔 提交于 2020-01-21 07:22:31
问题 I have a web application. I've generated MS Word document in xml format (Word 2003 XML Document) on server side. I need to show this document to a user on a client side using some kind of viewer. So, question is: what libraries I can use to solve this problem? I need an API to view word document on client side using java . 回答1: You cannot reliably display a Word document in a web page using Java (or any other simple technology for that matter). There are several commercial libraries out there

Run Java-applets directly ( without html page )

一世执手 提交于 2020-01-21 04:52:24
问题 I have a problem. How i can run my java-applet directly without embedded in my web page? I know appletViewr can execute applet without a browser but I need to get java applet without html page. 回答1: Appletviewer is the way to go, BUT, it still requires a webpage with an applet-tag . An alternative solution is to write a stub class, with a main method, that instantiates the applet, calls init() , start() , stop() and destroy() as would otherwise have been done by the browser or appletviewer.

Thread.Sleep() is freezing

十年热恋 提交于 2020-01-18 05:46:03
问题 Here is a snippet kit.insertHTML(doc, doc.getLength(), "Hello", 0, 0, null); try{ Thread.sleep(1000); }catch(Exception e){} I am using HTMLEditorKit() and HTMLDocument() as a textbox. The textbox should show "Hello" then wait one second however, when I try this, It waits one second then puts the word "Hello" which is not what I want. I am not sure why this happens because I put this in the logical order. If anyone can help me with this, that would be great. EDIT: Does anyone know an

Thread.Sleep() is freezing

核能气质少年 提交于 2020-01-18 05:45:28
问题 Here is a snippet kit.insertHTML(doc, doc.getLength(), "Hello", 0, 0, null); try{ Thread.sleep(1000); }catch(Exception e){} I am using HTMLEditorKit() and HTMLDocument() as a textbox. The textbox should show "Hello" then wait one second however, when I try this, It waits one second then puts the word "Hello" which is not what I want. I am not sure why this happens because I put this in the logical order. If anyone can help me with this, that would be great. EDIT: Does anyone know an

Get client windows username

本小妞迷上赌 提交于 2020-01-17 08:15:18
问题 Can i get the username of the currently looged in person using applets. If yes, how can i use the applet in my dynamic web project? I know in I.E we can do like this var objUserInfo = new ActiveXObject("WScript.network"); document.write(objUserInfo.ComputerName+"<br>"); document.write(objUserInfo.UserDomain+"<br>"); document.write(objUserInfo.UserName+"<br>"); var uname = objUserInfo.UserName; alert(uname); but i want it using applet so that it will work in any browser. 回答1: Be aware that

Printing g.Drawstring on a new line when for loop is run?

我们两清 提交于 2020-01-17 04:52:10
问题 I have been set an assignment and I have been working on this applet for days now, trying to figure out a solution myself but no amount of searching has brought up an answer which I can find to fit quite what I need. The problem is I need to create a java applet which tell you how many words of a certain length there are. So if I type "Hi There" it will say: 1 word of length 2 1 word of length 5 I am using g.DrawString to output the result of the entered text. If I enter more than one word