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

Similar Messages

  • Help needed with header and upload onto business catalyst

    Can someone help with a problem over a header please?
    I have inserted a rectangle with a jpeg image in  background, in the 'header' section, underneath the menu. It comes up fine on most pages when previsualised, going right to the side of the screen, but stops just before the edge on certain pages. I have double checked that I have placed it in the right place in relation to the guides on the page.
    That's one problem.
    The second problem is that I tried to upload onto business catalyst, which got to 60% and refused to go any further, saying it couldn't find the header picture, giving the title and then u4833-3.fr.png. The picture is in the right folder I have double checked. And it isn't a png. Does it have to be ?
    And the third problem is that I got an email following my upload from business catalyst in Swedish. I am living in France.
    Can anyone help ? Thanks.

    Thanks for replying,
    How can I check the preview in other browsers before I publish a provisional site with BC?
    The rectangle width issue happens on certain pages but not others. The Welecom page is fine when the menu is active, also the contact page, but others are slightly too narrow. Changing the menu spacing doesn’t help - I was already on uniform but tried changing to regular and back.
    In design mode the rectangle is set to the edge of the browser, that’s 100%browser width right?
    Re BC I have about 200 images on 24 different pages and it seems to be having difficulty uploading some of them. But it has managed a couple I named with spaces but not others I named with just one name.
    Is there an issue on size of pictures ? If I need to replace is there a quick way to rename and relink or do I have to insert the photos all over again?
    I’m a novice with Muse with an ambitious site !
    Thanks for your help.
    Mary Featherstone
    Envoyé depuis Courrier Windows
    De : Sanjit_Das
    Envoyé : vendredi 14 février 2014 22:15
    À : MFeatherstone
    Re: Help needed with header and upload onto business catalyst
    created by Sanjit_Das in Help with using Adobe Muse CC - View the full discussion 
    Hi
    Answering the questions :
    - Have you checked the preview in Muse and also in other browsers ?
    - Does the rectangle width issue happens when menu is active , or in any specific state , Try to change the menu with uniform spacing and then check.
    - In design view the rectangle is set to 100% browser width ?
    With publishing :
    - Please try to rename the image file and then relink
    - If it happens with other images as well , see if all the image names includes strange characters or spaces.
    - Try again to publish
    With e-mail from BC :
    - Under preferences , please check the country selected.
    - If you have previously created partner account in BC and selected country and language then it would follow that, please check that.
    Thanks,
    Sanjit
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/6121942#6121942
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/6121942#6121942
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/6121942#6121942. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Help with using Adobe Muse CC at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • Data Slice dynamic activation and deactivation for a set of users

    Hi Experts,
                     We have requirement to manually enter the data into RTC using IP.
    There are 2 sets of users --> Power Users and Normal Users.
    We need to allow the normal users to enter the data only from 1st to 5 th working day of every  month.
    Power Users should have authorization to edit and enter the data at any time.
    Can any one suggest how to set the dataslice using code.
    Regards,
    Shashi

    Hi.
    Please note that update of RSPLS_DS table do not affects at RUNTIME.
    If you want to create dataslice that activated and deactivated within sequence run you should do the next:
    1. Create exit variable that return you all working days EXCEPT 1 to 5 of each month.
    2. Create dataslice in modeler on this characteristic with restriction by this exit variable.
    3. This dataslice should be based on ABAP class as described [here|https://www.box.net/shared/zhirrvk859].
    4. In mydataslice method enter following code (I assume you have any DSO with definition whether user is power user or not. Lets say DSO has next structure:
    USER   | Z_IS_POWER   |
    aaaa    | NO
    bbbb    | YES
    Enter the next code in mydataslice method:
    SELECT Z_IS_POWER FROM YOURDSO INTO lv_POWER WHERE USER=sy-uname.
    IF sy-subrc = 0. *This is SUPER USER. Allow locked data edition
    e_noinput = rs_c_false.
    ELSE. *This is regular user. Do not allo locked data edition
    e_noinput = rs_c_true.
    5. Create in modeler 2 planning sequences for activating and deactivation dataslice as described in document.
    6. Each time you want to do something with locked data run first sequence for deactivation of dataslice. If super user will run it so dataslice will be deactivated, but if regular user - dataslice will lock the data.
    Regards.

  • What is mass activator and deactivator?

    hi all,
    Can anyone explain me what is mass activator and deactivator in Multi provider and in infocube?
    can  anyone let me know with examples.
    regds
    haritha

    Hi,
    When you choose <b>Mass Activator</b> a list of all objects in the system appears with their status. You can select the objects to be activated from this list and then activate them at one time.
    http://help.sap.com/saphelp_nw04/helpdata/en/3b/f2a8d4fb377c47b0aa25ae9ae160d6/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/3b/f2a8d4fb377c47b0aa25ae9ae160d6/frameset.htm

  • TS3694 What happens when the iPhone needs an activation and it doesn't respond? Then it asks me to restore it but due to an unknown error (-1) the iPhone can't be restored.

    What happens when the iPhone needs an activation and it doesn't respond? Then it asks me to restore it but due to an unknown error (-1) the iPhone can't be restored.

    Thank you for your response. However, I have done that plenty of times and each time I try to restore my phone, it extracts the software and then when it says restoring with the loading bar, an error message comes up saying an unknown error has occurred.

  • Activating and deactivating expose switches the window

    Hi,
    I found that expose in Lion behaves weirdly.
    The steps to repro:
    Open 2-3 windows of Safari.
    Move one window to another desktop (so there are windows of the same app on multiple desktops).
    Activate Expose (with gesture).
    Deactivate Expose (with gesture).
    What I expected to see after these steps: the same desktop, application and window as it was originally at the step 1.
    What I actually see: the screen slides to another desktop and activates the window on it. Doing it again does it again in the opposite direction.
    Nobody at the Apple store could explain why it happens or provide any logical explantion.
    So what's a deal with it?
    Cheers.

    Hi
    U need to assign an OK-CODE to print icon in the toolbar, but if it's a standard one, it means to change a standard object.
    Then u should considere after activing it u need to implement the abap code to manage it
    Max

  • Slice tool help needed width expands and contracts

    I recently did a header for my website and srinks and expands
    with different screen sizes I need a bit of help to undstand how
    and why this happens.
    I built it on a 19" screen fits perfectly on the page. Then
    on the 15" I'm using now its very small leaving gaps along the
    sides
    here's the problem

    No, I don't mean that your header should be all one image.
    Currently, your header is a table with a number of images
    inside it. The width of the table is "absolute." It is set to a
    fixed number of pixels (800). It won't change. What you see as
    smaller and larger on your different monitors is a result of the
    different resolution that the two monitors have.
    The forum content, on the other hand, is in tables with
    widths that are "relative." They are are a percentage of the width
    of the browser window (81%). These tables will change size
    depending on the size of the browser window. For just one perfect
    setting, everything will line up. For all other widths, you have a
    mess.
    You need your header table and your forum tables to match.
    Either your header needs to be designed differently, so that it can
    expand and contract gracefully when a browser window is a different
    size (in pixels), or you need to edit your forum so that the
    various parts are all 800 pixels wide instead of varying
    percentages.
    As for monitors, it isn't the physical size that is important
    here, it's resolution. It isn't the number of inches, it's the
    number of pixels. You can have a 21" monitor that's set to 800x600
    pixels and you can have a 17" monitor set to 1600x1200 pixels. On a
    monitor with 800x600 pixel resolution, your header will be the full
    width of the screen and the forum content will be about 650 pixels,
    indented on both sides. On a monitor that is 1600x1200 pixel
    resolution, your header will be about half of the screen width and
    your forum content will be about 1300 pixels wide.

  • Help needed on Servlets and JSTL

    Hi
    I am using tomcat 5.5 and JDK 1.5. What are the softwares I have to download for compiling servlets and creating JSTL ?. Help needed.
    Thanks
    IndyaRaja

    I tried compling servlet, but it is raising error
    that coul not find package javax.servletWhat I did not mention... you need to add those JARs in the Classpath explicitly. You will find them in %TOMCAT_HOME%\common\lib. You atleast need to add servlet-api.jar to your Classpath. :)

  • Help needed with layers and project files....

    Hello
    I am new to after effects so this might be a simple issue for most. I am having an issue with my layers not matching the files in my project window. I accidently deleted a comp file the other day so I had to remake a few layers but they are not showing up in the project window/solids folder. I have 5 layers on my timeline and only 4 files in the project/solids folder. Some of the files names do not match the ones in the timeline. Is there a way to create a new comp with the files that I have open in my timeline or to replace the ones in the project window?  I started a project a few days ago, Im trying to make a few partical orbs dancing on there own path then they will come together and then creates a few smaller ones. Im at the point where I want to copy one comp to another or copy the layers over but the particals follow one light instead of the original light from its own comp. I think the file names in the project window might be the issue but I really don't know. Any help or comments would greatly be appreciated
                                                     Thanks a million
                                                                   Adam                                                                                                                                                              
    Using trapcode particular and AE CS6
    Windows system

    Layers on the timeline are just instances of the source footage. If you rename them on the timeline, that won't affect the number or naming of the sources in the project window. Toggle the column header in the TL to see which laywer uses which source.
    Mylenium

  • Help needed with flash and web service call

    Hi all,
    I need some help with web services and flash. I'm very new to flash, so please have that in the back of your mind when reading this :-)
    I've got a .swf file, and I would like to display a number received from a web service (using adobe flash professional cs5). Ive added the web service and provided the WSDL, but when i try to "Add Method Call", nothing happens. Why? What am I doing wrong?
    Hope someone can help

    start with the button that causes the text to be displayed.  find what it does (which may not be easy because most templates are coded by novice or intermediate level coders) and follow that trail to the text.  (note:  the text may be in a txt or xml file that's loaded.)
    to have a button release open a file, use:
    yourbtn.onRelease=function(){
    getURL("http://www.adobe.com");

  • Satellite A100 - Need 64bit drivers and tools for Windows 7

    Hi,
    I have W7 RTM from Technet, and I was install 64bit edition on my laptop "Satellite A100 (PSAA9)" I need 64bit drivers and 64bit utilities (Value Added Package,..) but I can not find them... 32bit Value Added package not work on 64bit (installation is rejected ) :/
    Sorry, my english is very very bad
    Thanks for any advice

    Hello
    I have checked the Toshiba website and there I cant find drivers and tools for 64bit OS. So I think Akuma is right you should 32bit OS on an old system like Satellite A100. The Toshiba website offers all drivers and tools for Vista 32bit and most of them should also work on Windows 7.
    Alternative you can download the drivers and tools from another notebook model that is very similar to yours.
    Just search a little bit. :)
    Greets

  • Help needed with consolidating and moving itunes folder.

    I have imported songs into itunes using with the Copy Files To iTunes Folder When Adding To The Library box unchecked and moved the location of my music folder to an external hard drive. I already had a folder full of music files on this hard drive so I now have 2 folders with music files, the iTunes folder with music recently imported from cd's and the old folder. The library points to references to both of these folders but not ALL of the files in the old folder as I don't need them in iTunes.
    I now want to be able to listen to my iTunes library when not connected to the external drive. How do I do this? If I reset the location of my iTunes folder back to the macbook do I then need to consolidate, and if I do will only the files with reference pointers go into this folder? I don't want all the music files in the old folder to go onto the macbook, only the ones with reference pointers to them, plus the ones in the iTunes music folder.

    I have imported songs into itunes using with the Copy Files To iTunes Folder When Adding To The Library box unchecked and moved the location of my music folder to an external hard drive. I already had a folder full of music files on this hard drive so I now have 2 folders with music files, the iTunes folder with music recently imported from cd's and the old folder. The library points to references to both of these folders but not ALL of the files in the old folder as I don't need them in iTunes.
    I now want to be able to listen to my iTunes library when not connected to the external drive. How do I do this? If I reset the location of my iTunes folder back to the macbook do I then need to consolidate, and if I do will only the files with reference pointers go into this folder? I don't want all the music files in the old folder to go onto the macbook, only the ones with reference pointers to them, plus the ones in the iTunes music folder.

  • Help needed with footers and shrinking text

    Hi Guys
    I got a report that I want to print conditional headers and footers for. When I specify that I only want a foooter to appear on the last page, I get REP-1216 error, I checked out Metalink and followed a note on how to get around it but I'm having no joy. Can anyone help me out? I also want to make certain bits of the header and footer visible depending on a value retrieved from the report query only I get REP-1314 saying that my format trigger referencesa column at the wrong frequency. I know the value is in another frame but how do I make this value available in the margin so that the formatting will work?
    Also, I want to be able to shrink some lines of an address if it has a null value at runtime e.g
    My House
    First Address Line
    Second Address Line
    <Null>
    Post Code
    I want to format it so that it appears as:
    My House
    First Address Line
    Second Address Line
    Post Code
    I really appreciate if someone could help me out as always this is very urgent!
    Many thanks
    Ciaran

    Hi Ciaran,
    I only want a foooter to appear on the last page
    I am quoting from Note 1017067.102 on Metalink (REP-1216 when running report with field in margin) - you might have already seen this note...
    Objects in the margin region are restarted on every physical page. As a
    result, not all print condition types make sense for margin objects. Because
    objects are restarted on every page, it is as if you are always on the first
    page of the object.
    The print condition FIRST is the same as the print condition ALL.
    The print conditions LAST and ALL BUT LAST are invalid because "LAST" is never
    reached.
    The print condition ALL BUT FIRST causes the object to never appear because
    the object never goes beyond "FIRST" page.
    Thus, the only valid print conditions for the object are FIRST and ALL.
    also want to make certain bits of the header and footer visible depending on a value retrieved from the report queryYou can use conditional formatting / format trigger only for objects that are in the same group in the data model. For example, you can reference employee_id in the format trigger of employee_name if they are in the same group. In your header / footer Format Trigger, you can reference only report-level columns. So if you can make your column to appear at the report level (outside of any group), you may be able to reference it from the header / footer.
    want to be able to shrink some lines of an address if it has a null value at runtime You may be able to use Anchors. See Builder Help for more information and examples.
    Navneet.

  • There is possible to active and deactive some buttons ?

    Hey. I have code to detect what page of my flash book is active and question now: there is possible to make 4 diferent effect for one button depend on what page is active? example:
    page 1 : button is red
    page 2 : button is blue
    page 3 :button is black
    i think this is possible but cant figure out how to make this

    if you have a simplebutton, you can change its color using its transform.colorTransform property:
    var ct:ColorTransform=yourbutton.transform.colorTransform;
    if(this.currentFrameLabel=="page 1"){
    ct.color=0xff0000;
    } else if(this.currentFrameLabel=="page 2"){
    ct.color=0x0000ff;
    } else if(this.currentFrameLabel=="page 3"){
    ct.color=0x000000;
    yourbutton.transform.colorTransform=ct;

  • Help - Need Line in and Aux inputs active at the same time..... Audigy SE

    The company I work for purchased 3,000 of the Audigy SE? SB0570 sound cards to replace our aging original SB6 PCI cards used in our call centers. The application and Hardware require that the AUX connector and the Line in connector are both acti've at the same time in order for things to work properly.
    Problem is that when I go into the mixer settings (or windows volume controls) when I select one of the inputs to go acti've, it mutes the other two inputs (mic, line-in, or AUX). Does anyone know of a work around to let me activate the AUX and/or Line-in/Mic at the same time??
    Our workstations run Windows 2000? (but as a test, I?loaded up another PC with XP SP2 and it exibits the same problems)
    Thanks in advance for your help.

    We are using the internal AUX in connector to take audio from a vendors custom card, and at the same time we have to take audio in on the flexi-jack input on the rear of the card. The original SB PCI cards we have been using for 5 years allowed us to do this, but these new ones do not. I wrote an e-mail to Creative Tech support and here is their response: Basically it is a no go, so I am now looking at other manufactures that can support our requirements. Good news is that I contacted our supplier today and they are willing to take back all of the cards that are still sealed in their original packaging... about 2,800 of them.
    Dear Harry
    Thank you for reaching us at Creative Email Technical Support; we appreciate the opportunity to assist you.
    Based on your description, I understand that you are unable to use AUX IN and Line In/Mic In simultaneously.
    I would like to apologize for any inconvenience and seek your understanding, and are certainly thankful that you have taken precious time to bring this matter to our attention.
    Please allow me to assist you with regard to this issue.
    For your information, you are only able to use one of the option at a time.
    If you are trying to do a Recording, you may select "What U Hear"
    option.
    I hope the above mentioned solutions will be able to resolve your issue.
    If you still require assistance, please reply to this email with any previous correspondence to ensure the quickest and most accurate service.
    Best Regards,
    *removed*
    Technical Support
    Creative Labs Americas
    To provide feedback on your "Creative Experience" please click on the following link:
    http://www.**bleep**.com/support/contact/welcome.asp?r=CLI&d=TS[/u]
    This link is provided so that you may provide feedback on your "Creative Experience". If you require further troubleshooting or have additional questions simply reply to the original mail and we will be glad to assist you.
    Admin notes: Removed the name of the support advisor for their privacy.
    Message Edited by KokChoy-CL on <span class='local-date'> 0-22-2009<span class='local-time'> 0:57 [email protected]

Maybe you are looking for