AWT code for popUpmenu

AWT code for popUpmenu

View Answers

July 23, 2008 at 4:54 PM

import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.FileDialog;
import java.awt.Frame;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class Demo
{
public static void main(String[] args)
{
final Frame frame = new Frame("Demo");
final TextField textField = new TextField();
textField.setEditable(false);
Button button = new Button("Open");
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
FileDialog fileDialog = new FileDialog(frame," Open",FileDialog.LOAD);
fileDialog.setVisible(true);
String directory = fileDialog.getDirectory();
if(directory != null)
textField.setText(directory + fileDialog.getFile());
}
});
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent windowEvent)
{
frame.dispose();
}
});
frame.setLayout(new BorderLayout());
frame.add(BorderLayout.CENTER,textField);
frame.add(BorderLayout.SOUTH,button);
frame.setSize(200,100);
frame.setResizable(false);
frame.setVisible(true);
button.requestFocusInWindow();
}
}

-Ramesh A.V

July 23, 2008 at 6:59 PM









Related Tutorials/Questions & Answers:
AWT code for popUpmenu - Swing AWT
AWT code for popUpmenu  Respected Sir/Madam, I am writing a program... the code. ThanQ.   import java.awt.BorderLayout; import... for more information. http://www.roseindia.net/java/example/java/awt/pop
provide code - Swing AWT
provide code  Dear frnds please provide code for two player CHESS GAME.....using swings,awt concepts   Hi friend, import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; public
Advertisements
source code - Swing AWT
source code  source code for a program to shutdown, restart, log off the pc after clicking jbutton on jpanel or a jframe by user. thanks in advance
java code - Swing AWT
to open the lock  Hi Friend, Try the following code: class
java code - Swing AWT
java code  Hello .anyone can plz tell me code for this .First create a button wen it is clicked its enters into another window asking for Name .After...   Hi Friend, Try the following code: import java.io.*; import
java code - Swing AWT
java code  i want to open a new dialog box after clicking "upload" button, it should have a text field, browse button to browse the file from directory  Hi Friend, Try the following code: 1)OpenDialog.java import
Java Code - Swing AWT
Java Code  How to Display a Save Dialog Box using JFileChooser and Save the loaded Image from Panel in any Location.  Hi Friend, Try the following code: import java.io.*; import java.awt.*; import java.util.
Need source code - Swing AWT
Need source code  Hai, I need a source code for developing the project, title is "Face Recognition" and the backend as My-sql.... Thanks & Regards
game programming code - Swing AWT
game programming code  write a snake program using swings with step by step explanation?. please send me this source code to my mail id with step by step explanation
Need source code - Swing AWT
Need source code  Hai, I need a idea and code for developing the project "Face Recognition" with the backend as My-sql.... Thanks & Regards
Need source code - Swing AWT
Need source code  Hai friends, How can I, view all the datas from the mysql database table in the jframe........  Hi Friend, Try the following code: import java.awt.*; import java.sql.*; import
Need source code - Swing AWT
Need source code  Hai, In java swing, How can upload and retrieve the images from the mysql database?   Hi Friend, To upload and insert image in database, try the following code: import java.sql.*; import
"Urgent" convert this code to GUI - Swing AWT
"Urgent" convert this code to GUI   please convert for me this code to GUI THE CODES ARE BELOW, CLASS ATMCaseStudy is the driver class that runs all the other classes. its very urgent. //CLASS CashDispenser public class
please convert for me this code to GUI - Swing AWT
please convert for me this code to GUI  THE CODES ARE BELOW, CLASS ATMCaseStudy is the driver class that runs all the other classes. its very urgent. // class ATM import javax.swing.*; import java.awt.*; public class ATM
please convert for me this code to GUI - Swing AWT
please convert for me this code to GUI    THE CODES ARE BELOW, CLASS ATMCaseStudy is the driver class that runs all the other classes. its very urgent. // class ATM import javax.swing.*; import java.awt.*; public
AWT
AWT  How to set size of button in awt
awt
Java AWT Applet example  how to display data using JDBC in awt/applet
awt
JDBC and AWT to display data  how to display data using JDBC in awt/applet
awt
JDBC in awt applet  how to display data using JDBC in awt/applet
awt
JDBC in awt  how to display data using JDBC in awt/applet
how to include a session class in java awt code - JavaMail
how to include a session class in java awt code  Hi... i have been developing a mini online shopping tool using java awt and websphere MQ as middleware technology.. Iam facing problem in handling MQ calls ...so i need
Java Code - Swing AWT
code - Swing AWT
Java Code - Swing AWT
code to display images using 2d array - Swing AWT
code to display images using 2d array  HI !! I have an image file... to display this using java code. I am relatively new to coding such requirements. Can anyone please tell me how to go about it ? Explanation of the code
tetris game code - Swing AWT
java awt calender
java awt calender  java awt code for calender to include beside a textfield
AWT & SWING
AWT & SWING  What is diffennce between AWT & SWING
AWT programmes - Swing AWT
AWT programmes  I need few programs for menus in AWT. how to open a filed dialog window, and how to save a image in the save window when we press... has all AWT programms which must open,save and make changes to a particular
awt - Swing AWT
awt  dear sir my proble is , i have applet code which is stock market chart this code made using "AWT" . in this chart one textbox when user.../java/awt/ Thanks
awt in java
awt in java  using awt in java gui programming how to false the maximization property of a frame
Java AWT
Java AWT  What interface is extended by AWT event listeners
awt jdbc
awt jdbc  programm in java to accept the details of doctor (dno,dname,salary)user & insert it into the database(use prerparedstatement class&awt
awt swings - Swing AWT
awt swings  hello sir, My requirement is to insert captured image...).its urgent sir.it is a part of my project..if code is available......  Hi friend, This code will be captured your image. Please
Java AWT Package Example
Java AWT Package Example       In this section you will learn about the AWT package of the Java. Many running examples are provided that will help you master AWT package. Example
Java AWT
Java AWT  What is meant by controls and what are different types of controls in AWT
AWT Tutorials
AWT Tutorials  How can i create multiple labels using AWT????   Java Applet Example multiple labels 1)AppletExample.java: import...;BODY> <APPLET ALIGN="CENTER" CODE="AppletExample.class" width = "260" height
AWT Image
AWT Image  I have loaded two images using toolkit in java.one is concentric rectangle and other is concentric circle.kindly someone send me the source code of interchanging the inner most rectangle with the inner most circle
AWT-swings tutorial - Swing AWT
AWT-swings tutorial  hello sir, i am learnings swings and applets.. i want some tutorials and some examples related to swings.. thank you sir..waiting for your answer.  Hi friend, I am sending you a link
java awt package tutorial
Java AWT Package In Java, Abstract Window Toolkit(AWT) is a platform... programming language, the AWT is also platform-independent. A common set.... The implementation of the user interface elements provided by the AWT is done using
JAVA AWT BASE PROJECT
JAVA AWT BASE PROJECT  suggest meaningful java AWT-base project
put image on form creating in swing-swing code - Swing AWT
awt list item* - Swing AWT
awt list item*  how do i make an item inside my listitem not visible  Hi friend, import java.awt.*; import java.awt.event.... information. http://www.roseindia.net/java/example/java/awt/ Thanks
Swing and AWT Problem - Swing AWT
Swing and AWT Problem  hi sir i have a problem i know from one Jframe we can send values to another Jframe. so in my project i have one fame containing three textfields CODE: String a=TNa.getText().toString(); String b
AWT
Java AWT event hierarchy
Java AWT event hierarchy  What class is the top of the AWT event hierarchy?  The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy
java - Swing AWT
What is Java Swing AWT  What is Java Swing AWT
Basic Diffence between Swing-AWT - Swing AWT
Basic Diffence between Swing-AWT  What is Basic Diffence between Swing-AWT
awt - Java Interview Questions
awt  what is the difference between awt and swings  Hi friend, These are basically the main differences between awt and swing. 1.swing components sits on the top of AWT components and do the wiork. 2.AWT
AWT Components
AWT Components       The class component is extended by all the AWT components. More of the codes can be put to this class to design lot of AWT components. Most of the AWT

Ads