File chooser disabling the buttons

i want to disable the buttons unless the user chooses a file or inputs
name of the file how can i do that

Hello,
you could use FileChooser's setControlButtonsAreShown(boolean)-method:import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.*;
import javax.swing.filechooser.FileSystemView;
public class FileChooserTest extends JFrame
     public FileChooserTest()
          super("File-Chooser Test");
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          final JFileChooser fileChooser = new JFileChooser(FileSystemView.getFileSystemView());
          fileChooser.setControlButtonsAreShown(false);
          fileChooser.addActionListener(new ActionListener(){
               public void actionPerformed(ActionEvent e)
                    getContentPane().invalidate();
                    fileChooser.setControlButtonsAreShown(true);
                    getContentPane().validate();
                    getContentPane().repaint();
          getContentPane().add(fileChooser);
          pack();
          setLocationRelativeTo(null);
          setVisible(true);
     public static void main(String[] args)
          new FileChooserTest();
}regards,
Tim

Similar Messages

  • Calling File Chooser from a Button

    I create a new JFileChooser when a button in a main control panel is pushed but when the Chooser pops up it only responds to the keyboard and not to the mouse. How do I get the Chooser to respond to the mouse after it has been opened? (By the way, when I don't use the button to access the Chooser it works fine)
    Thanks.
    Scott

    I have no problem opening the file chooser using the button, the problem is that the file chooser does not listen to the mouse once it is opened. I know the file chooser normally works properly because when I comment out the buttons I can use the same file chooser method that I have created it works fine. Here is the code that I have for these parts:
    JButton getFile = new JButton("Get Files");
              JButton displayImage = new JButton("Display Scans");
              JButton calculate = new JButton("Calculate Rotations");
              panel.add(getFile, BorderLayout.WEST);
              panel.add(displayImage, BorderLayout.CENTER);
              panel.add(calculate, BorderLayout.EAST);     
              frame.getContentPane().add(panel, BorderLayout.CENTER);
              frame.pack();
              frame.setVisible(true);
              getFile.addActionListener(new ActionListener() {      
                   public void actionPerformed(ActionEvent e) {
                   JFileChooser choser2 = new JFileChooser();
                        File[] files = getDirectory(choser2);
    public static File[] getDirectory(JFileChooser fc){
         File[] files;
         files = new File[200];
         File file;
         fc.setMultiSelectionEnabled(true);
         JFrame frame = new JFrame("File Selector");
         int returnVal = fc.showOpenDialog(frame);
         if (returnVal == JFileChooser.APPROVE_OPTION) {
         files = fc.getSelectedFiles();
    } else {
         file = null;
    System.out.println("Open command cancelled by user.");
         return files;
    }

  • Disabling the button in a form

    Hi,
    May i know how to disabling the button in a form based on value of item in same itself. For eg: In a form an Select list item called 'Flag' which holds the values like Y and N. If Flag is N means the Button called 'Check' will be disable otherwise no need to disable the button 'Check'. It is our requirement, please help me if any one know the solution.
    Regards,
    Neel

    Hi Neel,
    You could set the conditional display of the button based on a Plsql function returning a boolean.
    Something along the lines of:
    IF :P1_ITEM = 'Some Value' THEN
    RETURN TRUE;
    ELSE
    RETURN FALSE;
    END IF;
    This will not display the button at all unless the P1_ITEM is equal to the value that you want.
    This is the simplest form that will get you going. If you want to "grey out" the button to leave it visible but disabled then you would need to investigate this a little further. I have seen some other threads that would probably help you out here but am no exert on javascript so just have a poke around.
    Hope this helps,
    Mike C

  • Disabling the Button in Ap invoice through custom pll

    Hi
    i have done one customization in ap invoices , such way that
    in supplier screen --> organization tab--> created the DFF for the supplier limit say 4000
    now in ap invoices screen, now i creating the PREPAYMENT, if the amount exceed that 4000, it will create hold, i written code for that
    now my problem is in HOLD TAB Release button is there,
    my requirement is RELEASE BUTTON SHOULD BE DISABLED until the until the amount is not rectified.
    in custom pll
    if form_name = 'APXINWKB' then
    if block_name = 'AP_HOLDS' then
    if event_name = 'WHEN-NEW-RECORD-INSTANCE' then
    l_invoice_id := name_in('INV_SUM_FOLDER.INVOICE_ID');
    l_release_hold :=xxcus.AKRUTI_PAYABLES_PKG.release_single_hold(l_invoice_id);
    if l_release_hold = 1 then
    fnd_message.set_string('Check the Advance amount enter greater than Supplier Limit or Advance amount greater than Purchase Order amount');
    fnd_message.show;
    set_item_property('APXHOLDS.AP_HOLDS_CONTROL.ACTION_BUTTON',ENABLED,PROPERTY_FALSE);
    elsif l_release_hold = 0 then
    set_item_property('APXHOLDS.AP_HOLDS_CONTROL.ACTION_BUTTON',ENABLED,PROPERTY_TRUE);
    end if;
    end if;
    end if;
    end if;
    the release button is not diabling since in the AP INVOICES forms, HOLDS is IN OBJECT GROUPS of that form the HOLD forms is APXHOLDS, how to disabled the button,
    it showing the message"'Check the Advance amount enter greater than Supplier Limit or Advance amount greater than Purchase Order amount"
    but it is not disabling the button

    are you using 11.5.10? If you are why not try the personalization features?

  • Enabling and disabling the button in the multi record block

    hi all,
    i am using
    Forms [32 Bit] Version 6.0.8.24.1 (Production)
    Oracle Database 10g Release 10.2.0.1.0 - Production
    i have a multi record block each block contains a button(button is to approve the record in terms of changing the status)
    i have the items like date,remarks and button
    the button should be enabled if the remarks is not null otherwise it should be disabled.
    for this in pre-record trigger i have written
    if :record is null then
       set_item_property('button',enabled,property_false);
    else
          set_item_property('button',enabled,property_false);
    end if;what problem is enable and disable is impacting on all the buttons in the block. in other words if first record's remarks is null then all the records button is disabled. if first record's remarks column is not null then all the records of the button column is enabled.
    i have to make enable and disable the button for the corresponding record.that means if first record's remarks column is not null then only first records button should be enabled others should be disabled.
    Thanks..

    You need to set the No. of items displayed to 1 as Ammad had said, additionally you can set the X and Y Position (Just Y will do and having fixed X) of the button depending upon the current record.
    can u explain this part alone bit more (setting the position of x and y)You need to calculate the variable Y_POS depending upon the current position of the cursor that is the current record.
    You can find the current record Y_POS using combination of
    V_CURRENT_RECORD := :SYSTEM.CURSOR_RECORD;
    V_TOP_RECORD := GET_BLOCK_PROPERTY ('BLOCK_NAME', TOP_RECORD);
    V_ITEM_Y_POS := GET_ITEM_PROPERTY ('ITEM_NAME', Y_POS);
    -- Also needs to add the Y_POS of the relative other items in the muti-record block
    V_HEIGHT := GET_ITEM_PROPERTY ('BUTTON_NAME', HEIGHT);
    -- Note :- TOP_RECORD  Returns the record number of the topmost visible record in the given block.
    V_Y_POS := V_ITEM_Y_POS + ((V_CURRENT_RECORD - V_TOP_RECORD) * V_HEIGHT);
    -- You will need to add Distance between Items in records if anyThen you can Set the current Y_POS of the button.
    SET_ITEM_PROPERTY ('BUTTON_NAME', Y_POS, V_Y_POS);
    [/code[
    Hope this helps
    Best Regards
    Arif Khadas
    Edited by: Arif Khadas on Feb 24, 2011 4:58 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to disable the button???

    Hi, guys.
    I searched the forum, but did not find anything about disabling the button. There are examples of disabling text areas... But when i tried to implement same technics to disable a button, it did not work.
    I have a page with two regions items region and buttons region. When page opens i want to check if P1_TXT_BOX in items region is empty and if yes, disable button P1_CMD_DOTHIS in buttons region. And then onBlur for P1_TXT_BOX, if it is not empty - enable the button.
    Pls, help...
    Thnks.
    Mike

    Hi,
    I have always struggled with buttons and javascript in APEX because of the way it generates the buttons (as a "button" not "submit").
    A way round it would be to create the buttons using html then disabling the accept button:
    <input type="submit" id="P1_DOWNLOAD" value="Download" onclick="swapButtonStatus();" />
    <input type="submit" id="P1_ACCEPT" value="Acc" onclick="swapButtonStatus();" />
    <script>
    document.getElementById('P1_ACCEPT').disabled="true";
    </script>
    You just need to put them in the region footer or somewhere applicable.
    And use the following javascript function in the HTML Header:
    function swapButtonStatus()
    var downloadButton = document.getElementById('P1_DOWNLOAD');
    var acceptButton = document.getElementById('P1_ACCEPT');
    if(acceptButton.disabled=="")
    downloadButton.disabled="";
    acceptButton.disabled="true";
    //you can submit the button using: then create a process that
    //runs when request=Accept
    doSubmit('Accept');
    else if(downloadButton.disabled=="")
    acceptButton.disabled="";
    downloadButton.disabled="true";
    //you can submit the button using: then create a process that
    //runs when request=Download
    doSubmit('Download');
    Hope this helps
    Graham.

  • Disabling the button till the response comes

    hi all
    i want the button to be disabled till the response has finished on clicking the button. Can anyone help how to do it.
    in java script it can be done, but it is painful for doing each and every form. so i want a centralized way for doing it.
    will the submit button help? we had lot of problem due to it when the load increased and several false records came due to clicking the button several times when response took a long time to come.
    in our project we will normal button and the action is executed using the action attribute.

    There is no other way than disabling the button with Javascript after onclick. Just create a simple function which does that and call that function in the onclick attribute.

  • How to disable the button in application toolbar in report pgm

    Can anyone help with How to disable the button in application toolbar in report pgm

    Hi,
    You can use it_excluding to disable button on the tool bar.You have to find the function code for the required button and append that function code to the it_excluding .The optional IMPORTING parameter IT_EXCLUDING is an internal table. It is only needed if the caller uses the list tool standard interface but wants to deactivate interface functions which he or she does not need.You can have your defined pf-status using I_CALLBACK_PF_STATUS_SET.
    SAMPLE PROGRAM
    tables spfli.
    type-pools: slis.
    DATA W_FCODE TYPE SLIS_EXTAB-FCODE.
    data: t_spfli TYPE SPFLI OCCURS 0 WITH HEADER LINE.
    select * from spfli into table t_spfli.
    data : t_excluding TYPE SLIS_T_EXTAB .
    W_fcode = '&OUP'.
    append w_fcode to t_excluding.
    W_fcode = '&ODN'.
    append w_fcode to t_excluding.
    call function 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_STRUCTURE_NAME = 'SPFLI'
    IS_LAYOUT =
    IT_FIELDCAT =
    IT_EXCLUDING = T_EXCLUDING
    tables
    t_outtab = T_SPFLI
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/99/49b844d61911d2b469006094192fe3/frameset.htm
    Regards,
    Priyanka.

  • Disable the buttons for creation using PFCG roles

    Hi SAP Experts,
       How to disable the buttons for creation using PFCG roles?
    Regards,
    Jaya

    Hi,
    u have to write the code in <b>at selection-screen output</b> event
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF  <b>P_PRINT</b> = 'X'.  " this is radiobutton
          IF screen-name = 'P_RANGE'.
            SCREEN-INPUT = 0.
          ENDIF.
          modify screen.
        ELSE.
          IF screen-name = 'S_LFDAT-LOW'.
            SCREEN-INPUT = 0.
          ENDIF.
          IF screen-name = 'S_LFDAT-HIGH'.
            SCREEN-INPUT = 0.
          ENDIF.
          IF screen-name = 'S_WERKS-LOW'.
            SCREEN-INPUT = 0.
          ENDIF.
          IF screen-name = 'S_WERKS-HIGH'.
            SCREEN-INPUT = 0.
          ENDIF.
          IF screen-name = 'P_LIFNR'.
            SCREEN-INPUT = 0.
          ENDIF.
          IF screen-name = 'S_BUKRS'.
            SCREEN-INPUT = 0.
          ENDIF.
          modify screen.
        ENDIF.
      ENDLOOP.
    Hope it helps.
    Regards,
    Sonika

  • Disabling the Button

    Hi
    i have done one customization in ap invoices , such way that
    in supplier screen --> organization tab--> created the DFF for the supplier limit say 4000
    now in ap invoices screen, now i creating the PREPAYMENT, if the amount exceed that 4000, it will create hold, i written code for that
    now my problem is in HOLD TAB Release button is there,
    my requirement is RELEASE BUTTON SHOULD BE DISABLED until the until the amount is not rectified.
    in custom pll
    if form_name = 'APXINWKB' then
                   ---if block_name = 'AP_HOLDS' then
              if event_name = 'WHEN-NEW-RECORD-INSTANCE' then
                   l_invoice_id := name_in('INV_SUM_FOLDER.INVOICE_ID');
              l_release_hold :=xxcus.AKRUTI_PAYABLES_PKG.release_single_hold(l_invoice_id);
              if l_release_hold = 1 then
                   fnd_message.set_string('Check the Advance amount enter greater than Supplier Limit or Advance amount greater than Purchase Order amount');
                                  fnd_message.show;                              
                                  set_item_property('APXHOLDS.AP_HOLDS_CONTROL.ACTION_BUTTON',ENABLED,PROPERTY_FALSE);     
              elsif l_release_hold = 0 then
                   set_item_property('APXHOLDS.AP_HOLDS_CONTROL.ACTION_BUTTON',ENABLED,PROPERTY_TRUE);      
              end if;
              -- end if;
                   end if;
                   end if;
    the release button is not diabling since in the AP INVOICES forms, holds is IN OBJECT GROUPS, how to disabled the button

    Hello,
    This is the standalone Forms forum, and you would increase chances to get an answer by posting in the APPS forum.
    Francois

  • Adobe Acrobat Add-On 11.0.6.70 will not allow me to download a .pdf file. Disabling the Add-On allows me to download the .pdf.

    I attempted to download a .pdf file and open it with Adobe Add-On 11.0.6.70 in FF 25.0.1 and got a message that the file was damaged and could not be repaired. I called the site's Tech Support and they requested that I try the download with another (Ugh!) browser and the download worked. I went back and disabled the Adobe Add-On in FF and the download worked in FF also. Not sure who developed the Add-On but whoever did so, left a bug in the process.

    HI central_texan,
    Please update to the latest version of Firefox by going to the About Firefox in the Firefox menu. If downloads hang at the last minute (just before reaching 100%), the cause might be antivirus software which tries to scan the file and during that process hangs the Firefox instance. It may also happen when the download becomes corrupt. What I want to know is in the System Requirements what " Firefox Extended Support Release" means.
    In order to fix the problem, try disabling the scanning as follows:
    # In the [[Location bar autocomplete|Location bar]], type '''about:config''' and press '''Enter'''. The about:config "''This might void your warranty!''" warning page may appear.
    # Click '''I'll be careful, I promise!''', to continue to the about:config page. A list of settings should appear
    # Filter the list by typing in the search bar at the top. Type in ''scanWhenDone''. You should now find the '''browser.download.manager.scanWhenDone''' preference.
    #Double-click on that preference to set the value to ''false''.
    #Next, try to download something and see if it still hangs.
    Please reply and tell us whether this helped you!

  • Can I disable the buttons on the side of my Nano 7?

    I keep my iPod Nano in my pocket frequently, and just about every time I do the device will start playing audio. After fiddling with it, I realized that I am pressing the "play" button just by moving my legs around. Is there any way to disable the play component on the volume button? The Settings menu is woefully sparse.

    You will need to have the iPhone's IMEI number registered with your service provider.  To fix your wi-fi try restarting your iPhone by holding down the on/off and the home buttons at the same time until you see the Apple logo.  If you are still having problems go into your settings>general>reset then tap reset network settings. 

  • Can I disable the button that opens my DVD Drive?

    The button on my dvd drive is so sensitive that it's hard to touch the side of my T510 withou accidentally opening the drive. VERRRy annoying.
    I'm loking for a way to disable the manual button.
    Is there a solution for this?

    I wrote LockCD application after giving up on finding a properly functioning software that would lock the CD ROM eject button which i hit quite frequently on my Lenovo T520 laptop. The main problem with the software found over the internet was that it wouldn't retain the lock state after Sleep/Resume. I made it freely available at http://sourceforge.net/p/lockcd/wiki/Home/

  • Disable the button in MPP

    Dear All,
    I am preparing a MPP in which i am using several buttons.
    I want to initially disable them and on particular event, I want to enable it.
    can any one please help me with the syntax to be used for this in MPP.
    Thanks
    Ankur

    Thanks Ravi
    its working now after some modification...
      LOOP AT SCREEN.
         if screen-name = 'FCT CODEE'.
           screen-INPUT = 0.
           modify screen.
           endif.
        endloop.
    Thanks a Lot
    Regards
    Ankur

  • Is it possible to disable the + button at the bottom of a view where Inline Editing in enabled?

    As per the title, I have a list view where Inline Editing is enabled. I need to know how to disable or hide the green plus icon at the bottom of the list (Add new item).

    Thank you Wendy! That solution works great.
    So all that is needed is this:
    <script
    src="http://code.jquery.com/jquery-1.10.2.min.js"
    type="text/javascript">
    </script>
    <style
    type="text/css">
    .ms-listviewtable
    img[alt='New']{
      display:none;
    </style>

Maybe you are looking for