Note that there are some explanatory texts on larger screens.

plurals
  1. POmultiple Inheritance .. class need to extend abstractHandler as well as Applet
    primarykey
    data
    text
    <p>I am trying to make an automation wizard that would take some files from system (via a command handler) and make its relevant applet.</p> <p>I shall try to explain my senario.</p> <p>I made a plugin for new command "newModule" which is handled via "newModuleHandler.java". so <strong>newModuleHandler extends AbstractHandler</strong>.</p> <p>Now i would like to make a wizard (applet) that helps me with certain selections that i need to make in order to complete that "newModule" command. so <strong>newModuleHandler extends Applet</strong> too.</p> <p>i wrote newModuleHandler something like this. </p> <pre><code> package archetypedcomponent.commands; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import java.applet.*;// required when you create an applet import java.awt.Graphics; public class newModuleHandler extends AbstractHandler { @Override public boolean isEnabled() { // TODO Auto-generated method stub return true; } @Override public boolean isHandled() { // TODO Auto-generated method stub return true; } @Override public Object execute(ExecutionEvent event) throws ExecutionException { // TODO Auto-generated method stub return null; } public class HelloWorld extends Applet { // The method that will be automatically called when the applet is started public void init() { // It is required but does not need anything. System.out.println("Applet initiated"); } // This method gets called when the applet is terminated // That's when the user goes to another page or exits the browser. public void stop() { // no actions needed here now. System.out.println("Applet Stopped"); } // The standard method that you have to use to paint things on screen // This overrides the empty Applet method, you can't called it "display" for example. public void paint(Graphics g) { //method to draw text on screen // String first, then x and y coordinate. System.out.println("Applet in paint"); g.drawString("Hey hey hey",20,20); g.drawString("Hellooow World",20,40); } } </code></pre> <p>}</p> <p>Now when the command will b given this method will be called</p> <pre><code>@Override public Object execute(ExecutionEvent event) throws ExecutionException { // TODO Auto-generated method stub return null; } </code></pre> <p>and applet will have to be called inside it. <strong>my question is how to call it?</strong></p> <p>======================================================================================== i was able to solve my problem but m replying here so that somebody who is also facing same problem can b guided</p> <p>this is my new <strong>"newModuleHandler.java"</strong> </p> <pre><code> package archetypedcomponent.commands; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import java.applet.*;// required when you create an applet import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JFrame; public class newModuleHandler extends AbstractHandler { @Override public boolean isEnabled() { // TODO Auto-generated method stub return true; } @Override public boolean isHandled() { // TODO Auto-generated method stub return true; } @Override public Object execute(ExecutionEvent event) throws ExecutionException { // TODO Auto-generated method stub // call applet here JFrame jp1 = new JFrame(); Loader a=new Loader (); jp1.getContentPane().add(a, BorderLayout.CENTER); jp1.setSize(new Dimension(500,500)); jp1.setVisible(true); return null; } </code></pre> <p>}</p> <p>i made a new <strong>Loader.java</strong> which extends applet</p> <pre><code> package archetypedcomponent.commands; import java.applet.Applet; import java.awt.Graphics; public class Loader extends Applet { // The method that will be automatically called when the applet is started public void init() { // It is required but does not need anything. System.out.println("Applet initiated"); // Graphics g=new ; } // This method gets called when the applet is terminated // That's when the user goes to another page or exits the browser. public void stop() { // no actions needed here now. System.out.println("Applet Stopped"); } // The standard method that you have to use to paint things on screen // This overrides the empty Applet method, you can't called it "display" for example. public void paint(Graphics g) { //method to draw text on screen // String first, then x and y coordinate. System.out.println("Applet in paint"); g.drawString("Hey hey hey",20,20); g.drawString("Hellooow World",20,40); } </code></pre> <p>}</p> <p>Now whatever i need applet to do can b done in paint of Loader.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload