Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Exam - MyApplication.java
- // https://imgur.com/a/5IzPju5
- package com.mycompany.myapp;
- import com.codename1.components.ImageViewer;
- import static com.codename1.ui.CN.*;
- import com.codename1.ui.Display;
- import com.codename1.ui.Form;
- import com.codename1.ui.Dialog;
- import com.codename1.ui.Label;
- import com.codename1.ui.plaf.UIManager;
- import com.codename1.ui.util.Resources;
- import com.codename1.io.Log;
- import com.codename1.ui.Toolbar;
- import java.io.IOException;
- import com.codename1.ui.layouts.BoxLayout;
- import com.codename1.io.NetworkEvent;
- import com.codename1.ui.ComboBox;
- import com.codename1.ui.Container;
- import com.codename1.ui.EncodedImage;
- import com.codename1.ui.Image;
- import com.codename1.ui.URLImage;
- import com.codename1.ui.events.ActionEvent;
- import com.codename1.ui.events.ActionListener;
- import com.codename1.ui.layouts.FlowLayout;
- import javafx.scene.image.ImageView;
- /**
- * This file was generated by <a href="https://www.codenameone.com/">Codename One</a> for the purpose
- * of building native mobile applications using Java.
- */
- public class MyApplication {
- private Form current;
- private Resources theme;
- EncodedImage enc;
- Image imgs;
- ImageViewer imgview;
- Image imgs1;
- ImageViewer imgview1;
- String url= "http://localhost/codenameoneRessource/img1.png";
- String url1= "http://localhost/codenameoneRessource/img2.png";
- public void init(Object context) {
- // use two network threads instead of one
- updateNetworkThreadCount(2);
- theme = UIManager.initFirstTheme("/theme");
- // Enable Toolbar on all Forms by default
- Toolbar.setGlobalToolbar(true);
- // Pro only feature
- Log.bindCrashProtection(true);
- addNetworkErrorListener(err -> {
- // prevent the event from propagating
- err.consume();
- if(err.getError() != null) {
- Log.e(err.getError());
- }
- Log.sendLogAsync();
- Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
- });
- }
- public void start() {
- if(current != null){
- current.show();
- return;
- }
- try {
- enc=EncodedImage.create("/logo.png");
- } catch (IOException ex) {
- // Logger.getLogger(MyApplication.class.getName()).log(Level.SEVERE, null, ex);
- }
- imgs = URLImage.createToStorage(enc, url, url);
- imgview =new ImageViewer(imgs);
- imgs1 = URLImage.createToStorage(enc, url1, url1);
- imgview1 =new ImageViewer(imgs1);
- Label l=new Label();
- l.setText("details1");
- l.addPointerPressedListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent evt) {
- }
- });
- Label l1=new Label();
- l1.setText("fggg");
- Form home = new Form("Hi World",new FlowLayout(CENTER,CENTER));
- Form home1 = new Form("Hi World",BoxLayout.y());
- Toolbar tb = home1.getToolbar();
- try {
- tb.addCommandToRightBar("",Image.createImage("/stat.png").scaled(30, 30), new ActionListener(){
- @Override
- public void actionPerformed(ActionEvent evt) {
- home.show();
- }
- });
- } catch (IOException ex) {
- }
- Container ct = new Container(BoxLayout.y());
- Container cc = new Container(BoxLayout.x());
- Container cc1 = new Container(BoxLayout.x());
- cc.add(imgview);
- cc.add(l);
- cc1.add(imgview1);
- cc1.add(l1);
- ImageViewer imgv = new ImageViewer();
- try {
- imgv =new ImageViewer(Image.createImage("/logo.png"));
- } catch (IOException ex) {
- ex.printStackTrace();
- }
- ComboBox cb = new ComboBox("Wattaneya","Tessiaa","Hannibal" );
- home1.add(cc);
- home1.add(cc1);
- cb.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent evt) {
- if(cb.getSelectedIndex()==0)
- {
- home1.show();
- }
- }
- });
- // this project is not done/completed yet ! the getDetails.php is not connected yet !
- ct.add(imgv);
- ct.add(cb);
- home.add(ct);
- home.show();
- }
- public void stop() {
- current = getCurrentForm();
- if(current instanceof Dialog) {
- ((Dialog)current).dispose();
- current = getCurrentForm();
- }
- }
- public void destroy() {
- }
- }
Add Comment
Please, Sign In to add comment