Help for activating & deactivating a window.

Here beelow, I have written the code.
Asper the code, I have created window1, that has a button "ok",clicking "ok", window2 appears.window2 has a "close" button.
So, the no. of times, I click the button "ok", the same no. of instances of window2 appears.But, I want after clicking the button "ok" in window1, window1 should be deactivated,and after clicking window2's "close" button, then window1 should be activated again.It means,only one instance of window2 should be visible,clicking the "ok" button.
If anybody has idea about this, please write me the updated version of the code given bellow.
Regards.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class window1 extends JFrame
JButton b;
window1()
Container con=getContentPane();
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
System.exit(0);
JPanel p1=new JPanel();
b=new JButton("ok");
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
if(e.getSource()==b)
new window2();
p1.add(b);
con.add(p1,BorderLayout.SOUTH);
setSize(200,150);
setVisible(true);
public static void main(String arg[])
window1 obj=new window1();
class window2 extends JFrame
JButton b2;
window2()
Container con=getContentPane();
JPanel p2=new JPanel();
b2=new JButton("close");
b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if(e.getSource()==b2)
dispose();
p2.add(b2);
con.add(p2, BorderLayout.SOUTH);
setSize(200,150);
setVisible(true);

A.
Keep the instance of the Window1 as global to the class.
e.g.
private window1 myWindow;
B.
In the constructor assign to the instance.
public window1 () {
myWindow = this;
C.
On click of "ok" set
myWindow.setVisible(false);
or
myWindow.setEnabled(false);
D.
In your window2's close button call the myWindow.setVisible (true) or myWindow.setEnabled (true)
I assume you have both the windows declared in one file.
Chintan

Similar Messages

  • How to implement "Application Help" for activated Businiess Functions & Add Ons?

    Dear all
    I am setting up a SAP NetWeaver System with Business Function INSURANCE activated (for the use of FS-CD) and the reinsurance Add On FS-RI installed.
    I am able to set up "Application Help" in transaction SR13 for the "ERP/ECC part", meaning: When I open some "normal" ECC/ERP transaction, like MM03 oder PA20 and click on ("Help" in menubar >) "Application Help" in SAP Gui, a browser opens an shows me the context sensitive online help page for the corresponding transaction. (For PA20, this is "Displaying HR Master Data", for MM03 it's "Displaying Material Master Records")
    If I open an FS-RI transaction (like "/MSG/H_BORD1" oder "/MSG/R_V3"), I am only forwarded to the general SAP Library. But there is an online documentation available ("SAP for Industries" > "SAP Insurance Management" > ...)
    So, how to link the Business Functions and Add Ons with the Online Help?
    Is there a simple way to set up "Application Help" for activated Business Functions and installed Add Ons?
    I found some (online) documentation, but this is all more confusing than helping...
    Thanks for any help!
    Frank

    Second, when you create a Core Data Document Based application, XCode generates the MyDocument class, derivating from NSPersistentDocument. This class is dedicated to maintain the Managed Object Model and the Managed Object Context of each document of your application.
    There is only one Context and generally one Model for each Document.
    In Interface Builder, the Managed Object Context must be bound to the managedObjectContext of the MyDocument instance: it's the File's owner of the myDocument.xib Nib file.
    It's not the case in your Nib File where the Managed Object Context is bound to the invoiceID of the Invoice Controller.
    It's difficult to help you without an overall knowledge of your application, perhaps could you create an InvoiceItem Controller and bind its Content Set to the relationship of your invoice.

  • Back end activities for Activation & Deactivation of Aggregates

    Hi ,
    Could any body help me to understand the back-end activites performed at the time of activation and deactivation of aggregates.
    Is filling of Agreegate is same as Roll up?
    What is the diffrence between de-activation and deletion of Aggregate?
    Thanks.
    Santanu

    Hi Bose,
    Activation:
    In order to use an aggregate in the first place, it must be defined activated and filled.When you activate it, the required tables are created in the database from theaggregate definition. Technically speaking, an aggregate is actually a separate BasicCube with its own fact table and dimension tables. Dimension tables that agree with the InfoCube are used together. Upon creation, every aggregate is given a six-digit number that starts with the figure1. The table names that make up the logical object that is the aggregate are then derived in a similar manner, as are the table names of an InfoCube. For example, if the aggregate has the technical name 100001, the fact tables are called: /BIC/E100001 and /BIC/F100001. Its dimensions, which are not the same as those in the InfoCube,have the table names /BIC/D100001P, /BIC/D100001T and so on.
    Rollup:
    New data packets / requests that are loaded into the InfoCube cannot be used at first for reporting if there are aggregates that are already filled. The new packets must first be written to the aggregates by a so-called “roll-up”. In other words, data that has been recently loaded into an InfoCube is not visible for reporting, from the InfoCube or aggregates, until an aggregate roll-up takes place. During this process you can continue to report using the data that existed prior to the recent data load. The new data is only displayed by queries that are executed after a successful roll-up.
    Go for the below link for more information.
    http://sapbibw2010.blogspot.in/2010/10/aggregates.html
    Naresh

  • HT201441 NEED HELP FOR ACTIVE PHONE

    HELLO AND GOOD DAY
    I AM SHIP CHANDLER AND SUPPLY CARGO VESSLES . I BUY ONE IPHONE 4 FROM ONE RUSSIAN CAPTAIN AND I'M NOT ACTIVE IT INSIDE THAT VESSLE AFTER THAT VESSLE SAIL I CHECK PHONE AND I TRY TO ACTIVE AND USE IT BUT I SEE THIS MESSAGE THIS PHONE IS CURRENTLY LINKED TO AN APPLE ID ([email protected]) I NEVER USE APPLE CELLPHONE BEFORE AND NEVER ACTIVE BEFORE ALSO PLEASE HELP ME TO ACTIVE THIS PHONE I HAVE SERIAL NUMBER AND IMEI ALSO I BUY IT IN BOX AND I DON'T KNOW HOW I CAN ACTIVE IT NOW AND I CAN NOT SEE THAT CAPTAIN BECOUSE THE VESSLE IS GO AND I DON'T KNOW HOW I CAN ACCESS TO HIM.
    PLEASE IF YOU CAN ACTIVE IT FOR ME OR HELP ME HOW I CAN ACTIVE IT .
    MY BEST REGARDS FOR YOU
    NADER DADGAR

    Please see these errors
    I am trying to push IDM Users into AD but getting these errors in AS Logs
    </Attribute>
    <Attribute name='originalAssignedLhPolicy' value='Default Identity Manager Account Policy'/>
    <Attribute name='password' value='change12345'/>
    <Attribute name='prevEffectiveLhPolicy' value='Default Identity Manager Account Policy'/>
    <Attribute name='questions'>
    <List>
    <Object name='Qa0ee8f8afc0293b6:77a34d0d:11eca669c58:-7e53'>
    <Attribute name='answerObfuscated' value='false'/>
    <Attribute name='id' value='a0ee8f8afc0293b6:77a34d0d:11eca669c58:-7e53'/>
    <Attribute name='loginInterface' value='UI_LOGIN_CONFIG_DISPLAY_NAME_ALL_INTERFACES'/>
    <Attribute name='question' value='What is your favorite pet&#39;s name?'/>
    </Object>
    </List>
    </Attribute>
    <Attribute name='resources'>
    <List>
    <String>AD</String>
    </List>
    </Attribute>
    <Attribute name='roleInfos'/>
    <Attribute name='selectedRoleType' value='AllRoleTypes'/>
    </Object>
    </Attribute>
    </Object>
    2009-01-12T17:15:56.108+0530: Error processing updates
    2009-01-12T17:15:56.108+0530: There was an error in activesync processing.
    2009-01-12T17:15:56.123+0530: java.lang.NullPointerException
    2009-01-12T17:15:56.342+0530: Looking for deletes with filter: (uSNChanged>=457812)
    2009-01-12T17:15:56.546+0530: Poll complete.
    2009-01-12T17:15:56.561+0530: SARunner: loop 423
    2009-01-12T17:15:56.655+0530: Started - Error, paused until Mon Jan 12 17:15:56 IST 2009
    2009-01-12T17:16:01.675+0530: Pause completed

  • Activating & deactivating a window.

    Here beelow, I have written the code.
    Asper the code, I have created window1, that has a button "ok",clicking "ok", window2 appears.window2 has a "close" button.
    So, the no. of times, I click the button "ok", the same no. of instances of window2 appears.But, I want after clicking the button "ok" in window1 then window1 should be deactivated,and after clicking window2's "close" button, then window1 should be activated again.It means,only once the window2 becomes visible, then after clicking the "close", if I again click the "ok", the same action should be held.
    If anybody has idea about this, please write me the updated version of the code given bellow.
    Regards.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class window1 extends JFrame
         JButton b;
         window1()
              Container con=getContentPane();
              addWindowListener(new WindowAdapter(){
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
              JPanel p1=new JPanel();
              b=new JButton("ok");
              b.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e)
                        if(e.getSource()==b)
                             new window2();
              p1.add(b);
              con.add(p1,BorderLayout.SOUTH);
              setSize(200,150);
              setVisible(true);
         public static void main(String arg[])
              window1 obj=new window1();
    class window2 extends JFrame
         JButton b2;
         window2()
              Container con=getContentPane();
              JPanel p2=new JPanel();
              b2=new JButton("close");
              b2.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e){
                        if(e.getSource()==b2)
                             dispose();
              p2.add(b2);
              con.add(p2, BorderLayout.SOUTH);
              setSize(200,150);     
              setVisible(true);
              

    A.
    Keep the instance of the Window1 as global to the class.
    e.g.
    private window1 myWindow;
    B.
    In the constructor assign to the instance.
    public window1 () {
    myWindow = this;
    C.
    On click of "ok" set
    myWindow.setVisible(false);
    or
    myWindow.setEnabled(false);
    D.
    In your window2's close button call the myWindow.setVisible (true) or myWindow.setEnabled (true)
    I assume you have both the windows declared in one file.
    Chintan

  • Can there be help for formatted Ipod using windows by mistake?

    I recently reformatted using windows by mistake. I read through this board and tried the putting Ipod in disc mode, opened Ipod updater, attached Ipod when prompted and reformatted. It would start to reset to factory settings then stop and give a write to disc failure notification. I have the 30 gig Ipod (video). Please help!!

    Disk cannot be Written Too -
    http://docs.info.apple.com/article.html?artnum=301267

  • Help for execute javascript in windows

    Dear developers i am new for using java script in acrobat please tel me where i write my java script and how can i execute please give a sample for read a pdf file and write it in a new file
    thank you....................

    Do you want to copy an entire page or a collection of indidual words? Do you want to create a new document or copy the content into an existing document?
    It's possible to read individual words using JavaScript, but you don't get punctuation and a lot of other things that can be on a page, and words may not appear in the order you think they should.
    It's also possible to insert pages from one document into the current document using JavaScript, and you can create a new document with JavaScript using the Report object, but you cave limited control over the layout.

  • Help for Activating Editing Mode on F2 Keyboard Click for a Tree Node

    I have a Jtree with several Nodes on the Left Pane. On the Right Pane I have a nodes corresponding Screen with many properties. There is a way to change the Node Name by editing the Name Field property on the Right.
    I want to Edit the tree Node name by Clicking F2 on the selected Node, Get it in the Editable Mode, Change the name and press enter. How Do I activate this editable Mode on Click of Keyboard F2 Button.

    tree.setEditable( true );

  • For Activation Help

    I need to help for activation for my soft

    Help for Download & Install & Setup & Activation
    http://forums.adobe.com/community/download_install_setup
    Chat http://www.adobe.com/support/download-install/supportinfo/
    -or http://www.adobe.com/support/chat/ivrchat.html
    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-deactivation-products.html

  • Help needed in activating and deactivating a window

    In my GUI, I have created a window, that is having one textfield, one label and 2 buttons named "Enabled" & "Disabled" .
    MY requirement is: After execution of the window when I will click "Disabled" button, the window should be deactivated, even I can't type in the textfield and then clicking the " Enabled" button the window should be activated, then I can access the textfield.
    Here bellow,I have written the code for visibility of the window, but I haven't written code for the action to be performed by the 2 buttons.
    Can anyof you please write me the updated code satisfying my requirement, sothat I'll proceed further.
    Regards.
    MY CODE:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class Test7 extends JFrame
         public Test7()
              Container con=getContentPane();
              addWindowListener(new WindowAdapter(){
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
              JPanel p1=new JPanel();
              p1.setBackground(Color.white);
              JPanel p2=new JPanel();
              JPanel p3=new JPanel();
              JTextField txt=new JTextField(10);
              JLabel l=new JLabel("hello world");;
              JButton b1=new JButton("Enable");
              b1.addFocusListener(new FocusAdapter(){
                   public void focusGained(FocusEvent evt)
              System.out.println("gained");
         // The component gained the focus
              JButton b2=new JButton("Disable");
              b2.addFocusListener(new FocusAdapter(){
                   public void focusLost(FocusEvent evt)
              System.out.println("lost");
         // The component lost the focus
              p1.add(txt);
              p2.add(l);
              p3.add(b1);
              p3.add(b2);
              con.add(p1,"North");
              con.add(p2,"Center");
              con.add(p3,"South");
              setSize(300,200);
              show();
         public static void main(String arg[])
              new Test7();

    try modifying code for the button listeners
    JButton b1=new JButton("Enable");
    b1.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent evt)
    System.out.println("gained");
    // The component gained the focus
    txt.setEnabled(true);
    JButton b2=new JButton("Disable");
    b2.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent evt)
    System.out.println("lost");
    txt.setEnabled(false);
    // The component lost the focus
    Hope this helps

  • New Envy Laptop 05/01/2015 saying the Windows I'm using is invalid for activation

    I've only had this Laptop for two days I've already had to do a recovery
    And now it's telling me that
    The Windows product key you typed is invalid for activation
    Buy a new product key online
    Type a different product key
    Contact Microsoft to help resolve this problem
    I've already phoned HP that was a wast of time so i will not be doing that again.
    First I have never typed in any product key for any software I also have powerDVD telling me that it
    can only run on authorized hardware.
    Am I best to call my bank and start a Chargeback or to keep trying HP in hope of getting a product key
    to use the £500+ laptop I just got of them.
    I only have two days left till this laptop is useless on that day it will be sent back for a full refund
    (if they like it or not)
    This question was solved.
    View Solution.

    Please identify your notebook with its complete product number or product name.
    1.  The complete Model Name. or Product Number. of the notebook - see This HP web document if you don't how to locate the model number and\or product number.
    Where did you get the  Windows 7 professional HP OEM USB Drive from?
     What you needed was an Windows 7 HP usb recovery flashdrive specifically created for your notebook series.  
    I have asked to have your issue escalated. Someone from HP should contact you between today or tomorrow. 
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • HT1461 Win 7 set up and running OK,but after go back from OSX the wireless net work stuck at identification cause the window working without Internet.Can we fix it or I must use Windows off line all the time? I already contact Microsoft 2 times for activa

    Win 7 set up and running OK,but after go back from OSX the wireless net work stuck at identification cause the window working without Internet.Can we fix it or I must use Windows off line all the time?
    I already contact Microsoft 2 times for activations.Hope I can fix from Apple instead.

    Ok....Got "Problem 2 and 4" solved....still trying to figure out this pop up everytime I click something...it's crazy how fast the pop up blinks...maybe once or 3 blinks then nothing till you close the window, then pop up then disappears...then click something
    else and pop up then gone....never seen this before...ive seen it when you tried to get online which turned out to be a virus on a customers cpu I worked on some years ago, I think it has something to do with the deleted files that I spoke of on last
    post...I notice it does it on start up as well.....think something is trying to install but not sure. Need to figure out where the appdata or start up folder and see whats in there....maybe it's in there.......so I might wait to see how it acts in the next
    couple days for "Problem 1"...but other than that it's running like a champ...so right now I just want to get the pop up windows to stop........thx again for everyone's help on this.
    John

  • HT201317 my computer (window 7) give me message "photo stream is not enabled. when i go to icloud control panel (version2 ) for activation. its not being activated. i tried many times but failed. i have activated photo stream on my iphone. please guide me

    my computer (window 7) give me message "photo stream is not enabled. when i go to icloud control panel on computer (icloud version2 ) for activation. its not being activated. i tried many times but failed. when i check the photo stream option and apply its shows that its ok. and after closing when i again open icloud panel the photo stream option remains unchecked that means its not activated. please guide me.

    Had the same problem. I uninstalled icloud, restarted my pc and reinstalled icloud and it's working fine. Hope this helps.

  • The Windows 7 Professional product key you typed is invalid for activation.

    Got a T410 & was trying to activate windows 7 that came preinstalled (OEM) ?????-OEM-8992671-?????
    Windows Product ID: ?????-OEM-8992671-?????. Windows Product ID Type: 2. Windows License Type: OEM SLP. Windows OS version: 6.1.7600.2.00010100.0.0.048
    Product ----  2516-CTO
    Serial -----  R8xxxxx
    BIOS: ------  6IET55WW (1.15)
    Warranty: --  till 03/2011
    I get the message: The Windows 7 Professional product key you typed is invalid for activation.
    I also have Norton Internet Security Preinstalled.
    I am new to this can anyone please help?
    Thanks in advance.
    Moderator Note; s/n edited for members own protection

    Hi joeamir, and welcome to the Lenovo User Community!
    Check this out:
    http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=migr-75177&sitestyle=lenovo
    And this thread:
    http://forums.lenovo.com/t5/T400-T500-and-newer-T-series/T410-update-new-BIOS-SLIC-misssing/m-p/2194...
    I don't work for Lenovo. I'm a crazy volunteer!

  • TS4268 hi my imessage isnt working so I turned off imessage and now its been saying "waiting for activation" and has been for a long while now? can you please help me!!! Also saying that my apple ID password is inccorrect when its not!

    Hi,
    My imessage isnt working so I turned off imessage and now its been saying "waiting for activation" and has been for a long while now? Also saying that my apple ID password is inccorrect when its not! Can anyone help me?
    Thanks

    While we all have MacBooks in this forum most of us don’t have Lion. There's a Lion Support Community where everybody has Lion.You should also post this question there.  https://discussions.apple.com/community/mac_os/mac_os_x_v10.7_lion

Maybe you are looking for