Results 1 to 10 of 10
  1. #1
    mlibot is offline Member
    Join Date
    Sep 2009
    Posts
    44
    Rep Power
    0

    Default how to enabled, disabled radio buttons

    I creating a program using netbeans...

    my program is for browsing a single file and directory.
    in my frame i have the following components which are:

    3 TextField, 3 Buttons and 2 RadioButtons. i want to make is, when i click radiobutton1 the textfield2 and button2 will be disabled. and then when i click radiobutton2 the textfield1 and button1 will be disabled.

    thanks for reply.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    So what have you done so far and where are you stuck?
    Didn't you ask this very same question before in another thread? Why are you starting a new thread then?

  3. #3
    mlibot is offline Member
    Join Date
    Sep 2009
    Posts
    44
    Rep Power
    0

    Default

    I'm start a new thread because i am going this to the netbeans..
    i stuck for radio buttons for how to enabled and disabled vice versa..
    i dont know how to write my codes because in the netbeans have a default class.. like this
    Java Code:
    private void RadioSFileActionPerformed(java.awt.event.ActionEvent evt) {
            // TODO add your handling code here:
            
        }
    i do not know how to insert my codes
    Java Code:
    ButtonGroup btnGroup = new ButtonGroup();
          btnGroup.add(RadioSFile);
          btnGroup.add(RadioDir);
          RadioSFile.addItemListener(new ItemListener() 
          {
             public void itemStateChanged(ItemEvent e) {
                if (e.getStateChange() == ItemEvent.SELECTED) {
                   TxtFldDir.setEnabled(false);
                   BrowseDir.setEnabled(false);
                   TxtFldSFile.setEnabled(true);
                   BrowseSFile.setEnabled(true);
                }
             }
          });
          RadioDir.addItemListener(new ItemListener() 
          {
             public void itemStateChanged(ItemEvent e) {
                if (e.getStateChange() == ItemEvent.SELECTED) {
                   TxtFldSFile.setEnabled(false);
                   BrowseSFile.setEnabled(false);
                   TxtFldDir.setEnabled(true);
                   BrowseDir.setEnabled(true);
                }
             }
          });

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    So don't use netbeans if you already have code written outside netbeans. Otherwise you first have to go through a Netbeans tutorial to find out how it works.

  5. #5
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    842
    Rep Power
    6

    Default

    Still ur code is not complete.send the code fully.
    Ramya:cool:

  6. #6
    mlibot is offline Member
    Join Date
    Sep 2009
    Posts
    44
    Rep Power
    0

    Default

    Im done with my problem about enabled and disabled radio buttons...
    i have my problem about browsing... how can i browse a directory..? not only file but the directory or folder..

    do you have idea.? or do you know on this..?

    please help... this is my last problem... do you tutorial on this..?

  7. #7
    mlibot is offline Member
    Join Date
    Sep 2009
    Posts
    44
    Rep Power
    0

    Default

    I creating a program and I'm done with my design. my program contains 2radiobuttons, 3textfields and 3buttons. the flow of my program is to browse a single file and directory...

    my question is? it is possible to browse a directory..?

    do you have tutorial on this..? on how to make this possible..?

    please help.. i need your idea.

    thanks.

  8. #8
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    842
    Rep Power
    6

  9. #9
    mlibot is offline Member
    Join Date
    Sep 2009
    Posts
    44
    Rep Power
    0

    Default

    Thanks for the help... but i want to browse a directory or folder and then they list the contents of the directory or a folder... it is possible..?

  10. #10
    mlibot is offline Member
    Join Date
    Sep 2009
    Posts
    44
    Rep Power
    0

    Default

    hello...

    how to get the current path of the directory and it will display on the textfield...
    this is my codes:

    Java Code:
     private void BrowseDirActionPerformed(java.awt.event.ActionEvent evt) {
            // TODO add your handling code here:
            JFileChooser JFileChooseDir = new JFileChooser();
            JFileChooseDir.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    		int result = JFileChooseDir.showDialog(this, "Open/Save");
    		if (result == JFileChooser.APPROVE_OPTION) {
                    File file2 = JFileChooseDir.getCurrentDirectory();
    		if (file2.isDirectory()){
                    System.getProperty("user.dir");
                    TxtFldDir.setText(file2.getPath());
                }
                    }
        }
    i need answer asap...

    thanks for your help

Similar Threads

  1. Java Radio Buttons
    By dbashby in forum New To Java
    Replies: 4
    Last Post: 09-21-2009, 01:07 AM
  2. [SOLVED] Radio Buttons
    By dbashby in forum New To Java
    Replies: 2
    Last Post: 04-04-2009, 04:44 PM
  3. Deselect Radio Buttons
    By linux1man in forum AWT / Swing
    Replies: 7
    Last Post: 03-21-2009, 05:01 AM
  4. How to use Radio Buttons
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-25-2008, 03:26 PM
  5. radio buttons and paint
    By gtraylo in forum Java Applets
    Replies: 1
    Last Post: 04-19-2008, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •