A little help
here is my code....I really need to make it so that I can use the .jar executible. if anyone could help me make the file so that I can put it on a computer without netbeans i would be very thankful.
import java.io.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.awt.image.*;
publicclass guiextends JFrame{
public gui(){
initComponents();
}
privatevoid initComponents(){
compBox =new javax.swing.JComboBox(companys);
date =new javax.swing.JLabel();
time =new javax.swing.JLabel();
custName =new javax.swing.JLabel();
custText =new javax.swing.JTextField();
cbNum =new javax.swing.JLabel();
cbText =new javax.swing.JTextField();
puAddress =new javax.swing.JLabel();
puText =new javax.swing.JTextField();
carType =new javax.swing.JLabel();
carText =new javax.swing.JTextField();
towTo =new javax.swing.JLabel();
towToText =new javax.swing.JTextField();
priceQuote =new javax.swing.JLabel();
priceQuoteText =new javax.swing.JTextField();
notes =new javax.swing.JLabel();
jScrollPane1 =new javax.swing.JScrollPane();
notesArea =new javax.swing.JTextArea();
printButton =new javax.swing.JButton();
saveButton =new javax.swing.JButton();
getDateTime();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Call Sheet");
custName.setText("Customers Name:");
cbNum.setText("Callback Number:");
puAddress.setText("Pick-up Address:");
carType.setText("Vehicle Type:");
towTo.setText("Tow to:");
priceQuote.setText("Price Quote");
notes.setText("Notes:");
notesArea.setColumns(20);
notesArea.setRows(5);
jScrollPane1.setViewportView(notesArea);
printButton.setText("Print");
saveButton.setText("Save");
javax.swing.GroupLayout layout =new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,false)
.addComponent(notes)
.addComponent(towTo)
.addComponent(carType)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(saveButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(16, 16, 16)
.addComponent(printButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,false)
.addComponent(puAddress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(custName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(compBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(55, 55, 55)
.addComponent(date, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(74, 74, 74)
.addComponent(time, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,false)
.addComponent(puText, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(carText, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(custText, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbNum)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbText, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(towToText, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(priceQuote)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(priceQuoteText, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap())))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(compBox)
.addComponent(date, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
.addComponent(time))
.addGap(22, 22, 22)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(custName)
.addComponent(custText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cbNum)
.addComponent(cbText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(28, 28, 28)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(puText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(puAddress))
.addGap(22, 22, 22)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(carType)
.addComponent(carText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(towTo)
.addComponent(priceQuoteText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(priceQuote)
.addComponent(towToText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(notes)
.addGap(5, 5, 5)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(49, 49, 49)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(saveButton, javax.swing.GroupLayout.DEFAULT_SIZE, 44, Short.MAX_VALUE)
.addComponent(printButton, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(37, 37, 37))
);
pack();
saveButton.addActionListener(new saveListener());
notesArea.setLineWrap(true);
}
publicvoid getDateTime(){
cal =new GregorianCalendar();
String Month, DayOW, AmPm;
year = cal.get(Calendar.YEAR);
month = cal.get(Calendar.MONTH);
day = cal.get(Calendar.DAY_OF_MONTH);
dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
hour = cal.get(Calendar.HOUR);
min = cal.get(Calendar.MINUTE);
ampm = cal.get(Calendar.AM_PM);
AmPm = AMPM[ampm];
Month = months[month];
DayOW = daysOfWeek[dayOfWeek-1];
if(min < 10 && hour == 0)
time.setText("12" +":" +"0"+ min +" " + AmPm);
elseif(hour == 0)
time.setText("12" +":" + min +" " + AmPm);
elseif (min < 10)
time.setText(hour +":" +"0" + min +" " + AmPm);
else
time.setText(hour +":" + min +" " + AmPm);
date.setText(Month +" "+day +", "+year);
}
privateclass saveListenerimplements ActionListener{
publicvoid actionPerformed(ActionEvent e){
String fileName, callSheetTitle, comp;
fileName ="CallSheets" +"/" + custText.getText() +"_" + month +"-"+ day +"-"+ year+".doc";
try{
outFile =new PrintWriter(new File(fileName));
}catch (FileNotFoundException ex){
ex.printStackTrace();
}
int temp = compBox.getSelectedIndex();
comp = companys[temp];
callSheetTitle = comp +" Call Sheet";
outFile.append(date.getText()+"\t"+time.getText()+"\n");
outFile.append(callSheetTitle+"\n\n");
outFile.append("Customer's Name: " + custText.getText() +"\n");
outFile.append("Call-back Number: " + cbText.getText() +"\n");
outFile.append("Pick-up Address: " + puText.getText() +"\n");
outFile.append("Vehicle type: " + carText.getText() +"\n");
outFile.append("Tow to : " + towToText.getText() +"\t\t");
outFile.append("Price Quote: $" + priceQuoteText.getText() +"\n");
outFile.append("Notes:\n"+notesArea.getText());
outFile.close();
}
}
publicstaticvoid main(String args[]){
java.awt.EventQueue.invokeLater(new Runnable(){
publicvoid run(){
new gui().setVisible(true);
}
});
}
private javax.swing.JTextField carText;
private javax.swing.JLabel carType;
private javax.swing.JLabel cbNum;
private javax.swing.JTextField cbText;
private javax.swing.JComboBox compBox;
private javax.swing.JLabel custName;
private javax.swing.JTextField custText;
private javax.swing.JLabel date;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel notes;
private javax.swing.JTextArea notesArea;
private javax.swing.JLabel priceQuote;
private javax.swing.JTextField priceQuoteText;
private javax.swing.JButton printButton;
private javax.swing.JLabel puAddress;
private javax.swing.JTextField puText;
private javax.swing.JButton saveButton;
private javax.swing.JLabel time;
private javax.swing.JLabel towTo;
private javax.swing.JTextField towToText;
private Calendar cal;
private PrintWriter outFile;
privateint year, month, day, dayOfWeek, ampm, min, hour;
privatefinal String daysOfWeek[] ={"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
privatefinal String months[] ={"Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"};
privatefinal String AMPM [] ={"AM","PM"};
privatefinal String companys [] ={"Airport Gulf","Bradley's"};
}

