Advertisement
Guest User

dqdqwd

a guest
Mar 25th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. import javax.swing.*;
  2.  
  3. public class ModelFunctions {
  4. private String fullName;
  5. private String shortName;
  6. ModelFunctions(String fullName,String shortName){
  7. this.fullName=fullName;
  8. this.shortName=shortName;
  9. }
  10. ModelFunctions(){
  11.  
  12.  
  13. }
  14.  
  15. public String getFullName() {
  16. return fullName;
  17. }
  18.  
  19. public String getShortName() {
  20. return shortName;
  21. }
  22.  
  23. public void setFullName(String fullName) {
  24. this.fullName = fullName;
  25. }
  26.  
  27. DefaultListModel<ModelFunctions> listModel=new DefaultListModel<ModelFunctions>();
  28.  
  29.  
  30. DefaultListModel<ModelFunctions> returnList(){
  31. listModel.addElement(new ModelFunctions("sin()","sinus"));
  32. listModel.addElement(new ModelFunctions("cos()","cosinus"));
  33. listModel.addElement(new ModelFunctions("tg()","tangens"));
  34. listModel.addElement(new ModelFunctions("ctg()","cotangens"));
  35. listModel.addElement(new ModelFunctions("ln()","natural logarithm"));
  36. listModel.addElement(new ModelFunctions("*pi","multiplication by pi"));
  37. listModel.addElement(new ModelFunctions("*e","multiplication by e"));
  38. listModel.addElement(new ModelFunctions("*[L]","multiplication by const Levy"));
  39. listModel.addElement(new ModelFunctions("+","addition"));
  40. listModel.addElement(new ModelFunctions("-","subtraction"));
  41. listModel.addElement(new ModelFunctions("*","multiplication"));
  42. listModel.addElement(new ModelFunctions("","Last result"));
  43. return listModel;
  44. }
  45. public void lastResult(String result){
  46. listModel.get(11).setFullName(result);
  47. }
  48. @Override
  49. public String toString(){
  50. return shortName;
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement