Hello Everyone,

I am having trouble getting a display of my program on the JTextArea "DisplayWindow". My code works and compiles but i do not know how to transfer the program to run on the GUI. It is really simple and I just want it to display and accept the inputs just like the program does. I have attached my code and attached the code to the GUI. Please help with any suggestions. I am not sure how to get them to run together. Thank you!!!

*****************Program code**********************

package tripplanner;
import java.util.*;
/**
 *
 * @author deo5025
 */
public class TripPlanner {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Interface form = new Interface ();
      form.setVisible(true);

        Scanner in = new Scanner (System.in);
        double gallonsNeeded;
        double refuel;
        System.out.println("Enter Fuel tank size: ");
        double tankSize = in.nextDouble();
        System.out.println("Enter MPG of car: ");
        double mpg = in.nextDouble();
        System.out.println("Enter estimated traveling distance: ");
        double travelDistance = in.nextDouble();
        System.out.println("Enter price of fuel (per gallon): ");
        double price = in.nextDouble();
        System.out.println("Total cost of fuel for trip is: "+ totalCost(travelDistance, price, mpg));
        System.out.println("Gallons of fuel used on trip is: "+ gallonsUsed(travelDistance, mpg));
        System.out.println("You will refuel "+ refuel(travelDistance, mpg, tankSize));

    }

    public static double gallonsUsed (double travelDistance, double mpg)
     {
        double gallonsUsed = (travelDistance / mpg) ;
        return gallonsUsed;
     }

    public static double totalCost (double price, double travelDistance, double mpg)
     {
        double totalCost = (travelDistance / mpg) * price;
        return totalCost;
     }

    public static double refuel (double travelDistance, double mpg, double tankSize)
     {
         double distance = mpg * tankSize;
         double refuel = travelDistance / distance;
         return refuel;
     }       


}

********************GUI Code*****************************

package tripplanner;

/**
 *
 * @author deo5025
 */
public class Interface extends javax.swing.JFrame {

    /**
     * Creates new form Interface
     */
    public Interface() {
        initComponents();



    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        DisplayWindow = new javax.swing.JTextArea();
        jLabel3 = new javax.swing.JLabel();

        jLabel1.setText("jLabel1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel2.setText("Trip Planner");

        DisplayWindow.setColumns(20);
        DisplayWindow.setRows(5);
        jScrollPane1.setViewportView(DisplayWindow);

        jLabel3.setIcon(new javax.swing.ImageIcon("upfsa.up.ist.local\\Users\\deo5025\\Desktop\\PENN STATE.png")); // NOI18N
        jLabel3.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 382, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(57, 57, 57)
                .addComponent(jLabel3)
                .addContainerGap(551, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(92, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>                        

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Interface().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify                     
    private javax.swing.JTextArea DisplayWindow;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration                   
}

Well you want to display some info on your GUI. Therefore you need to provide it with some data through your constructor, or make setter methods to set label and text area
If not clear you better read some book or Oracle tutorial

To prompt the user and get input in a simple gui, use JOptionPane (Google it for details). Display stuff in your text area by calling its append(String str) method.

But if you wanted to make your text area work just like the console window for input and output then (a) that's not really a GUI and (b) it's surprisingly difficult.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.