Creating a new window from and action event

Hey I have a problem i would like most of my menu items to create a new window containing a set text and i was thinking of creating a new container with a JTextArea but for some reason its not working. if someone could help me that be great... so my question is how do create another window (TextArea) with my tokenized array info in it open up when Print File or Print Total is the event??
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
import java.util.StringTokenizer;
import javax.swing.plaf.*;
class PhoneProject extends JFrame implements ActionListener
     private static final int WIDTH = 260;
     private static final int HEIGHT = 160;
     private static final int X_ORIGIN = 402;
     private static final int Y_ORIGIN = 299;
     ArrayList internalCalls = new ArrayList();
     ArrayList externalCalls = new ArrayList();
     PhoneCall internal;
     PhoneCall external;
     JMenu query = new JMenu("Query");
     JMenu proccess = new JMenu("Proccess");
     String inRecord;
     int numExtension;
     int numCallType;
     int numSeconds;
     int totalIntTime;
     int totalExtTime;
public static void main(String args[])
          PhoneProject frame = new PhoneProject();
          frame.setVisible(true);
public  void LoadArray(File myFile) throws IOException
          FileReader fr = new FileReader(myFile);
          BufferedReader br = new BufferedReader(fr);
          while ((inRecord = br.readLine()) != null)
               StringTokenizer tokenizer = new StringTokenizer(inRecord);
               String extension = tokenizer.nextToken();
               String callType = tokenizer.nextToken();
               String seconds = tokenizer.nextToken();
               numExtension = Integer.parseInt(extension);
               numCallType = Integer.parseInt(callType);
               numSeconds = Integer.parseInt(seconds);
               if (numCallType == 0)
                    internal= new PhoneCall(numExtension, numCallType, numSeconds);
                    totalIntTime = (totalIntTime + numSeconds);
                    //System.out.println(totalIntTime + "int");
                    internalCalls.add(internal);
               if (numCallType == 1)
                    external = new PhoneCall(numExtension, numCallType, numSeconds);
                    totalExtTime = (totalExtTime + numSeconds);
                    //System.out.println(totalExtTime + "EXT");
                    externalCalls.add(external);
               System.out.println(internal.getSeconds());     
     public PhoneProject()
          Container contentPane;
          setBounds(X_ORIGIN, Y_ORIGIN, WIDTH, HEIGHT);
          setTitle("Phone Analyzer");
          setResizable(true);
          contentPane = getContentPane();
        contentPane.setLayout(new BorderLayout());
          JMenu file = new JMenu("File");
          JMenuItem  item;
          item = new JMenuItem("Open");
          item.addActionListener(this);
          file.add(item);
          item = new JMenuItem("Exit");
          item.addActionListener(this);
          file.add(item);
          proccess.setEnabled(false);
          item = new JMenuItem("Print File");
          item.addActionListener(this);
          proccess.add(item);
          item = new JMenuItem("Print Totals");
          item.addActionListener(this);
          proccess.add(item);
          item = new JMenu("Low and High");
          item.addActionListener(this);
          proccess.add(item);
          JMenuItem subItem = new JMenuItem("Compare");
          subItem.addActionListener(this);
          item.add(subItem);
          query.setEnabled(false);
          item = new JMenu("Average Total Utilization");
          item.addActionListener(this);
          query.add(item);
          JMenuItem itemInt = new JMenuItem("Internal");
          itemInt.addActionListener(this);
          item.add(itemInt);
          JMenuItem itemExt = new JMenuItem("External");
          itemExt.addActionListener(this);
          item.add(itemExt);
          item = new JMenuItem("Highest Internal Utilization");
          item.addActionListener(this);
          query.add(item);
          item = new JMenuItem("Highest Total Utilization");
          item.addActionListener(this);
          query.add(item);
          JMenuBar menuBar = new JMenuBar();
        setJMenuBar(menuBar);
        menuBar.add(file);
        menuBar.add(proccess);
        menuBar.add(query);
          contentPane.add(new JTextArea("Phone Report"));
  public void actionPerformed(ActionEvent event)
       String menuName;
       menuName = event.getActionCommand();
       if (menuName == "Open")
            JFileChooser chooser = new JFileChooser();
            int returnVal = chooser.showOpenDialog(this);
            if (returnVal == JFileChooser.APPROVE_OPTION)
                 try
                    File myFile = chooser.getSelectedFile();
                    this.LoadArray(myFile);
                    proccess.setEnabled(true);
                    query.setEnabled(true);
                 catch (Exception e)
     if (menuName == "Print File")
JTextArea display = new JTextArea();
          display.setText("Hello");testing to see if it works
          display.setVisible(true);
     if (menuName == "Print Total")
                                           JTextArea display = new JTextArea();
          display.setText("Hello");//testing
          display.setVisible(true);
       if (menuName == "Exit")
            System.exit(0);
}Phone.txt
2000 0 300
2000 0 538
2000 1 305
2000 1 729
2005 0 205
2005 0 305
2005 1 592
2005 1 594
2010 0 364
2010 0 464
2010 1 904
2010 1 100
2020 0 234
2020 0 839
2020 1 999
2020 1 210
Assignment: Array Based GUI Assignment
Telephone call data has been collected from a company's telephone switch. You have been asked to analyze it and produce various statistics.
Input File
The input file is a sequential file. It is in no specific order. The file contains an extension number, type of call, and the length of call in seconds. A record is produced each time a call is made from that extension. You should create your own test file.
Field     Type     Description
Extension     Integer     Extension number. This is a 4 digit number. Valid Extensions are 2000 to 2020.
Type     Integer     Value of 1 means internal, any other value is an external call.
Time     Long     Length of call in seconds
Example:
�     2000,1,60 : ----->>>> Extension 2000 had an internal call that lasted 60 seconds
�     2000,1,356: ----->>>> Extension 2000 had an internal call that lasted 356 seconds
�     2019,2,65: ------>>>> Extension 2019 had an external call that lasted 65 seconds
�     2001,1,355: ----->>>> Extension 2001 had an internal call that lasted 355 seconds
Process
1.     Use 2 arrays to accumulate the time of calls for each extension, both internal and external.
2.     The reports and queries are to be produced from the arrays.
Hints:
�     Create 2 arrays: one for internal calls and one for external calls.
�     Load the arrays in Form Load: do not do any calculations here.
�     The report and queries can totally be produced from the arrays.
Output: Report
Telephone Useage Report
Extension Internal External
2000 4500 3500
2001 19350 22981
2002 2333 900
2003 3144 122
Totals 99999 99999
Output: Queries
On the form add add query capability.
1.     Average Total Utilization: Internal Calls: 9999 (total length of all internal calls / number extensions)
2.     Average Total Utilization: External Calls: 9999
3.     Extension with the highest internal call utilization: Ext xxxx; 9999 seconds.
4.     Extension with the highest total utilization.
Form Design
The design of the form is up to you. However, use the following guidelines:
�     use menus (preferred) or command buttons
�     use a common dialog box to ask for the file name
�     use a list box or text box to display the output
the caption on the form should include your name

hi
u can try like following code
if (menuName == "Print File")
          new mytextframe();
class mytextframe extends JFrame{
     JTextArea display = new JTextArea();
     public mytextframe()
          setSize(300,300);
          setVisible(true);
          add(display);
          display.setText( "ello");
}

Similar Messages

  • When i create a new window, firefox Yanks me back to where i was and i dont want to be yanked back.

    i duplicate current pages by create new windows on a very frequent basis;
    to do this, i go to the top of the page that i want to duplicate and right-click and click on Open Link in New Window;
    I specifically want to duplicate the page i am on in another Window, not a new tab;
    Because
    Duplicating the current page to Open Link in New Tab, gives tabs on the top of my screen;
    Duplicating the current page to Open Link in New Window, gives 'tabs' on the bottom of my screen;
    I want 'tabs' to show on the bottom of my screen and to do that i have to Open Link in New Window;
    My question and What is happening, is that firefox is yanking me back to the page that i have just duplicated by right-clicking at the top of the page and clicking on Open Link in New Window;
    When i create the new Window, firefox yanks me back to the page that i just duplicated and i dont want to be yanked back to that page;
    I want to stay on the page that i just duplicated.
    I have tried changing the way tabs work in Options but nothing checked or unchecked results in the specific way i want to have new Windows open and STAY on that newly created Window and not be YANKED back to the window i duplicated.

    The original window did not have a Flash object, but does the window that hides itself contain a Flash object? That is the usual pattern for this bug in the plugin's protected mode feature.
    If you have not already tried disabling it, the following pages/posts provide different ways to do that:
    * Adobe support article under the heading "Last Resort": [http://forums.adobe.com/message/4468493#TemporaryWorkaround Adobe Forums: How do I troubleshoot Flash Player's protected mode for Firefox?]
    * Manual steps: https://support.mozilla.org/questions/968190?page=5#answer-509209
    * Batch file to automate the manual steps: https://support.mozilla.org/questions/982093#answer-518078
    Flash needs to completely unload from memory (restarting Firefox might help) before this would take effect.
    More history: [https://support.mozilla.org/questions/955659 Opening New Windows and Shockwave Flash]

  • HT1449 After moving music and movies from my MacBook Air to an external hard drive, do I create a new iTunes music and media folder on my computer then add more music and movies, then will I be able to move the computer music/media to the hard drive musci

    I need to move the music and movies from my MacBook Air (original) to an external hard drive, after I do this, do I create a new music folder and media folder on my computer to load music/movies in via the dedicatd external drive and then would I be able to move the newly imported to the external drive which would be my main site of storage?

    No, do it all in one go and henceforth only use the library located on the external drive.
    iTunes: How to move [or copy] your music to a new computer [or another drive] - http://support.apple.com/kb/HT4527
    Quick answer if you let iTunes manage your music:  Copy the entire iTunes folder (and in doing so all its subfolders and files) intact to the other drive.  Start iTunes with the option (shift on Windows) key held down and guide it to the new location of the library.

  • Custom SSIS Source: How do I make it create a new connection manager and display its properties window?

    I am writing a custom SSIS source that uses a standard SSIS Flat File Connection Manager. I have got a working UI that shows all usable connection managers in a dropdown list and allows the user to pick one. I would like to be able to have a button that
    the user can click on to create a new connection manager, and it would open the properties window for the new connection manager so it can be set up.
    Abridged code:
    Public Class MyNewSourceUI
    Implements IDtsComponentUI
    Private MetaData As IDTSComponentMetaData100
    Public Function Edit(ByVal parentWindow As IWin32Window, _
    ByVal variables As Variables, _
    ByVal connections As Connections) As Boolean _
    Implements Microsoft.SqlServer.Dts.Pipeline.Design.IDtsComponentUI.Edit
    Dim UIwin As New MyNewSourcePropertiesWindow(MetaData, connections)
    Return (UIwin.ShowDialog() = DialogResult.OK)
    End Function
    Public Sub Initialize(ByVal dtsComponentMetadata As IDTSComponentMetaData100, _
    ByVal serviceProvider As System.IServiceProvider) _
    Implements Microsoft.SqlServer.Dts.Pipeline.Design.IDtsComponentUI.Initialize
    MetaData = dtsComponentMetadata
    End Sub
    End Class
    Public Class MyNewSourcePropertiesWindow
    Inherits System.Windows.Forms.Form
    Private _metadata As IDTSComponentMetaData100
    Private _cnxions As Connections
    Public Sub New(ByVal ComponentMetaData As IDTSComponentMetaData100, ByVal connections As Connections)
    InitializeComponent()
    _metadata = ComponentMetaData
    _cnxions = connections
    ShowConnections()
    'Setup Existing Metadata '
    End Sub
    Private Sub ShowConnections()
    Me.cboConnection.Items.Clear()
    Me.cboConnection.Items.AddRange((
    From i As ConnectionManager In _cnxions _
    Where CType(i.Properties("CreationName").GetValue(i), String) = "FLATFILE" _
    AndAlso CType(i.Properties("Format").GetValue(i), String) = "Delimited" _
    Select i.Name).ToArray())
    End Sub
    Private Sub btnNewConnection_Click(ByVal sender as Object, ByVal e as System.EventArgs) Handles btnNewConnection.Click
    Dim newconn As ConnectionManager = _cnxions.Add("FLATFILE")
    ShowConnections()
    Me.cboConnection.SelectedItem = newconn.Name
    End Sub
    Private Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
    Me.DialogResult = DialogResult.Cancel
    Me.Close()
    End Sub
    Private Sub btnOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOK.Click
    'Store any metadata changes '
    Me.DialogResult = DialogResult.OK
    Me.Close()
    End Sub
    End Class
    That's what I've got so far. I had assumed that adding a new connection would automatically display the properties window to the user (right?). However, in my tests, what actually happens is that it creates the new source with a random GUID for a name and no
    other properties set up, and puts it in the connections pane, and that's it. Not real useful.
    Obviously, something else is required to make the properties window appear, but I can't find what it is. There's no ShowUI() member on any of the classes I have, and I haven't been able to find out the name of the UI class that's used by the flat file source.
    Does anyone know how this is done? I know it can be done, because such a button exists in the normal Flat File Source UI.

    Yes, you need to drive the UI creation. I see you create a custom connection manager, in this case on how to build its UI please refer to http://kzhendev.wordpress.com/2013/08/07/part-2-adding-a-custom-ui-to-the-connection-manager/
    Arthur My Blog

  • I upgraded to OS Yosemite on my MacBook Air...and I cannot upgrade the Adobe Flash download that Adobe keeps asking me to download. I get the screen and when I click on the icon it just creates a new window but not download. Thoughts?

    I upgraded to OS Yosemite on my MacBook Air...and I cannot upgrade the Adobe Flash download that Adobe keeps asking me to download. I get the screen and when I click on the icon it just creates a new window but not download. Thoughts?

    I just tried the link and it is just fine. If the GateKeeper pops up then open Security & Privacy preferences, click on the General tab, set the last radio button to Anywhere.

  • I created an new apple id and want to change my billing information from the old id to the new id. How do i do that, as i have been trying it like always and it keeps saying that i have to contact apple support? I have an iphone 5S.

    I created an new apple id and want to change my billing information from the old id to the new id. How do i do that, as i have been trying it like always and it keeps saying that i have to contact apple support? I have an iphone 5S.

    Good day BenithaK,
    Once you have changed your Apple ID, you need to set it up for use in the various systems such as iTunes, the App Store, etc so it can be used as intended. This article shows how to do that -
    Apple ID: What to do after you change your Apple ID - Apple Support
    To change your iTunes billing information for either Apple ID account, follow the directions in this article -
    iTunes 12 for Mac: Manage your iTunes Store account
    Thanks for using Apple Support Communities.
    Safe computing,
    Brett L 

  • My husband bought a new ipad and he created a new apple id and new password etc, now he wants to have all his pictures from his old Ipad that it was created on a different ID or Icloud id. How can i get the pictures?

    My husband bought a new Ipad Mini and he created a new Apple ID and new password for him, but his old Ipad was under my Apple ID and Icloud too. Now he wants to get his pictures from Icloud to his new Ipad, What do i need to do?

    You can use a wireless flash drive.
    Copy from old iPad > wireless flash drive > copy to new iPad
    http://www.sandisk.sg/products/wireless/flash-drive/

  • I have a nano and want to transfer my music from it to my new iPad. Unfortunately upon the excitement of setting up my new iPad I created a new apple Id and now cannot sync. Can I do it another way. Step by step pls I'm technologically challenged!

    I have a nano and want to transfer my music to my new iPad, in all the excitement of setting up my iPad I created a new apple Id and now I can't sync my music!
    Can someone please advise if there is a way to transfer my music to my iPad manually? If so, please detail step by step, as I am technologically challenged! Thanks in anticipation.

    You can search within your music folder on your pc, or within documents folder for a music folder.
    In any case, you would need to sync with itunes
    IOS: Syncing with iTunes
    http://support.apple.com/kb/HT1386
    Apple - Support - iPad - Syncing
    http://www.apple.com/support/ipad/syncing/
    If the music was purchased from the itunes store, you can also download it directly from there to the ipad.

  • Is it possible to create a new List from another List's template and NOT carry over the associated Workflow?

    Related to
    this post, in cases where it's desirable to have two different workflows for two different Lists—is it possible to NOT bring forward a hardwired workflow when creating a new List from a saved template?
    I.e. List #2 still has the workflow from List #1 hardwired in.  List #1 still needs its workflow but List #2 wants to have a separate Workflow.

    More importantly, because it's relatively easy for most folks to just start from scratch with a new Workflow—how does one disassociate a carried-over Workflow from the new List?
    Use the web-GUI. (List Settings > Workflow Settings)
    From Designer, there's a shortcut button at the top of the page in the Workflows tab: "Administration Web Page".

  • When creating a new window in safari, using command T, the marker have not activated the search field. It means you have to click there every time. Changed after upgrading to Mavericks. Anyone knows how to change this?

    When creating a new window in safari, using command T, the marker have not activated the search field. It means you have to click there every time. Changed after upgrading to Mavericks. Anyone knows how to change this?

    Yes, you can do something like that. What you would do is create a button for each image and then hide them. When I do this type of thing I place all of the buttons on a template page and then hide the template.
    You can then use JavaScript to copy the icon from any of the hidden buttons to the main button that you've set up to display the image. For example, suppose you set up 10 buttons named b1, b2, b3, ...b10. The code to copy the icon from one of them to the button used to display the image (b0) would be something like this:
    // Get the icon from the b3 button
    var oIcon = getField("b3").buttonGetIcon();
    // Get  reference to the b0 button
    var f = getField("b0");
    // Set the icon of the b0 button to the icon retrieved from the hidden button
    f.buttonSetIcon(oIcon);
    // Show the b0 button
    f.display = display.visible;
    This code would go in the Mouse Up event of the smaller button.

  • Open iviews in new window from detailed navigation context menu function

    hello,
    when we click in the detail navigation menu and in the context menu (because many of ours users are used to right click to open a link in a new window on the internet) on the functionnality "open in new window", the start page is always display instead of the corresponding iview ...
    could you tell me if there is a configuration into the portal to :
    1- suppress the function "open in new window" from the context menu in the detailed navigation !
    2- make the iview displayed into the new window really the iview desired !
    best regards,
    Olivier.

    Hi Olivier,
    The frist part is very precise. Not possible. Period. The reason is that the links are calling JS and not directly calling a http target.
    About the second part: Within the Light Framework, you create a Light Detailed Navigation. And in this case, the links are direct http links. So with that, you have what you want.
    For the Light Framework see http://help.sap.com/saphelp_nwce10/helpdata/en/43/0174a642406db7e10000000a422035/frameset.htm and around.
    Hope it helps
    Detlev

  • My iTunes is accessed with an old email address. I have just created a new apple ID and now want to change my iTunes account to reference this- how do I do it?

    Arghh!! I am literally about to throw my new iPad out of a window - apple is driving me beyond crazy. I have an old iTunes account to which all my music is saved. I have just created a new apple id and want that to be the one that my iTunes account references - it won't let me change my old email to this as it says my new apple I'd is sychd to another account. How do I do it? Am desperate!

    Delete them and then download them from the desired Apple ID. This may require repurchasing paid applications.
    (95675)

  • How to create a new connection from SAPGUI to Test drive?

    Hi,
    I have installed Sap Netweaver Test drive on a linux virtual machine (windows host). The installation was successful and I was able to start the instance (application server and the database), yet I don't know how to create a new connection from my SAPGUI client (7.20) to this server. The static IP address of the server is 192.168.1.160.
    I entered the following values for my new connection entry
    Description: SAP Netweaver
    Application server: 192.168.1.160
    Instance number: 01
    System ID: DB2
    SAProuter: /H/192.168.1.160/S/3201/H/
    But it does not work. Any idea about the values needed  for creating a new entry?
    Thanks in advance,
    Dariyoosh

    >
    Dibya R Das wrote:
    > Why are you entering a router string? Can't you reach a box directly from your machine?
    >
    > Doesn't a ping to that host & a "telnet <host/ip address> 3201" work from your machine to the SAP System.
    >
    > Remove the router string you wont need if the above works.
    >
    > - Regards, Dibya
    Hello there,
    Thank you very much for your answer which solved my problem. In fact there was no need of providing router string.
    Kind Regards,
    Dariyoosh

  • Is there a way to create a new Calendar that replicates all events

    Is there a way to create a new Calendar that replicates all events from a subscribed calendar ? Mobile Me is great but my most important Calendar is technically in the "Subscriptions" category so it doesn't get pushed to me iPhone. I want to create a new Calendar and have it just automatically copy all the events from the subscribed calendar and keep up to date with that one.

    lincolnroadjeff,
    I subscribed to a Holiday calendar that I also wanted to be published, and the only workaround that I found was to export the calendar, delete the subscription, and then import the calendar.
    This obviously will only work with a subscription that is not often updated/subject to change.
    ;~)

  • How to open a new window from the login window?

    hi,
    can someone tell me how to open a new window from an existing window, here by window i mean frame. The case is i hv two java files - oracle.java and FDoptions.java. The first frame is in the Login.java. The oracle.java file has a button "Login", when it is clicked, i want to open the next frame which is in the file FDoptions.java. Can some one help me with this? I m giving the code below -
    oracle.java
    import java.awt.BorderLayout;
    import java.awt.FlowLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import javax.swing.AbstractAction;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JTextField;
    * The application's main frame.
    public class oracle {
        private JFrame frame;
        private JPanel logInPanel;
        private JButton clearButton;
        private JButton logInButton;
        private JButton newuserButton;
        private JButton forgotpasswordButton;
        private JTextField userNameTextField;
        private JPasswordField passwordTextField;
        public oracle() {
            initComponents();
        private final void initComponents() {
            JLabel userNameLabel = new JLabel("User name: ");
            JLabel passwordLabel = new JLabel("Password: ");
            userNameTextField = new JTextField();
            passwordTextField = new JPasswordField();
            JPanel userInputPanel = new JPanel(new GridLayout(2, 2, 5, 5));
            userInputPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 20));
            userInputPanel.add(userNameLabel);
            userInputPanel.add(userNameTextField);
            userInputPanel.add(passwordLabel);
            userInputPanel.add(passwordTextField);
            logInButton = new JButton(new LogInAction());
            clearButton = new JButton(new ClearAction());
            newuserButton = new JButton(new NewUserAction());
            forgotpasswordButton = new JButton(new ForgotPassword());
            JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
            JPanel buttonPanel1 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
            buttonPanel.add(logInButton);
            buttonPanel.add(clearButton);
            buttonPanel1.add(newuserButton);
            buttonPanel1.add(forgotpasswordButton);
            logInPanel = new JPanel(new BorderLayout());
            logInPanel.add(userInputPanel, BorderLayout.NORTH);
            logInPanel.add(buttonPanel, BorderLayout.CENTER);
            logInPanel.add(buttonPanel1,BorderLayout.SOUTH);
            frame = new JFrame("FD Tracker");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(500, 500);
            frame.setContentPane(logInPanel);
            frame.pack();
            frame.setVisible(true);
        private void performLogIn() {
            // Log in the user
            System.out.println("Username: " + userNameTextField.getText());
            char[] password = passwordTextField.getPassword();
            System.out.print("Password: ");
            for(char c : password) {
                System.out.print(c);
            System.out.println();
        private void performClear() {
            // Clear the panel
            System.out.println("Clearing the panel");
            userNameTextField.setText("");
            passwordTextField.setText("");
        private final class LogInAction extends AbstractAction {
            public LogInAction() {
                super("Log in");
            @Override
            public void actionPerformed(ActionEvent e) {
                performLogIn();
        private final class ClearAction extends AbstractAction {
            public ClearAction() {
                super("Clear");
            @Override
            public void actionPerformed(ActionEvent e) {
                performClear();
        private final class NewUserAction extends AbstractAction{
             public NewUserAction(){
                 super("New User");
             @Override
             public void actionPerformed(ActionEvent e){
                 JFrame newuser = new JFrame("NewUser");
        private final class ForgotPassword extends AbstractAction{
            public ForgotPassword(){
                super("Forgot Password");
            @Override
            public void actionPerformed(ActionEvent e){
                JFrame forgotpassword = new JFrame("Forgot Password");
        public static void main(String args[]) {
            new oracle();
         FDoptions.java
    import java.awt.FlowLayout;
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import javax.swing.AbstractAction;
    import javax.swing.BorderFactory;
    import javax.swing.JPanel;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    public class Fdoptions{
        private JFrame fdoptions;
        private JPanel fdoptpanel;
        private JButton enterfdbutton;
        private JButton viewfdbutton;
        public Fdoptions() {
            initComponents();
        private final void initComponents(){
            fdoptpanel = new JPanel(new BorderLayout());
            fdoptpanel.setBorder(BorderFactory.createEmptyBorder(80,50,80,50));
            enterfdbutton = new JButton(new EnterFDAction());
            viewfdbutton = new JButton(new ViewFDAction());
           JPanel enterbuttonpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
           JPanel viewbuttonpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
            enterbuttonpanel.add(enterfdbutton);
            viewbuttonpanel.add(viewfdbutton);
            fdoptpanel.add(enterbuttonpanel,BorderLayout.NORTH);
            fdoptpanel.add(viewbuttonpanel,BorderLayout.SOUTH);
            fdoptions = new JFrame("FD Options");
            fdoptions.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            fdoptions.setSize(1000,1000);
            fdoptions.setContentPane(fdoptpanel);
            fdoptions.pack();
            fdoptions.setVisible(true);
        private void performEnter(){
        private void performView(){
        private final class EnterFDAction extends AbstractAction{
            public EnterFDAction(){
                super("Enter new FD");
            public void actionPerformed(ActionEvent e){
                performEnter();
        private final class ViewFDAction extends AbstractAction{
            public ViewFDAction(){
                super("View an existing FD");
            public void actionPerformed(ActionEvent e){
                performView();
        public static void main(String args[]){
            new Fdoptions();
    }

    nice day,
    these lines..., despite the fact that this example is about something else, shows you two ways
    1/ modal JDialog
    2/ two JFrame
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    * Parent Modal Dialog. When in modal mode, this dialog
    * will block inputs to the "parent Window" but will
    * allow events to other components
    * @see javax.swing.JDialog
    public class PMDialog extends JDialog {
        private static final long serialVersionUID = 1L;
        protected boolean modal = false;
        private WindowAdapter parentWindowListener;
        private Window owner;
        private JFrame blockedFrame = new JFrame("No blocked frame");
        private JFrame noBlockedFrame = new JFrame("Blocked Frame");
        public PMDialog() {
            noBlockedFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            noBlockedFrame.getContentPane().add(new JButton(new AbstractAction("Test button") {
                private static final long serialVersionUID = 1L;
                @Override
                public void actionPerformed(ActionEvent evt) {
                    System.out.println("Non blocked button pushed");
                    blockedFrame.setVisible(true);
                    noBlockedFrame.setVisible(false);
            noBlockedFrame.setSize(200, 200);
            noBlockedFrame.setVisible(true);
            blockedFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
            blockedFrame.getContentPane().add(new JButton(new AbstractAction("Test Button") {
                private static final long serialVersionUID = 1L;
                @Override
                public void actionPerformed(ActionEvent evt) {
                    final PMDialog pmd = new PMDialog(blockedFrame, "Partial Modal Dialog", true);
                    pmd.setSize(200, 100);
                    pmd.setLocationRelativeTo(blockedFrame);
                    pmd.getContentPane().add(new JButton(new AbstractAction("Test button") {
                        private static final long serialVersionUID = 1L;
                        @Override
                        public void actionPerformed(ActionEvent evt) {
                            System.out.println("Blocked button pushed");
                            pmd.setVisible(false);
                            blockedFrame.setVisible(false);
                            noBlockedFrame.setVisible(true);
                    pmd.setVisible(true);
                    System.out.println("Returned from Dialog");
            blockedFrame.setSize(200, 200);
            blockedFrame.setLocation(300, 0);
            blockedFrame.setVisible(false);
        public PMDialog(Dialog parent, String title, boolean isModal) {
            super(parent, title, false);
            initDialog(parent, title, isModal);
        public PMDialog(Frame parent, String title, boolean isModal) {
            super(parent, title, false);
            initDialog(parent, title, isModal);
        private void initDialog(Window parent, String title, boolean isModal) {
            owner = parent;
            modal = isModal;
            parentWindowListener = new WindowAdapter() {
                @Override
                public void windowActivated(WindowEvent e) {
                    if (isVisible()) {
                        System.out.println("Dialog.getFocusBack()");
                        getFocusBack();
        private void getFocusBack() {
            Toolkit.getDefaultToolkit().beep();
            super.setVisible(false);
            super.pack();
            super.setLocationRelativeTo(owner);
            super.setVisible(true);
            //super.toFront();
        @Override
        public void dispose() {
            owner.setEnabled(true);
            owner.setFocusableWindowState(true);
            super.dispose();
        @Override
        @SuppressWarnings("deprecation")
        public void hide() {
            owner.setEnabled(true);
            owner.setFocusableWindowState(true);
            super.hide();
        @Override
        public void setVisible(boolean visible) {
            boolean blockParent = (visible && modal);
            owner.setEnabled(!blockParent);
            owner.setFocusableWindowState(!blockParent);
            super.setVisible(visible);
            if (blockParent) {
                System.out.println("Adding listener to parent ...");
                owner.addWindowListener(parentWindowListener);
                try {
                    if (SwingUtilities.isEventDispatchThread()) {
                        System.out.println("EventDispatchThread");
                        EventQueue theQueue = getToolkit().getSystemEventQueue();
                        while (isVisible()) {
                            AWTEvent event = theQueue.getNextEvent();
                            Object src = event.getSource();
                            if (event instanceof ActiveEvent) {
                                ((ActiveEvent) event).dispatch();
                            } else if (src instanceof Component) {
                                ((Component) src).dispatchEvent(event);
                    } else {
                        System.out.println("OUTSIDE EventDispatchThread");
                        synchronized (getTreeLock()) {
                            while (isVisible()) {
                                try {
                                    getTreeLock().wait();
                                } catch (InterruptedException e) {
                                    break;
                } catch (Exception ex) {
                    ex.printStackTrace();
                    System.out.println("Error from EDT ... : " + ex);
            } else {
                System.out.println("Removing listener from parent ...");
                owner.removeWindowListener(parentWindowListener);
                owner.setEnabled(true);
                owner.setFocusableWindowState(true);
        @Override
        public void setModal(boolean modal) {
            this.modal = modal;
        public static void main(String args[]) {
            new PMDialog();
    }

Maybe you are looking for

  • Network Drives inaccessible

    I have now updated to Version 10049, after a fresh install of 10041, since the update from 9926 didn't work.   I have found that this version and 10041 both have a problem with seeing the local network drives.   I can assign  drive letters to the par

  • Is there a note app that features encryption, folders, backup, and import/export?

    Hi friends, I have been searching for a month for a Notetaking app for the iphone which has these attributes: able to import/export notes from some form of text file suchas csv. I need to bring over a large number of notes from my android phone. I ca

  • Can't see my MobileMe gallery to insert

    I created one MobileMe gallery and I could insert it as a link from within iWeb using either the Insert Menu up top, or the Web Widgets icon on the bottom. But then I created another gallery from within iPhoto. I set it up so it would synch automatic

  • Problem Sending attachments with JavaMail API

    Hi, I am able to succesfully able to send the attachment but the body message is not going with it. If i dont send the attachment then the email body goes properly. i can't understand what the problem is . please help. import java.util.*; import java

  • Check lot Numbers length

    Hi friends, in check lot creation (FHCI) previosly we have created check lot with 5 digits (eg 12345) but, now we want to create with 6 digit  (eg 123456)...can anyone help for this issue With regards, Gopal Krishna