Devilzc0de Forum Follow @devilzc0de
  • Home
  • Hacking
  • Networking
  • Programming
  • O.S
  • Server
  • Tweets
  • Search
  • Member List
  • Calendar
Current time: 05-19-2013, 01:41 AM Hello There, Guest! (Login — Register)
Devilzc0de Forum › Information Technology › Programming › Java v
« Previous 1 2 3 4 5 6 ... 8 Next »

[Ask] tidak bisa membuka program java

Home General Computer Multimedia Business Lounge

Post Reply 
Tweet
Threaded Mode | Linear Mode
Ask tidak bisa membuka program java
05-05-2012, 12:53 PM
Post: #1
junker Offline
./Devilz Officer
Posts: 196
Joined: Feb 2012
Reputation: 1
tidak bisa membuka program java
mau tanya om, ane kan kemarin dpt tugas suruh buat program segitiga pascal mnggunakan j2me. pas dicompile kmrin di kompi lab bs, eh pas dicoba di laptop ane gak bisa. apa karena diganti type hp nya ya om? ngefek gak? ane prustasi nih nyari kesalahannya dmna...prasaan ane compile ini source kmrin bs kok kesel


berikut sourcenya om :


Quote:
Code:
package hello;

import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;

public class segitigapascal extends MIDlet implements CommandListener {
    
    private boolean midletPaused = false;

//<editor-fold defaultstate="collapsed" desc=" Generated Fields ">                      
    private Form form;
    private TextField textField1;
    private TextField textField;
    private Form form1;
    private Command exitCommand;
    private Command okCommand;
    private Command backCommand;
//</editor-fold>                    
    
    public segitigapascal() {
    }

//<editor-fold defaultstate="collapsed" desc=" Generated Methods ">                      
//</editor-fold>                    
//<editor-fold defaultstate="collapsed" desc=" Generated Method: initialize ">                                          
    /**
     * Initializes the application. It is called only once when the MIDlet is
     * started. The method is called before the
     * <code>startMIDlet</code> method.
     */
    private void initialize() {                                        
        // write pre-initialize user code here
                                          
        // write post-initialize user code here
    }                            
//</editor-fold>                          

//<editor-fold defaultstate="collapsed" desc=" Generated Method: startMIDlet ">                                        
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Started point.
     */
    public void startMIDlet() {                                      
        // write pre-action user code here
                                        
        // write post-action user code here
    }                            
//</editor-fold>                          

//<editor-fold defaultstate="collapsed" desc=" Generated Method: resumeMIDlet ">                                        
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Resumed point.
     */
    public void resumeMIDlet() {                                      
        // write pre-action user code here
        switchDisplayable(null, getForm());                                        
        // write post-action user code here
    }                              
//</editor-fold>                            

//<editor-fold defaultstate="collapsed" desc=" Generated Method: switchDisplayable ">                                              
    /**
     * Switches a current displayable in a display. The
     * <code>display</code> instance is taken from
     * <code>getDisplay</code> method. This method is used by all actions in the
     * design for switching displayable.
     *
     * @param alert the Alert which is temporarily set to the display; if
     * <code>null</code>, then
     * <code>nextDisplayable</code> is set immediately
     * @param nextDisplayable the Displayable to be set
     */
    public void switchDisplayable(Alert alert, Displayable nextDisplayable) {                                            
        // write pre-switch user code here
        Display display = getDisplay();                                              
        if (alert == null) {
            display.setCurrent(nextDisplayable);
        } else {
            display.setCurrent(alert, nextDisplayable);
        }                                            
        // write post-switch user code here
    }                                  
//</editor-fold>                                

//<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Displayables ">                                                
    /**
     * Called by a system to indicated that a command has been invoked on a
     * particular displayable.
     *
     * @param command the Command that was invoked
     * @param displayable the Displayable where the command was invoked
     */
    public void commandAction(Command command, Displayable displayable) {                                              
        // write pre-action user code here
        if (displayable == form) {                                          
            if (command == exitCommand) {                                        
                // write pre-action user code here
                exitMIDlet();                                          
                // write post-action user code here
            } else if (command == okCommand) {                                          
                 String aw = textField.getString();
                String bts = textField1.getString();
                int bil1 = Integer.parseInt(aw);
                int bil2 = Integer.parseInt(bts);
                int[][] a=new int [20][20];
                int i, j;
                a[1][1]=bil1;

                switchDisplayable(null, getForm1());                                          
                form1.append("Segitiga Pascal : \n\n");
        form1.append(a[1][1]+"\n");
        for(i=2;i<=bil2;i++){
            for(j=1;j<=i;j++){
                a[i][j]=a[i-1][j-1]+a[i-1][j];

                form1.append(a[i][j]+"  ");
            }
            form1.append("\n");
        }

            }                                          
        } else if (displayable == form1) {
            if (command == backCommand) {                                        
                // write pre-action user code here
                switchDisplayable(null, getForm());                                          
                // write post-action user code here
            }                                                  
        }                                                
        // write post-action user code here
    }                              
//</editor-fold>                            

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: form ">                                  
    /**
     * Returns an initialized instance of form component.
     *
     * @return the initialized component instance
     */
    public Form getForm() {
        if (form == null) {                                
            // write pre-init user code here
            form = new Form("segitiga pascal", new Item[]{getTextField(), getTextField1()});                                    
            form.addCommand(getExitCommand());
            form.addCommand(getOkCommand());
            form.setCommandListener(this);                                  
            // write post-init user code here
        }                        
        return form;
    }
//</editor-fold>                      

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: textField ">                                  
    /**
     * Returns an initialized instance of textField component.
     *
     * @return the initialized component instance
     */
    public TextField getTextField() {
        if (textField == null) {                                
            // write pre-init user code here
            textField = new TextField("angka pertama :", null, 32, TextField.ANY);                                  
            // write post-init user code here
        }                        
        return textField;
    }
//</editor-fold>                      

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: textField1 ">                                  
    /**
     * Returns an initialized instance of textField1 component.
     *
     * @return the initialized component instance
     */
    public TextField getTextField1() {
        if (textField1 == null) {                                
            // write pre-init user code here
            textField1 = new TextField("angka kedua :", null, 32, TextField.ANY);                                  
            // write post-init user code here
        }                        
        return textField1;
    }
//</editor-fold>                      

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: form1 ">                                  
    /**
     * Returns an initialized instance of form1 component.
     *
     * @return the initialized component instance
     */
    public Form getForm1() {
        if (form1 == null) {                                
            // write pre-init user code here
            form1 = new Form("form1");                                    
            form1.addCommand(getBackCommand());
            form1.setCommandListener(this);                                  
            // write post-init user code here
        }                        
        return form1;
    }
//</editor-fold>                      

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand ">                                  
    /**
     * Returns an initialized instance of exitCommand component.
     *
     * @return the initialized component instance
     */
    public Command getExitCommand() {
        if (exitCommand == null) {                                
            // write pre-init user code here
            exitCommand = new Command("Exit", Command.EXIT, 0);                                  
            // write post-init user code here
        }                        
        return exitCommand;
    }
//</editor-fold>                      

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand ">                                  
    /**
     * Returns an initialized instance of okCommand component.
     *
     * @return the initialized component instance
     */
    public Command getOkCommand() {
        if (okCommand == null) {                                
            // write pre-init user code here
            okCommand = new Command("Ok", Command.OK, 0);                                  
            // write post-init user code here
        }                        
        return okCommand;
    }
//</editor-fold>                      

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand ">                                  
    /**
     * Returns an initialized instance of backCommand component.
     *
     * @return the initialized component instance
     */
    public Command getBackCommand() {
        if (backCommand == null) {                                
            // write pre-init user code here
            backCommand = new Command("Back", Command.BACK, 0);                                  
            // write post-init user code here
        }                        
        return backCommand;
    }
//</editor-fold>                      

    
    public Display getDisplay() {
        return Display.getDisplay(this);
    }

    public void exitMIDlet() {
        switchDisplayable(null, null);
        destroyApp(true);
        notifyDestroyed();
    }

    public void startApp() {
        if (midletPaused) {
            resumeMIDlet();
        } else {
            initialize();
            startMIDlet();
        }
        midletPaused = false;
    }

    public void pauseApp() {
        midletPaused = true;
    }

    public void destroyApp(boolean unconditional) {
    }
}

ini gambar flowchartnya :

Quote:
[Image: flow.png]


Quote:
[Image: hasil.png]




mohon bantuannya om stress
Find all posts by this user
Quote this message in a reply
05-31-2012, 09:05 PM
Post: #2
ceoode Offline
./Devilz Officer
Posts: 50
Joined: Nov 2011
Reputation: 1
RE: tidak bisa membuka program java
untuk versi jdk nya sama nggak om ? di lab sma di laptop ?
Find all posts by this user
Quote this message in a reply
06-06-2012, 02:16 AM (This post was last modified: 06-06-2012 03:11 AM by dion_ableh.)
Post: #3
dion_ableh Offline
./Devilz 1st Cadet
Posts: 17
Joined: May 2012
Reputation: 1
RE: tidak bisa membuka program java
Ane uda cobain ni bro dan hasilnya bisa... awalnya sempat ga bisa, namun terus ane coba set ulang action command2nya. Akhirnya bisa bro...

Untuk type hp tidak masalah bro... type hape hanya berpengaruh pada device profilenya, kalo type hp DefaultCldcJtwiPhone1 tidak support unt MIDP 2.1 hanya sampai seri MIDP 2.0
Pada dasarnya code nya tidak ada masalah om... Ini penampakkan hasil ujicoba ane...

Error yang sama muncul karena Started nya belum di definisikan
[Image: oju5w.jpg]

Setelah didefinisikan berikut ini adalah penampakannya.
[Image: 3tggq.jpg]

Mungkin untuk inisialisasi started nya bisa diset ulang bro.
Ane juga lagi belajar bro. Semoga dapat membantu...


**klik gambarnya ya bro biar keliatan lebih jelas .... heheheh
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Topic Tools
Topic Link :
BBCode :
HTML Code :
View a Printable Version Send Thread to a Friend Subscribe to this thread
Submit Google Submit Face book Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
Tongue [Tutor] [code] Algoritma pengolahan data array statik [JAVA] jboxx 4 90 05-14-2013 02:35 AM
Last Post: wenkhairu
  [Tutor] [java] MENGHITUNG PANJANG DERAJAT PER MILIMETER PADA MAGNET MOTOR hakimoxz 6 116 05-12-2013 09:32 PM
Last Post: tabun
  [java] Share ebook java maknnyummy hakimoxz 9 115 05-12-2013 07:53 PM
Last Post: Miss_Idol
  membuat compas menggunakan java ndutz.newbie 6 2,635 05-04-2013 08:15 PM
Last Post: l0c4l r00t
  Koneksi JDBC(Java DataBase Connectivity) d4y4x 1 2,180 04-30-2013 09:47 PM
Last Post: l0c4l r00t
  [Ask] Cara menggunakan coding Java Zikry.Z.Azhar 3 63 04-28-2013 03:17 PM
Last Post: hakimoxz
Thumbs Up Free ebook java :) [Politeknik Telkom Bandung] ./blacknotes 37 8,802 04-28-2013 09:29 AM
Last Post: Zikry.Z.Azhar
  [Tutor] Tutorial nembak cewek dengan java Bayu Syafresal Izdham 18 524 04-07-2013 01:15 PM
Last Post: orochimadit
  [Tutor] IPFinder GUI [Java Edition] root31 8 236 04-07-2013 01:13 PM
Last Post: orochimadit
  [Tutor] Menggambar Graphics menggunakan Java Alldy Newbie 6 224 04-07-2013 10:24 AM
Last Post: orochimadit

Users Browsing
1 Guest(s)

  • Contact Us
  • devilzc0de
  • Return to Top
  • Mobile Version
  • RSS Syndication
  • Help
Current time: 05-19-2013, 01:41 AM Powered By MyBB, © 2002-2013 MyBB Group. Theme created by Justin S. | Mixed By Chaer.Newbie | Fixed By Aditya

USING THIS SITE INDICATES THAT YOU HAVE READ AND ACCEPT OUR TERMS. IF YOU DO NOT ACCEPT THESE TERMS, YOU ARE NOT AUTHORIZED TO USE THIS SITE