applet

Java Compile Error: class Appletprac is public, should be declared in a file named Appletprac.java

别说谁变了你拦得住时间么 提交于 2019-12-17 22:28:16
问题 When I am compiling the java program I am getting this error: class Appletprac is public, should be declared in a file named Appletprac.java Here is my java code: import java.applet.*; import java.awt.*; // Graphics Class import javax.swing.*; import java.awt.event.*; /*<applet code="Appletprac.class" width="500" height="500"> </applet>*/ public class Appletprac extends JApplet implements ActionListener { JButton OK; JRadioButton Font_Style1,Font_Style2,Font_Style3; ButtonGroup bg; JCheckBox

Java BasicStroke “Fuzzy”

被刻印的时光 ゝ 提交于 2019-12-17 22:01:35
问题 I'm trying to write a simple paint applet with Java, but I'm having trouble with BasicStroke . Initially, my plan was to try to somehow draw a line with a width, but the API apparently doesn't support that. I tried using BasicStroke , but the result is just a fuzzy mess. How can I fix this fuzz problem? private void mousedrag_hook(Point point) { if(start == null) start = point; end = point; Graphics2D g2d = (Graphics2D)applInstance.buffer_g; g2d.setStroke(new BasicStroke(7)); //g2d.fillOval

Applet: Java heap space

試著忘記壹切 提交于 2019-12-17 21:30:05
问题 Due to a small implementation mistake I discovered how quickly I could reach a Java heap space issue now the bug is fixed everything is fine but it did get me looking into how to solve this and I foudn multiple solution such as java -Xms5m -Xmx15m MyApp the problem is that this changes the java memory on my computer, but I'm working on a Applet that is going to be used in a webrowser. Therefore, is there a way, at RUNTIME in an APPLET to change the heap size ? 回答1: You can add parameters to

java.awt.HeadlessException - Applet not displayed

元气小坏坏 提交于 2019-12-17 21:10:09
问题 I am using Tomcat 5.5.23, JDK 1.5 on HP Unix. We have an application which when invoked form tomcat starts an applet. It was working fine till JDK 1.4. But now we have moved to JDK 1.5 and the applet does not start. The exception thrown is - java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. I then added JAVA_OPTS="-Djava.awt.headless=true" to catalina.sh file. But still I get the same Headless exception, but this time

signed applet gives AccessControlException: access denied, when calling from javascript

自作多情 提交于 2019-12-17 20:26:02
问题 I have an easy self-signed an applet (done with keytool and the jarsigner): public class NetAppletLauncher extends JApplet { private static final long serialVersionUID = 1L; public void init() { exec("notepad c:/hello.txt"); } public void exec(String command) { try { // launch EXE and grab stdin/stdout and stderr Process process = Runtime.getRuntime().exec(command); // OutputStream stdin = process.getOutputStream(); InputStream stderr = process.getErrorStream(); InputStream stdout = process

Running a java applet from netbeans?

爱⌒轻易说出口 提交于 2019-12-17 20:19:35
问题 I am trying to run a Java applet from NetBeans, and in trying to run it, I get a 'main class not found' error. I can avoid this by doing SHIFT+F6, but that'll only work if I am currently writing in the main class. I will be working on a somewhat large project, and it's going to have multiple files, and eventually it will be quite cumbersome to always navigate back to the main class to the 'main' file and run it from there. Is there any sort of configurations I can edit to tell NetBeans that I

Restrictions on what an unsigned Java applet can do?

怎甘沉沦 提交于 2019-12-17 18:58:54
问题 I'm trying to compile a complete list of all restrictions placed on unsigned Java applets (defined as things a normal Java application can do, but an unsigned Java applet cannot). This is the list I've compiled so far: An unsigned Java applet ... Cannot access the local filesystem. Cannot access the system clipboard. Cannot initiate a print job. Cannot connect to or retrieve resources from any third party server (any server other than the server the applet originated from). Cannot use

Does this applet work in an Iced Tea JRE?

匆匆过客 提交于 2019-12-17 17:10:38
问题 I mentioned a small demo. in Setting up policies for an Applet embedded in HTML & an Iced Tea JRE user commented that the demo. failed for them. They refused permission to the applet (thereby limiting it to the sand-box) & were supposed to see the green colored 'this applet is sand-boxed' page. Instead the applet completely failed and they saw a 'gray space' where the applet should have been. I am WAGing that it was attempting to instantiate a File object that is the difference. I.E. The Sun

Will my Java Applets run on Chrome 45?

本小妞迷上赌 提交于 2019-12-17 16:57:07
问题 The web application we develop uses three Java Applets. We know that Chrome 45 will drop NPAPI support. In this page, Oracle says that Java Plugin relies on NPAPI. https://java.com/en/download/faq/chrome.xml The fact is that I've tried to execute my Applets with chrome 43 and 44, which disable NPAPI by default but not the Java Plugin and they execute correctly, although some extra warning messages appear on the top of the window saying that the Java Plugin will be disabled soon. Question 1 :

How to make a dynamic frequency histogram from user input

帅比萌擦擦* 提交于 2019-12-17 16:54:36
问题 Object fileButton = null; if("Analyze Text File".equals(command)) { JFileChooser filechooser; JFileChooser chooser = new JFileChooser(); int returnVal = filechooser.showOpenDialog(getParent()); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = filechooser.getSelectedFile(); String Stext = (String) readFileAsString(file); //String text = textInput.getText(); Map<Integer, Integer> counts = getCounts(text); int width = counts.size() * BAR_WIDTH; int max = maxCount(counts); int height =