QuestionQuestion

Signal generator outputs various waveforms.
1. It needs a logo or banner at the top of the app with a model name or number for the signal generator - your choice. I recommend a JLabel onto which you place an image you design.
2. It needs a JTextField for a frequency. Make the frequency you will enter between 10 hz to 40000 hz.
3. It needs a JTextField for duration of the output - in Seconds.
4. It needs 4 JButtons for the kind of waveform Sine, Square, Sawtooth and Triangle.
5. It needs a JTextField for Amplitude (loudness) It will have a number between 10 and 100
6. Each JTextField should have a JLabel to the left of it stating what the JTextField is.
7. Have JTextArea that will display words.
For this assignment, there will not be any output. We will add the oscillator portion later.
8. The JButtons must respond. That means it needs to implement an ActionListener.
For now, when they are pressed which was pressed must be displayed in the JTextArea
9. Have a JButton saying "Generate" that when pressed will read the JTextFields, parse them into double values and output a series of sentences like Frequency is 2000 hz. Amplitude is 90. Go for 10 seconds. Type of waveform is SQUARE.   These can happen via something like String a = String.format("Frequency is %8.2f hz\n",Double.parseDouble(amplitudeTextField.getText( ));
outputTextArea.append(a);

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class SignalGenerator extends JFrame implements ActionListener {
   
    public static final int FRAME_WIDTH = 500;
    public static final int FRAME_HEIGHT = 240;
   
    private JTextField frequency;
    private JTextField duration ;
    private JButton [] buttons;
    private JTextField amplitudeTextField ;
    private JTextArea outputTextArea;
   
    private String waveform ;
   
    /**
    * contribute
    * @throws HeadlessException
    */
    public SignalGenerator() throws HeadlessException {
       setTitle("Signal Generator");
       // init all atrributes
       frequency = new JTextField(10);
       duration = new JTextField(10);
       amplitudeTextField = new JTextField(10);
       buttons = new JButton[5];...
$23.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats