Small Problem in JTable,Please help me..

hi ,i am doing college project & hv some problem
Problem : (code is given below ) as i run program ,i am not able to edit cells of table one by one.when i write value in any cell & then if i edit other cell, then previous cell's value become come to initial value
This problem is requires small modification ,plz help(unless my project will not exceed further )
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import javax.swing.table.*;
//import javax.swing.JScrollPane;
//import javax.swing.JTable;
import java.util.*;
import java.util.List;
public class v_swing1 extends JFrame
     {     JButton b1;
          Container cont;
          JTable table ;
          TableModel myData ;
          TextField t1;
          private LocalTableModel theTableModel;                         //t1.setEditable(false);
          private List<Row> theRows;
     private class Row {
          private int theFirstField;
          private String theSecondField;
          public Row(int aFirstField, String aSecondField) {
               theFirstField = aFirstField;
               theSecondField = aSecondField;
          public int getFirstField() {
               return theFirstField;
          public String getSecondField() {
               return theSecondField;
     private class LocalTableModel extends AbstractTableModel {
          public String getColumnName(int column) {
               if (column == 0) {return "name";}
               else      {  return "age";}     }
          public Class getColumnClass(int columnIndex) {
          if (columnIndex == 0) { return Integer.class;}
               else      {   return String.class;   }
          public boolean isCellEditable(int rowIndex, int columnIndex) {
               return true;     }
          public int getRowCount() {
               return theRows.size();
          public int getColumnCount() {
               return 2;
          public Object getValueAt(int rowIndex, int columnIndex) {
               Row row = theRows.get(rowIndex);
               if (columnIndex == 0) { return row.getFirstField();}
               else { return row.getSecondField(); }
     public v_swing1(String theLable)
          b1=new JButton();
          t1=new TextField(4);
          theRows = new LinkedList<Row>();
          theTableModel = new LocalTableModel();           
          table = new JTable(theTableModel);
          setLayout(new FlowLayout());
          JPanel thePan=new JPanel();
          thePan.add(t1);
          thePan.add(b1);
          Container cont= getContentPane();
          cont.setLayout(new FlowLayout());
          cont.add(thePan);
          b1.addActionListener(new ActionListener(){
               public void actionPerformed(ActionEvent e)
                    load();
                    reload();
                         //x=Integer.parseInt(t1.getText());
                    //t1.setText(" ");          
                                        // table = new JTable(2,3);     
                              //table.setRowSelectionAllowed(true);
                              // table.setColumnSelectionAllowed(true);
                              //table.setCellSelectionEnabled(true);
          cont.add(new JScrollPane(table));
          load();               
     private void reload(){
          int l =Integer.parseInt(t1.getText());
          for(int size = theRows.size();size<=l;size++)
          theRows.add(new Row(size, " "+size));
          theTableModel.fireTableRowsInserted(size, size);
     private void load(){
          int size = theRows.size();
          if (size > 0) {
               theRows.clear();
               theTableModel.fireTableRowsDeleted(0, size - 1);
          theRows.add(new Row(0, "" + 0));     
          theTableModel.fireTableRowsInserted(0, 1);
     public static void main(String args[])
          v_swing1 obj=new v_swing1("hay");
          obj.addWindowListener(new WindowAdapter(){
          public void windowClosing(WindowEvent e) {
          System.exit(0);
          obj.setSize(400,400);
          obj.setVisible(true);
     }

Please cut and paste the exact message in a reply.
Most likely, your CLASSPATH is wrong.
Larry

Similar Messages

  • I am not able to launch FF everytime i tr to open it, it says FF has to submit a crash report, i even tried doing that and the report was submitted too, but stiil FF did not start, and the problem still persists, please help me solve this issue in English

    Question
    I am not able to launch FF everytime i try to open it, it says FF has to submit a crash report,and restore yr tabs. I even tried doing that and the report was submitted too, but still FF did not start, and the problem still persists, please help me solve this issue
    '''(in English)'''

    Hi Danny,
    Per my understanding that you can't get the expect result by using the expression "=Count(Fields!TICKET_STATUS.Value=4) " to count the the TICKET_STATUS which value is 4, the result will returns the count of all the TICKET_STATUS values(206)
    but not 180, right?
    I have tested on my local environment and can reproduce the issue, the issue caused by you are using the count() function in the incorrect way, please modify the expression as below and have a test:
    =COUNT(IIF(Fields!TICKET_STATUS.Value=4 ,1,Nothing))
    or
    =SUM(IIF(Fields!TICKET_STATUS=4,1,0))
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • HT201263 my ipad give me the apple sign without running up it appears all the time in the screen , i tries to reset my ipad , but still in this problem , can you please help me?

    my ipad give me the apple sign without running up it appears all the time in the screen , i tries to reset my ipad , but still in this problem , can you please help me?

    You may want to look at this about using recovery mode to restore your iPad.
    http://support.apple.com/kb/ht4097

  • It won't let me drag an effect from the browser all of a sudden. I have always been able to do before. I am using effects from favorites bin and when I try to drag it, it won't move. I have never had this problem before. Please help.

    It won't let me drag an effect from the browser all of a sudden. I have always been able to do before. I am using effects from favorites bin and when I try to drag it to the timeline, it won't move. I have never had this problem before. Please help.
    P.S. I have tried other effects including transitions and it still won't let me drag.

    Wow that was really quick, thank you so much.  Im not sure at all which version it was because i said it was around 4 years ago he bought it.  I know it isn't under his username, since he's a PC person (ugh) so i know its probably registered to one of our actual names.  isn't there some way to look it up since we did register it, because I'm not even sure where the disks are from when we bought it (we've moved a lot and also have two storage lockers, i know i would have kept it with other disks) but my cd rom drive is actually broken on my computer as well ( i think it got stepped on and is now squished and won't eject or run disks.)
    So is there anyway they can look up that its registered to one of our names since we did register it when we bought and installed it, or do i really have to find the disk with some sort of proof of purchase (i know there would be no receipt after all this time)
    either way, ill do what you suggested to the best of my abilities and thank you so much for answering my questions, i can't even open the program as its incompatible and find out the info from that) so I'm in a bit of a pickle and your response was so thorough and it didn't seem to be posted long enough to even write a well researched response, thanks, all the best,
    sarucia

  • Mac Book Air sleeps when moved...i don't know whats the problem...please help me out if anyone knows about this...

    Mac Book Air sleeps when moved...i don't know whats the problem...please help me out if anyone knows about this...

    your reed switch for the monitor is defective, it thinks youve shut the lid when you havent
    mechanical fault , contact Apple for service and parts replacement.

  • I want to ask how to downgrade ios 7 to 6.1.3, because a lot of problems ios 7. please help

    I want to ask how to downgrade ios 6.1.3 to 7, because a lot of problems ios 7. please help

    I'm sorry, but Apple does not provide a downgrade path for iOS. Because downgrading is unsupported by Apple we cannot discuss it on these forums.

  • Error getting license. License server communication problem: E_ADEPT_NO_TOKEN. Please help

    I try to download my ebooks on my laptop but receive the onscreen message, Error getting license, License server commucication problem: E_ADEPT_NO_TOKEN. Please help?

    It means, the URLLink.ACSM file is corrupted. Please contact the book store and ask them to check whether the configuration in the server side is correct for that book.
    One of the simple setting in the server which can case this issue is, setting the book for loan in server and providing the purchase option in the book store or vise verse.
    Hope this solves your problem.

  • HT1386 i tried to sync my ipad to my itunes using usb but it will say not charging,, i can sync with my ipod touch without any problem... please help..

    i tried to sync my ipad to my itunes using usb but it will say not charging,, i can sync with my ipod touch without any problem... please help..

    From http://support.apple.com/kb/HT4060 :
    The fastest way to charge your iPad is with the included 10W USB Power Adapter. iPad will also charge, although more slowly, when attached to a computer with a high-power USB port (many recent Mac computers) or with an iPhone Power Adapter. When attached to a computer via a standard USB port (most PCs or older Mac computers) iPad will charge, but only when it's in sleep mode.
    iPods need less power to charge them (their wall charger is half the power of the iPad's, 5W as opposed to 10W), so are more likely to charge via USB

  • Jtable Update problem .. Please help !!!!!!!!

    Hi ,
    I am trying to get my updated Jtable, stored in a table of database over a previous table ......after updating it via drag n drop ....
    But even after I change the cell position to make the changes ... it still takes up the old value of that cell and not the new one while writing the data in the database table...
    Here is the code .... Please see it and tell me if it is possible :
    package newpackage;
    import java.sql.*;
    import java.util.Vector;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Dimension;
    import java.text.*;
    import newpackage.ExcelExporter;
    import java.awt.Dimension;
    import javax.swing.border.*;
    import javax.swing.table.*;
    import java.awt.datatransfer.*;
    import java.awt.dnd.*;
    import java.awt.image.*;
    import java.io.*;
    import java.util.*;
    import java.awt.print.*;
    import java.awt.*;
    import java.io.*;
    import java.util.Random.*;
    import javax.swing.*;
    import java.text.*;
    import javax.swing.DefaultCellEditor;
    import javax.swing.JComboBox;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.TableColumn;
    public class tab7le extends javax.swing.JFrame {
        Vector columnNames = new Vector();
        Vector data = new Vector();
        Connection con;
    Statement stat;
    ResultSet rs;
    int li_cols = 0;
    Vector allRows;
    Vector row;
    Vector newRow;
    Vector colNames;
    String dbColNames[];
    String pkValues[];
    String tableName;
    ResultSetMetaData myM;
    String pKeyCol;
    Vector deletedKeys;
    Vector newRows;
    boolean ibRowNew = false;
    boolean ibRowInserted = false;
        private Map<String, Color> colormap = new HashMap<String, Color>();
        /** Creates new form tab7le */
        public tab7le() {
            populate();
            initComponents();
           public void updateDB(){
                     try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          catch (ClassNotFoundException e){
                System.out.println("Cannot Load Driver!");
          try{
             String url = "jdbc:odbc:FAMS";
             con = DriverManager.getConnection(url);
             stat = con.createStatement();
             rs = stat.executeQuery("Select * from SubAllot");
             deletedKeys = new Vector();
             newRows = new Vector();
             myM = rs.getMetaData();
             tableName = myM.getTableName(1);
             li_cols = myM.getColumnCount();
             dbColNames = new String[li_cols];
             for(int col = 0; col < li_cols; col ++){
                dbColNames[col] = myM.getColumnName(col + 1);
             allRows = new Vector();
             while(rs.next()){
                newRow = new Vector();
                for(int i = 1; i <= li_cols; i++){
                   newRow.addElement(rs.getObject(i));
                } // for
                allRows.addElement(newRow);
             } // while
          catch(SQLException e){
             System.out.println(e.getMessage());
    String updateLine[] = new String[dbColNames.length];
          try{
             DatabaseMetaData dbData = con.getMetaData();
             String catalog;
             // Get the name of all of the columns for this table
             String curCol;
             colNames = new Vector();
             ResultSet rset1 = dbData.getColumns(null,null,tableName,null);
             while (rset1.next()) {
                curCol = rset1.getString(4);
                colNames.addElement(curCol);
             rset1.close();
             pKeyCol = colNames.firstElement().toString();
             // Go through the rows and perform INSERTS/UPDATES/DELETES
             int totalrows;
             totalrows = allRows.size();
             String dbValues[];
             Vector currentRow = new Vector();
             pkValues = new String[allRows.size()];
             // Get column names and values
             for(int i=0;i < totalrows;i++){
                currentRow = (Vector) allRows.elementAt(i);
                int numElements = currentRow.size();
                dbValues = new String[numElements];
                for(int x = 0; x < numElements; x++){
                   String classType = currentRow.elementAt(x).getClass().toString();
                   int pos = classType.indexOf("String");
                   if(pos > 0){ // we have a String
                      dbValues[x] = "'" + currentRow.elementAt(x) + "'";
                      updateLine[x] = dbColNames[x] + " = " + "'" + currentRow.elementAt(x) + "',";
                      if (dbColNames[x].toUpperCase().equals(pKeyCol.toUpperCase())){
                        pkValues[i] = currentRow.elementAt(x).toString() ;
                   pos = classType.indexOf("Integer");
                   if(pos > 0){ // we have an Integer
                      dbValues[x] = currentRow.elementAt(x).toString();
                      if (dbColNames[x].toUpperCase().equals(pKeyCol.toUpperCase())){
                         pkValues[i] = currentRow.elementAt(x).toString();
                      else{
                         updateLine[x] = dbColNames[x] + " = " + currentRow.elementAt(x).toString() + ",";
                   pos = classType.indexOf("Boolean");
                   if(pos > 0){ // we have a Boolean
                      dbValues[x] = currentRow.elementAt(x).toString();
                      updateLine[x] = dbColNames[x] + " = " + currentRow.elementAt(x).toString() + ",";
                      if (dbColNames[x].toUpperCase().equals(pKeyCol.toUpperCase())){
                         pkValues[i] = currentRow.elementAt(x).toString() ;
                } // For Loop
                // If we are here, we have read one entire row of data. Do an UPDATE or an INSERT
                int numNewRows = newRows.size();
                int insertRow = 0;
                boolean newRowFound;
                for (int z = 0;z < numNewRows;z++){
                   insertRow = ((Integer) newRows.get(z)).intValue();
                   if(insertRow == i+1){
                      StringBuffer InsertSQL = new StringBuffer();
                      InsertSQL.append("INSERT INTO " + tableName + " (");
                      for(int zz=0;zz<=dbColNames.length-1;zz++){
                         if (dbColNames[zz] != null){
                            InsertSQL.append(dbColNames[zz] + ",");
                      // Strip out last comma
                      InsertSQL.replace(InsertSQL.length()-1,InsertSQL.length(),")");
                      InsertSQL.append(" VALUES(" + pkValues[i] + ",");
                      for(int c=1;c < dbValues.length;c++){
                         InsertSQL.append(dbValues[c] + ",");
                      InsertSQL.replace(InsertSQL.length()-1,InsertSQL.length(),")");
                      System.out.println(InsertSQL.toString());
                      stat.executeUpdate(InsertSQL.toString());
                      ibRowInserted=true;
                } // End of INSERT Logic
                // If row has not been INSERTED perform an UPDATE
                if(ibRowInserted == false){
                   StringBuffer updateSQL = new StringBuffer();
                   updateSQL.append("UPDATE " + tableName + " SET ");
                   for(int z=0;z<=updateLine.length-1;z++){
                      if (updateLine[z] != null){
                         updateSQL.append(updateLine[z]);
                   // Replace the last ',' in the SQL statement with a blank. Then add WHERE clause
                   updateSQL.replace(updateSQL.length()-1,updateSQL.length()," ");
                   updateSQL.append(" WHERE " + pKeyCol + " = " + pkValues[i] );
                   System.out.println(updateSQL.toString());
                   stat.executeUpdate(updateSQL.toString());
                   } //for
             catch(Exception ex){
                System.out.println("SQL Error! Cannot perform SQL UPDATE " + ex.getMessage());
             // Delete records from the DB
             try{
                int numDeletes = deletedKeys.size();
                String deleteSQL;
                for(int i = 0; i < numDeletes;i++){
                   deleteSQL = "DELETE FROM " + tableName + " WHERE " + pKeyCol + " = " +
                                                ((Integer) deletedKeys.get(i)).toString();
                System.out.println(deleteSQL);
                   stat.executeUpdate(deleteSQL);
                // Assume deletes where successful. Recreate Vector holding PK Keys
                deletedKeys = new Vector();
             catch(Exception ex){
                System.out.println(ex.getMessage());
        public void populate()
            try
                //  Connect to the Database
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                Connection con = DriverManager.getConnection("Jdbc:Odbc:FAMS"," "," ");
                System.out.println("ok1");
                //  Read data from a table
                String sql;
                 sql = "Select * from SubAllot";
                 System.out.println("ok1");
                Statement stmt = con.createStatement();
                System.out.println("ok1");
                ResultSet rs = stmt.executeQuery( sql );
                System.out.println("ok1");
                ResultSetMetaData md = rs.getMetaData();
                System.out.println("ok1");
                int columns = md.getColumnCount();
                for(int i = 0;i<columns;i++){
                    columnNames.addElement(md.getColumnName(i+1));
                    System.out.println("ok2");
                while (rs.next())
                    Vector row = new Vector(columns);
                    for (int i = 1; i <columns+1; i++)
                        row.addElement( rs.getObject(i) );
                    data.addElement( row );
            catch(Exception e){
                e.printStackTrace();
                 public void dropmenu(JTable table,TableColumn subpref1) {
            //Set up the editor for the sport cells.
            JComboBox comboBox = new JComboBox();
          for (int i = 0;i<=20;i++)
           comboBox.addItem(i);
            subpref1.setCellEditor(new DefaultCellEditor(comboBox));
            //Set up tool tips for the sport cells.
            DefaultTableCellRenderer renderer =
                    new DefaultTableCellRenderer();
            renderer.setToolTipText("Click for combo box");
            subpref1.setCellRenderer(renderer);
                       abstract class StringTransferHandler extends TransferHandler {
            public int dropAction;
            protected abstract String exportString(final JComponent c);
            protected abstract void importString(final JComponent c, final String str);
            @Override
            protected Transferable createTransferable(final JComponent c) {
                return new StringSelection(exportString(c));
            @Override
            public int getSourceActions(final JComponent c) {
                return MOVE;
            @Override
            public boolean importData(final JComponent c, final Transferable t) {
                if (canImport(c, t.getTransferDataFlavors())) {
                    try {
                        String str = (String) t.getTransferData(DataFlavor.stringFlavor);
                        importString(c, str);
                        return true;
                    } catch (UnsupportedFlavorException ufe) {
                    } catch (IOException ioe) {
                return false;
            @Override
            public boolean canImport(final JComponent c, final DataFlavor[] flavors) {
                for (int ndx = 0; ndx < flavors.length; ndx++) {
                    if (DataFlavor.stringFlavor.equals(flavors[ndx])) {
                        return true;
                return false;
        class TableTransferHandler extends StringTransferHandler {
            private int dragRow;
            private int[] dragColumns;
            private BufferedImage[] image;
            private int row;
            private int[] columns;
            public JTable target;
            private Map<String, Color> colormap;
            private TableTransferHandler(final Map<String, Color> colormap) {
                this.colormap = colormap;
            @Override
            protected Transferable createTransferable(final JComponent c) {
                JTable table = (JTable) c;
                dragRow = table.getSelectedRow();
                dragColumns = table.getSelectedColumns();
                createDragImage(table);
                return new StringSelection(exportString(c));
            protected String exportString(final JComponent c) {
                JTable table = (JTable) c;
                row = table.getSelectedRow();
                columns = table.getSelectedColumns();
                StringBuffer buff = new StringBuffer();
                colormap.clear();
                for (int j = 0; j < columns.length; j++) {
                    Object val = table.getValueAt(row, columns[j]);
                    buff.append(val == null ? "" : val.toString());
                    if (j != columns.length - 1) {
                        buff.append(",");
                    colormap.put(row+","+columns[j], Color.LIGHT_GRAY);
                table.repaint();
                return buff.toString();
            protected void importString(final JComponent c, final String str) {
                target = (JTable) c;
                DefaultTableModel model = (DefaultTableModel) target.getModel();
                String[] values = str.split("\n");
                int colCount = target.getSelectedColumn();
                int max = target.getColumnCount();
                for (int ndx = 0; ndx < values.length; ndx++) {
                    String[] data = values[ndx].split(",");
                    for (int i = 0; i < data.length; i++) {
                        String string = data;
    if(colCount < max){
    Object val = model.getValueAt(target.getSelectedRow(), colCount);
    model.setValueAt(string, target.getSelectedRow(), colCount);
    model.setValueAt(val, dragRow, dragColumns[i]);
    colCount++;
    public BufferedImage[] getDragImage() {
    return image;
    private void createDragImage(final JTable table) {
    if (dragColumns != null) {
    try {
    image = new BufferedImage[dragColumns.length];
    for (int i = 0; i < dragColumns.length; i++) {
    Rectangle cellBounds = table.getCellRect(dragRow, i, true);
    TableCellRenderer r = table.getCellRenderer(dragRow, i);
    DefaultTableModel m = (DefaultTableModel) table.getModel();
    JComponent lbl = (JComponent) r.getTableCellRendererComponent(table,
    table.getValueAt(dragRow, dragColumns[i]), false, false, dragRow, i);
    lbl.setBounds(cellBounds);
    BufferedImage img = new BufferedImage(lbl.getWidth(), lbl.getHeight(),
    BufferedImage.TYPE_INT_ARGB_PRE);
    Graphics2D graphics = img.createGraphics();
    graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f));
    lbl.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
    lbl.paint(graphics);
    graphics.dispose();
    image[i] = img;
    } catch (RuntimeException re) {
    class TableDropTarget extends DropTarget {
    private Insets autoscrollInsets = new Insets(20, 20, 20, 20);
    private Rectangle rect2D = new Rectangle();
    private TableTransferHandler handler;
    public TableDropTarget(final TableTransferHandler h) {
    super();
    this.handler = h;
    @Override
    public void dragOver(final DropTargetDragEvent dtde) {
    handler.dropAction = dtde.getDropAction();
    JTable table = (JTable) dtde.getDropTargetContext().getComponent();
    Point location = dtde.getLocation();
    int row = table.rowAtPoint(location);
    int column = table.columnAtPoint(location);
    table.changeSelection(row, column, false, false);
    paintImage(table, location);
    autoscroll(table, location);
    super.dragOver(dtde);
    public void dragExit(final DropTargetDragEvent dtde) {
    clearImage((JTable) dtde.getDropTargetContext().getComponent());
    super.dragExit(dtde);
    @Override
    public void drop(final DropTargetDropEvent dtde) {
    Transferable data = dtde.getTransferable();
    JTable table = (JTable) dtde.getDropTargetContext().getComponent();
    clearImage(table);
    handler.importData(table, data);
    super.drop(dtde);
    private final void paintImage(final JTable table, final Point location) {
    Point pt = new Point(location);
    BufferedImage[] image = handler.getDragImage();
    if (image != null) {
    table.paintImmediately(rect2D.getBounds());
    rect2D.setLocation(pt.x - 15, pt.y - 15);
    int wRect2D = 0;
    int hRect2D = 0;
    for (int i = 0; i < image.length; i++) {
    table.getGraphics().drawImage(image[i], pt.x - 15, pt.y - 15, table);
    pt.x += image[i].getWidth();
    if (hRect2D < image[i].getHeight()) {
    hRect2D = image[i].getHeight();
    wRect2D += image[i].getWidth();
    rect2D.setSize(wRect2D, hRect2D);
    private final void clearImage(final JTable table) {
    table.paintImmediately(rect2D.getBounds());
    private Insets getAutoscrollInsets() {
    return autoscrollInsets;
    private void autoscroll(final JTable table, final Point cursorLocation) {
    Insets insets = getAutoscrollInsets();
    Rectangle outer = table.getVisibleRect();
    Rectangle inner = new Rectangle(outer.x + insets.left,
    outer.y + insets.top,
    outer.width - (insets.left + insets.right),
    outer.height - (insets.top + insets.bottom));
    if (!inner.contains(cursorLocation)) {
    Rectangle scrollRect = new Rectangle(cursorLocation.x - insets.left,
    cursorLocation.y - insets.top,
    insets.left + insets.right,
    insets.top + insets.bottom);
    table.scrollRectToVisible(scrollRect);
    /** 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.
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
    jScrollPane1 = new javax.swing.JScrollPane();
    table = new javax.swing.JTable();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    table.setModel(new javax.swing.table.DefaultTableModel(
    data, columnNames
    jScrollPane1.setViewportView(table);
    //populate();
    table.getTableHeader().setReorderingAllowed(false);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setCellSelectionEnabled(true);
    table.setDragEnabled(true);
    TableTransferHandler th = new TableTransferHandler(colormap);
    table.setTransferHandler(th);
    table.setDropTarget(new TableDropTarget(th));
    dropmenu(table, table.getColumnModel().getColumn(11));
    jButton1.setText("Update");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    jButton2.setText("Ex");
    jButton2.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton2ActionPerformed(evt);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(92, 92, 92)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 605, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGroup(layout.createSequentialGroup()
    .addGap(347, 347, 347)
    .addComponent(jButton1)
    .addGap(115, 115, 115)
    .addComponent(jButton2)))
    .addContainerGap(73, Short.MAX_VALUE))
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(47, 47, 47)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 354, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(58, 58, 58)
    .addComponent(jButton1)
    .addContainerGap(83, Short.MAX_VALUE))
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jButton2)
    .addGap(65, 65, 65))))
    pack();
    }// </editor-fold>
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
    updateDB(); // TODO add your handling code here:
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
    try {
    String pathToDesktop = System.getProperty("user.home")+File.separator+"Desktop";
    pathToDesktop = pathToDesktop + "//Final Allotment.xls";
    ExcelExporter exp = new ExcelExporter();
    exp.exportTable(table, new File(pathToDesktop));
    JOptionPane.showMessageDialog(this,"File exported and saved on desktop!");
    catch (IOException ex) {
    System.out.println(ex.getMessage());
    ex.printStackTrace();
    } // TODO add your handling code here:
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new tab7le().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable table;
    // End of variables declaration
    Please help !!!!!!!!
    Thanks in advance.....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    Here is the code Do you expect people to read through 400 lines of code to understand what you are doing?
    Why post code with access to a database? We can't access the database.
    Search the forum for my "Database Information" (without the space) example class which shows you how to refresh a table with new data.
    If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.

  • SAPscript Output Problem - Very Urgent - Please help

    Hi,
    I am having the following problem with SAPscript.
    In the Main Window, I have instructions to the printer in the ZPL2 language (For Zebra Printer).
    There are also several variables, which are highlighted in Gray and enclosed in the’&’.
    There are also several elements – all of them empty except for the one where this code is.
    Now, I received this program to modify in terms of code and the output.
    IF you have never done any work with Zebra Printing, the way it is done is that you create a label using the Zebra BarOne or Zebra Designer program, then output it to an ‘itf’ file, upload it into a standard text as .itf and copy the uploaded contents to the main window. When printing to a Zebra printer, the Zebra printer will read the instructions and will print the output.
    Here is the problem: The config for the output type is correct.
    When doing a printing test from SAPscript, I get the right output and the Zebra printer is able to print it.
    However, the real process for this task will go through MB02. There, if I create a spool request using the proper method (select output type and etc.), it will go the spool. However, if I print preview or output (doesn’t work with the Zebra printer, so I have to output to the Laser printer), it will output the following (none of the following includes any of the ZPL2 code/instructions. Instead, it seams to print the variables contents with the field name next to it – This isn’t whats it’s the Main window!!!)
    http://img244.imageshack.us/img244/6915/66052475zk2.jpg
    Please help. I have debugged but don’t know what to do and can’t find anything wrong.
    This is very urgent. Any help will be useful.
    Thanks,
    John

    Ok, maybe I have confused others in regards to the issue as well.
    We expect this label to be output from a Zebra Printer.
    When output through Sapscripts printing test, the preview from the spool shows the ZPL2 code in small font (non readible if a created a screenshot) and if sent to the Zebra Printer, it prints the label correctly.
    When output through MB02, the preview from the spool shows the code that I have attached to the 1st post in this thread. If I try to output to the Zebra Printer, nothing happens because the ZPL2 instructions are not even in the preview and therefore, the Zebra printer recieves no instructions. I should not have mentioned the laser printer, because it has nothing to do with this issue.
    I hope that this makes the issue a little more clear and understandable. Please help.
    Here is the ZPL2 coding before uploading to standard text (only difference is that once uploaded,  the '/' characters are removed.) However, I believe that the problem may lie in the print program and how it compiles but I debugged and haven't really seen where it comes from:
    /:NEW-PAGE
    / ^XA
    / DFNEW-RE-1FS
    / ^PRC
    / LH0,0FS
    / ^LL1830
    / ^MD0
    / ^MNY
    / LH0,0FS
    / FO244,854A0N,55,46CI13FRFB154,1,0,LFN999^FS
    / FO819,698A0N,55,46CI13FRFN998FS
    / FO245,477A0N,55,46CI13FRFB755,1,0,RFN997^FS
    / FO389,926A0N,55,46CI13FRFB654,1,0,RFN996^FS
    / BY3,3.0FO42,1072B3N,N,152,N,YFRFN995FS
    / FO276,1258A0N,55,46CI13FRFN995FS
    / FO484,774A0N,55,46CI13FRFN994FS
    / FO817,774A0N,55,46CI13FRFN993FS
    / FO611,556A0N,55,46CI13FRFN992FS
    / FO245,556A0N,55,46CI13FRFN991FS
    / FO397,117A0N,55,46CI13FRFN990FS
    / FO245,405A0N,55,46CI13FRFB880,1,0,RFN989^FS
    / FO244,698A0N,55,46CI13FRFN988FS
    / FO629,998A0N,55,46CI13FRFN987FS
    / FO244,623A0N,52,42CI13FRFN986FS
    / FO397,261A0N,55,46CI13FRFB404,1,0,RFN985^FS
    / FO819,854A0N,55,46CI13FRFN984FS
    / FO725,554A0N,55,46CI13FRFN983FS
    / FO397,189A0N,55,42CI13FRFB695,1,0,RFN982^FS
    / FO397,333A0N,55,42CI13FRFN981FS
    / FO638,333A0N,55,42CI13FRFN980FS
    / FO391,21A0N,63,63CI13FRFB433,1,0,CFN979^FS
    / FO36,698A0N,55,46CI13FR
    / FDWBS:FS
    / FO37,405A0N,55,46CI13FR
    / FDMATL:FS
    / FO37,478A0N,62,44CI13FR
    / FDDESC:FS
    / FO554,698A0N,55,46CI13FR
    / FDSUPPLIER:FS
    / FO32,625A0N,55,46CI13FR
    / FDTEXT:FS
    / FO35,1258A0N,55,46CI13FR
    / FDBATCH NO:FS
    / FO770,775A0N,63,51CI13FR
    / FD/FS
    / FO32,854A0N,55,46CI13FR
    / FDESHM:FS
    / FO37,556A0N,55,46CI13FR
    / FDQTY:FS
    / FO32,998A0N,55,46CI13FR
    / FDSAP MATERIAL DOC NO:FS
    / FO525,333A0N,55,46CI13FR
    / FDofFS
    / FO556,854A0N,55,46CI13FR
    / FDINSPECT:FS
    / FO32,926A0N,55,46CI13FR
    / FDUNLOADING:FS
    / FO37,117A0N,55,46CI13FR
    / FDSTOCK TYPE:FS
    / FO32,774A0N,55,46CI13FR
    / FDPURCHASE ORDER:FS
    / FO37,188A0N,55,46CI13FR
    / FDDELIVER TO:FS
    / FO37,260A0N,55,46CI13FR
    / FDSTORAGE LOC:FS
    / FO37,332A0N,55,46CI13FR
    / FDCONTAINERS:FS
    / FO1,1359GB1217,0,6^FS
    / FO594,1359GB0,474,6^FS
    / ^XZ
    /:NEW-PAGE
    / ^XA
    / ^XFNEW-RE-1.ZPL
    / FN999FD&ATWRT_HAZAMAT(6)&^FS
    / FN998FD&EKKO-LIFNR&^FS
    / FN997FD&MABDR-MAKTX&^FS
    / FN996FD&MSEG-ABLAD&^FS
    / FN995FD&MSEG-CHARG&^FS
    / FN994FD&MSEG-EBELN&^FS
    / FN993FD&MSEG-EBELP&^FS
    / FN992FD&MSEG-ERFME&^FS
    / FN991FD&MSEG-ERFMG&^FS
    / FN990FD&MSEG-INSMK(1)&^FS
    / FN989FD&MSEG-MATNR&^FS
    / FN988FD&MSEG-MAT_PSPNR&^FS
    / FN987FD&MSEG-MBLNR&^FS
    / FN986FD&MSEG-SGTXT(40)&^FS
    / FN985FD&MSEG-UMLGO&^FS
    / FN984FD&QALS-PRUEFLOS&^FS
    / FN983FD&V_BACKORDER&^FS
    / FN982FD&V_NAME3&^FS
    / FN981FD&WS_CNTR&^FS
    / FN980FD&WS_CON&^FS
    / FN979FD&WS_HEADER& &^FS
    / ^PQ1,0,1,N
    / ^XZ
    / ^FX End of job

  • Sorting problem in TreeMap, please help urgent :-((

    Hi
    Following is a program, please execute it to see the problem. I am adding four elements in the TreeMap. The problem is when I add the elements it never compares the newly added element with the first element. I was sick of it so to test the TreeMap I created my own small class and defined a Comparator for that class. Following is the code which shows the problem in TreeMap. Am I doing something wrong? Please help its urgent.
    import java.util.*;
    public class SortingCollection {
         public static void main(String[] args) {
              SortingCollection sortingCollection = new SortingCollection();
              sortingCollection.sortingTest();
         public void sortingTest() {
              TreeMap treeMap = new TreeMap();
              treeMap.put(new Test("Bhushan", 1022), new Integer(1022));
              treeMap.put(new Test("Wasil", 1023), new Integer(1023));
              treeMap.put(new Test("Ifti", 1020), new Integer(1020));
              treeMap.put(new Test("Roshan", 1021), new Integer(1021));
              System.out.println(treeMap);
              Test test = new Test("Bhushan", 1028);
              treeMap.put(test, new Integer(1022));
              System.out.println(treeMap);
         public class Test implements Comparable {
              public String name;
              public int age;
              public Test(String name, int age) {
                   this.name = name;
                   this.age = age;
              public int compareTo(Object toBeCompared) {
                   Test casted = (Test) toBeCompared;
                   if (name.equals(casted.name)) {
                        System.out.println("Returning 0 for " + name + " " + casted.name);
                        return 0;
                   System.out.println("Returning -1 for " + name + " " + casted.name);
                   return -1;
              public String toString() {
                   return "[" + name + ", " + age + "]";
    }

    If you are using TreeMap, you should want the keys to be immutable. You can't change the state of the keys of a Map such that their natural order will change, or chaos will happen.
    If the key is the GateKeeperInfo class (which has host, port, and # of users as its data members) and the value is "some other object reference which you need", and this reference is closely tied to the GateKeeperInfo, have you considered making it a member of the GateKeeperInfo?
    That way you don't need this TreeMap business. You can have the natural ordering imposed on the GateKeeperInfo class (which is apparently comparing the host and port only). You can also have a Comparator object that can compare these objects in a different way (# of users, for instance).
    public class MyClass implements Comparable
       String host;
       int    port;
       int    currNumUsers;
       Object someOtherObjectReferenceINeed;
       // or if the object reference you need is an Integer, make that last member
       // an int...
       // Also, let's keep a Comparator in here for comparing # of users.
       // See further down for actual implementation...
       public static final Comparator BY_NUM_USERS = new NumUsersComparator();
         // Use the equal methods to determine whether or not host and port matches
       public boolean equals( Object obj )
       // Use the compareTo method to compare 2 instances in terms of host and port
       public int compareTo( Object obj )
         // Make this object take care of changing # of users, outside of the
         // Comparable interface.
         public int getNumUsers();
         public int bumpNumUsers( int byThisAmount ); // changes # of users...
         // Beef up this object to take advantage of someOtherObjectReferenceINeed
    // Use this Comparator object to compare 2 instances of MyClass
    // according to # of users.
    public class NumUsersComparator implements Comparator
         public int compare( Object a, Object b )
              MyClass left      = (MyClass)a;
              MyClass right      = (MyClass)b;
              // I am assuming both # of users are of the same sign...positive
              return ( right.getNumUsers() - left.getNumUsers() );
    // Now when you need to compare, you can do it 2 different ways...
    // You can use whatever Collection you fits, List, Set, ...
    // I am going to use List in this case
    List gateways = new ArrayList;
    // add the objects...
    gateways.add( /* . . . */ );
    // Now let's sort in terms of user/port
    Collections.sort( gateways );
    // Let's sort in terms of number of users...
    Collections.sort( gateways, MyClass.BY_NUM_USERS );
    // I am going to mix them around now...
    Collections.shuffle( gateways );
    // Now let's find the gateway w/ the largest # of users...
    MyClass currMaxGateway = Collections.max( gateways, MyClass.BY_NUM_USERS );
    .

  • Nokia 5130 problems...please help!

    hiya i recently updated my Nokia 5130 over-the-air and had no problems so far. then i have downloaded the latest internet settings fro my phone via my network operator. no problem there. but whenever i surf the net or use 3rd-party chat service the internet shuts down and just stops working? why is this? is there a way to use my internet (to surf or chat) seamlessly? (n.b. i have an unlimited internet option on my network account).
    please help!

    you need to call them again the message comes via text its a configuration setting ,then you save this message so call them again
    If  i have helped at all a click on the white star below would be nice thanks.
    Now using the Lumia 1520

  • Tm2 1010ea problems!! PLEASE HELP

    PLEASE HELP!!
    I only just got my Tm2 1010ea yesterday and I'm already having problems.
    I started it up, completed the initial setup and everything was fine. Then I tried to install itunes and norton 360 (which I know had compatability issues but i tried anyway ) and then the problems started.
    Firstly, the icon for the touchsmart app changed and when I went to click it, i got an error message saying the program couldn't be located. Loads of other shortcuts stopped working as well.
    Even when I went to Start -> All programs
    I couldn't start the HP touchsmart app. Apparently Windows couldn't find the program!!
    So I did a system restore to the recovery point before I installed itunes and norton.
    Some of the shortcuts started working again but not all. Also, when I launched touchsmart, I couldn't get music or video or tutorials or webcam to work. I could get calendar and some of the other apps though.
    So then I did another system restore this time to the very first recovery point. But still no good.
    After hours of searching the web for answers, I downloaded a driver from the hp website which fixed the music, photo and video apps in touchsmart, but I still can't get webcam or tutorials to work.
    Also, my HP advisor doesn't work!!
    Since I only got the laptop yesterday I don't have anything on it that I need to keep so is there a way I can delete/clear EVERYTHING so that the laptop goes back to how it was before I even set it up?
    It's very frustrating because according to my program manager itunes and norton have been removed and it looks like everything system wise has been restored to the original "settings", but the fact that when i open program files or program files (x86) I still have itunes and norton folders makes me think that it's interferring with my programs!!
    If anyone can please help i'd really appreciate it!!! As you can probably tell, i'm not exactly proficient with computers but i didn't think i was THAT bad....

    Hi,
    It's not so easy to uninstall Norton product. Standard uninstallation process always leaves some files from this software in system. You will have too use Norton Removal Tool. iTunes is often very problematic software too.
    All pre-installed software on your laptop You will find in C:\swsetup folder. All latest drivers You will find here.
    From this what I see the best solution on your problems will be restoring system to orginal state. How to do that? Restart your system and press F11 on boot. For more information about it check below document:
    Using HP Recovery Manager in Windows 7
    ** Say thanks by clicking the "Thumb up" icon which is on the left. **
    ** Make it easier for other people to find solutions, by marking my answer with "Accept as Solution" if it solves your issue. **

  • Mac mini intel shut down problem !! please help !!

    hi !
    following problem, mac mini intel single core does not shut down, shut down process last 10 min and more (bluescreen, black wheel running) but does not shutdown at all!!
    When I log off my user and then press the shutdown button at the login window, it shuts down normally.
    Any ideas???
    Feeling like being in windows times???
    please help
    thanks
    tobias

    Good catch. I would never have though of that since I eagerly anticipate each chance I get for a clean install.
    I much prefer to get a clean start and consciously change the things I need to work - often I find that the defaults really are better and would otherwise be stuck in habit...

  • My updates are failing.  Adobe application manager may be damaged.  I have downloaded and installed a new copy and the problem persists.   Please help.

    I am trying to update Photoshop CS6 in order to read my camera's RAW files.  It is a camera that is supported by Adobe Photoshop CS6.  However, when I try to get the Adobe Application Manager to update the software, it fails to do so.  (The spinning wheel tells me it is checking for updates and then quits, saying that "Update Failed - Updates could not be applied.  Adobe Application Manager may be damaged.  Download and install a new copy of Adobe Application Manager.")
    I have tried to reinstall the Adobe Application Manager 8.0, which gives me the following error message "We've encountered the following issues.  Installer failed to initialize.  Please download Adobe Support Advisor to detect the problem."  However, when I go to the link provided to download the Adobe Support Advisor, this piece of software NO LONGER EXISTS. "
    The Adobe Support Advisor has been discontinued
    The Adobe Support Advisor tool was used to analyze installer log and system information associated with installation errors. The tool has been replaced with improved installation support mechanisms. Please visit Adobe Support section for Knowledge base articles around Installation."
    So, I have gone to the forums and took the recommended step to update my software manually - getting the update Photoshop_CS6_13_0_6upd-2.dmg.  However, this update also fails stating that my Adobe Application Manager may be damages.  Download and install a new copy of Adobe Application Manager.  Which puts me right back where I started.  
    I have also taken the step of completely reinstalling Photoshop CS6.  This did not solve the problems outlined above.  
    Please help!

    reset your preferences:
    dreamweaver:  http://helpx.adobe.com/dreamweaver/kb/restore-preferences-dreamweaver-cs4-cs5.html
    flash:  http://helpx.adobe.com/flash/kb/re-create-preferences-flash-professional.html
    indesign:  https://forums.adobe.com/thread/526990
    lightroom:  http://www.lightroomforums.net/showthread.php?14226-Resetting-%28or-Trashing-%29-the-Light room-Preferences-file
    photoshop:  https://forums.adobe.com/thread/375776
    if that fails, uninstall ps, clean (Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6) and reinstall.  then use the manual updates.

Maybe you are looking for