Saving a file from a form to be display on a table

Hi i'm having some problems trying to save the filled out on the form to be displayed on the table i don't know how i am going to go about it can you please help me thanks.
Here is the code for the form.
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;              //for layout managers and more
import java.awt.event.*;        //for action events
import java.net.URL;
import java.text.ParseException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.swing.JComboBox;
public class DD extends JPanel
                             implements ActionListener {
    private String newline = "\n";
    protected static final String textFieldString = "Name"; 
    protected static final String textFieldString1 = "Start Time";
    protected static final String textFieldString2 = "End Time";
    protected static final String textFieldString3 = "Total Time(Minutes)";
    protected static final String ftfString = "Date";
    protected static final String buttonString = "JButton";
    JFormattedTextField startTime;
    JTextField totalTime;
    protected JLabel actionLabel;
    Component[][] rowData;
    private String[] shapeName = { "Meeting", "Lunch", "Holiday", "Sickness",
             "Preparing report", "Administrative work", "Emails", "Query" };
    public DD() {
        setLayout(new BorderLayout());
        Panel data = new Panel();
          data.setLayout(new GridLayout(7, 4));
        rowData = new Component[7][];
//      One row
               for (int row = 0; row < 7; row++)
                    rowData[row] = new Component[5];
                    rowData[row][0] = new TextField(10);
                    rowData[row][1] = new TextField(10);
                    ((TextField) rowData[row][1]).addActionListener(this);
                    rowData[row][2] = new JComboBox(shapeName);
                    ((JComboBox) rowData[row][2]).addActionListener(this);
//      ((TextField)rowData[ row ][ 2 ]).addActionListener(this);
                    rowData[row][3] = new TextField(10);
                    ((TextField) rowData[row][3]).addActionListener(this);
//      JComboBox jcboxShapeCombo;
//      System.out.println(rowData[row][2]);
//      jcboxShapeCombo[2] = new JComboBox (shapeName);
//      rowData[ row ][ 3 ] = new TextField(10);
                    rowData[row][4] = new TextField(10);
                    ((TextField) rowData[row][4]).addActionListener(this);
                    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("H:mm");
                    ((TextField) rowData[row][0]).setText(sdf.format(new java.util.Date()));
                    data.add(rowData[row][0]);
                    data.add(rowData[row][1]);
                    data.add(rowData[row][2]);
                    data.add(rowData[row][3]);
                    data.add(rowData[row][4]);
        //Create a regular text field.
        JTextField textField = new JTextField(10);
        textField.setActionCommand(textFieldString);
        textField.addActionListener(this);
        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("H:mm");
        startTime = new JFormattedTextField(sdf);
        startTime.setValue(new java.util.Date());
        startTime.setActionCommand(textFieldString1);
        startTime.addActionListener(this);
        JTextField textField2 = new JTextField(10);
        textField2.setActionCommand(textFieldString2);
        textField2.addActionListener(this);
        totalTime = new JTextField(10);
        totalTime.setActionCommand(textFieldString3);
        totalTime.addActionListener(this);
        //Create a formatted text field.
        JFormattedTextField ftf = new JFormattedTextField(
                  //java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("H:mm");
                java.util.Calendar.getInstance().getTime());
        ftf.setActionCommand(textFieldString);
        ftf.addActionListener(this);
        //Create some labels for the fields.
        JLabel textFieldLabel = new JLabel(textFieldString + ": ");
        textFieldLabel.setLabelFor(textField);
        JLabel textFieldLabel1 = new JLabel(textFieldString1 + ": ");
        textFieldLabel1.setLabelFor(startTime);
        JLabel textFieldLabel2 = new JLabel(textFieldString2 + ": ");
        textFieldLabel2.setLabelFor(textField2);
        JLabel textFieldLabel3 = new JLabel(textFieldString3 + ": ");
        textFieldLabel3.setLabelFor(totalTime);
        JLabel ftfLabel = new JLabel(ftfString + ": ");
        ftfLabel.setLabelFor(ftf);
        //Create a label to put messages during an action event.
        actionLabel = new JLabel("Type text in a field and press Enter.");
        actionLabel.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
        //Lay out the text controls and the labels.
        JPanel textControlsPane = new JPanel();
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        textControlsPane.setLayout(gridbag);
        JLabel[]labels = {textFieldLabel, textFieldLabel1,textFieldLabel2, textFieldLabel3, ftfLabel};
        JTextField[] textFields = {textField, startTime,textField2,totalTime, ftf};
        addLabelTextRows(labels, textFields, gridbag, textControlsPane);
        c.gridwidth = GridBagConstraints.REMAINDER; //last
        c.anchor = GridBagConstraints.WEST;
        c.weightx = 1.0;
        textControlsPane.add(actionLabel, c);
        textControlsPane.setBorder(
                BorderFactory.createCompoundBorder(
                                BorderFactory.createTitledBorder("Text Fields"),
                                BorderFactory.createEmptyBorder(5,5,5,5)));
        //Create a text area.
        JTextArea textArea = new JTextArea(
        textArea.setFont(new Font("Serif", Font.ITALIC, 16));
        textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);
        JScrollPane areaScrollPane = new JScrollPane(textArea);
        areaScrollPane.setVerticalScrollBarPolicy(
                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        areaScrollPane.setPreferredSize(new Dimension(250, 250));
        areaScrollPane.setBorder(
            BorderFactory.createCompoundBorder(
                BorderFactory.createCompoundBorder(
                                BorderFactory.createTitledBorder("Comment"),
                                BorderFactory.createEmptyBorder(5,5,5,5)),
                areaScrollPane.getBorder()));
        //Create an editor pane.
        JEditorPane editorPane = createEditorPane();
        JScrollPane editorScrollPane = new JScrollPane(editorPane);
        editorScrollPane.setVerticalScrollBarPolicy(
                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        editorScrollPane.setPreferredSize(new Dimension(250, 145));
        editorScrollPane.setMinimumSize(new Dimension(10, 10));
        String[] initString =
        { "Meeting", "Lunch", "Holiday", "Sickness",
                 "Preparing report", "Administrative work", "Emails", "Query" };
        JList listCategories = new JList(initString);
        JScrollPane editorScrollPane = new JScrollPane(listCategories);
        editorScrollPane.setVerticalScrollBarPolicy(
                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        editorScrollPane.setPreferredSize(new Dimension(250, 145));
        editorScrollPane.setMinimumSize(new Dimension(10, 10));
        //Create a text pane.
        JTextPane textPane = createTextPane();
        JScrollPane paneScrollPane = new JScrollPane(textPane);
        paneScrollPane.setVerticalScrollBarPolicy(
                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        paneScrollPane.setPreferredSize(new Dimension(250, 155));
        paneScrollPane.setMinimumSize(new Dimension(10, 10));
        //Put the editor pane and the text pane in a split pane.
        JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
                                              editorScrollPane,
                                              paneScrollPane);
        splitPane.setOneTouchExpandable(true);
        splitPane.setResizeWeight(0.5);
        JPanel rightPane = new JPanel(new GridLayout(1,0));
        rightPane.add(splitPane);
        rightPane.setBorder(BorderFactory.createCompoundBorder(
                        BorderFactory.createTitledBorder("Category of Task"),
                        BorderFactory.createEmptyBorder(5,5,5,5)));
        JPanel rightPane = new JPanel(new GridLayout(1,0));
        rightPane.add(editorScrollPane);
        //Put everything together.
        JPanel leftPane = new JPanel(new BorderLayout());
        leftPane.add(textControlsPane,
                     BorderLayout.PAGE_START);
        leftPane.add(areaScrollPane,
                     BorderLayout.CENTER);
        add(leftPane, BorderLayout.LINE_START);
        add(rightPane, BorderLayout.LINE_END);
        JButton button = new JButton("Submit");
        button.setCursor(Cursor.getDefaultCursor());
        //button.setMargin(new Insets(0,0,0,0));
        button.setActionCommand(buttonString);
        button.addActionListener(this);
        add(button, BorderLayout.SOUTH);
        button.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent evt)
                    String toPrint = collectData();
                    newFile(toPrint);
   private String collectData()
          String toPrint = "";
          for (int i = 0; i < rowData.length; i++)
               Component[] currentRowComps = rowData;
               for (int j = 0; j < currentRowComps.length; j++)
                    Component currentComp = currentRowComps[j];
                    if (currentComp instanceof TextField)
                         TextField tf = (TextField) currentComp;
                         toPrint += tf.getText() + " - ";
                    else if (currentComp instanceof JComboBox)
                         JComboBox box = (JComboBox) currentComp;
                         Object selection = box.getSelectedItem();
                         if (selection != null)
                              toPrint += selection.toString() + " - ";
               toPrint += "\n";
          return toPrint;
     private File newFile(String data)
          File newfile = null;
          try
               newfile = new File("I:\\ouput.doc");
               System.out.println("DATA? - " + data);
               FileOutputStream fos = new FileOutputStream(newfile);
               fos.write(data.getBytes());
               fos.close();
               // JOptionPane.showMessageDialog(null, "Save File");
               JOptionPane.showMessageDialog(null, "File saved.", "Success",
               JOptionPane.INFORMATION_MESSAGE);
          catch (IOException ioexc)
               JOptionPane.showMessageDialog(null, "Error while saving file: " + ioexc,
               "Error", JOptionPane.ERROR_MESSAGE);
          return null;
private void addLabelTextRows(JLabel[] labels,
JTextField[] textFields,
GridBagLayout gridbag,
Container container) {
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.EAST;
int numLabels = labels.length;
for (int i = 0; i < numLabels; i++) {
c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
c.fill = GridBagConstraints.NONE; //reset to default
c.weightx = 0.0; //reset to default
container.add(labels[i], c);
c.gridwidth = GridBagConstraints.REMAINDER; //end row
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1.0;
container.add(textFields[i], c);
public void actionPerformed(ActionEvent e) {
String prefix = "You typed \"";
if (textFieldString2.equals(e.getActionCommand()))
JTextField source = (JTextField)e.getSource();
actionLabel.setText(prefix + source.getText() + "\"");
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("H:mm");
try {
                    java.util.Date end = sdf.parse(source.getText());
                    java.util.Date start = sdf.parse(startTime.getText());
                    long difference = (end.getTime() - start.getTime()) / 60000;
                    totalTime.setText(Long.toString(difference));
               } catch (ParseException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
if (textFieldString1.equals(e.getActionCommand()))     {JTextField source = (JTextField)e.getSource();
        actionLabel.setText(prefix + source.getText() + "\"");}
if (textFieldString2.equals(e.getActionCommand()))     {JTextField source = (JTextField)e.getSource();
        actionLabel.setText(prefix + source.getText() + "\"");}
if (textFieldString3.equals(e.getActionCommand()))     {JTextField source = (JTextField)e.getSource();
        actionLabel.setText(prefix + source.getText() + "\"");}
else if (textFieldString.equals(e.getActionCommand())) {
//JPasswordField source = (JPasswordField)e.getSource();
//actionLabel.setText(prefix + new String(source.getPassword())
//+ "\"");
} else if (buttonString.equals(e.getActionCommand())) {
Toolkit.getDefaultToolkit().beep();
private JEditorPane createEditorPane() {
JEditorPane editorPane = new JEditorPane();
editorPane.setEditable(false);
java.net.URL helpURL = DD.class.getResource(
"DailyDairyDemoHelp.html");
if (helpURL != null) {
try {
editorPane.setPage(helpURL);
} catch (IOException e) {
System.err.println("Attempted to read a bad URL: " + helpURL);
} else {
System.err.println("Couldn't find file: Daily Dairy.html");
return editorPane;
     private JTextPane createTextPane() {
String[] initString =
{ "Meeting", "Lunch", "Holiday", "Sickness",
     "Preparing report", "Administrative work", "Emails", "Query" };
String[] initStyles =
{ "regular", "italic", "bold", "small", "large",
"regular", "button", "regular", "icon",
"regular"
JTextPane textPane = new JTextPane();
StyledDocument doc = textPane.getStyledDocument();
addStylesToDocument(doc);
try {
for (int i=0; i < initString.length; i++) {
doc.insertString(doc.getLength(), initString[i],
doc.getStyle(initStyles[i]));
} catch (BadLocationException ble) {
System.err.println("Couldn't insert initial text into text pane.");
return textPane;
protected void addStylesToDocument(StyledDocument doc) {
//Initialize some styles.
Style def = StyleContext.getDefaultStyleContext().
getStyle(StyleContext.DEFAULT_STYLE);
Style regular = doc.addStyle("regular", def);
StyleConstants.setFontFamily(def, "SansSerif");
Style s = doc.addStyle("italic", regular);
StyleConstants.setItalic(s, true);
s = doc.addStyle("bold", regular);
StyleConstants.setBold(s, true);
s = doc.addStyle("small", regular);
StyleConstants.setFontSize(s, 10);
s = doc.addStyle("large", regular);
StyleConstants.setFontSize(s, 16);}
/*s = doc.addStyle("icon", regular);
StyleConstants.setAlignment(s, StyleConstants.ALIGN_CENTER);
ImageIcon pigIcon = createImageIcon("images/Pig.gif",
"a cute pig");
if (pigIcon != null) {
StyleConstants.setIcon(s, pigIcon);
s = doc.addStyle("button", regular);
StyleConstants.setAlignment(s, StyleConstants.ALIGN_CENTER);
ImageIcon soundIcon = createImageIcon("images/sound.gif",
"sound icon");
JButton button = new JButton();
if (soundIcon != null) {
button.setIcon(soundIcon);
} else {
button.setText("BEEP");
button.setCursor(Cursor.getDefaultCursor());
button.setMargin(new Insets(0,0,0,0));
button.setActionCommand(buttonString);
button.addActionListener(this);
StyleConstants.setComponent(s, button);
/** Returns an ImageIcon, or null if the path was invalid. */
protected static ImageIcon createImageIcon(String path,
String description) {
java.net.URL imgURL = DD.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL, description);
} else {
System.err.println("Couldn't find file: " + path);
return null;
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event dispatch thread.
private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("DailyDairyDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Add content to the window.
frame.add(new DD());
//Display the window.
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
//Schedule a job for the event dispatching thread:
//creating and showing this application's GUI.
SwingUtilities.invokeLater(new Runnable() {
public void run() {
//Turn off metal's use of bold fonts
          UIManager.put("swing.boldMetal", Boolean.FALSE);
          createAndShowGUI();
And here is the code for the table.
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
import java.util.Date;
import java.sql.*;
import java.text.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.table.*;
public class DDTable extends JFrame{
     protected JTable m_table;
     protected DDTableData m_data;
     protected JLabel m_title;
     public DDTable(){
          super("DDTABLE");
          setSize(600, 300);
          UIManager.put("Table.focusCellHighlightBorder",new LineBorder(Color.black, 0));
          m_data = new DDTableData();
          m_title = new JLabel(m_data.getTitle(), SwingConstants.CENTER);
          m_title.setFont(new Font("Helvetica", Font.PLAIN, 24));
          getContentPane().add(m_title, BorderLayout.NORTH);
          m_table = new JTable();
          m_table.setAutoCreateColumnsFromModel(false);
          m_table.setModel(m_data);
          for (int k = 0; k < m_data.getColumnCount(); k++) {
               DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
               renderer.setHorizontalAlignment(DDTableData.m_columns[k].m_alignment);
               TableColumn column = new TableColumn(k, DDTableData.m_columns[k].m_width, renderer, null);
               m_table.addColumn(column);
          JTableHeader header = m_table.getTableHeader();
          header.setUpdateTableInRealTime(false);
          setJMenuBar(createMenuBar());
          JScrollPane ps = new JScrollPane();
          ps.getViewport().setBackground(m_table.getBackground());
          ps.getViewport().add(m_table);
          getContentPane().add(ps, BorderLayout.CENTER);
          protected JMenuBar createMenuBar(){
               JMenuBar menuBar = new JMenuBar();
               JMenu mFile = new JMenu("File");
               mFile.setMnemonic('f');
               Action actionNew = new AbstractAction("New Appointment"){
                    public void actionPerformed(ActionEvent e){
                         if (!promptToSave())
                              return;
                         newDocument();
                    JMenuItem item = new JMenuItem(actionNew);
                    item.setMnemonic('n');
                    item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK));
                    mFile.add(item);
                    Action actionSave = new AbstractAction("Save Appointment"){
                         public void actionPerformed(ActionEvent e){
                              boolean m_textChanged = false;
                              if (!m_textChanged)
                                   return;
                              saveFile(false);
                          item = new JMenuItem(actionSave);
                         item.setMnemonic('s');
                         item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
                         mFile.add(item);
               JMenuItem mData = new JMenuItem("Retrieve Data");
               mData.setMnemonic('r');
               ActionListener lstData = new ActionListener(){
               public void actionPerformed(ActionEvent e){
                    retrieveData();
               mData.addActionListener(lstData);
               mFile.add(mData);
               mFile.addSeparator();
               JMenuItem mExit = new JMenuItem("Exit");
               mExit.setMnemonic('x');
               ActionListener lstExit = new ActionListener(){
                    public void actionPerformed(ActionEvent e){
                         System.exit(0);
               mExit.addActionListener(lstExit);
               mFile.add(mExit);
               menuBar.add(mFile);
               return menuBar;
          protected void saveFile(boolean b) {
               // TODO Auto-generated method stub
          protected void newDocument() {
                 //Create and set up the window.
             JDialog frame = new JDialog();//"DailyDairyDemo");
             frame.setModal(true);
             //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             //Add content to the window.
             frame.add(new DD());
             //Display the window.
             frame.pack();
             frame.setVisible(true);
             JOptionPane.showMessageDialog(this, "Done!");
             //loadFile();
          protected boolean promptToSave() {
               // TODO Auto-generated method stub
               return true;
          public void retrieveData(){
               Runnable updater = new Runnable(){
                    public void run(){
                         SimpleDateFormat frm = new SimpleDateFormat("MM/dd/yyyy");
                         String currentDate = frm.format(m_data.m_date);
                         String result =
                         (String)JOptionPane.showInputDialog(DDTable.this,"Please enter date in form mm/dd/yyyy:", "Input", JOptionPane.INFORMATION_MESSAGE, null, null, currentDate);
                         if (result==null)
                              return;
                         java.util.Date date = null;
                         try{
                              date = frm.parse(result);
                         catch (java.text.ParseException ex){
                              date = null;
                         if (date == null){
                              JOptionPane.showMessageDialog(DDTable.this, result+" is not a valid date", "Warning", JOptionPane.WARNING_MESSAGE);
                              return;
                         setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                         try{
                              m_data.retriveData(date);
                         catch (Exception ex){
                              JOptionPane.showMessageDialog(DDTable.this,"Error retrieving data:\n"+ex.getMessage(),"Error",JOptionPane.ERROR_MESSAGE);
                         setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                         m_title.setText(m_data.getTitle());
                         m_table.tableChanged(new TableModelEvent(m_data));
               SwingUtilities.invokeLater(updater);
     public static void main(String argv[]){
          DDTable frame = new DDTable();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);
   class DDData{
        public String m_name;
        public String m_date;
        public String m_startTime;
        public String m_endTime;
        public String m_totalTime;
        public String m_comment;
        public String m_category;
        public DDData(String name, String date,String startTime, String endTime, String totalTime, String comment, String category){
             m_name = name;
             m_date = date;
             m_startTime = startTime;
             m_endTime = endTime;
             m_totalTime = totalTime;
             m_comment = comment;
             m_category = category;
   class ColumnData{
        public String m_title;
        public int m_width;
        public int m_alignment;
        public ColumnData(String title, int width, int alignment) {
             m_title = title;
             m_width = width;
             m_alignment = alignment;
   class DDTableData extends AbstractTableModel{
     private static final long serialVersionUID = 1L;
     static final String QUERY = "SELECT symbols.name,"+"data startTime, data.endTime, data.totalTime, data.comment, data.category FROM DATA INNER JOIN SYMBOLS"
     +"ON DATA.symbol = SYMBOLS.symbol WHERE"+
     "month(data.date1)=? AND day(data.date1)=?"+
     "AND year(data.date1)=?";
     @SuppressWarnings("unchecked")
     public void retriveData(Date date)
     throws SQLException, ClassNotFoundException {
          try {
               File f = new File("appointments.dat");
               FileInputStream fis = new FileInputStream(f);
            ObjectInputStream ois = new ObjectInputStream(fis);
            m_vector = (Vector<DDData>) ois.readObject();
            ois.close();
            fis.close();
           } catch(ClassCastException ex) {
           } catch(FileNotFoundException ex) {
           } catch(IOException ex) {
          /*GregorianCalendar calendar = new GregorianCalendar();
          calendar.setTime(date);
          int month = calendar.get(Calendar.MONTH)+1;
          int day = calendar.get(Calendar.DAY_OF_MONTH);
          int year = calendar.get(Calendar.YEAR);
          m_date = date;
          m_vector = new Vector();
          Connection conn = null;
          PreparedStatement pst = null;
          try{
               //Load the JDBC-ODBC bridge driver
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               conn = DriverManager.getConnection("jdbc:odbc:Market", "admin", "");
               pst = conn.prepareStatement(QUERY);
               pst.setInt(1, month);
               pst.setInt(2, day);
               pst.setInt(3, year);
               ResultSet results = pst.executeQuery();
               while (results.next()){
                    String name = results.getString(1);
                    String startTime = results.getString(2);
                    String endTime = results.getString(3);
                    String totalTime = results.getString(4);
                    String comment = results.getString(5);
                    String category = results.getString(6);
                    m_vector.addElement(new DDData(name, startTime, endTime, totalTime, comment, category, category));
               sortData();
          finally{
               if (pst != null )
                    pst.close();
               if (conn != null)
                    conn.close();
     private void saveData() {
          try {
               File f = new File("appointments.dat");
               FileOutputStream fos = new FileOutputStream(f);
            ObjectOutputStream oos = new ObjectOutputStream(fos);
            oos.writeObject(m_vector);
            oos.close();
            fos.close();
           } catch(IOException ex) {
     private void sortData() {
          // TODO Auto-generated method stub
     static final public ColumnData m_columns[] = {
             new ColumnData("Name", 100, JLabel.LEFT),
             new ColumnData("Date", 100, JLabel.LEFT),
             new ColumnData("Start Time", 100, JLabel.RIGHT),
             new ColumnData("End Time", 100, JLabel.RIGHT),
             new ColumnData("Total Time", 100, JLabel.RIGHT),
             new ColumnData("Comment", 200, JLabel.RIGHT),
             new ColumnData("Category", 100, JLabel.RIGHT),
        protected SimpleDateFormat m_frm;
        protected Vector<DDData> m_vector = new Vector<DDData>();
        protected Date m_date;
        public DDTableData(){
             m_frm = new SimpleDateFormat("MM/dd/yyyy");
             setDefaultData();
        public void setDefaultData(){
             try{
                  m_date = m_frm.parse("07/31/2007");
             catch (java.text.ParseException ex){
                  m_date = null;
             m_vector.removeAllElements();
             m_vector.addElement(new DDData("Jerome", null, "Dan", null, null, null, null));
        public int getRowCount(){
             return m_vector==null ? 0 : m_vector.size();
        public int getColumnCount(){
             return m_columns.length;
        public String getColumnName(int column){
             return m_columns[column].m_title;
        public boolean isCellEditable(int nRow, int nCol){
             return false;
        public Object getValueAt(int nRow, int nCol){
             if (nRow < 0 || nRow>=getRowCount())
                  return "";
             DDData row = m_vector.elementAt(nRow);
             switch (nCol){
             case 0: return row.m_name;
             case 1: return row.m_date;
             case 2: return row.m_startTime;
             case 3: return row.m_endTime;
             case 4: return row.m_totalTime;
             case 5: return row.m_comment;
             case 6: return row.m_category;
             return "";
        public String getTitle(){
             if (m_date==null)
                  return "Daily Dairy";
             return "Daily Dairy at "+m_frm.format(m_date);

here is code to collect the data pls what can i do to get the data on the form display on the JTable in the all categories as on the form pls...
private String collectData()
          String toPrint = "";
          for (int i = 0; i < rowData.length; i++)
               Component[] currentRowComps = rowData;
               for (int j = 0; j < currentRowComps.length; j++)
                    Component currentComp = currentRowComps[j];
                    if (currentComp instanceof TextField)
                         TextField tf = (TextField) currentComp;
                         toPrint += tf.getText() + " - ";
                    else if (currentComp instanceof JComboBox)
                         JComboBox box = (JComboBox) currentComp;
                         Object selection = box.getSelectedItem();
                         if (selection != null)
                              toPrint += selection.toString() + " - ";
               toPrint += "\n";
          return toPrint;
     private File newFile(String data)
          File newfile = null;
          try
               newfile = new File("I:\\ouput.doc");
               System.out.println("DATA? - " + data);
               FileOutputStream fos = new FileOutputStream(newfile);
               fos.write(data.getBytes());
               fos.close();
               // JOptionPane.showMessageDialog(null, "Save File");
               JOptionPane.showMessageDialog(null, "File saved.", "Success",
               JOptionPane.INFORMATION_MESSAGE);
          catch (IOException ioexc)
               JOptionPane.showMessageDialog(null, "Error while saving file: " + ioexc,
               "Error", JOptionPane.ERROR_MESSAGE);
          return null;
private void addLabelTextRows(JLabel[] labels,
JTextField[] textFields,
GridBagLayout gridbag,
Container container) {
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.EAST;
int numLabels = labels.length;
for (int i = 0; i < numLabels; i++) {
c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
c.fill = GridBagConstraints.NONE; //reset to default
c.weightx = 0.0; //reset to default
container.add(labels[i], c);
c.gridwidth = GridBagConstraints.REMAINDER; //end row
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1.0;
container.add(textFields[i], c);
Message was edited by:
desaint
Message was edited by:
desaint

Similar Messages

  • How to open .cmdrw file from Oracle Forms 10g

    Hi,
    We need to call *.cmdrw* file from Oracle forms 10g. Is there any way to call *.cmdrw* file from Oracle forms 10g?
    Thanks for the help.
    Viishnu Nekkanti

    In case you want to open a .cmdrw with its associated application you can use the following procedure:
    webutil_host.NonBlocking( 'rundll32 url.dll,FileProtocolHandler ' || client_filename );This works for every file where a program has been associated to its file extension. (Adobe Reader for *.pdf, Microsoft Word for *.doc, Microsoft Excel for *.xls and so on)
    Regards
    Markus

  • Create a JSON file from a form submission

    Hi there, I am trying to create my first BC app but struggling to find a solution to create some data inside BC, I need to create a JSON file from a form submission that will be used as feed for my app.
    How I see it working:
    - Form submits details { Name, Email, Phone Number and a Date.} to a JSON file.
    - My app.js will read the JSON file and populate the content on a graph.
    Any other ideas will be much appreciated.
    I don't know if BC is has another way to host data from an app! but if you know pleas share.

    Hi Liam I must be explaining it wrong then, I am creating a BC App not an WebApp, At the moment I have my BC App generating the WebApp but once its done the JSON is generated somewhere in BC where i cannot fetch I tried using some directories to fetch it.
    I created the app this way:
    function tryWebAppCreate(data, xhr) {
        $.getJSON("booking-data/webapp.json")
            .done(function(webAppJsonDescriptor) {
                createWebApp(WEBAPP_NAME, webAppJsonDescriptor.webAppCustomFields, webAppJsonDescriptor.webAppSampleData, loadTeamMembers);   
            .fail(function() {
                systemNotifications.showError("Could not load webapp definition file");
    But now to fetch it i tried: ( replacing the braces with appropriate IDs)
    /api/v2/admin/sites/[site id]/webapps/[app id]/webappp.json
    My 3rd party App will connect to my BC App and from my app i have another call to send the JSON info.
    I just cant call it! maybe if you know how please let me know.

  • Why aren't all view options available when saving a file from Adobe InDesign CC 2014 on OS X Yosemite?

    Why aren't all view options available when saving a file from Adobe InDesign CC 2014 on OS X Yosemite?

    ASk in the ID forum and explain better what you actually mean.
    Mylenium

  • How to run batch file from oracle forms 9i

    Hi everyone.
    i have a data in csv file. i want to upload it to my database. i am using sql loader for it.
    i have made a batch file which run the sql loader and transfer my data to database.
    How to run batch file from oracle forms 9i.
    when i press the button, nothing uploads in my database. (when i simply run the batch file it works).
    here is my code
    Begin
    HOST('C:\temp\batchfile.bat');
    message('done');
    end;
    Thanks in advance
    regards
    sajid

    this is my log file, when i run manually.
    SQL*Loader: Release 10.2.0.1.0 - Production on Thu Jul 1 23:27:53 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Control File: file_to_upload.ctl
    There are 2 data files:
    Data File: sk.csv
    Bad File: sk.bad
    Discard File: none specified
    (Allow all discards)
    Data File: sk1.csv
    Bad File: sk1.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table KHAN, loaded from every logical record.
    Insert option in effect for this table: APPEND
    Column Name Position Len Term Encl Datatype
    SR FIRST * , O(") CHARACTER
    DATES NEXT * , O(") CHARACTER
    AGENT NEXT * , O(") CHARACTER
    COUNTRY NEXT * , O(") CHARACTER
    TRANSACTIONS NEXT * , O(") CHARACTER
    PKR NEXT * , O(") CHARACTER
    USD NEXT * , O(") CHARACTER
    BANK NEXT * , O(") CHARACTER
    Table KHAN:
    11088 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 132096 bytes(64 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 11088
    Total logical records rejected: 0
    Total logical records discarded: 0
    Run began on Thu Jul 01 23:27:53 2010
    Run ended on Thu Jul 01 23:27:54 2010
    Elapsed time was: 00:00:00.63
    CPU time was: 00:00:00.17

  • Call an executable file from oracle forms 6i

    Hello ,
    i want to call a local .exe file from oracle forms 6i passing along a couple of parameters in the command line .
    Can anyone help me out here ?
    thanks
    C.
    Edited by: user539712 on Jan 21, 2011 11:55 AM
    Edited by: user539712 on Jan 21, 2011 11:55 AM

    that worked...now i am facing a different issue now which i didnt have without the start command . i am calling iexplorer.exe but i am passing a long a url in the command line . the 2nd parameter in the url is not working so when i do :
    "start c:\progra~1\intern~1\iexplore.exe" http://localhost/hello.jsp&a=ddd&b=333
    the &b=333 is not passed (some issue with the & character i am guessing). Would you know a workaround ?
    thanks

  • I have a Seagate expansion drive with files from my former pc.  How do I transfer these files to my new iMac?

    I have a Seagate expansion drive with files from my former pc.  How do I transfer these files to my new iMac?

    Drag them to the desired locations.
    (93394)

  • How to call a .rpt file from oracle form 10g

    I need to call a .rpt file from oracle form 10g. please suggest what to do for this

    Hi,
    onlz rdf and rep files are Reports executables. Convert rpt to rep and you are file (Reports has a conversion utility in the bin directory)
    Frank

  • Have CS 5 Installed on my iMac and works ok. But installed on my new MacBook Pro it won't open NEF files from my Nikon D810. Displays NEF icons, but when I try and open them the response is: Make sure latest RAW updates are installed. If problem persists

    Have CS 5 Installed on my iMac and works ok. But installed on my new MacBook Pro it won't open NEF files from my Nikon D810. Displays NEF icons, but when I try and open them the response is: Make sure latest RAW updates are installed. If problem persists follow link: http://www.adobe.com/go/kb407111. Have installed Bridge 5.0.2.4; Raw Ref Version 7.0.0.308; DNG converter_8_7_1.dmg; Bridge 5.0.2 Update 2. Also same problem with Lightroom which I don't normally use. Lightroom_3_LS11_mac_3_6.dmg installed.

    In the link you posted it states that the Nikon 810 requires ACR 8.6 or newer.
    Version of ACR are specific to versions of Photoshop. You cannot use 8.6 nor even 7.0.in CS5.
    I believe that ACR 6.7 is the latest that will work with CS5, so make sure you have this installed and get rid of ACR 7.
    Having 2 versions of ACR will cause problems.
    You have already downloaded DNG Converter 8.7.1.
    Have you double clicked the DMG file to allow you to install DNG Converter on your computer?
    Be aware that DNG converter is a stand-along application and not a plug-in.
    You need to open DNG converter at select the FOLDER that contain your .NEF files.
    Don't open the folder and try to select individual files, it doesn't work that way.
    After converting your D810 files to DNGs you can then open the DNGs in CS5
    The problem is your camera didn't exist when CS5 & its version of ACR was developed.
    i don't use Lightroom, but the list mentions Lightroom 5.6 as needed to open D819 so your 3.6 version of LR won't cut it.

  • How to call a jar file from oracle forms (6i)

    Hi,
    I'm working with oracle 6i. I want to know that how to call a .jar file from forms menu. when I use HOST('<path>\test.jar') it is working in 'Client Server' any way. but the problem is I use application server in order to run my form. so my form is in the server and I run the form via clients web browser. in that case above solution will not work. if any body knows how to overcome this problem please reply.
    thanks.
    duminda

    I created a bean area and set the class name as implementation class. within that java bean class I called to a bat file which consists of the execution command of the jar file ( because i don't know how to call .jar file from my bean class directly).
    then i tried to run it in application server. its still not running.
    can you tell me what i have to do within my bean class? or can you suggest any solution?
    thank you.

  • How to call pdf files from oracle forms

    I have a pdf file in the server , I need to call this and open when a button is pressed in the oracle forms.
    Please let me know how to do this.
    Thanks,
    Previn

    Frank,
    I have oracle applications and I want to open a pdf file located in the server from a button in oracle applications.
    Previn,
    you don't mention the Forms release you are running.
    If you are running Forms on the web, you can use
    web.show_document() to load files from the Web if
    they are accessible via HTTP.
    Frank

  • Problem saving mp3 files from the internet

    Hi
    I'm having problems saving mp3's from internet sites. Whenever i find an mp3 which I wanna download, and I press the ctrl button as choose "save as", it oly saves as an internet link file ( called something like web.archive) does anyone have an idea how i solve this problem? Another thing is if i click the mp3 file it opens in quicktime, but there is no save as options..
    Best Regards
    Mark

    No that is not the problem, it works with windows and I have done it before, just not with a mac

  • Folders for saving imported files - "From Files or Folders"?

    When I "get" photos into PSE 10 from my camera or card reader, I have the option of saving each photo to a folder named after the shot date. I can also delete the original once it has been copied to my PC. Is there a way to do the same thing for photos imported using "Get Photos > From Files or Folders"? When I use the From Files and Folders route, the file organization scheme is entirely different and I would like to use the same storage organization that applies when I "get" photos from my camera or card reader.
    Thanks,
    Bob

    wrnoof wrote:
    When I "get" photos into PSE 10 from my camera or card reader, I have the option of saving each photo to a folder named after the shot date. I can also delete the original once it has been copied to my PC. Is there a way to do the same thing for photos imported using "Get Photos > From Files or Folders"? When I use the From Files and Folders route, the file organization scheme is entirely different and I would like to use the same storage organization that applies when I "get" photos from my camera or card reader.
    Thanks,
    Bob
    Warning !
    There is a big difference between getting files from camera or card reader (this implies a copy from the camera or card reader to your computer) and getting files from files and folders (already present in your computer). In the last case there is no copy (no download), just a recording in the database of the real location of the files already in your computer.
    You can delete the original in the first case : it has been transferred to your computer by the downloader module. In the second case, there is no copy and the catalog is only a list of the files and their  location (paths) on your computer drive. Deleting originals will delete all.
    If you want to organize your already present folders in a similar date scheme at the default option of the downloader, you'll have to move or rename existing files and folders. The only way to do this would be to do the moves and renaming from the organizer itself, not from the explorer. A lot of work, and totally useless if you use the right tools like tags, categories or albums.

  • How to generate a file from JSP form

    Hi,
    I want to generate a file from the informations of a form(JSP).
    Which classes do I have to use ?
    Thanks.

    Of course you have to use the standard servlet classes to retrieve the request parameters from the form.
    ie request.getParameter();
    package "java.io" gives you File input/output ability.
    If you are generating a text file, thats probably the BufferedWriter and FileWriter classes.
    Cheers,
    evnafets

  • Crash (DEP Exception) Saving .mov files from Vista and Internet Explorer 7

    I have re-created the issue on multiple Vista workstations with IE 7.
    Latest Version of Quicktime (Pro)
    Vista SP2
    When I save a .mov file from a web site, the first time I have no problem, but the second time my Internet Explorer crashes unless I have protected mode turned off.
    Any help would be appreciated....

    The workstations have standard image with the following applications on them:
    Adobe FlashPlayer 10
    Adobe Reader 9.3
    Adobe Shockwave Player 11
    Citrix XenAppWebPlugin
    Courion DirectCP
    IBM eGather
    Intel Drivers
    Microsoft .NET Framework SP3
    Microsoft Office 2007
    Microsoft Visual C++ 2005
    Microsoft Mobile Devices
    Oracle Client 10g
    Apple Quicktime
    RockinFewl LaunchinIE
    SoundMAX
    Sun JRE 1.6.0.16
    Symantec EndPoint Protection
    Verdiem Surveyor Client
    Nothing that should have old Apple Components...is there a way to tell?
    Other Information on the Internet Explorer 7 crash:
    Problem signature
    Problem Event Name: BEX
    Application Name: iexplore.exe
    Application Version: 7.0.6002.18005
    Application Timestamp: 49e01e78
    Fault Module Name: StackHash_fd00
    Fault Module Version: 0.0.0.0
    Fault Module Timestamp: 00000000
    Exception Offset: 00000000
    Exception Code: c0000005
    Exception Data: 00000008
    OS Version: 6.0.6002.2.2.0.256.4
    Locale ID: 4105
    Additional Information 1: fd00
    Additional Information 2: ea6f5fe8924aaa756324d57f87834160
    Additional Information 3: fd00
    Additional Information 4: ea6f5fe8924aaa756324d57f87834160
    Extra information about the problem
    Bucket ID: 559760929
    Message was edited by: gillani

Maybe you are looking for

  • How do I change the default program to open Pages docs to the old (4.3) version instead of the new one (5.0)?

    How do I change the default program to open Pages docs to the old (4.3) version instead of the new one (5.0)? When I do what Apple said and go to a Pages file in finder and select "get info" then select "Pages 4.3" and "change all" it just defaults t

  • I am not seeing export to Excel option in SharePoint 2013 survey (even in the overview view mode)

    Hi If anyone could point me in the right direction as to what steps to take to enable the export to excel option in a sharePoint survey list. all other surveys are showing up that export to excel option. I am not seeing the view dropdown as well whic

  • ADF Faces Skins Not Working

    I can't seem to get my ADF faces skins to register at all. I have a css file, an adf-faces-skins.xml file, and a <skin-family> element in my adf-faces-config.xml file, but to no avail. One possible hint--I think I might not be getting access to the a

  • NullPointerException thrown from findByPrimaryKey()

    I have deployed a EJB entity bean on weblogiic server. When I try to access the entity bean using a client the following exception is thrown. java.lang.NullPointerException at weblogic.rmi.cluster.WeightBasedReplicaHandler.chooseReplica(WeightBasedRe

  • Unity 4.0(4) VM to Unity 7.0 UM

    Hi there, I've done some searches on the forums and CCO and I am still not clear about the Cisco recommended steps for my customers scenario: Customer has a VM install of Unity 4.0(4) on Windows 2000 and wants to end up with Cisco Unity 7.0 in UM mod