Advertisement
firas-hakimi

Untitled

Apr 24th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.92 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package com.codesmuggler5.socialpro;
  7.  
  8. import com.codename1.components.FloatingActionButton;
  9. import com.codename1.components.SpanLabel;
  10. import com.codename1.io.Preferences;
  11. import com.codename1.ui.Button;
  12. import com.codename1.ui.Calendar;
  13. import com.codename1.ui.Command;
  14. import com.codename1.ui.Component;
  15. import com.codename1.ui.Container;
  16. import com.codename1.ui.Dialog;
  17. import com.codename1.ui.Display;
  18. import com.codename1.ui.FontImage;
  19. import com.codename1.ui.Form;
  20. import com.codename1.ui.Graphics;
  21. import com.codename1.ui.Image;
  22. import com.codename1.ui.Label;
  23. import com.codename1.ui.Tabs;
  24. import com.codename1.ui.TextField;
  25. import com.codename1.ui.Toolbar;
  26. import com.codename1.ui.animations.ComponentAnimation;
  27. import com.codename1.ui.events.ActionEvent;
  28. import com.codename1.ui.layouts.BorderLayout;
  29. import com.codename1.ui.layouts.BoxLayout;
  30. import com.codename1.ui.layouts.FlowLayout;
  31. import com.codename1.ui.layouts.GridBagLayout;
  32. import com.codename1.ui.layouts.GridLayout;
  33. import com.codename1.ui.layouts.LayeredLayout;
  34. import com.codename1.ui.util.Resources;
  35.  
  36. /**
  37. *
  38. * @author Firas
  39. */
  40. public class TestTheme extends Form{
  41.  
  42. final Resources res;
  43. private Toolbar tb;
  44. private Command cmd1,cmd2,cmd3,cmd4;
  45. private int circleMaskWidth=150;
  46. private int circleMaskHeight=150;
  47. private Object circleMask;
  48.  
  49. public TestTheme(Resources res) {
  50. super("Projects");
  51. super.setUIID("project");
  52. this.res = res;
  53. setLayout(new BorderLayout());
  54. Container north = new Container(new BoxLayout(BoxLayout.Y_AXIS));
  55. Container row = new Container(new GridLayout(1, 2));
  56.  
  57. Label nbrProjects = new Label("Projects");
  58. nbrProjects.setUIID("topLab");
  59. Label nbrP = new Label("30");
  60. nbrP.setUIID("numbLab");
  61. Container col1Con = new Container(new BoxLayout(BoxLayout.Y_AXIS));
  62. Container col11 = new Container(new FlowLayout(Component.CENTER));
  63. col1Con.setUIID("col1");
  64. col11.addComponent(nbrProjects);
  65. col1Con.addComponent(col11);
  66. Container col12 = new Container(new FlowLayout(Component.CENTER));
  67. col12.addComponent(nbrP);
  68. col1Con.addComponent(col12);
  69.  
  70.  
  71. Label completedProjects = new Label("Completed");
  72. completedProjects.setUIID("topLab");
  73. Label nbrC = new Label("9");
  74. nbrC.setUIID("numbLab");
  75. Container col2Con = new Container(new BoxLayout(BoxLayout.Y_AXIS));
  76. Container col21 = new Container(new FlowLayout(Component.CENTER));
  77. col2Con.setUIID("col2");
  78. col21.addComponent(completedProjects);
  79. col2Con.addComponent(col21);
  80. Container col22 = new Container(new FlowLayout(Component.CENTER));
  81. col22.addComponent(nbrC);
  82. col2Con.addComponent(col22);
  83.  
  84. row.addComponent(col1Con);
  85. row.addComponent(col2Con);
  86. north.addComponent(row);
  87.  
  88. this.addComponent(BorderLayout.NORTH,north);
  89.  
  90. Container center = new Container(new BoxLayout(BoxLayout.Y_AXIS));
  91. center.setUIID("Center");
  92. center.setScrollableY(true);
  93. Container centerCon = new Container(new BoxLayout(BoxLayout.Y_AXIS));
  94.  
  95.  
  96.  
  97. for(int i=0;i<10;i++){
  98. Container conn1 = new Container(new GridLayout(1, 4));
  99. conn1.setUIID("conn1");
  100. Label l0 = new Label(""+i);
  101. Label l = new Label("10:35");
  102. Label l1 = new Label("zzzzzz");
  103. Label l2 = new Label("Done");
  104. conn1.addComponent(l0);
  105. conn1.addComponent(l);
  106. conn1.addComponent(l1);
  107. conn1.addComponent(l2);
  108. centerCon.addComponent(conn1);
  109. }
  110.  
  111. center.addComponent(centerCon);
  112.  
  113. this.addComponent(BorderLayout.CENTER, center);
  114.  
  115. Image dukeImage = Image.createImage(circleMaskWidth, circleMaskHeight, 0);
  116. Graphics g = dukeImage.getGraphics();
  117. g.drawImage(res.getImage("Logo.png"), 0, 0, circleMaskWidth, circleMaskHeight);
  118. Label duke = new Label(dukeImage);
  119. Label circle = new Label(res.getImage("circle-line.png"));
  120. Container dukeImageContainer = LayeredLayout.encloseIn(duke, circle);
  121. Label name = new Label("Duke");
  122. Container dukeContainer = BorderLayout.west(BoxLayout.encloseY(dukeImageContainer, name));
  123. Container dukeCon = new Container(new FlowLayout(Component.CENTER));
  124. dukeCon.addComponent(dukeContainer);
  125. dukeCon.setUIID("ProfileContainer");
  126.  
  127. this.getToolbar().addComponentToSideMenu(dukeCon);
  128. this.getToolbar().addMaterialCommandToSideMenu("CodenameOne.com",
  129. FontImage.MATERIAL_WEB, e -> Display.getInstance().execute("https://www.codenameone.com/"));
  130. this.getToolbar().addMaterialCommandToSideMenu("Getting Started", FontImage.MATERIAL_WEB, e -> Display.getInstance().execute("https://www.codenameone.com/"));
  131. this.getToolbar().addMaterialCommandToSideMenu("Developer Guide", FontImage.MATERIAL_WEB, e -> Display.getInstance().execute("https://www.codenameone.com/files/developer-guide.pdf"));
  132. this.getToolbar().addMaterialCommandToSideMenu("JavaDoc (Reference)", FontImage.MATERIAL_WEB, e -> Display.getInstance().execute("https://www.codenameone.com/javadoc/"));
  133. this.getToolbar().addMaterialCommandToSideMenu("Source Code", FontImage.MATERIAL_WEB, e -> Display.getInstance().execute("https://github.com/codenameone/KitchenSink"));
  134. //Display.getInstance().share("Check out the kitchen sink app from Codename One: " + getAppstoreURL(), null, null);
  135.  
  136.  
  137. this.getToolbar().setVisible(false);
  138.  
  139. }
  140. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement