URGENT!!!  Help me about JTable, Please.

I have a JTable, it is contained into JScrollPane and I show JScrollPane on a Dialog. When I use JTable, I have some problem :
+ How can I change the data in a JTable, change quantity of columns, quantity of rows (example : I can increase or decrease quantity of columns or rows at the run time).

if you have the JDK documentation installed than search for JTable, you will get everything on tables there, no offence but it sounds really stupid that you cant get what you want coz according to your question, i have seen more than enough information.
asrar

Similar Messages

  • I am trying to buy mitril for hobbit kom but it always gives me error i have already added my card information to store but i cant buy it.Could u help me about it ,please?

    I am trying to buy mitril for hobbit kom but it always gives me error i have already added my card information to store but i cant buy it.Could u help me about it ,please?

    Wish I could help. My wife is having the same problem.  Same computer for 2 years and all of a suddent it thinks this is her first purchase.

  • URGENT !!! Help me about JTable.

    I want to make a program with swing. I use class JTable to show my datum and I have a problem :
    When I create an Object of class JTable (with a Vector , you can review constructor of JTable), I add it into a Scroll (JScrollPane class) and then I add whole into a Dialog (JDialog). My main problem is :
    - When Dialog is showed, it contained Table with ScrollPane. On Table, there is some datum and now, I want to clear old datum and show new datum on Table. How can I do that???
    Thanks !!!

    Instead of passing a Vector to your JTable constructor, do:
    // The second arg is the names of the columns.  Adjust the number and names as required.
    DefaultTableModel model = new DefaultTableModel(yourVector,
        new String[]{"Names", "For", "The", "Columns"});
    JTable table = new JTable(model);When you want to change the data:
    // 2nd are is the column names again.
    model.setDataVector(newData, new String[]{"New", "Column", "Names", "(or old ones)"});

  • Urgent help needed in jtable

    PLEASE could someone help me look at this and see why the color of my data in a jtable cell is niot turning red when I press enter
    THX
    package mintest;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.table.*;
    import com.borland.jbcl.layout.*;
    import java.awt.color.*;
    import javax.swing.event.*;
    import java.awt.Image;
    import javax.swing.ImageIcon;
    import javax.swing.AbstractButton;
    import javax.swing.JButton;
    import java.awt.datatransfer.*;
    import javax.swing.BorderFactory;
    import javax.swing.border.Border;
    import javax.swing.border.TitledBorder;
    import javax.swing.border.EtchedBorder;
    import java.io.*;
    import java.awt.print.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import javax.swing.BorderFactory;
    import javax.swing.JLabel;
    import javax.swing.JTable;
    import javax.swing.border.Border;
    import javax.swing.table.TableCellRenderer;
    import java.awt.Color;
    import java.awt.Component;
    import javax.swing.table.DefaultTableCellRenderer;
    public class VeckoSchema extends JPanel
    private boolean DEBUG = false;
    JTabbedPane tabbedPane;
    Color rgdcolor2= new Color (0,153,255); //Definiera f?rgen f?r schema-,projekt- och l?nehuvudflikarna
    Color rgdcolor1= new Color (0,102,255);
    Color rgdcolor3= new Color (51,204,255); //Definiera f?rgen f?r schema-,projekt- och l?nehuvudflikarna
    Color rgdcolor= new Color (0,0,153);
    Color rgdcolor4= new Color (153,153,153);
    JList list;
    DefaultListModel listModel = new DefaultListModel();
    ImageIcon icon= new ImageIcon ("D:\\Dokument\\Skolarbete\\Examens projekt\\JAVA\\minTest\\Bakgrundsbild2.jpg");
    ImageIcon icon1= new ImageIcon ("D:\\Dokument\\Skolarbete\\Examens projekt\\JAVA\\minTest\\Save16.gif");
    ImageIcon icon2= new ImageIcon ("D:\\Dokument\\Skolarbete\\Examens projekt\\JAVA\\minTest\\printer2.gif");
    JButton spara;
    JButton Ok_knapp = new JButton();
    JPanel panel7;
    TitledBorder title;
    Border blackline;
    JTable table = new JTable(new MyTableModel());
    int x;int y;
    Object data1;
    //ColorRenderer renderer;
    Color mincellColor= Color.red;
    TableCellRenderer Renderer;
    public VeckoSchema() {
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    private void jbInit() throws Exception
    this.setBackground(rgdcolor2);
    this.setLayout(null);
    //Skapa tabellen
    //JTable table = new JTable(new MyTableModel());
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    JScrollPane scrollPane = new JScrollPane(table);
    scrollPane.setBounds(30, 40, 1000, 600);//(avst?nd fr?n v?nster sidan 49, avst?nd fr?n norr 39, bredd 144, h?jd 38));
    this.add(scrollPane);
    //TableCellRenderer weirdRenderer = new WeirdRenderer();
    table.setCellSelectionEnabled(true);
    table.requestFocus(true);
    table.getInputMap().put(KeyStroke.getKeyStroke(
    KeyEvent.VK_ENTER, 0),
    "check");
    table.getActionMap().put("check", new AbstractAction() {
    public void actionPerformed(ActionEvent e) {
    try {
    System.out.println("BINGO");
    x= table.getSelectedColumn() ;
    y= table.getSelectedRow() ;
    //System.out.println("markerad kolumn ?r" + table.getSelectedColumn()) ;
    //System.out.println("markerad Rad ?r" + table.getSelectedRow()) ;
    // table.setColumnSelectionAllowed(true);
    data1 = table.getModel().getValueAt(
    table.getSelectedRow(),
    table.getColumnModel().getColumn(
    table.getSelectedColumn()).getModelIndex());
    System.out.println("markerad text inneh?ller" + data1);
    x= table.getSelectedColumn() ;
    y= table.getSelectedRow() ;
    /* table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column)
    System.out.println("hejsan hoppsan markerad text inneh?ller" + data1);
    Component cell =super.getTableCellRendererComponent(table, value, isSelected,hasFocus, row, column);
    if (row == y && column == x ) {
    System.out.println("rad"+y);
    System.out.println("column"+x);*/
    //cell.setFont(new java.awt.Font("Dialog", 0, 20));
    /* cell.setForeground(Color.red);
    else
    cell.setForeground(null);
    return cell;
    // ColorRenderer centerRenderer = new ColorRenderer();
    // Use renderer on a specific column
    /* TableColumn column = table.getColumnModel().getColumn(
    table.getColumnModel().getColumn(
    table.getSelectedColumn()).getModelIndex()
    column.setCellRenderer( centerRenderer );
    table.setDefaultRenderer(String.class, centerRenderer);*/
    class table extends JTable {
    ColorRenderer multiRenderer=new ColorRenderer();
    table(MyTableModel tm)
    super(tm);
    public TableCellRenderer getCellRenderer(int row,int col) {
    if (row == y && col == x) return multiRenderer;
    else return super.getCellRenderer(row,col);
    catch(Exception x) {
    x.printStackTrace();
    class MyTableModel extends AbstractTableModel {
    String[] columnNames = {"",
    "M?NDAG",
    "TISDAG",
    "ONSDAG",
    "TORSDAG",
    "FREDAG",
    "L?RDAG",
    "S?NDAG"};
    Object[][] data = {
    {"Anna Svensson","", "","Eji Eze", "","","",""},
    {"","", "","", "Christopher ?kesson","Eji Eze","",""},
    {"","", "","", "","Sara Eggert","",""},
    {"Eji Eze","", "","", "","","",""},
    {"Stefan Wielsel","", "","", "","","",""},
    {"","", "","", "","","Anna Persson","Markus Nilsson"},
    {"","Markus Nilsson", "Malin Mejby","", "","","",""},
    {"","Stefan Wiesel", "","", "","","",""},
    {"","Anna Svensson", "","", "","","",""},
    public int getColumnCount() {
    return columnNames.length;
    public int getRowCount() {
    return data.length;
    public String getColumnName(int col) {
    return columnNames[col];
    public Object getValueAt(int row, int col) {
    return data[row][col];
    /* Denna metod g?r det m?jligt att ?ndrar i tabellen*/
    public boolean isCellEditable(int row, int col) {
    if (col < 8) {
    return false;
    } else {
    return true;
    /*Denna metod g?r s? ?ndringarna som g?rs i en viss cell inte f?rsvinnar d? man l?mnar cellen*/
    Object[][] value = {              {"Chiji Eze"},
    int row= 3;
    int col = 4;
    public void setValueAt(Object value, int row, int col) {
    /* if (DEBUG) {
    System.out.println("Setting value at " + row + "," + col
    + " to " + value
    + " (an instance of "
    + value.getClass() + ")");
    data[row][col] = value;
    fireTableCellUpdated(row, col);
    /* if (DEBUG) {
    System.out.println("New value of data:");
    printDebugData();
    /* private void printDebugData() {
    int numRows = getRowCount();
    int numCols = getColumnCount();
    for (int i=0; i < numRows; i++) {
    System.out.print(" row " + i + ":");
    for (int j=0; j < numCols; j++) {
    System.out.print(" " + data[i][j]);
    System.out.println();
    System.out.println("--------------------------");*/
    /*class MyCellColor extends DefaultTableCellRenderer
    public MyCellColor()
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column)
    JLabel result = null;
    if(isSelected && value != null)
    result = new JLabel(value.toString());
    result.setOpaque(true);
    result.setForeground(Color.blue);
    System.out.println("Result "+result.getText());
    System.out.println("Color is "+result.getForeground());
    return result;
    /* public TableCellRenderer getCellRenderer (int row, int column)
    //seulement pour la premiere colonne
    if (column == 0)
    return Renderer;
    // sinon le Renderer par d?faut
    return super.getCellRenderer (row, column);
    class ColorRenderer extends JTextArea implements TableCellRenderer{ //DefaultTableCellRenderer
    Color testfarg;
    public ColorRenderer( ){
    testfarg= Color.red;
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
    System.out.println("hejsan hoppsan markerad text inneh?ller" + data1);
    //Component cell =super.getTableCellRendererComponent(table, value, isSelected,hasFocus, row, column);
    if(row==y && column == x)
    setForeground(testfarg);
    else
    setBackground(null);
    return this;

    You really need to study this tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    After you have read it, take a look at this example, and tweak it to suit your needs:
    import javax.swing.table.*;
    import javax.swing.*;
    public class Test {
      public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.getContentPane().add(new JScrollPane(new JTable(new MyTableModel())));
        frame.pack();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    class MyTableModel extends AbstractTableModel {
      private String columnNames[] = new String[] {
          "Name", "Checked"
      private Class columnClasses[] = new Class[] {
          String.class, Boolean.class
      private Object data[][] = new Object[][] {
          { "One", Boolean.TRUE },
          { "Two", Boolean.FALSE },
          { "Three", Boolean.FALSE },
          { "Four", Boolean.TRUE },
      public int getColumnCount() {
        return columnNames.length;
      public int getRowCount() {
        return data.length;
      public Object getValueAt(int rowIndex, int columnIndex) {
        return data[rowIndex][columnIndex];
      public Class getColumnClass(int columnIndex) {
        return columnClasses[columnIndex];
      public String getColumnName(int columnIndex) {
        return columnNames[columnIndex];
      public boolean isCellEditable(int rowIndex, int columnIndex) {
        if (columnIndex == 1)
          return true;
        else
          return false;
      public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
        data[rowIndex][columnIndex] = aValue;
    }

  • Urgent help with If statement please!

    HI Everyone
    Was wondering if anyone can tell me why flash seems to be
    ignoring my If Statements, every time I try to use one it ignores
    the condition and just actions the command. Its driving me crazy.
    I'm sure I must be doing something wrong I just can't work it out.
    I've put;
    on (release) {
    if ((_root.eyeshadow = "Pink") && (_root.lipy =
    "Pink")) {
    _root.correct._alpha =100;
    It seems to just action the _root.correct._alpha = 100;
    even when a different colour is selected.
    I was wondering can flash read a variable from another
    script, because if not it will not know what eyeshadow and lipy
    are. I dont get any error messages though.
    Please help somebody!
    Thank you,
    Stacy.x.

    Thank you that appears to have made the if statement work,
    but now i have another problem.
    It doesn't seem to acknowledge wether these selections have
    been selected.
    I have put in the code for the pink eyeshadow;
    on (release) {
    _root.eyeshadow2._alpha =0;
    _root.eyeshadow1._alpha = 100;
    eyeshadow == "Pink";
    the same code is in all the other selections, with the name
    variations.
    any ideas?
    .x.

  • Urgent help required about nokia N8

    I was updating my phone software whine installation suddenly power off and my phone turn off... Now when I switch on it nothing papers on screen please help what should I do....? 

    @MHassan125
    A black screen usually indicates device still in flash mode and a visit to Nokia Care facility for device software to be re-installed is required.
    Happy to have helped forum with a Support Ratio = 42.5

  • URGENT HELP NEEDED FOR JTABLE PROBLEM!!!!!!!!!!!!!!!!!

    firstly i made a jtable to adds and deletes rows and passes the the data to the table model from some textfields. then i wanted to add a tablemoselistener method in order to change the value in the columns 1,2,3,4 and set the result of them in the column 5. when i added that portion of code the buttons that added and deleted rows had problems to function correctly..they dont work at all..can somebody have a look in my code and see wot is wrong..thanx in advance..
    below follows the code..sorry for the mesh of the code..you can use and run the code and notice the problem when you press the add button..also if you want delete the TableChanged method to see that the add button works perfect.
    * Created on 03-Aug-2005
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    * @author Administrator
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Vector;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    import java.io.*;
    public class NodesTable extends JFrame implements TableModelListener, ActionListener {
    JTable jt;
    DefaultTableColumnModel dtcm;
    TableColumn column[] = new TableColumn[100];
    DefaultTableModel dtm;
    JLabel Name,m1,w1,m2,w2;
    JTextField NameTF,m1TF,w1TF,m2TF,w2TF;
    String c [] ={ "Name", "Assessment1", "Weight1" , "Assessment2","Weight2 ","TotalMark"};
    float x=0,y=0,tMark=0,z = 0;
    float j=0;
    int i;
         JButton DelButton;
         JButton AddButton;
         JScrollPane scrollPane;
         JPanel mainPanel,buttonPanel;
         JFrame frame;
         Object[][] data =
              {"tami", new Float(1), new Float(1.11), new Float(1.11),new Float(1),new Float(1)},
              {"tami", new Float(1), new Float(2.22), new Float(2.22),new Float(1),new Float(1)},
              {"petros", new Float(1), new Float(3.33), new Float(3.33),new Float(1),new Float(1)},
              {"petros", new Float(1), new Float(4.44), new Float(4.44),new Float(1),new Float(1)}
    public NodesTable() {
    super("Student Marking Spreadsheet");
    this.AddNodesintoTable();
    setSize(400,250);
    setVisible(true);
    public void AddNodesintoTable(){
    // Create a vector object and load them with the data
    // to be placed on each row of the table
    dtm = new DefaultTableModel(data,c);
    dtm.addTableModelListener( this );
    jt = new JTable(dtm){
         // Returning the Class of each column will allow different
              // renderers to be used based on Class
              public Class getColumnClass(int column)
                   return getValueAt(0, column).getClass();
              // The Cost is not editable
              public boolean isCellEditable(int row, int column)
                   int modelColumn = convertColumnIndexToModel( column );
                   return (modelColumn == 5) ? false : true;
    //****************************User Input**************************
    //Add another node
    //Creating and setting the properties
    //of the panel's component (panels and textfields)
    Name = new JLabel("Name");
    Name.setForeground(Color.black);
    m1 = new JLabel("Mark1");
    m1.setForeground(Color.black);
    w1 = new JLabel("Weigth1");
    w1.setForeground(Color.black);
    m2= new JLabel("Mark2");
    m2.setForeground(Color.black);
    w2 = new JLabel("Weight2");
    w2.setForeground(Color.black);
    NameTF = new JTextField(5);
    NameTF.setText("Node");
    m1TF = new JTextField(5);
    w1TF = new JTextField(5);
    m2TF=new JTextField(5);
    w2TF=new JTextField(5);
    //creating the buttons
    JPanel buttonPanel = new JPanel();
    AddButton=new JButton("Add Row");
    DelButton=new JButton("Delete") ;
    buttonPanel.add(AddButton);
    buttonPanel.add(DelButton);
    //adding the components to the panel
    JPanel inputpanel = new JPanel();
    inputpanel.add(Name);
    inputpanel.add(NameTF);
    inputpanel.add(m1);
    inputpanel.add(m1TF);
    inputpanel.add(w1);
    inputpanel.add(w1TF);
    inputpanel.add(m2);
    inputpanel.add(m2TF);
    inputpanel.add(w2TF);
    inputpanel.add(w2);
    inputpanel.add(AddButton);
    inputpanel.add(DelButton);
    //creating the panel and setting its properties
    JPanel tablepanel = new JPanel();
    tablepanel.add(new JScrollPane(jt, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED
    , JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS));
    getContentPane().add(tablepanel, BorderLayout.CENTER);
    getContentPane().add(inputpanel, BorderLayout.SOUTH);
    //Method to add row for each new entry
    public void addRow()
    Vector r=new Vector();
    r=createBlankElement();
    dtm.addRow(r);
    jt.addNotify();
    public Vector createBlankElement()
    Vector t = new Vector();
    t.addElement((String) " ");
    t.addElement((String) " ");
    t.addElement((String) " ");
    t.addElement((String) " ");
    t.addElement((String) " ");
    return t;
    // Method to delete a row from the spreadsheet
    void deleteRow(int index)
    if(index!=-1) //At least one Row in Table
    dtm.removeRow(index);
    jt.addNotify();
    // Method that adds and deletes rows
    // from the table by pressing the
    //corresponding buttons
    public void actionPerformed(ActionEvent ae){
         Float z=new Float (m2TF.getText());
    String Name= NameTF.getText();
    Float x= new Float(m1TF.getText());
    Float y= new Float(w1TF.getText());
    Float j=new Float (w2TF.getText());
    JFileChooser jfc2 = new JFileChooser();
    String newdata[]= {Name,String.valueOf(x),String.valueOf(y),
    String.valueOf(z),String.valueOf(j)};
    Object source = ae.getSource();
    if(ae.getSource() == (JButton)AddButton)
    addRow();
    if (ae.getSource() ==(JButton) DelButton)
    deleteRow(jt.getSelectedRow());
    //method to calculate the total mark in the TotalMark column
    //that updates the values in every other column
    //It takes the values from the column 1,2,3,4
    //and changes the value in the column 5
    public void tableChanged(TableModelEvent e) {
         System.out.println(e.getSource());
         if (e.getType() == TableModelEvent.UPDATE)
              int row = e.getFirstRow();
              int column = e.getColumn();
              if (column == 1 || column == 2 ||column == 3 ||column == 4)
                   TableModel model = jt.getModel();
              float     q= ((Float)model.getValueAt(row,1)).floatValue();
              float     w= ((Float)model.getValueAt(row,2)).floatValue();
              float     t= ((Float)model.getValueAt(row,3)).floatValue();
              float     r= ((Float)model.getValueAt(row,4)).floatValue();
                   Float tMark = new Float((q*w+t*r)/(w+r) );
                   model.setValueAt(tMark, row, 5);
    // Which cells are editable.
    // It is only necessary to implement this method
    // if the table is editable
    public boolean isCellEditable(int row, int col)
    { return true; //All cells are editable
    public static void main(String[] args) {
         NodesTable t=new NodesTable();
    }

    There are too many mistakes in your program. It looks like you are new to java.
    Your add and delete row buttons are not working because you haven't registered your action listener with these buttons.
    I have modifide your code and now it works fine. Just put some validation code for the textboxes becuase it throws exception when user presses add button without entering anything.
    Here is the updated code: Do the diff and u will know my changes
    * Created on 03-Aug-2005
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    * @author Administrator
    * TODO To change the template for this generated type comment go to Window -
    * Preferences - Java - Code Style - Code Templates
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextField;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    import javax.swing.table.DefaultTableColumnModel;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableModel;
    public class NodesTable extends JFrame implements TableModelListener,
              ActionListener {
         JTable jt;
         DefaultTableColumnModel dtcm;
         TableColumn column[] = new TableColumn[100];
         DefaultTableModel dtm;
         JLabel Name, m1, w1, m2, w2;
         JTextField NameTF, m1TF, w1TF, m2TF, w2TF;
         String c[] = { "Name", "Assessment1", "Weight1", "Assessment2", "Weight2 ",
                   "TotalMark" };
         float x = 0, y = 0, tMark = 0, z = 0;
         float j = 0;
         int i;
         JButton DelButton;
         JButton AddButton;
         JScrollPane scrollPane;
         JPanel mainPanel, buttonPanel;
         JFrame frame;
         public NodesTable() {
              super("Student Marking Spreadsheet");
              this.AddNodesintoTable();
              setSize(400, 250);
              setVisible(true);
         public void AddNodesintoTable() {
              // Create a vector object and load them with the data
              // to be placed on each row of the table
              dtm = new DefaultTableModel(c,0);
              dtm.addTableModelListener(this);
              jt = new JTable(dtm) {
                   // The Cost is not editable
                   public boolean isCellEditable(int row, int column) {
                        int modelColumn = convertColumnIndexToModel(column);
                        return (modelColumn == 5) ? false : true;
              //****************************User Input**************************
              //Add another node
              //Creating and setting the properties
              //of the panel's component (panels and textfields)
              Name = new JLabel("Name");
              Name.setForeground(Color.black);
              m1 = new JLabel("Mark1");
              m1.setForeground(Color.black);
              w1 = new JLabel("Weigth1");
              w1.setForeground(Color.black);
              m2 = new JLabel("Mark2");
              m2.setForeground(Color.black);
              w2 = new JLabel("Weight2");
              w2.setForeground(Color.black);
              NameTF = new JTextField(5);
              NameTF.setText("Node");
              m1TF = new JTextField(5);
              w1TF = new JTextField(5);
              m2TF = new JTextField(5);
              w2TF = new JTextField(5);
              //creating the buttons
              JPanel buttonPanel = new JPanel();
              AddButton = new JButton("Add Row");
              AddButton.addActionListener(this);
              DelButton = new JButton("Delete");
              DelButton.addActionListener(this);
              buttonPanel.add(AddButton);
              buttonPanel.add(DelButton);
              //adding the components to the panel
              JPanel inputpanel = new JPanel();
              inputpanel.add(Name);
              inputpanel.add(NameTF);
              inputpanel.add(m1);
              inputpanel.add(m1TF);
              inputpanel.add(w1);
              inputpanel.add(w1TF);
              inputpanel.add(m2);
              inputpanel.add(m2TF);
              inputpanel.add(w2TF);
              inputpanel.add(w2);
              inputpanel.add(AddButton);
              inputpanel.add(DelButton);
              //creating the panel and setting its properties
              JPanel tablepanel = new JPanel();
              tablepanel.add(new JScrollPane(jt,
                        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                        JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS));
              getContentPane().add(tablepanel, BorderLayout.CENTER);
              getContentPane().add(inputpanel, BorderLayout.SOUTH);
         //Method to add row for each new entry
         public void addRow() {
              Float z = new Float(m2TF.getText());
              String Name = NameTF.getText();
              Float x = new Float(m1TF.getText());
              Float y = new Float(w1TF.getText());
              Float j = new Float(w2TF.getText());
              String newdata[] = { Name, String.valueOf(x), String.valueOf(y),
                        String.valueOf(z), String.valueOf(j) };
              dtm.addRow(newdata);
         // Method to delete a row from the spreadsheet
         void deleteRow(int index) {
              if (index != -1) //At least one Row in Table
                   dtm.removeRow(index);
                   jt.addNotify();
         // Method that adds and deletes rows
         // from the table by pressing the
         //corresponding buttons
         public void actionPerformed(ActionEvent ae) {
              Object source = ae.getSource();
              if (ae.getSource() == (JButton) AddButton) {
                   addRow();
              if (ae.getSource() == (JButton) DelButton) {
                   deleteRow(jt.getSelectedRow());
         //method to calculate the total mark in the TotalMark column
         //that updates the values in every other column
         //It takes the values from the column 1,2,3,4
         //and changes the value in the column 5
         public void tableChanged(TableModelEvent e) {
              System.out.println(e.getSource());
              //if (e.getType() == TableModelEvent.UPDATE) {
                   int row = e.getFirstRow();
                   int column = e.getColumn();
                   if (column == 1 || column == 2 || column == 3 || column == 4) {
                        TableModel model = jt.getModel();
                        float q = (new Float(model.getValueAt(row, 1).toString())).floatValue();
                        float w = (new Float(model.getValueAt(row, 2).toString())).floatValue();
                        float t = (new Float(model.getValueAt(row, 3).toString())).floatValue();
                        float r = (new Float(model.getValueAt(row, 4).toString())).floatValue();
                        Float tMark = new Float((q * w + t * r) / (w + r));
                        model.setValueAt(tMark, row, 5);
         // Which cells are editable.
         // It is only necessary to implement this method
         // if the table is editable
         public boolean isCellEditable(int row, int col) {
              return true; //All cells are editable
         public static void main(String[] args) {
              NodesTable t = new NodesTable();
    }

  • Urgent Help is needed : Experts please help

    Does modification of Transfer rule and update rule require data deletion from all the dependent data targets?
    Hi Experts,
    Two new key figures have been added in data source and subsequently in transfer rules, updated rules, ODS and cubes there in data flow.
    The changes are supposed to move in production on this weekend. I am afraid; does this activity require data deletion from the data targets before moving the transports?
    With out deletion of the data can these transports be moved in prod?
    Please reply with your valuable advice.
    Points will be rewarded.
    Thanks,
    BW USER

    hi,
    hope u might have to do changes in the cube and ods also rite?
    and you need to have data for the added key figure in the cube/ods for the already existing records in the cube/ods.for this you copy content in other cube/ods and do delete and reload the data to the new changed cube/ods.
    Ramesh

  • Urgent Help on JAXB Validation - Please Help

    I have an application that needs validation before marshalling a content tree. If the tree is not valid, I need to marshall the tree and look at the problem in the XML file itself.
    If it's a valid XML file, then continue as usual...
    These is the pseudo code.. But don't know if I can implement it with JAXB or not....And how to implement it..
    populate XML tree
    check if the tree is valid or not
    if it is valid continue processing
    if not valid, marshall the tree into an XML file and analyze the
    problem
    Any input is welcome...
    Thanks in advance..

    svenkatesh s, thanks for your reply. In addition to your suggestion,
    I found this method:
    public class ValidationHelper implements ValidationEventHandler {
    public boolean handleEvent(ValidationEvent arg0) {
         System.out.println("The message is: " + arg0.getMessage());
         System.out.println("The severity is: " + arg0.getSeverity());
         ValidationEventLocator locator = arg0.getLocator();
         System.out.println("The column number: " + locator.getColumnNumber());
         System.out.println("The line number: " + locator.getLineNumber());
              Node nd = locator.getNode();
              log.write(Logger.LOG_INFO, "The node: " + nd);
              String st = nd.getNodeName();
              log.write(Logger.LOG_INFO, "Node Name " + st);
              String stt = nd.getNodeValue();
              log.write(Logger.LOG_INFO, "Node Value: " + stt);
              return true;
    I noticed that Node is null, but it might be a test data problem...

  • HELP WITH IPHONE 4S IPHONE URGENT HELP PLEASE?

    IPHONE URGENT HELP PLEASE?
    for the whole day my network has been 'Searching...'
    i have tried airplane mode on and off, turning my phone on and off and network reset and taking sim in and out.
    so i backed up my phone and restored to factory settings as i don't think i did the option of choosing manually select a carrier.
    my network is still 'searching...' and it won't let my wifi to allow me to activate my iphone. i have tried to connect to itunes and it still won;t work.
    i keep getting a message about no activation server.
    this is a new iphone. i got it replaced on saturday.
    PLEASE SOMEONE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Hello,
    If this is a new iPhone then you will have free access, as all iPhones come with it, to Apple support. I would have them take care of an issue like this.
    Hope this helps.
    Regards,
    Jake

  • Need help about JTable

    Can some one please help me about how to sort a column in a JTable when click on the the column title

    Can't tell you off the top of my head but I know you will find it here...
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#selection

  • I have frequent instances of my Macbook Pro beeping 3 times and then I have to forcefully shut it down by pressing the power button. What is this all about? Please help. Thank you.

    I have frequent instances of my Macbook Pro beeping 3 times and then I have to forcefully shut it down by pressing the power button. What is this all about? Please help. Thank you.
    I saw this report being sent to Apple:
    Interval Since Last Panic Report:  581719 sec
    Panics Since Last Report:          10
    Anonymous UUID: F4CF708D-D85C-4EC5-8047-4FC22C6B03AF
    Fri Mar  7 13:00:14 2014
    panic(cpu 0 caller 0xffffff80002d1208): Kernel trap at 0xffffff800020c590, type 14=page fault, registers:
    CR0: 0x0000000080010033, CR2: 0x0000000000000000, CR3: 0x0000000007541000, CR4: 0x0000000000040660
    RAX: 0xffffff8000000000, RBX: 0xffffff800d35a870, RCX: 0xffffff800cf55cd8, RDX: 0xffffff80008a8fcc
    RSP: 0xffffff805e5f3d60, RBP: 0xffffff805e5f3da0, RSI: 0x000000001dcd6500, RDI: 0xffffff800d168778
    R8: 0x0000000000000001, R9: 0xffffff805e5f3e88, R10: 0x0000000000000011, R11: 0x0000000000000000
    R12: 0x0000000000000000, R13: 0xffffff800d168770, R14: 0xffffff800d168778, R15: 0x0000000000000000
    RFL: 0x0000000000010082, RIP: 0xffffff800020c590, CS:  0x0000000000000008, SS:  0x0000000000000010
    Error code: 0x0000000000000000
    Backtrace (CPU 0), Frame : Return Address
    0xffffff805e5f3a00 : 0xffffff8000204d15
    0xffffff805e5f3b00 : 0xffffff80002d1208
    0xffffff805e5f3c50 :
    Model: MacBookPro8,1, BootROM MBP81.0047.B27, 2 processors, Intel Core i5, 2.3 GHz, 4 GB, SMC 1.68f99
    Graphics: Intel HD Graphics 3000, Intel HD Graphics 3000, Built-In, 384 MB
    Memory Module: global_name
    AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xD6), Broadcom BCM43xx 1.0 5.100.198.104.5)
    Bluetooth: Version 2.4.5f3, 2 service, 12 devices, 1 incoming serial ports
    Serial ATA Device: Hitachi HTS545032B9A302, 298.09 GB
    Serial ATA Device: OPTIARC DVD RW AD-5970H
    USB Device: FaceTime HD Camera (Built-in), 0x05ac  (Apple Inc.), 0x8509, 0xfa200000 / 3
    USB Device: Hub, 0x0424 (SMSC), 0x2513, 0xfa100000 / 2
    USB Device: BRCM2070 Hub, 0x0a5c  (Broadcom Corp.), 0x4500, 0xfa110000 / 5
    USB Device: Bluetooth USB Host Controller, 0x05ac  (Apple Inc.), 0x821a, 0xfa113000 / 8
    USB Device: Apple Internal Keyboard / Trackpad, 0x05ac  (Apple Inc.), 0x0245, 0xfa120000 / 4
    USB Device: Hub, 0x0424 (SMSC), 0x2513, 0xfd100000 / 2
    USB Device: IR Receiver, 0x05ac  (Apple Inc.), 0x8242, 0xfd110000 / 3

    Hmm. The problem still may be the RAM - Apple buys the RAM it puts in its machines from third-party vendors (usually Hynix) so it could be a RAM problem.
    There are a couple of things that you can do yourself before taking your machine into an Apple Store or an AASP... download and run an application named Rember that will run a RAM test for you - let it run for a couple of hours or even overnight. If it turns out that your RAM is faulty, Rember will let you know. If it is faulty, then you have a couple of options - replace the RAM yourself or (particularly if you're under warranty still) take the machine to an Apple Store or AASP and have them replace the RAM.
    If Rember finds no fault with the RAM, then you'll need to take it into an Apple Store/AASP and get a free diagnosis on the machine. Three beeps do usually indicate faulty RAM, but if it tests good with Rember you likely have another problem - it could be something as simple as the RAM, somehow, not seated correctly or signs of another hardware problem.
    Run Rember first... call back with results.
    Good luck,
    Clinton

  • I was updating software and suddenly my IPHONE  started asking for I tunes on mobile screen ,  how can  i  get by screen back or How i can restore without loosing data , I m more worried about data , Please help in resolutio

    i was updating software and suddenly my IPHONE  started asking for I tunes on mobile screen ,  how can  i  get by screen back or How i can restore without loosing data , I m more worried about data , Please help in resolutio

    What exactly are you seeing on the phone's screen ? If the iTunes icon and cable then the phone is in recovery mode, in which case it's too late to take a new backup or to copy any content off the phone - you will have to connect the phone to your computer's iTunes and reset it back to factory defaults, after which you can restore to the last backup that you took or just resync your content to it

  • Please help me about Workflow

    sir/mam,i am new for workflow,will any one give me guidence for how i will start with workflow ..please help me about this topic....?

    Somnath,
    Your question is very vague.  What do you mean by new to Workflow?
    Workflow can be defined as
    A workflow is a reliably repeatable pattern of activity enabled by a systematic organization of resources, defined roles and mass, energy and information flows, into a work process that can be documented and learned. Workflows are always designed to achieve processing intents of some sort, such as physical transformation, service provision, or information processing.
    Workflows are closely related to other concepts used to describe organizational structure, such as silos, functions, teams, projects, policies and hierarchies. Workflows may be viewed as one primitive building block of organizations. The relationships among these concepts are described later in this entry.
    Read more on the Web ..http://en.wikipedia.org/wiki/Workflow
    Suda

  • Please help me about question security because in my apple id no have for restart or chenge my answer

    please help me about answer security question in my apple id because im forgot for my answer, in my apple id no have for change answer, tell me for this please because i love my iphone.
    <Email Edited by Host>

    You need to ask Apple to reset your security questions; this can be done by clicking here and picking a method, or if your country isn't listed, filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (110899)

Maybe you are looking for