Conditional Display : Différence entre versions

De Wiki
Aller à : navigation, rechercher
m (Admin a déplacé la page CONDITIONAL DISPLAY vers Conditional Display)
Ligne 25 : Ligne 25 :
 
    
 
    
 
</code>
 
</code>
 +
  
 
{{:user_manual:conditionaldisplay1.jpg?330|}} {{ :user_manual:conditionaldisplay2.jpg?330|}}
 
{{:user_manual:conditionaldisplay1.jpg?330|}} {{ :user_manual:conditionaldisplay2.jpg?330|}}

Version du 2 mai 2017 à 13:34

Conditional display is simply managed with « if » or « switch » and using the generic() method (or the display() method for specific treatments):

public class myPanel extends GPanel {

 GButton but1;
 GButton but2;
 GButton but3;
 GCheckBox cb;
 public myPanel() {
   but1 = new GButton("Bouton 1");
   but2 = new GButton("Bouton 2");
   but3 = new GButton("Bouton 3");
   cb   = new GCheckBox("Display button 3"); 
 }
 public void generic() throws GException {
   put(but1);
   put(but2);
   if ( cb.isSelected() ) { put(but3); } // Easy, isn't it ?
   put(cb);
  }
  


User manual:conditionaldisplay1.jpg?330 User manual:conditionaldisplay2.jpg?330

//Return to the introduction ↑//\\ //Go to the next page →//