java - Hiding a JButton -


i'm using netbeans , i'm trying make button hide based on value of array in class. basically, if array has value of on 0 button should visible. if not, should hidden. ideas? thanks!

this code button:

setvisible(false);     total totaltab= new total();     totaltab.setvisible(true); 

and array targeting towards, it's in separate class.

   private double[][] entree = new double[][]{     // {burgers,cheeseburgers,veggie burgers, fish sandwich}     //sold @     //{$4.99, $3.29, $4.50, $2.00}     //respectively     {0, 0, 0, 0},     {4.99, 3.29, 4.50, 2.00} 

this project pos machine "total" button doesn't appear unless there active order. (e.g. 2d array in order class has value greater it's default 0)

in class holds array need declare function returns array.

something like:

public double[][] getarray(){     return entree; } 

then in class containing button need create instance of class holds array.

something like:

classholdingarray classvariable = new classholdingarray(); 

then able access array calling:

classvariable.getarray(). 

once have array can check each value , when @ condition met can set button visible/invisible.

if(classvariable.getarray()[index1][index2] > 0){     button.setvisible(true) } else{     button.setvisible(false) } 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -