Results 1 to 8 of 8
Like Tree1Likes
  • 1 Post By Junky

Thread: help needed

  1. #1
    rahulV is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Smile help needed

    hello guys i have made a morse code decoder project and i have designed the gui and there is a text file containing the morse code of the alphabets there is a translate button.i want that when the user clicks the translate button the morse key from the text file will be readed and output will be shown in other text box.the user will enter a character or a string i am new to java please help.
    here is my code that i have made
    import javax.swing.*;
    import java.io.*;
    import java.awt.*;
    public class MorseConverter
    {
    JFrame f;
    JPanel cPanel,bPanel;
    JTextArea textArea1,textArea2;
    JButton btnTranslate,btnExit;
    public MorseConverter()
    {
    f = new JFrame("MOrseConverter");
    f.setLayout(new BorderLayout());
    cPanel = new JPanel();
    cPanel.setLayout(new GridLayout(0,2));
    bPanel = new JPanel();
    textArea1 = new JTextArea();
    textArea1.setColumns(40);
    textArea1.setRows(20);
    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    textArea2 = new JTextArea();

    textArea1.setColumns(40);
    textArea1.setRows(20);
    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);

    btnTranslate = new JButton("TRANSLATE");
    btnExit = new JButton("EXIT");
    bPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
    f.getContentPane().add(cPanel,BorderLayout.CENTER) ;
    f.getContentPane().add(bPanel,FlowLayout.CENTER);
    cPanel.add();
    bPanel.add(btnTranslate);
    bPanel.add(btnExit);
    f.setSize(900,500);
    f.setVisible(true);
    }
    public static void main(String args[])
    {
    new MorseConverter();
    }
    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: help needed

    Thread moved from Introductions. The duplicate thread started in Forum Guides has been removed.

    Please go through the Forum Rules, particularly the second and third paragraphs. Please also go through Guide For New Members and BB Code List - Java Programming Forum and edit your post accordingly.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: help needed

    -- Grossly incorrect use of GroupLayout
    -- Uncompilable code with
    ---- At least two calls to nonexistant methods
    ---- At least one duplicate variable declaration

    Finally, no specific question asked.

    Recommended reading: How to ask questions the smart way

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    rahulV is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Re: help needed

    where do i post doubts in programming??

  5. #5
    rahulV is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Re: help needed

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.ArrayList;
    import static java.lang.Character.*;
    public class MorseCodeDecoder implements ActionListener
    {
    JFrame f;
    JPanel tPanel,cPanel,bPanel;
    JLabel lblHead,lblEnterText,lblOutput;
    JTextField txtInText,txtOutText;
    JButton btnTranslate,btnExit;
    int i;
    Stringuser in1;

    public MorseCodeDecoder()
    {
    f = new JFrame("MorseCodeDecoder");


    f.setLayout(new BorderLayout());
    tPanel = new JPanel();
    tPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
    tPanel.setBackground(Color.yellow);
    cPanel = new JPanel();

    cPanel.setLayout(new GridLayout(0,2));
    bPanel = new JPanel();
    bPanel.setLayout(new FlowLayout(FlowLayout.CENTER));

    lblHead = new JLabel("MorseCodeDecoder");
    lblEnterText = new JLabel("EnterText");
    lblOutput = new JLabel("Output");
    txtInText = new JTextField(60);
    txtOutText = new JTextField(60);
    btnTranslate = new JButton("TRANSLATE");
    btnTranslate.addActionListener(this);
    btnExit = new JButton("EXIT");
    btnExit.addActionListener(this);
    f.getContentPane().add(tPanel,BorderLayout.NORTH);
    f.getContentPane().add(bPanel,BorderLayout.SOUTH);
    f.getContentPane().add(cPanel,BorderLayout.CENTER) ;
    tPanel.add(lblHead);
    cPanel.add(lblEnterText);
    cPanel.add(txtInText);
    cPanel.add(lblOutput);
    cPanel.add(txtOutText);
    bPanel.add(btnTranslate);
    bPanel.add(btnExit);
    f.setSize(900,500);
    f.setVisible(true);
    }


    public static void main(String args[])
    {
    new Morse();
    }
    }






    here is the code

  6. #6
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default Re: help needed

    Quote Originally Posted by rahulV View Post
    where do i post doubts in programming??
    You don't post doubts. You post specific questions.
    penguinCoder likes this.

  7. #7
    rahulV is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default How to create action listener

    I have a text file containing the morse key of alphabets when the user clicks the translate button the morse key of the string or char should be readed and displayed in another text box how should i create action listener for it

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: help needed

    You were already asked to go through the forum rules, with specific stress on the paragraph about multiple threads for the same question. I've moved the above post form a new thread and merged it here.

    You have also in your response at #5 neglected the advice about code tags contained in the page linked in my response at #2. If you expect to benefit from help on a forum, you will have to go through the responses.

    Note that starting any more threads about the same matter may lead to a temporary ban.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Help needed
    By kenson02 in forum New To Java
    Replies: 6
    Last Post: 12-07-2011, 09:37 PM
  2. help needed
    By radhi16 in forum New To Java
    Replies: 2
    Last Post: 01-27-2011, 04:44 PM
  3. Help Needed
    By 7auz in forum Eclipse
    Replies: 1
    Last Post: 09-30-2010, 05:59 PM
  4. Help Needed
    By jyothi_tallapaneni in forum Advanced Java
    Replies: 1
    Last Post: 02-11-2010, 07:07 PM
  5. help needed
    By amarchandar in forum New To Java
    Replies: 3
    Last Post: 02-17-2009, 01:59 PM

Posting Permissions

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