78Views3Replies

Author Options:

HI! could someone please tell me how to make this code run? Answered

import javax.swing.*;

import java.awt.event.*;

    public class project9AlexandruMandache extends JFrame {
private JPanel panel;
private JLabel messageLable;
private JTextField nameTextField;
private JTextField addressTextField;
private JTextField dateTextField;
private JTextField rentTextField;
private JButton calcButton;
private final int WINDOW_WIDTH=500;
private final int WINDOW_HEIGHT=400;
public project9AlexandruMandache(){
  setTitle(" Input tenants information");
  setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  buildPanel();
  add(panel);
  setVisible(true);
}
   private void buildPanel() {
   messageLable=new JLabel("Enter name of tenant:");
   nameTextField=new JTextField (25);
   messageLable=new JLabel("Enter proprety address:");
   addressTextField=new JTextField (25);
   messageLable=new JLabel(" Enter Date:");
   dateTextField=new JTextField (25);
   messageLable=new JLabel(" Enter rent:");
   rentTextField=new JTextField (25);
   calcButton=new JButton(" Save to file ");
   calcButton.addActionListener(new CalcButtonListener ());
   panel=new JPanel();
   panel.add(messageLable);
   panel.add(nameTextField);
   panel.add(addressTextField);
   panel.add(dateTextField);
   panel.add(dateTextField);
   panel.add(calcButton);
  }
    private class CalcButtonListener implements ActionListener{
    public void actionPerformed (ActionEvent e){
        String input;
                 input=nameTextField.getText();
                 input=addressTextField.getText();
                 input=dateTextField.getText();
                 input=rentTextField.getText();

    JOptionPane.showMessageDialog(null, input);
   }
  }
     public static void main(String[]args){
     new project9AlexandruMandache();
}
}

Discussions

0
None
steveastrouk

5 years ago

Joy.

Uncommented code, with no analysis of what it isn't doing.

0
None
seandoguesteveastrouk

Answer 5 years ago

From a quick gander, it appears to be some sort of app for landlords to keep track of rental payments, or at least a portion of the code required for it.

0
None
seandogue

5 years ago

Nothing mystical here... You need a Java IDE to continue with whatever you're attempting to do.

0
None
mpilchfamily

5 years ago

Start by uploading it to the appropriate hardware. ;)