JButton that enables a JComponent

Hi all. For my application i would like a button that, when clicked, enables a text field otherwise disabled. i thought it would be easy to do with a mouseListener on the button that, when intercepts an event from BUTTON1, would simply call the setEnabled on the button:
edit.addMouseListener(new MouseAdapter() {
                    public void mouseClicked(MouseEvent e) {
                        if (e.getButton () == e.BUTTON1)
                            comp1.setEnabled(true);
                });but i have a "local variable comp1 is accessed from within inner class; needs to be declared final" and, i think, i can't declare it final because if i do, the setEnabled wouldn't have effect. What am i doing wrong?
thank you all!

i did my tests, and your right. i have a really nasty bug on my code, then.. i'll make you simplier that i can:
since (i think) that the important one is the state of the component in the moment it's attached to the panel.. how can i make the trick??

Similar Messages

  • I am working with iPhoto 9.  When I choose a layout that enables me to write something, the print is so small I cannot read it.  How do I enlarge the print so I can correct mistakes.

    I am making an iPhoto Book in iPHoto 9.  When I choose a layout that enables me to write something the print is so small that I cannot see what I have written to correct any errors.  How can I make this print larger?

    In the lower menu bar click the Settings icon. You will see all the fonts and sizes for different locations for typing there.

  • Can i turn off the option that enables iOS 8 to connect to my apple tv without using wifi?

    I am a schoolteacher and our school uses Apple-tv to project lesson contents. We have separated the students wifi network from the teachers wifi network, so our students won't be able to use the apple-tv's and disrupt our lessons.
    Since the introduction of ios8, the separated wifinetwork doesn't do the trick anymore. Students can now use every Appltv in their vicinity to project whatever image they want. This is a problem.
    Can we turn off the option that enables IOS8 to connect to apple-tv without using the wifi network?
    Thanks in advance.
    Marco

    Unless buffering a rental/prior purchase to watch it should not consume significant bandwidth when connected.
    Power wise it uses 6W at most.
    You can't power off from the remote but you can set it to sleep -
    Press and hold Select for five seconds (or go to Settings > Sleep Now on Apple TV (2nd generation), or Settings > Standby on Apple TV (1st generation)

  • Creating an JButton that implements EventListener

    Hi all
    im at university and have a question that was in one of my java books. Im learning about event handling
    and adding EventListeners to components. But there was a one part of my book that talked about defining a new class of JButton
    that extends JButton and implemented ActionListener that could listen for itself being clicked.
    so i could just create instances of this button.
    could someone explain this idea to me or show me a tutorial on it i tryed googe but i could not find
    anything that helped.

    JustSomeGuy wrote:
    I was just kidding in my last response, as that is the same thing as calling system.exit.
    Making a generic "Exit" EventListner is also a good ideal, but that doesn't mean you can't make a generic "exit" button as well.
    The way I personally handle it is I always have a CleanUp method in my code, typically in the same class as main is. If it is not threaded, or is a simple GUI (differentiated because swing GUI's are always multithreaded) then the method does contain system.exit(0), usually right after dispose() without much else. If it is multithreaded, then that is another story. My generic "Exit" button, which is actually on my netbeans pallette, simply calls CleanUp. I think I have one for menu exit items too, not sure I would have to check.
    JSGCalls cleanUp where? I'm not really seeing the advantage. You call System.exit()? Hmmmm

  • I accidentally deleted a history link that enables "friends" to be listed in Farmville. How can I get it back?

    I was deleting a link in the history list that enabled a specific gift claim in Farmville when I was installing Firefox 4. It apparently deleted the whole link for gifting and the listing of friends in Farmville and in Dragons of Atlantis. I cannot play these games fully without having access to my Facebook Friends who are also playing these games. It did not effect the same feature in Kingdoms on Camelot. How can I restore the friends link in the other two games? I told the history to "forget" the specific link for one specific gift claim. There were other links in the history list that I did not touch.

    Welcome to Apple Support Communities.
    I don't think you actually deleted any fonts. The missing fonts are Truetype fonts originally installed with Microsoft Windows XP. The website probably was optimized for Windows XP and Internet Explorer some time ago. These fonts were never part of Mac OS X.
    NOTE: My answer does not address font licensing issues if you do not own a Windows XP computer!
    If you have a XP computer, you can locate and copy those font files from the Windows computer to a flash drive, eject it, put the flash drive into your Mac, open it in Finder, and click on each ttf filename, one at a time. They should automatically open in in a window similar to this one for the Orbitron font:
    Click the Install Font.
    Repeat this for each of the four ttf files, and you are done.
    Message was edited by: kostby

  • How to creating a webservice that enable client/authentication

    hi, i'm newbie of the webservice development...and i would like to know how to start to create webservice that enable client/authentication on the website...
    can i know where can get the relevant information for development?
    thanks in advance,
    burnthome

    The first step will be to setup client side auth. You can take a look at Mike's bolg for some how-to entries with the step-by-step instructions: http://radio.weblogs.com/0132036/2004/01/26.html.
    Eric

  • HT1338 I have an older mac with Mac OS X 10.4.11...can I update that software or buy software that enables me to access my email through the icloud?

    I have an older mac with Mac OS X 10.4.11...can I update that software or buy software that enables me to access my mail via icloud? 

    This article says you can keep using your email with devices that don't support iCloud: http://support.apple.com/kb/HT4929?viewlocale=en_US&locale=en_US
    I don't know what the required email settings are, though.

  • Will there eventually be an update on the iPod Touch 4g that enables Siri?

    I don't have anything to say here

    Short Answer: No
    Long Answer: The Apple iPod Touch will never have a update that enables Siri because Siri isn't supported on the iPod Touch 4th Generation becuase it doesn't have enough power to run such a processor intensive add-on and Siri doesn't just run off a client connected to the internet it runs on multiple Siri enabled internet server that the iPod Touch 4g isn't compatible with and most likely never will be.
    Hope this helps.

  • How to create a JButton that can run other Apps?

    Hi, Every1
    i want to create a JButton which can let the user click it and it runs a
    specified installed app in the system ( say, a JButton that fires up MS
    Outlook). how can i do that?
    thank you very much.
    Yu.

    hi, if i want to execute some kind of the following, how would i handle it?
    mailto:[email protected]
    i tried: Runtime.getRuntime().exec("mailto:[email protected]");
    but it gave me java.io.IOException: CreateProcess: mailto:[email protected] error=2
    i think this problem would be relatively easy but i just cant figure out.
    thanks

  • Rescue CD/distribution that enables ssh/telnet on boot?

    Hi all,
    I am looking for a distribution/live cd that enables ssh/telnet (or something similar) on boot. The reason I need this: I am trying to get data from a broken all-in-one PC (only the monitor appears broken), and do not have access to a monitor.
    I have searched google for this, and it looks like this particular livecd may not exist, and that I may have to create my own livecd (something I have never done before...).
    I figured I'd ask here first, in case anyone knew of such a livecd.
    Thanks

    WonderWoofy wrote:
    I never said you were rude, but I am giving you a viable solution.  It is not like you are going to have to do this over and over again, you simply need access to your headless machine (hopefully just once anyway).
    I did exactly what I am proposing to you when I installed Arch on my headless server.  So I know it can be done, and it is probably one of the simplest of solutions... by that I mean you could be moving data off your drive by now.
    Insert Archiso and press power button
    ...give it some time to boot...
    # passwd <desired password>
    # systemctl start sshd
    PROFIT!
    I tried this earlier, but it did not seem to work. I'll move the PC downstairs and hook it up straight to the router instead of my current usage of powerline ethernet (seems harder to find the IP with nmap), and try the arch iso again.
    The good news is that I know it boots from the CD, from looking at the various lights and listening to the hdd/drive sounds. xD

  • Is there a location aware wifi option (or app) that enables wifi at a specific location (home) and automatically disables it when you are away from the specified location?

    I manually turn off my wifi when leaving home for several reasons:
    1. I don't want my wifi to be on and constantly scanning wifi networks while I am away from home due to privacy reasons.  Many retail stores and airports are now tracking users based on their smartphone's wifi pings.  They can then store your phone's MAC address (the unique identifier of your phone) to determine how often you visit the store and where you go within the store.  It's just a matter of time before they match up your phone's MAC address with your credit card/payment info and then to your identity.  The only way to subvert this is to turn off your phone's wifi.
    2. For security reasons: Wifi access points can track devices that broadcast their wifi signal, even if they don't ever actually connect to the access point's network.  These access points can then store your device's details including your phone's MAC address.  Once your phone's MAC address is discovered, it can be targeted by a hacker.  In addition, there are multiple well known hacker tools that can be used to scan for smartphone wifi signals in order to detect and then hack your iphone.  Bottom line: if your wifi is discoverable, then your device is hackable.
    3. I believe it would save battery life if the iphone's wifi is not on and constantly scanning for networks all the time.
    There are other reasons as well, but the above are my 3 main reasons for asking about this.
    The reminders app is location aware - you can set reminders to alert you when you are at a specific location.  So, why not provide the option (or an app) to only enable wifi when you are at home - or any other location where you have an authorized or trusted wifi?
    As it is right now, the iphone's wifi is broadcasting 24/7 everywhere you go.  Not great for privacy & security.  When I turn off my wifi, the phone uses my 4G plan for data and GPS for location services... so wifi is not needed at all for data or location services while I am away from home (and no, wifi does not improve location accuracy, that is a fallacy... there is nothing within the wifi protocol that could ever improve location accuracy).  But the point is, wifi should have a location aware option.  Otherwise, it's just a matter of time before there is a headline story about how not having this feature is a huge security/privacy problem.

    Understood.  However, the point that I'm trying to make is that it's not the WiFi access point's security that's in question, it's having your phone's WiFi in an always-on mode that's in question.  It's simple: if your phone's WiFi is on, then it is both discoverable and hackable... even when it's not connected to a WiFi network or access point.  Here's an article about a drone in London that was created to hack smartphone WiFi signals (and hackers have been doing what this drone does for years):
    http://money.cnn.com/2014/03/20/technology/security/drone-phone/
    The point is that it's not  secure to have your phone's WiFi in an always-on mode.  It would be better for privacy and security if Apple made WiFi location aware so that it is only enabled when you are at a trusted location (e.g. your home or office).  Or, at least give us the option of location aware WiFi so that each user can determine the best mode for their phone:
    (1) Always-On (current default - not secure and many privacy issues).
    (2) Trusted mode (only on at trusted locations).
    (3) Off.

  • How do I create a form that enables the user to save the form filled in?

    When I create the form, save it and open it later, I get the message that the form can only be saved empty - without whatever the user filled into the text fields. Why is this and how can I enable the form to be saved including the content of the fields?

    It should only say that when used with Reader versions prior to version 11. If you have Acrobat, you can Reader-enable the form, allowing it to be saved in versions prior to 11, and 11 as well. Exactly how you do this depends on what version of Acrobat you're using:
    A9: Advanced > Extend Features in Adobe Reader
    A10: File > Save As > Reader Extended PDF > Enable Additional Features
    A11: File > Save as Other > Reader Extended PDF > Enable More Tools (includes form fill-in & save)

  • Script that enables mail users and kicks out two csv files

    I am working on a script that will mainly be used as a scheduled task to enabled mailuser by calling the update-recipient command. 
    But before it calls that command it will get for various issues that can cause errors.
    Missing PrimarySMTP
    Display name having a space at front or back.
    The external email address being blank.
    I have IF statements setup to check for those and then call a function that will save into an array the issue for that user. 
    Here is the script
    <#
    .SYNOPSIS
    Enable-MailUsers Synced Mail Users in the Exchange environment
    THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE
    RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER.
    Version .9, 30 June 2014
    .DESCRIPTION
    This script mail-enables Synced Mail Users and creates a CSV report of mail users that were enabled.
    The following is shown:
    * Report Generation Time
    .PARAMETER SendMail
    Send Mail after completion. Set to $True to enable. If enabled, -MailFrom, -MailTo, -MailServer are mandatory
    .PARAMETER MailFrom
    Email address to send from. Passed directly to Send-MailMessage as -From
    .PARAMETER MailTo
    Email address to send to. Passed directly to Send-MailMessage as -To
    .PARAMETER MailServer
    SMTP Mail server to attempt to send through. Passed directly to Send-MailMessage as -SmtpServer
    .PARAMETER ScheduleAs
    Attempt to schedule the command just executed for 10PM nightly. Specify the username here, schtasks (under the hood) will ask for a password later.
    .EXAMPLE
    Generate the HTML report
    .\Enable-MailUsers.ps1 -SendMail -MailFrom [email protected] -MailTo [email protected] -MailServer ex1.contoso.com -ScheduleAs SvcAccount
    #>
    param(
    [parameter(Position=0,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Send Mail ($True/$False)')][bool]$SendMail=$false,
    [parameter(Position=1,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Mail From')][string]$MailFrom,
    [parameter(Position=2,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Mail To')]$MailTo,
    [parameter(Position=3,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Mail Server')][string]$MailServer,
    [parameter(Position=4,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Schedule as user')][string]$ScheduleAs
    # Sub Function to neatly update progress
    function _UpProg1
    param($PercentComplete,$Status,$Stage)
    $TotalStages=5
    Write-Progress -id 1 -activity "Mail enabled Objects" -status $Status -percentComplete (($PercentComplete/$TotalStages)+(1/$TotalStages*$Stage*100))
    #Sub Function create ErrObject output
    function _ErrObject{
    Param($name,
    $errStatus
    If(!$err){
    Write-Host "error detected"
    $script:err = $True
    $ErrObject = New-Object -TypeName PSObject
    $Errobject | Add-Member -Name 'Name' -MemberType Noteproperty -Value $Name
    $Errobject | Add-Member -Name 'Comment' -MemberType Noteproperty -Value $errStatus
    $script:ErrOutput += $ErrObject
    # 1. Initial Startup
    # 1.0 Check Powershell Version
    if ((Get-Host).Version.Major -eq 1)
    throw "Powershell Version 1 not supported";
    # 1.1 Check Exchange Management Shell, attempt to load
    if (!(Get-Command Get-ExchangeServer -ErrorAction SilentlyContinue))
    if (Test-Path "D:\Exchsrvr\bin\RemoteExchange.ps1")
    . 'D:\Exchsrvr\bin\RemoteExchange.ps1'
    Connect-ExchangeServer -auto
    } elseif (Test-Path "D:\Exchsrvr\bin\Exchange.ps1") {
    Add-PSSnapIn Microsoft.Exchange.Management.PowerShell.Admin
    .'D:\Exchsrvr\bin\Exchange.ps1'
    } else {
    throw "Exchange Management Shell cannot be loaded"
    # 1.2 Check if -SendMail parameter set and if so check -MailFrom, -MailTo and -MailServer are set
    if ($SendMail)
    if (!$MailFrom -or !$MailTo -or !$MailServer)
    throw "If -SendMail specified, you must also specify -MailFrom, -MailTo and -MailServer"
    # 1.3 Check Exchange Management Shell Version
    if ((Get-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.Admin -ErrorAction SilentlyContinue))
    $E2010 = $false;
    if (Get-ExchangeServer | Where {$_.AdminDisplayVersion.Major -gt 14})
    Write-Warning "Exchange 2010 or higher detected. You'll get better results if you run this script from an Exchange 2010/2013 management shell"
    }else{
    $E2010 = $true
    $localserver = get-exchangeserver $Env:computername
    $localversion = $localserver.admindisplayversion.major
    if ($localversion -eq 15) { $E2013 = $true }
    #Get date
    $filedate = get-date -uformat "%m-%d-%Y"
    $filedate = $filedate.ToString().Replace("0", "")
    #Get the valid users that are not mail-enabled
    _UpProg1 1 "Getting User List" 1
    #$Users = Get-mailuser -ResultSize unlimited -OrganizationalUnit "R0018.COLLABORATION.ECS.HP.COM/Accounts/AbbVienet/Users" | ?{$_.legacyexchangeDN -eq ""}
    $i = 0
    $output = @()
    $errOutput = @()
    $err = $False
    #2 Process users
    ForEach ($User in $Users){
    $i++
    _UpProg1 ($i/$Users.Count*100) "Updating Recipients" 2
    If ($user.ExternalEmailAddress -eq $null){
    _ErrObject $user.Name, "Missing External Email Address"
    ElseIf($user.DisplayName -NotLike "* "){
    _ErrObject $user.Name, "DisplayName contains a trailing space"
    ElseIf($user.DisplayName -NotLike "_*"){
    _ErrObject $user.Name, "DisplayName contains a Leading space"
    ElseIf($user.PrimarySmtpAddress -eq $null){
    _ErrObject $user.Name, "Missing Primary SMTP address"
    Else{
    #Disable EmailAddressPolicy on these users
    Set-Mailuser $User.Name -EmailAddressPolicyEnabled $false
    #pass to Update-recipient
    Update-Recipient $User.Name
    $LEDN = Get-MailUser $User.Name | Select {$_.LegacyExchangeDN}
    If ($LEDN -ne ""){
    $object = New-Object -TypeName PSObject
    $X500 = "x500:" + $LEDN.'$_.LegacyExchangeDN'
    $object | Add-Member -Name 'Name' -MemberType Noteproperty -Value $User.Name
    $object | Add-Member -Name 'x500' -MemberType Noteproperty -Value $X500
    $output += $object
    #Creating CSVFile Output
    _UpProg1 99 "Outputting CSV file 3" 3
    $CSVFile = "c:\scripts\Mail-enable\Mailenabled_$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).csv"
    If($err){
    $ErrCSVFile = "c:\scripts\Mail-enable\ProblemUsers_$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).csv"
    $errOutput | Select-Object Name, Comment | ConvertTo-CSV -NoTypeInformation > $ErrCSVFIle
    $Output | ConvertTo-Csv -NoTypeInformation > $CSVFile
    if ($SendMail)
    _UpProg1 95 "Sending mail message.." 4
    If($err){
    Send-MailMessage -Attachments $CSVFile,$ErrCSVFile -To $MailTo -From $MailFrom -Subject "Enable Mail Users Script" -BodyAsHtml $Output -SmtpServer $MailServer
    Else{
    Send-MailMessage -Attachments $CSVFile -To $MailTo -From $MailFrom -Subject "Enable Mail Users Script" -BodyAsHtml $Output -SmtpServer $MailServer
    if ($ScheduleAs)
    _UpProg1 99 "Attempting to Schedule Task.." 4
    $dir=(split-path -parent $myinvocation.mycommand.definition)
    $params=""
    if ($SendMail)
    $params+=' -SendMail:$true'
    $params+=" -MailFrom:$MailFrom -MailTo:$MailTo -MailServer:$MailServer"
    $task = "powershell -c \""pushd $dir; $($myinvocation.mycommand.definition) $params\"""
    Write-Output "Attempting to schedule task as $($ScheduleAs)..."
    Write-Output "Task to schedule: $($task)"
    schtasks /Create /RU $ScheduleAs /RP /SC DAILY /ST 22:00 /TN "Enable Mail Users" /TR $task
    The Problem is that when I look at the $errOutput I see things but when I pipe the $erroutput to convertTo-CSV I get this within the CSV file. I think its because I an calling a function to do the updating. But not sure.
    Jeff C

    Hi Jeff,
    Any updates? If you have any other questions, please feel free to let me know.
    A little clarification to the script:
    function _ErrObject{
    Param($name,
    $errStatus
    If(!$err){
    Write-Host "error detected"
    $script:err = $True
    $ErrObject = New-Object -TypeName PSObject
    $Errobject | Add-Member -Name 'Name' -MemberType Noteproperty -Value $Name
    $Errobject | Add-Member -Name 'Comment' -MemberType Noteproperty -Value $errStatus
    $script:ErrOutput += $ErrObject
    $errOutput = @()
    _ErrObject Name, "Missing External Email Address"
    $errOutput
    _ErrObject Name "Missing External Email Address"
    $errOutput
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna Wang
    TechNet Community Support

  • Is this any way that abobe Flash include in the next version a plugin that enable use of flip book

    Hi all,
    Realy i've thinking many times to have a plugin in adobe flash, that will include a flip book component wich will be easy to build an online magazine for our real estate agency in marrakesh, i've used the latest trial version of adobe flash Cs5 but it enable to work with as i am a not programmer. But hope that one day get it.

    Best to post your question in the Flash forum
    http://forums.adobe.com/community/flash/flash_general?view=discussions

  • How to create a program that enable peer-to-peer connection

    I'm currently doing a college project which is a instant messenging system. The system will have the client-server network and peer-to-peer network. The client-server network part has been finished but i still facing the problem to write the code to enable two pc communicate with each other by using a server that use in the client-server part .
    I very hope someone can help me.
    thank you!

    Hi,
    I think that i can help u in this respect.
    Let me see what you are suggesting.
    You have two or more servers which need to be aware of on another.
    you have clients which can be connecting on any of the servers.
    you need these clients to be aware of each other.
    well....to do this you need to take a lot of factors into account.
    1. you can use a central server and redirect accordingly.
    2. use distributed servers.
    this is the more difficult part as you need to keep track of the server timezone.
    you need to keep track of the up and downtime of your servers.
    when servers are up or down you need to distribute clients accordingly.
    The second approach is more robust and known better as load balancing.
    Regards,
    myraid

Maybe you are looking for

  • The subtle use of task flow "No Controller Transaction" behavior

    I'm trying to tease out some subtle points about the Task Flow transactional behavior option "<No Controller Transaction>". OTN members familiar with task flows in JDev 11g and on wards would know that task flows support options for transactions and

  • Cost center and plant in asset master creation compulsory entry config

    where we configure that cost center and plant entry is complusory while creation of asset master. is it   asset accounting                master data                        Define screen layout for asset master                                  Define

  • 12 days of gifts app not appearing on app list.

    I downloaded the 12 Days Gift on my iPad Model  MC955LL/A IOS Version 7.0.4 (11B554a) It seemed to download fine, but then I exit the store, no icon appears.  Then I go back to the store it says "+open" (the "+" is superscript) When I go to the Gener

  • Turning off the Driving Mode Announcement.

    I turned on driving mode on my Lumia 928 and now everytime I get into the car it announces: "I have turned on Driving Mode for you."  It has become real tiring.  How do you turn it off???  I have searched with no luck, please help. dwf1234

  • Service centre says it/s liquid problem

    My blackberry 9220 curve is in warranty and  there is heating problem and charging jack problem,  the service centre guy after checking the set, asked to handover the set  for rectification, A day after they called me back that your hand set is damag