Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners how to run a applet from browser

Have Programming Question? Ask it here!
 
 
 


kalmudunuru
how to run a applet from browser
0 Answer(s)      3 years ago
Posted in : Java Beginners


hi,

iam sending the code of an applet. it is working in cmd prompt,but not working from browser.

<APPLET CODE="SPlotfinal.class" codebase="/applets" archive="jfreechart-1.0.13.jar , jcommon-1.0.8.jar ,mysql-connector-java-5.0.8-bin.jar">
</APPLET>

iam getting error. plz suggest me the related code to execute from browser.

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Shape;
import java.util.*;
import javax.swing.JPanel;
import org.jfree.chart.*;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYItemRenderer;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;
import org.jfree.util.ShapeUtilities;
import java.sql.*;

public class SPlotfinal extends ApplicationFrame {

    public SPlotfinal(String s) {
        super(s);
        JPanel jpanel = createDemoPanel();
        jpanel.setPreferredSize(new Dimension(640, 480));
        add(jpanel);
    }
     public static JPanel createDemoPanel() {
        JFreeChart jfreechart = ChartFactory.createScatterPlot(
            "Dot Plot ", "X", "Y", samplexydataset2(),
            PlotOrientation.VERTICAL, true, true, false);
        Shape cross = ShapeUtilities.createDiagonalCross(3, 1);
        XYPlot xyPlot = (XYPlot) jfreechart.getPlot();
        xyPlot.setDomainCrosshairVisible(true);
        xyPlot.setRangeCrosshairVisible(true);
        XYItemRenderer renderer = xyPlot.getRenderer();
        renderer.setSeriesShape(0, cross);
        renderer.setSeriesPaint(0, Color.red);
        return new ChartPanel(jfreechart);
    }

    private static XYDataset samplexydataset2() {
        int cols = 20;
        int rows = 20;
        double[][] values = new double[cols][rows];
        XYSeriesCollection xySeriesCollection = new XYSeriesCollection();
        XYSeries series = new XYSeries("GRAPH");
        Random rand = new Random();

    try
{

String connectionURL = "jdbc:mysql://localhost:3306/mysql";
Connection con;
Class.forName("com.mysql.jdbc.Driver");
// Get a Connection to the database
con = DriverManager.getConnection(connectionURL, "root", "root"); 
//Add the data into the database
String sql = "SELECT COUNT(*) FROM GRAPH";
Statement stm = con.createStatement();
stm.executeQuery(sql);
ResultSet rs= stm.getResultSet();

while (rs.next ()){

 int count=rs.getInt(1);
 System.out.println(count);
 String sql1 = "SELECT XAXIS,YAXIS FROM GRAPH";
 Statement stm1 = con.createStatement();
 stm1.executeQuery(sql1);
 ResultSet rs1= stm1.getResultSet();
  while (rs1.next ()){

 for(int k=0; k<=count; k++)
    {

               double x = rs1.getInt(1);
               double y = rs1.getInt(2);
               series.add(x, y);
            }
    }
}

}

catch(Exception e){
    System.out.println(e);
       }





        xySeriesCollection.addSeries(series);
        return xySeriesCollection;
    }

    public static void main(String args[]) {
        SPlotfinal scatterplotdemo4 = new SPlotfinal("GRAPH-KALYANI");
        scatterplotdemo4.pack();
        RefineryUtilities.centerFrameOnScreen(scatterplotdemo4);
        scatterplotdemo4.setVisible(true);
    }


       }

thank in advance,


Advertisement
View Answers

Related Tutorials/Questions & Answers:
how to run a applet from browser
how to run a applet from browser  hi, iam sending the code of an applet. it is working in cmd prompt,but not working from browser. <APPLET CODE... error. plz suggest me the related code to execute from browser. import
how to run applet - Applet
how to run applet   Hi everybody i am using connecting jdbc in applet program. this is executed successfully with appletviewer command >... how can i execute in browser ? Thanks in advance thanks for seeing my
Advertisements
Applet run with appletviewer but not in browser, any code problem.
Applet run with appletviewer but not in browser, any code problem.  ... fine but not run from the browser as http://localhost:8080/ProgressoApplication... the 52 cards will be show in browser as by "appletviewer" and run as "java applet" I
Problem In applet Its run on browser but hang and blinking when image is draging some where.
Problem In applet Its run on browser but hang and blinking when image is draging some where.  I am Created applet in working properly on browser. In my applet 52 card images is draw and drage and move on the applet, but when I am
Java - Applet Hello World
. You will learn how to develop applet code and run in the browser. Applet...: javac HelloWorldApplet.java Running Applet from console: java HelloWorldApplet Running Applet from Web browser: Running applet in browser is very easy job
The Java Applet Viewer
. It is included in the SDK. It helps you to test an applet before you run it in a browser... in a web page and run within a web browser. The applet's code gets transferred... different from a Web browser, though they are logically same. The Applet viewer
The Java Applet Viewer
. It is included in the SDK. It helps you to test an applet before you run it in a browser... in a web page and run within a web browser. The applet's code gets transferred... different from a Web browser, though they are logically same. The Applet viewer runs
The Java Applet Viewer
and can be stored in a web page and run within a web browser. The applet's code... of Applet viewer is a bit different from a Web browser, though they are logically... applet tags. The difference in using the applet viewer and the web browser to run
Java - Opening a URL from an Applet
window from an applet. This program shows that how a url is opened in same... Java - Opening a URL from an Applet  ... used for opening url from an applet. This program is using two functions
How to run PHP Script from the command line ?
How to run PHP Script from the command line ?  Running PHP Script from the command line   Actually it is very simple to run php script... expect. You can also check : http://www.phpzag.com/running-php-script-from
How to call the run method from another class?
How to call the run method from another class?  Sorry, if this is a stupid question. I would like to find out how to call the run method... run() { new FereastraPrincipala().setVisible(true); from the class
Applet
Applet  how to run an applet on a web browser
Java - Opening a url in new window from an applet
Java - Opening a url in new window from an applet       This is the example of opening a url from an applet. This program shows that how a url is opened in a new document or browser
Browser Crashes Suddenly : Application uses applet - Applet
Browser Crashes Suddenly : Application uses applet   Hello All, All of sudden, when the application is running the browser IE6 gets crashed . JRE used is 1.5.0_05. Can anyone please help me out . Its urgent.. Vishal
Applet in Eclipse - Running Applet In Eclipse
and run Applet in Eclipse IDE. In this section, you will learn how to run applet... in a browser. The HTML document tells the browser to load and run an applet using... Run->Run as->Java Applet from the menu bar. The program runs
java applet run time error - Applet
java applet run time error  Hi, Im new to java applet.please help me. i have create a MPEG movie player in applet. when i run that program... javax.media.*; public class PlayerApplet extends Applet implements ControllerListener
to run html code in web browser - JSP-Servlet
to run html code in web browser  how to run jsp file which calls html file on web browser??  Hi Friend, Try the following code: 1)form.jsp: Enter Name: 2)welcome.html: Add Profile Edit
How to run java swing application from jar files .
How to run java swing application from jar files .  Hello Sir... setup file .As per my knowledge i have to run .jar file from dist folder of netbeans but when i am trying to run from there i am getting error "Could not find
how can i run ASP.Net Server from netbeans IDE?
how can i run ASP.Net Server from netbeans IDE?  please help me how can i run ASP.Net Server from netbeans IDE? in other word , I have a web services published with IIS7 and I want to use it from my Application My Application
how i get experience wise resume from database when i submit from browser
how i get experience wise resume from database when i submit from browser  how i get experience wise resume from database when i submit from browser   Please go through the following link: Visit Here
difference from browser to browser - JSP-Servlet
difference from browser to browser  I am developing a project in jsp. When browse in mozilla it works good and when I open it with IE there is a difference how to overcome this problem.Thanks in advance
Security Issues with the Applet
Security Issues with the Applet       Java applet is run inside a web browser. But an applet is restricted in some areas, until it has been deemed
how to retrieve data into combo from database in java applet?
how to retrieve data into combo from database in java applet?  hi,. i have written applet codes for linking two frames and database connectivity...= con.createStatement(); ResultSet rs=st.executeQuery("SELECT rolename from role
Applet in Java
Applet is a Java program designed for execution within the web browser... Firefox and Internet Explorer. These web browsers download Applet from the Internet and run them. An Applet is a Java subclass that extends
how to run rmi program
how to run rmi program  how to run rmi program
How to launch my web application from my desktop without opening Netbeans IDE everytime i run the application?
How to launch my web application from my desktop without opening Netbeans IDE everytime i run the application?  Hi RoseIndia, Thanks for ur reply... to create browser shorcut to my project,how to deploy my project on web server
How to send from netbeans gui registration form to MySQL query browser database?
How to send from netbeans gui registration form to MySQL query browser database?  Well i have a Registration form GUI in my netbeans. in my GUI... Browser database. what code will i do? this is my existing code from my
How to send from netbeans gui registration form to MySQL query browser database?
How to send from netbeans gui registration form to MySQL query browser database?  Well i have a Registration form GUI in my netbeans. in my GUI... Browser database. what code will i do? this is my existing code from my
Opening a URL from an Applet
window from an applet. This program shows that how a url is opened in same... Opening a URL from an Applet     ... used for opening url from an applet. This program is using two functions in which
changes in netbeans/ browser so that each application run opens in a new window of browser
changes in netbeans/ browser so that each application run opens in a new window... time i run an application it opens up in a new window rather than a new tab.. Do i have to make changes in netbeans or browser? and what changes need
passing parameter from html to applet
passing parameter from html to applet  how to pass the following from HTML to applet in Java code - font size,font style,font size?give me suitable code
How to get browser time zone?
How to get browser time zone?  How to get browser Time Zone and browser date using java concept
download a file from browser - Java Beginners
download a file from browser  How to download a file from browser and save it in local path
how to run this program?
how to run this program?  how to run java swing program   Java Swing program runs same as a simple java program. There is no difference... with javac and run with java command, same as a simple java program. Learn Swing
how to run servlet
how to run servlet  Servlet run procedure for J2EE Software   Hi Friend, Please visit the following links: http://www.roseindia.net/servlets/introductiontoconfigrationservlet.shtml http://www.roseindia.net/servlets
how to run servlet - JSP-Servlet
how to run servlet  pls give me comlete procedure to run the servlet on apache-tomcat 6.0.16 how can i set my classpath, java_home etc. also where i have to save my servlet program and how it compile and then run on web browser
how to run - Java Beginners
how to run   how to run java program... brifely  Hi... to execute or run the program. For ex, If you have the following java program... file on the command prompt using: "javac HelloWorld.java". And then run it using
How to compile and run the JSP
How to compile and run the JSP  Hi Kindly tell me how to run and compile JSP small Program using Tomcat as webserver. I created small program HELLO JSP in HTML and compile the program but it is saying Class o r interface
how to disable browser back button
how to disable browser back button  Am doing a web application in that how to disable browser back button using java script
how to run java program that has several classes under package from usb drive?
how to run java program that has several classes under package from usb drive... package. I have to use following line on command line to compile and run my program... and run the code. I tried installing jdk but it was taking very long time so did
how to run java program
how to run java program  i have jar file. in jar i have so many classes.in one of file i want modify .after modifying file i want replce in jar. please help me to how to generate class and how to replace
Could not able to run Java Applet in JSP using <jsp:plugin>
Could not able to run Java Applet in JSP using   I could not able to run the above example applet in the JSP. Getting class not found exception... the following links: http://www.roseindia.net/jsp/applet-jsp.shtml http
browser
browser  how to make a browser
Servlet and Applet - Applet
Invoke and run an Applet from Servlet  How can i invoke and run an applet from servlet. Can anyone provide me the sample code
How to run? - Hibernate
How to run?  Hiiiiiiiiiiiii friend.. i am Magesh, doing MCA at Madurai in Tamilnadu. i know little bit about Jsp,Servlet.. But my friends are told hibernate is a new entry to Java. so plz try to tell how to use
The Java Applet Viewer
be stored in a web page and run within a web browser. The applet's code gets... of Applet viewer is a bit different from a Web browser, though they are logically same... tags. The difference in using the applet viewer and the web browser to run
how to display pdf file on browser
how to display pdf file on browser   In my project i have created one pdf file(by pdfwriter) into my local mechine . after that it need to display in browser as a pdf file . but in jsp i can't display by iframe tag can anyone
Works when run from desktop but....
Works when run from desktop but....  I used the code provided here for a pie chart using swing in Java, and when I saved it to my desktop, it ran fine, and worked as explained, but then I tried to add the same code to NetBeans
how to dispaly pdf file on browser
how to dispaly pdf file on browser  In my project i have created one pdf file(by pdfwriter) into my local mechine . after that it need to display in browser as a pdf file . but in jsp i can't display by tag can anyone give me
Opening a browser only with body from a java program
Opening a browser only with body from a java program  Hi all, I got following requirement, Opening a browser window only with body and title bar... bar and etc. And I don't know how to close this browser window. Please help me
 

 

 

DMCA.com