Guest User

Untitled

a guest
Nov 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. JButton btn = new JButton("OK");
  2. btn.addActionListener(
  3. new ActionListener(){
  4. public void actionPerformed(ActionEvent e){
  5.  
  6. String currentCountry = (String)cb.getSelectedItem();
  7. double percentage = 0.00;
  8.  
  9. if(currentCountry.equals("Brazil") || currentCountry.equals("Argentina")) {
  10. cb2.removeAllItems();
  11. for(int i = 0; i < choicesSouthAmerica.length; i++) {
  12. cb2.addItem(choicesSouthAmerica[i]);
  13. }
  14. }
  15. else {
  16. cb2.removeAllItems();
  17. for(int i = 0; i < choicesEurope.length; i++) {
  18. cb2.addItem(choicesEurope[i]);
  19. }
  20. }
  21.  
  22. btn.setEnabled(false);
  23. btn2.setEnabled(true);
  24. if(currentCountry.equals("Brazil") || currentCountry.equals("Argentina")){
  25. percentage = 1/5;
  26.  
  27. }
  28. else{
  29. percentage = 1/8;
  30.  
  31. }
  32. }
  33.  
  34.  
  35. }
  36.  
  37.  
  38.  
  39. );
Add Comment
Please, Sign In to add comment