Results 1 to 8 of 8
Thread: help needed
- 10-16-2012, 07:26 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 4
- Rep Power
- 0
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();
}
}
- 10-16-2012, 07:47 PM #2
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.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 10-16-2012, 07:50 PM #3
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
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 10-16-2012, 08:22 PM #4
Member
- Join Date
- Oct 2012
- Posts
- 4
- Rep Power
- 0
Re: help needed
where do i post doubts in programming??
- 10-16-2012, 08:29 PM #5
Member
- Join Date
- Oct 2012
- Posts
- 4
- Rep Power
- 0
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
- 10-17-2012, 02:14 AM #6
- 10-17-2012, 08:19 AM #7
Member
- Join Date
- Oct 2012
- Posts
- 4
- Rep Power
- 0
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
- 10-17-2012, 12:07 PM #8
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.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Help needed
By kenson02 in forum New To JavaReplies: 6Last Post: 12-07-2011, 09:37 PM -
help needed
By radhi16 in forum New To JavaReplies: 2Last Post: 01-27-2011, 04:44 PM -
Help Needed
By 7auz in forum EclipseReplies: 1Last Post: 09-30-2010, 05:59 PM -
Help Needed
By jyothi_tallapaneni in forum Advanced JavaReplies: 1Last Post: 02-11-2010, 07:07 PM -
help needed
By amarchandar in forum New To JavaReplies: 3Last Post: 02-17-2009, 01:59 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks