Results 1 to 4 of 4
  1. #1
    coldvoice05's Avatar
    coldvoice05 is offline Member
    Join Date
    Jul 2009
    Posts
    12
    Rep Power
    0

    Smile Hello fellow genius members!!!

    Im an asian and taking up bachelor of science in information technology...

    anyways you might want to help me with this stuff??

    guys can you help me to convert java application code to java midlet J2ME code using netbeans???

    heres the java application code

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;

    ////////////////////////////////////////////////////////////// class BMI
    class BMI extends JFrame {
    //=============================================== static method main
    public static void main(String[] args) {
    BMI window = new BMI();
    window.setVisible(true);
    }

    //=============================================== instance variables
    // Declare and initialize instance variables that are
    // referred to when the program is running.
    private JTextField _mField = new JTextField(4); // height
    private JTextField _kgField = new JTextField(4); // weight
    private JTextField _bmiField = new JTextField(4); // BMI

    //================================================== ==== constructor
    public BMI() {
    //... Create button and add action listener.
    JButton bmiButton = new JButton("Compute BMI");
    bmiButton.addActionListener(new BMIListener());

    //... Set layout and add components.
    JPanel content = new JPanel();
    content.setLayout(new FlowLayout());
    content.add(new JLabel("Weight in kilograms"));
    content.add(_kgField);
    content.add(new JLabel("Height in meters"));
    content.add(_mField);
    content.add(bmiButton);
    content.add(new JLabel("Your BMI is"));
    content.add(_bmiField);

    //... Set the window characteristics.
    setContentPane(content);
    setTitle("Body Mass Index");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    pack(); // Do layout.
    setLocationRelativeTo(null); // Center window.
    }

    //////////////////////////////////////////// inner class BMIListener
    // Inner class is used to access components.
    // BMI is converted to int to eliminate excess "accuracy".
    private class BMIListener implements ActionListener {
    public void actionPerformed(ActionEvent e) {
    double kilograms = Double.parseDouble(_kgField.getText());
    double meters = Double.parseDouble(_mField.getText());
    int bmi = (int)computeBMI(kilograms, meters);
    _bmiField.setText("" + bmi);
    }
    }

    //=========================================== logic method computeBMI
    public static double computeBMI(double weight, double height) {
    return weight / (height * height);
    }
    }

    please help me to convert this code to J2ME or mobility midlet

    thank you guys!!!!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Welcome to the forum.

    In order to comply with forum rules that you have agreed to on joining us, please choose the single best forum for your question and post it there as no one likes being part of a disjointed / divided discussion. Please let me know which thread that should be. Again, welcome.

  3. #3
    coldvoice05's Avatar
    coldvoice05 is offline Member
    Join Date
    Jul 2009
    Posts
    12
    Rep Power
    0

    Default

    ^

    thanks... I cant see the section about J2ME... is it exist?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Open Cursors exceeed...question for fellow gurus
    By AlmostAGuru in forum Advanced Java
    Replies: 2
    Last Post: 08-11-2009, 01:37 AM
  2. Hello to all members!
    By tmdurand in forum Introductions
    Replies: 3
    Last Post: 01-18-2009, 02:54 PM
  3. Java Genius needed
    By Sanguine.digitalis in forum Jobs Offered
    Replies: 4
    Last Post: 06-29-2008, 11:10 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •