Disable jTable so that user cant enter any value & is stopped to do so

Hi
my program has 2 options for user: 1. To enter a list of values(for which im using table), 2. To use default values embedded in the program.
for these options i have used jRadioButtons n ButtonGroup.When user selects DefaultValues radiobutton program uses default values,but when it selects DefaultValues radiobutton i want to disable the Table such that the user cannot enter any value in the cell and it should be visible to the user too that the table has been disabled.
The user should only b able to enter values in table if he/she selects the first option's radiobutton.
note: im using DefaultTableModel, if somebody can tell me any way other than using isCellEditable(),it would be more appreciatable
thanks

Erm i use netbeans..... the program i am pasting is really small in netbeans but when it is pasted somewhere else alot of code appears.....if its not right to do,tell me what to do....to make it more smaller
import java.awt.Color;
import java.awt.Component;
import predoms.DisabledPanel;
* @author Me
public class test extends javax.swing.JFrame {
    /** Creates new form test */
    public test() {
        initComponents();
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
        buttonGroup1 = new javax.swing.ButtonGroup();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        buttonGroup1.add(jRadioButton1);
        jRadioButton1.setText("default");
        jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton1ActionPerformed(evt);
        buttonGroup1.add(jRadioButton2);
        jRadioButton2.setText("use table");
        jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton2ActionPerformed(evt);
        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"a", null},
                {"b", null},
                {"c", null},
                {"d", null}
            new String [] {
                "Title 1", "Title 2"
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Integer.class
            boolean[] canEdit = new boolean [] {
                false, false
            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
        jScrollPane1.setViewportView(jTable1);
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(72, 72, 72)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jRadioButton1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jRadioButton2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(74, Short.MAX_VALUE))
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(136, 136, 136)
                .addComponent(jRadioButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jRadioButton2))
                .addContainerGap(193, Short.MAX_VALUE))
        pack();
    }// </editor-fold>
    private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt)
        DisabledPanel disabledPanel = new DisabledPanel(jTable1);
        disabledPanel.setDisabledColor(Color.lightGray);
        Component addu = this.add(disabledPanel);
        disabledPanel.setEnabled(false);        
    * @param args the command line arguments
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new test().setVisible(true);
    // Variables declaration
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    // End of variables declaration
}

Similar Messages

  • How to force the user to enter a value in the prompt

    Is there a way to force the user to enter a value in the prompt before they run the report?
    We have a customer specific dashbaord. The user has to enter a customer number in Dashbaord prompt on a first page of the dashboard. We store that value in a presentation variable. That presenatation variable value is being referenced in all the other pages of the dashabord. If the user does not enter a values in the first page and directly navigates to the other pages on the dashbaord, the reports on the other pages start to run for all the customers. Is there a way to force the customer to enter a value in the prompt before running any of the reports on the dashboard?
    Thanks!

    by Answer prompts, do you mean Column prompt?
    I can not use Column prompt in this senario as the user should not have to enter the same customer number over and over again when he navigates from one page to another on the same dashboards. If there is a way to default the column prompts then this would be an acceptable solution.
    I have already defaulted the prompt to a value as suggested in hte blog, but the issues occurs when the user erases the defaulted value. Is there are way to set the default value within the report?
    Can you please explaing mroe about option 3 regarding Java Script. Also please let me know what other options there are so that I can check whether they will fit my needs.
    Thank you very much!

  • Force a user to enter a value for a parameter.

    Hi,
    I have a report with a bunch of parameters and I want to force the user to enter values for two parameters amongst all of them. Like for example when the user doesn't select values for those 2 parameters he should get a dialog box saying "please enter value for xyz parameter" or something like that, which will force the user to enter a value for the parameters before he can see the report.
    Please let me know if BI Publisher can do this.
    Thanks,
    DY

    Thanks for your replies BIPUser. I have recently started working on BI Publisher without a lot of help around.
    The information in the link is what I was thinking of, if there is no such feature I'll have a default value for those 2 parameters.
    Thanks,
    DY

  • How can we prevent a user from entering a value in Parameter Field?

    how can we prevent a user from entering a value in Parameter Field and Select-options Field?

    make it invisible, make it inactive, make it display only.
    if the field is not there or not to be seen the user WILL have problems inputting data.
    BUT once the field is there you can NOT prevent that the user fills it with data.
    all you can do is on PAI check if the data the user inputted was good or bad, and clear his inputs, but you can NOT prevent him inputting something.

  • I'm using photoshop elements 2.0 and window vista.  when i want to crop i cannot enter any values in

    I'm using photoshop elements 2.0 and window vista.  when i want to crop i cannot enter any values in the width and height boxes.  the cursor won't enter.  same thing with resolution.  what did i do?  what's wrong?

    The first thing you might try is resetting the Crop Tool by right clicking on the crop icon in the tool options bar and choosing Reset Tool.
    If that doesn't work then the next thing is to reset the photoshop elements 2 settings file by holding down
    the Shift+Ctrl+Alt keys just after clicking or double clicking on the pse 2 shortcut.
    Keep holding the keys until a dialog appears ask if you want to delete the photoshop elements settings file
    and click yes in the dialog.

  • On and iPad how to Allow User To Enter Custom Text  (Dropdown only) Enables users to enter a value other than the ones in the list.

    On an iPad, how do I :
    Allow User To Enter Custom Text
    (Dropdown only) Enables users to enter a value other than the ones in the list.'?

    Are you using the built-in Currency option under the Format tab? If so,
    what you're describing should not happen.

  • I can't enter any values in JTextField after loading the flash files.

    Hi to all,
    In my application I have two panels. One panel has JTextField and another panel i loaded flash files.
    The flash files are build by CS4. I'm using JDIC to load the flash files. While open the application i loaded flash file and I try to enter any input in the textfiled, but I can't. After minimize and maximize the application I can enter the values. This problem happens only after I change the jre version from 1.6 to 1.7.
    While loading flash files I'm getting the below exception.
    org.jdesktop.jdic.init.JdicInitException: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
         at org.jdesktop.jdic.init.JdicManager.initBrowserNative(Unknown Source)
         at org.jdesktop.jdic.browser.WebBrowser.<clinit>(Unknown Source)
    pls give me a solution.
    Thanks in advance...:)

    I can't enter any values in JTextField after loading the flash files., locking.

  • I can't enter any value in the Text field, after loading flash files

    Hi to all,
    In my Java application, I'm using a text field and a panel to load flash files. I'm using JDIC 0.9.1 to load the flash files in the panel. The flash files are created by Flash CS4.
    While running the application, I can't enter any value in the Text field, after minimize and maximize the application I can enter the values.
    This problem happens after change the jre version from 1.6 to 1.7.
    I'm getting the following exception while running the application.
    org.jdesktop.jdic.init.JdicInitException: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
    at org.jdesktop.jdic.init.JdicManager.initBrowserNati ve(Unknown Source)
    at org.jdesktop.jdic.browser.WebBrowser.<clinit>(Unkn own Source)
    pls give me a solution.
    Thanks in advance...:)

    I can't enter any values in JTextField after loading the flash files., locking.

  • How to get last 24 months data (if user not enter any kind of information)

    Hi all,
    I am want a report such that
    1. if user does not enter months he has to get last 24 months data(from current month)
    eg1.
    Sales
    currentmonth     300
    currentmonth-1  400
    currentmonth-20 500
    2. if user  enter months he has to get required months data(from current month)
    eg1.assume that user entered the interval of last two months.
    Sales
    currentmonth     300
    currentmonth-1  400.
    friends please me in desinging this query.
    It's very urgent,waiting for responses.
    Thanks,
    James.

    Hi james,
    1. if user does not enter months he has to get last 24 months data(from current month)
    ANS: U have to create variable Of  Currentmonth with The following
             Process Type: SAP Exit
             Variable Represent: Single value
            Variable Entry: Optional
    Check chekboxes for <b>Ready for Input</b> & Can be change in Query navigation.
    b) After this u have to give offsets by restricting this variable
    2. if user enter months he has to get required months data(from current month)
    ANS:
    For this U have to use Process Type: User-exit( User Entry)
    & After that specify the offsets by restriction.
    Thanks,
    kiran.
    Message was edited by:
            kiran manyam

  • Compare all values that user has enter or not.

    Hi experts and abap lovers!!!
    I like to CHECK THAT ALL FIELDS WHEATER THE USER HAS ENTERED OR NOT. IF YES I HAVE TO INSERT THE VALUES IN THE TABLE..
    For eg.
    IF ZTABLENAME-FIELD1 <> '0'  AND ZTABLENAME-FIELD2 <> '0' AND ZTABLENAME-FIELD3 <> '0'.
    INSERT ZTABLENAME.
    ELSE.
    MESSAGE 'FILL IN ALL REQUIRED FIELDS' TYPE 'E'.
    END IF.
    Am searching answer for long time. above mentioned when i execute it says
    RELATIONAL OPERATOR  AND IS NOT USED.
    Kindly help me out in this regard.

    HI,
    Instead of comparing with 0 check with Initial value
    IF NOT ZTABLENAME-FIELD1 IS INITIAL AND
        NOT ZTABLENAME-FIELD2 IS INITIAL AND
        NOT  ZTABLENAME-FIELD3 IS INITIAL .
    INSERT ZTABLENAME.
    ELSE.
    MESSAGE 'FILL IN ALL REQUIRED FIELDS' TYPE 'E'.
    END IF.
    As per your code your missing relational operator
    IF ZTABLENAME-FIELD1 NE '0' AND
       ZTABLENAME-FIELD2 NE '0' AND
       ZTABLENAME-FIELD3 NE '0'
    INSERT ZTABLENAME.
    ELSE.
    MESSAGE 'FILL IN ALL REQUIRED FIELDS' TYPE 'E'.
    END IF.

  • HT4972 my ipod touch wont let me update IOS and becuase of that i cant download any apps

    my ipod touch wont let me update IOS and becuase of that i cant download anything of the app world is there anyway of helping me

    Do you have a 2G iPod. Those can only go to iOS 4.2.1.
    A 1G can only go to 3.1.3
    A 3G only to 5.1.1
    Identifying iPod models
    What version of iTunes is on the computer? The latest is 11
    iPod touch (3rd generation)
    iPod touch (3rd generation) features a 3.5-inch (diagonal) widescreen multi-touch display and 32 GB or 64 GB flash drive. You can browse the web with Safari and watch YouTube videos with Wi-Fi. You can also search, preview, and buy songs from the iTunes Wi-Fi Music Store on iPod touch.
    The iPod touch (3rd generation) can be distinguished from iPod touch (2nd generation) by looking at the back of the device. In the text below the engraving, look for the model number. iPod touch (2nd generation) is model A1288, and iPod touch (3rd generation) is model A1318.

  • What is the best way to prompt a Form user to enter a value

    Hi,
    I apologize in advance if this topic has already been raised on the forum - I've done a search but couldn't find anything.
    Basically I would be interested in finding out if there is a 'best way' to prompt and accept an entered value from a user. I am just experimenting at the moment with asking a user to enter a date value which will then be used in code. I am running Form 9.0.4.
    Any suggestions or links would be gratefully accepted,
    regards,
    Kevin.

    I am rather puzzled by the question. Forms primary use is to accept user input, and then respond to that input. It is no wonder a search does not turn anything up.
    So there are a number of ways to accept input. The first that comes to mind is a simple input field on the canvas with some prompt text next to it.
    I don't think there really is a "best practice". It really depends on what your form is doing.
    If you explained what you mean by "which will then be used in code", or described what your form needs to do, then you would get some good suggestions.

  • How to allow user to enter new values in a segmnt which's having a ValueSet

    Hi Gurus
    I am having a DFF segment where user needs the following validation. I have to check whether the value entered by user is having status number as 5 in a custom table. I can do this by Table type Validation.
    But the problem here is, they should also be able to enter new values which not in that table.
    How i can achieve this. Appreciate your help on this.
    Thanks.
    Praveen

    Value sets allow only for standar list for validation, not a combobox that is what may help You to achieve what You want. You either have a restricted list or an open field to type whatever matches the format restrictions.
    For what You specify, I see no reason on having a table validation is the user can after all enter new values, perhaps it's to have the table values as references and avoid duplicates. Workarounds may be:
    Add an "others" value to the table, and enable another segment to enter new values and add custom validation to avoid duplicates and insert the new values to the table for future use.
    Have an independent value set and add a customization to avoid duplicates (more difficult considering typos) and insert new values.

  • How to allow user to enter multiple values?

    Hi, can someone tell me how I can allow user to select multiple values from a selection screen. To be more clear, I have to display 4 values on the selection screen and want to allow user to select 2 or 3 values from it. It will be very helpful if someone could tell me how to do it.
    Thanks in advance,
    pushpa

    hi mahesh,
    pls c the code below. this is what i have written in my program. when i run this program it is showing only one value and that too only the first one '1234'. i want that it display all the values that i gave in the initialization part.
    please help.
    thanks,
    pushpa
    SELECTION-SCREEN BEGIN OF BLOCK enter_data WITH FRAME TITLE text-001.
    SELECT-OPTIONS skunnr FOR kna1-kunnr.
    SELECTION-SCREEN END OF BLOCK enter_data.
    INITIALIZATION.
    skunnr-low = '1234'.
    skunnr-sign = 'I'.
    skunnr-option = 'EQ'.
    APPEND skunnr.
    skunnr-low = '9824'.
    skunnr-sign = 'I'.
    skunnr-option = 'EQ'.
    APPEND skunnr.
    skunnr-low = '8756'.
    skunnr-sign = 'I'.
    skunnr-option = 'EQ'.
    APPEND skunnr.
    skunnr-low = '6534'.
    skunnr-sign = 'I'.
    skunnr-option = 'EQ'.
    APPEND skunnr.

  • Want to restrict user form putting any value in condition in po

    Dear all,
    ply help on this matter.
    i want to restrict person for put any value in condition tab for po.
    let say i am putting "FRC1" condition and value let say 5rs then i should get an error saying your are not authorised.
    puprose:condition like FRC1 ETC should not be allowed to change.
    regards
    amey

    Hi,
    To restrict any manual entries for a Condition type, In that condition type under Changes which can be made maintain 'D' for Manual entries option.
        Along with this maintain the condition record for that perticular vendor for the amount which has to be paid for Freight.
    Regards,
    Vijay

Maybe you are looking for

  • Missing plug-ins CS5 - help needed

    In the filter menu I haven't got the first plug-ins. I have blur, noise, pixelate, sharpen, stylize, other and that's all. Where are the others and, more importantly, how can I get them?

  • Opening new window from separate class

    Hello. I am currently writing a program that should be able to open a new window. Upon clicking a button in the first window, a second window should open up. The second window has to contain it's own buttons and methods, and upon clicking the button

  • Best Final Cut export to iDVD, 16:9

    I apologize if this has been covered a lot, but I've struggled with this question for a couple of years. How do you get a 16:9, 23.98fps Sequence, to export "as is" to iDVD? I've tried many different settings, but it seems that iDVD wants to interpre

  • Timed webcam video

    is there a way for me to set my webcam so it records videos for a certain length of time during the day?

  • Referencing and toggling mulitple regions from side bar.

    This is on APEX 32 10G XE. My page looks like this <--------------Sidebar Region------------>     <-------------------------------------------- A chart Region from link1---------------------------------> |   _link1_                              |