swing - Java code needs to restrict the user input -


i got serious problem on code.

i got swing jdbc code need fill table of names, addresses , id person, different table's id. created swing input code it, however, wish not include id number's possibility - therefore, make swing have nothing else name , address being able set used, , not show id @ all.

is there possibility it?

the creation of new partner, has name, address , identitynumber strings, private , getters , setters public.

{      protected final string frame_title = "vehicle repository";     private databasehandler dbhandler;     private jtabbedpane tabbedpane;     private jtable partnertable;     private jpacontrolledtablemodel<partner> partnertablemodel;      @override     public void oncreate() {         setdefaults(frame_title);         setdefaultcloseoperation(dispose_on_close);         dbhandler = new databasehandler();         dbhandler.open();         tabbedpane = new jtabbedpane();          partnertablemodel = new asyncfullqueryingtablemodel<>(dbhandler.getpartnerjpacontroller(), dbhandler.getentityclassestocontrollersmap());         partertable = new jtable(partnertablemodel);          tabbedpane.addtab("partners", new jscrollpane(partertable));         getcontentpane().add(tabbedpane, borderlayout.center);     }      @override     public jmenubar createjmenubar() {         jmenubar menubar = new jmenubar();         jmenu menu = new jmenu("data");         menubar.add(menu);         jmenuitem menuitem;         menuitem = new jmenuitem(newpartneraction);         menu.add(menuitem);         return menubar;     }     private action newpartneraction = new abstractaction("new parnter") {         @override         public void actionperformed(actionevent e) {             partner partner = new partner();             entityeditordialog<partner> editordialog = entityeditordialogfactory.createeditordialog(partner, dbhandler.getpartnerjpacontroller());             editordialog.setvisible(true);             if (partner.getid() != null) {                 partnertablemodel.refresh();             }         }     };      private string getstring(string message) {         return joptionpane.showinputdialog(rootpane, message, "data input", joptionpane.question_message);     }      private partner getpartner(string message) {         object[] partners = dbhandler.getpartnerjpacontroller().findentities().toarray();         if (partners.length == 0) {             return null;         } else {             return (partner) joptionpane.showinputdialog(rootpane, message, "data input", joptionpane.question_message, null, partners, partners[0]);         }     }      @override     public void dispose() {         dbhandler.close();         super.dispose();     } }      }; 

and not show id @ all

you can remove column display in jtable:

table.removecolumn( table.getcolumn(...) ); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -