Home Answers Viewqa Swing-AWT AWT code for popUpmenu

 
 


Gopi
AWT code for popUpmenu
2 Answer(s)      4 years and 10 months ago
Posted in : Swing AWT

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 Pages:
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
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
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
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.
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 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 calender
java awt calender  java awt code for calender to include beside a textfield
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
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
Pop-up Menus
Pop-up Menus       A PopupMenu is similar to a Menu as it contains MenuItem objects. The Pop... to use the Swing component set.  In the program code given below, we have used
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
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
JDBC-AWT
JDBC-AWT  I can not able to capture the data in an applet which contains the components like text fields,check box etc.. and i am trying to save the data in sql+. When i run the code in netbeans, i can abe to store successfully
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
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
"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
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
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
JavaThread "AWT-EventQueue-176 - Applet
JavaThread "AWT-EventQueue-176  Hello, I am getting some dump files... --------------- Current thread (0x02cd1ef0): JavaThread "AWT-EventQueue-176" [_thread... code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x10f3] j
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
tooltip problem - Swing AWT
tooltip problem  Hi All, I am using SWT_AWT bridge in my code to embed swing components into SWT Composite. I am using a Swing JButton in SWT... in advance.   Hi friend, Code to help in solving the program
Java Dialogs - Swing AWT
in advance  Hi Friend, Try the following code: b) 1.../springlayout.html http://www.roseindia.net/java/example/java/awt/borderlayout-example
GUI - Swing vs. AWT
Java: GUI - Swing vs. AWT The original graphical user interface (GUI) for Java was called the Abstract Windowing Toolkit (AWT). Performance and extendability problems with AWT were resolved by introducing a new GUI interface, known
What is AWT in java
What is AWT in java      ... available with JDK. AWT stands for Abstract Windowing Toolkit. It contains all classes... toolkits. You can use the AWT package to develop user interface objects like
SWT_AWT bridge ,jtextfield edit problem - Swing AWT
SWT_AWT bridge ,jtextfield edit problem  Hi All, I am using SWT_AWT bridge in my code to embed swing components in to SWT Composite. I am using SWT_AWT bridge frame and adding JTextfield to it, My problem is that the JTextfield
loading image - Swing AWT
loading image  give me a source code to add any wallpaer of my PC as a background image to jpanel on a jframe
LinkButton - Swing AWT
the following code: 1)link.jsp: Sign Up 2)login.jsp: Login... want that link into swings(java) code not in html.... i know the html code but i want java(swings) code in that i forgot to write using swings.... if u
SWT Solaris - Swing AWT
SWT Solaris  Hi, When I am using SWT in my application it works fine with windows platform, But when I run the same code on Solaris platform I am getting problems . Could any one please let me know how to develop the code
java - Swing AWT
java  Hi, I override the mouseClicked interface in my code and get the X and Y coordinates of the event using e.getX() and e.getY(). Is there a way to obtain the text at that location?  Hi Friend, Please clarify
tree - Swing AWT
tree  example of tree java program   Hi Friend, Please visit the following code: http://www.roseindia.net/java/example/java/swing/TreeComponent.shtml http://www.roseindia.net/java/example/java/swing
java - Swing AWT
java  hello sir,u have send me code.But when i should run tat code,it was not displayed proper output,just open frame.so plzzzzzzzzz send me any other code...And that project criteria will like,ORKUT,when user edit her/his
About jcombobox - Swing AWT
suggest jcombobox in swing? If yes is there any jar file for that or any code if you have. Thanks in advance.   Hi Friend, Try the following code...(); int code = e.getKeyCode(); if(code==KeyEvent.VK_ENTER
java - Swing AWT
java  what will be the code for handling button event in swing?  Hi Friend, Try the following code: import java.awt.*; import javax.swing.*; import java.awt.event.*; class ButtonEvent extends JFrame

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.