Applet

Applet

View Answers

June 18, 2009 at 12:34 PM

Hi Friend,

Try the following code:

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class MenuApplet extends JApplet {
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("Menu");
JMenuItem item1 = new JMenuItem("Shortcut Keys");
JMenuItem item2 = new JMenuItem("Versions");
public void init(){
setJMenuBar(menuBar);
getContentPane().setLayout(null);
setSize(400,200);
menuBar.add(menu);
menu.add(item1);
menu.add(item2);
item1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String text="<html>Home=Move to start of the current line<br>Ctrl+C=Copy the Statement<br>Ctrl+V=Paste the Statement<br>Page Up=Scroll up one screen<br>Page Dn=Scroll Down one screen<br>End=Move to end of the current line<br>End=Move to end of the current line<br>Ctrl+X=Cut to you selected line</html>";
JFrame aa=new JFrame("Frame1");
aa.setVisible(true);
aa.setSize(300,200);
aa.add(new JLabel(text));
}

});
item2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String text="<html>Java Version 1.5.0_16<br>Dos Editor ver 1.0</html>";
JFrame aa=new JFrame("Frame2");
aa.setSize(300,100);
aa.setVisible(true);
aa.add(new JLabel(text));
}
});
}
}
Thanks









Related Tutorials/Questions & Answers:
Applet
Applet  Write an applet to display a string in an applet. String should be passed as a parameter to an applet
applet
applet  What is the immediate superclass of the Applet class
Advertisements
Applet
Applet  how to run an applet on a web browser
applet
applet  Explain different stages in the lifecycle of an applet with figure.   Stages of Applet: Life cycle of an Applet: init(): This method is called to initialized an applet start(): This method is called after
Applet
Applet  Give the class hierarchy of an Applet class
Applet
Applet  Write a ava applet that sets blue color foreground and yellow color background at the start of an applet
Applet
Applet  Explain the start() and stop() methods of applet life cycle.   Start and Start method of Applet Life Cycle Start () method: The start method of an applet is called after the initialization method init
Applet
Applet  Write a short note on applet life cycle
Applet
Applet  I have a java applet that has a button. On clicking the button it should disappear and another applet should appear. How to write this code???? Also in login applet after successful login it should display admin applet
Applet
Applet  Draw the class hierarchy of an Applet class. Also explain how to set background and forground colors in java
applet
applet  what is applet in java   An applet is a small program that can be sent along with a Web page to a user. Java applets can perform... the following link: Applet Tutorials
Applet
Applet  Write a Java applet that drwas a line between 2 points. The co-ordinates of 2 points should be passed as parametrs from html file. The color of the line should be red
applet
applet  applet to open new tab not working.here's my code import java.applet.*; import java.awt.*; import java.net.*; import java.awt.event.*; public class NewURL extends Applet implements ActionListener{ public void init
applet - Applet
.  Hi Friend, Try the following code: 1)Create an applet... extends Applet{ public void paint(Graphics g){ g.drawString("Welcome in Java Applet.",40,20); } } 2) Call this applet with html code
Applet - Applet
Applet  what is the concept of applet? what is different between the applet concept and HTML? what is mean by swing?  Hi friend, Applet Applet is java program that can be embedded into HTML pages. Java applets
applet - Applet
*; import java.awt.*; public class CreateTextBox extends Applet implements.../applet/ Thanks
Applet - Applet
Applet   Namaste, I want to create a Menu, the menu name is "Display... java.awt.event.*; public class menu2frame extends Applet implements WindowListener...------------------------"); g.drawString("Demo of Java Applet Window Event Program"); g.drawString("Java
applet problem - Applet
applet problem  How can I create a file in client side by a java applet . Surely it will need a signed applet .But how can a signed applet create a file in the client side
Applet codebase
Applet codebase  What is codebase in applet
embedding class in an applet - Applet
embedding class in an applet  I have an applet that has a set... java.awt.event.*; public class tesURL extends Applet implements ActionListener... a remote controller). I have the applet code for the remote controller
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
java - Applet
java  what is applet
creating hyperlinks in applet - Applet
creating hyperlinks in applet  Dear sir, how can i move from one applet to another applet and how can i use previous applet input data in anotherapplet(just like session tracking) thanks
applet program code - Applet
applet program code  hello sir, i did't get the code for below problem... please help me... 1.An applet program to draw a line graph for y=2x+5.[for suitable values of x & y
Applet JSP communication - Applet
Applet JSP communication  Hi.. I've an application where i need to get the data from the applet to JSP... How can i do this..?? can anyone explain with a sample code
applet running but no display - Applet
applet running but no display  Hai, Thanks for the post. I have... from a client, the page appears with a blank applet part (just whitescreen..., it is showing that the "Applet as1 started". Please help me to solve this issue
applet Question
applet Question  Write a java applet to display a circle in a rectangle
applet question
applet question  Write a java applet to display a rectangle inside a circle
applet question
applet question  Write a java applet to display atriangle inside a circle
What is Applet? - Applet
What is Applet?  What is Applet?  Hi,Here is a little information about Applet.An applet is a little application. Prior to the World Wide... programming language, an applet is a small program that can be sent along with a Web
loading Java Applet - Applet
loading Java Applet  Hi, I use the archive tag to download my applet into the Browser It takes too long to load. Can I do it in several steps... control the loading within the applet? thanks
java applet - Applet
java applet  wants to creat address bar on my java applet.  Hi Applet don't provide a facility to create a address bar directly. You just create a text box. In this text box if you enter any http address
Applet query - Applet
Applet query  i want to knw d complete detail of why does applet... calls the applet methods at different points depending on the stage it reached... link: http://www.roseindia.net/java/example/java/applet/ Thanks
Applet database access - Applet
Applet database access  HI... I'm having an applet where we should display the database values in the applet... It works fine in the local system... but when its in the server, we r getting null values in the local system.. I
how to run applet - Applet
in applet program. this is executed successfully with appletviewer command >...://www.roseindia.net/java/example/java/applet/ http://www.roseindia.net/java/example/java/applet/FirstApplet.shtml Hope that it will be helpful for you.Even
applet security error - Applet
applet security error  HI, Thanks for your reply. In the sample plugin code, the URL(nspluginurl) you have specified is for netscape navigator. ------------ ----------- Can you please tell me the same for IE url
applet servlet communication - Applet
applet servlet communication  Can anybody tell me applet - servlet... project in eclipse and writing the applet code in ajava file which is present in src... that the applet class is not found, but if I am copying t=all the classes
java applet - Applet
java applet  I want to close applet window which is open by another button of applet program. plz tell me!   Hi Friend, Try... java.awt.event.*; public class CloseWindow extends Applet implements ActionListener
lifecycle of an applet
lifecycle of an applet  What is the lifecycle of an applet
Applet code parameter - Applet
Applet code parameter  Hi... I've designed an applet where i placed the .class file in another subpackage... i.e...if my html file is in the folder named project then the class file is in project/WEB-INF/classes folder
problem with applet plugin - Applet
problem with applet plugin  hello friends, iam using Eclipse IDE. i created one applet and i want to plugin that applet into webpage.. when i am..... Thanks in advance..  Hi Friend, If you want to plugin applet
methods in the applet - Applet
; public class applet1 extends Applet { String m; public void init... applet is simular to the contructor defined in a java application. The purpose... provides the Applet class with default implementation for all the applet methods
drawing shapes in applet - Applet
drawing shapes in applet  hi, i need a single applet prgm which... java.applet.Applet; public class CubeExample extends Applet { Stroke... Applet { public void paint (Graphics g){ Graphics2D ga = (Graphics2D)g
Java Applet
Java Applet   How to add Image in Java Applet? what is getDocumentBase
applet program
applet program  applet to simulates a traffic signal light with short delay between states
applet dought
applet dought  life cycle of an applet is init start and destroy but applets are executed by java enabled browsers like iexpl,so with out an object how these methods of an applet are executed
Applet Error - Applet
Applet Error  Hi... I had an application where i designed an applet to get the database values into the applet when i clicked a line... It works... Applet implements MouseListener{ boolean
java - Applet
java  how to connect database table with scrollbar in java applet
java - Applet
java  how to connect database table with scrollbar in java applet
applet question
applet question  sir please tell me that how can i call an event on clicking on applet window without using any component

Ads