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

    Exclamation Convert java code to midlet code

    hi guys can you help me convert my java application code entitled "flames" to java midlet source code???

    heres my java application code I need to convert

    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;

    import javax.swing.*;

    public class chumma extends JFrame implements ActionListener
    {
    public static JPanel jp1, jp;
    public static JButton jb;
    public static JTextField name_1;
    public static JTextField name_2;
    public static JLabel jl;
    public static JLabel Output,just;
    public static Font f,f1;
    public static StringBuffer name1, name2;

    public chumma()
    {

    this.setVisible(true);
    this.setSize(300, 200);
    this.setLocation(400,300);

    this.setTitle("The Simple Love Calculator");
    f = new Font("serif", 2, 14);
    f1=new Font("sansserif",Font.BOLD,16);
    addWindowListener(new MyWindowAdapter(this));
    jp = new JPanel(new GridLayout(6, 2));
    jp1 = new JPanel(new GridLayout(1, 1));
    jb = new JButton("Check It");
    jb.setFont(f);
    jl = new JLabel(" FLAMES ");
    just=new JLabel(" The Relatioship is ");
    just.setVisible(false);
    name_1 = new JTextField();
    name_1.setFont(f);
    name_2 = new JTextField();
    name_2.setFont(f);
    Output = new JLabel(" ");
    Output.setFont(f1);
    jp.add(jl);
    jp.add(new JLabel("Funny Reationship Finder"));
    jp.add((new JLabel("Enter the NAme1")));
    jp.add(name_1);
    jp.add((new JLabel("Enter the NAme2")));
    jp.add(name_2);
    jp.add(new JLabel(" "));
    jp.add(jb);
    jp.add(just);
    jp.add(Output);
    // jp.add();

    add(jp);
    jb.addActionListener(this);
    }

    public void actionPerformed(ActionEvent ae)
    {

    FLAMES();
    }

    public void FLAMES()
    {

    name1 = new StringBuffer(name_1.getText());
    name2 = new StringBuffer(name_2.getText());
    for (int i = 0; i < name1.length(); i++)
    {
    char ch = name1.charAt(i);
    for (int j = 0; j < name2.length(); j++)
    {
    if (ch == name2.charAt(j))
    {

    name1.deleteCharAt(i);
    name2.deleteCharAt(j);
    i = -1;
    break;
    }

    }

    }


    int totallength = name1.length() + name2.length();


    StringBuffer str = new StringBuffer("FLAMES");
    int cancel_value = 1;

    for (int i = 0; i < 5; i++)
    {
    cancel_value = totallength % str.length();

    if (cancel_value == 0)
    {
    cancel_value = str.length();
    }
    cancel_value--;

    if (cancel_value == 0)
    {

    str = new StringBuffer(str.substring(1));
    } else if (cancel_value == (str.length() - 1))
    {

    str = new StringBuffer(str.substring(0, str.length() - 1));
    } else
    str = new StringBuffer(str.substring(cancel_value + 1)
    + str.substring(0, cancel_value));

    }

    just.setVisible(true);
    Output.setText(relation(str.charAt(0)));


    }
    public static void main(String a[])
    {
    chumma aa=new chumma();
    }
    public String relation(char ch)
    {
    String str1="";
    switch(ch)
    {
    case 'F':
    str1= "FRIENDS";
    break;
    case 'L':
    str1="LOVERS";
    break;
    case 'A':
    str1= "AFFECTION";
    break;
    case 'M':
    str1="MARRIAGE";
    break;
    case 'E':
    str1="ENEMY";
    break;
    case 'S':
    str1="SISTER";
    break;

    }
    return str1;

    }
    }

    class MyWindowAdapter extends WindowAdapter
    {
    chumma sampleFrame;

    public MyWindowAdapter(chumma sampleFrame)
    {
    this.sampleFrame = sampleFrame;
    }

    public void windowClosing(WindowEvent we)
    {
    sampleFrame.setVisible(false);
    System.exit(0);
    }
    }


    thank you guys!!!

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

    Default

    To the OP, please don't multi-post the same question. I am going to lock this thread.

Similar Threads

  1. Convert THE APPLET CODE TO SWING USING JPANEL
    By jammyjamsticy in forum AWT / Swing
    Replies: 2
    Last Post: 12-22-2011, 10:16 AM
  2. Convert bar code to number
    By samatha_kudi in forum Advanced Java
    Replies: 1
    Last Post: 07-17-2009, 03:56 PM
  3. I need help fixing my code.. or non code?
    By MrHuggykins in forum New To Java
    Replies: 1
    Last Post: 03-19-2008, 11:12 PM
  4. how to convert source code to xml
    By valery in forum XML
    Replies: 2
    Last Post: 08-06-2007, 09:29 PM
  5. Replies: 1
    Last Post: 04-26-2007, 04:52 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
  •