JTable Urgent !

In JTable if the focus is not removed from the row, which is edited last and if some other action is performed(like sending the data to database) then the data from the last cell which is being edited is not saved.
This problem is solved in jdk 1.3 by calling fireTableCellUpdated() method of DefaultTableModel. But in jdk 1.4.1 this does not work. Can anyone help me for this.

Sorry, it is not working and I also get this error message when I click the cell. Do you know why I got the cursor indicator inside the cell after I registered a FocusLost event?
thanks
kelly
Exception occurred during event dispatching:
java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
     at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:1242)
     at java.awt.Component.getLocationOnScreen(Component.java:1216)
     at javax.swing.Autoscroller.mouseDragged(Autoscroller.java:82)
     at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:2295)
     at java.awt.Component.processEvent(Component.java:3548)
     at java.awt.Container.processEvent(Container.java:1164)
     at java.awt.Component.dispatchEventImpl(Component.java:2593)
     at java.awt.Container.dispatchEventImpl(Container.java:1213)
     at java.awt.Component.dispatchEvent(Component.java:2497)
     at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.repostEvent(BasicTableUI.java:438)
     at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mouseDragged(BasicTableUI.java:503)
     at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:260)
     at java.awt.Component.processMouseMotionEvent(Component.java:3759)
     at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:2299)
     at java.awt.Component.processEvent(Component.java:3548)
     at java.awt.Container.processEvent(Container.java:1164)
     at java.awt.Component.dispatchEventImpl(Component.java:2593)
     at java.awt.Container.dispatchEventImpl(Container.java:1213)
     at java.awt.Component.dispatchEvent(Component.java:2497)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2205)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
     at java.awt.Container.dispatchEventImpl(Container.java:1200)
     at java.awt.Window.dispatchEventImpl(Window.java:926)
     at java.awt.Component.dispatchEvent(Component.java:2497)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)

Similar Messages

  • JComboBox in Jtable - Urgent!!!!

    Hi folks,
    I am using my owm editor for combobox in jtable. My problem is when I am editing the combobox, value is set only after I press enter or click on the other row. But I want to set the values when i change the selection in the combobox. How can I do that. It is very URGENT!! I appreciate any help.
    My code for editor :
    class comboEditor extends DefaultCellEditor
    public comboEditor (JComboBox b)
    super(new JComboBox()); //Unfortunately, the constructor
    //expects a check box, combo box,
    //or text field.
    editorComponent = b;
    setClickCountToStart(1); //This is usually 1 or 2.
    //Must do this so that editing stops when appropriate.
    b.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    fireEditingStopped();
    b.addItemListener(new ItemListener()
    public void itemStateChanged(ItemEvent e)
         fireEditingStopped();
    protected void fireEditingStopped()
    super.fireEditingStopped();
    public Object getCellEditorValue()
    return editorComponent;
    public Component getTableCellEditorComponent(JTable table,
    Object value,
    boolean isSelected,
    int row,
    int column)
    editorComponent = (JComboBox)value;
    return editorComponent;
    Thank you very much.

    Thanks Greg. But my problem is when I select an item in the combobox still that column contains combobox in the table which I don't want. I want the combobox to be dissappear as soon as I select an item. This is important for me as I can change the values in the table dynamically by selecting the different panels underneath the dialog which contains this table. So, if user selects an item in the combobox ( without clicking the enter key)and then selects another panel (which loads different data ), then the selected value is set for the second panel not for the first panel(actually value shud be set for first panel).
    And one more problem is samething is happening for even textfield in the table. So, how can I fire editing stopped event before setting the new data. Actually, now when I directly set the data , it is setting the data first and then firing editing stopped event, so it is setting the data for second selected panel.
    Any help is appreciated.
    Thanks.

  • How do I add a JCheckBox to a JTable - URGENT HELP NEEDED

    Hello All,
    This is kicking my butt. I need to create a JTable that I can dynamically add and delete rows of data to and this table must contain a JCheckBox which I can read the value of. I've been able to find examples out there that provides the ability to have a JCheckBox in the JTable, but do not also provide the function to add / delete rows from the JTable. I need to have both funtions in my table. Can somebody out there please help me with this?
    Here's a simple example that I'm working with as a test to figure this out. This example has the functionality to add rows of data.
    Thanks in advance.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.JFrame;
    import javax.swing.JTable;
    import javax.swing.table.*;
    public class TableTest extends JFrame implements ActionListener
         JButton btnAdd;
         BorderLayout layout;
         DefaultTableModel model;
         public static void main(String[] args)
              TableTest app = new TableTest();
              app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public TableTest()
              super("Table Example");
              layout = new BorderLayout();
              Container container = getContentPane();
              container.setLayout(layout);
              btnAdd = new JButton("Add");
              btnAdd.addActionListener(this);
              model = new DefaultTableModel();
              JTable table = new JTable(model);
              // Create a couple of columns
              model.addColumn("Col1");
              model.addColumn("Col2");
              // Append a row
              model.addRow(new Object[] { "v1", "v2" });
              model.addRow(new Object[] { "v3", "v4" });
              JScrollPane scrollPane = new JScrollPane(table);
              container.add(btnAdd, BorderLayout.NORTH);
              container.add(scrollPane,BorderLayout.CENTER);
              setSize(300, 200);
              setVisible(true);
         public void actionPerformed(ActionEvent e)
              if (e.getSource() == btnAdd)
                   model.addRow(new Object[]{"Test", new Boolean(true)});
    }

    I got it, I added the public Class getColumnClass to new DefaultTableModel(). Here it is for your viewing pleasure.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.JFrame;
    import javax.swing.JTable;
    import javax.swing.table.*;
    public class TableTest extends JFrame implements ActionListener
         JButton btnAdd;
         BorderLayout layout;
         DefaultTableModel model;
         JTable table;
         public static void main(String[] args)
              TableTest app = new TableTest();
              app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public TableTest()
              super("Table Example");
              layout = new BorderLayout();
              Container container = getContentPane();
              container.setLayout(layout);
              btnAdd = new JButton("Add");
              btnAdd.addActionListener(this);
              model = new DefaultTableModel()
                   public Class getColumnClass(int col)
                        switch (col)
                             case 1 :
                                  return Boolean.class;
                             default :
                                  return Object.class;
              table = new JTable(model);
              // Create a couple of columns
              model.addColumn("Col1");
              model.addColumn("Col2");
              // Append a row
              model.addRow(new Object[] { "v1", new Boolean(false)});
              model.addRow(new Object[] { "v3", new Boolean(false)});
              JScrollPane scrollPane = new JScrollPane(table);
              container.add(btnAdd, BorderLayout.NORTH);
              container.add(scrollPane, BorderLayout.CENTER);
              setSize(300, 200);
              setVisible(true);
         public void actionPerformed(ActionEvent e)
              if (e.getSource() == btnAdd)
                   model.addRow(new Object[] { "Karl", new Boolean(true)});

  • Need help in jtable - urgent....

    is it possible to put a progress bar on the table. if so please give a sample source code. thankssss

    It�s possible, but it isn�t so easy to put an JComponent in a table cell. You have to rewrite the TableModel, the TableCellRenderer and perhaps the TableCellEditor! Please descripe exactly what actions you want to do. Perhaps I can help!
    Greetings <tg>

  • How to display images in a Jtable cell-Urgent

    Hay all,
    Can anybody tell me that can we display images to JTable' cell,If yes the how do we do that(with some code snippet)? Its very urgent .Plz reply as soon as possible.

    Here is an example
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    class SimpleTableExample extends JFrame
         private     JPanel  topPanel;
         private     JTable  table;
         private     JScrollPane scrollPane;
         public SimpleTableExample()
              setTitle( "Table With Image" );
              setSize( 300, 200 );
              setBackground( Color.gray );
              topPanel = new JPanel();
              topPanel.setLayout( new BorderLayout() );
              getContentPane().add( topPanel );
              // Create columns names
              String columnNames[] = { "Col1", "Col2", "Col3" };
              // Create some data
              Object data[][] =
                   { (ImageIcon) new ImageIcon("User.Gif"), (String) "100", (String)"101" },
                   { (String)"102", (String)"103", (String)"104" },
                   { (String)"105", (String)"106", (String)"107" },
                   { (String)"108", (String)"109", (String)"110" },
              // Create a new table instance
    DefaultTableModel model = new DefaultTableModel(data, columnNames);
              JTable table = new JTable( model )
                   public Class getColumnClass(int column)
                        return getValueAt(0, column).getClass();
              };          // Add the table to a scrolling pane
              scrollPane = new JScrollPane( table );
              topPanel.add( scrollPane, BorderLayout.CENTER );
         public static void main( String args[] )
              SimpleTableExample mainFrame     = new SimpleTableExample();
              mainFrame.setVisible( true );
    }

  • Adding Image in JTable - help needed(Urgent).

    Hai Friends,
    i want to add two icon in the cells of JTable... i dont know where am going wrong... the icon is not getting displayed in the cell but instead if i double click the cell the name of the icon is displayed in editable mode... any suggestion...
    this is my code... i got this from the forum only... but tis not working....
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TableIcon extends JFrame
         public TableIcon()
              String[] columnNames = {"Picture", "Description"};
              Object[][] data =
                   {new ImageIcon("juggler.ico"), "Copy"},
                   {new ImageIcon("favicon.gif"), "Add"},
              DefaultTableModel model = new DefaultTableModel(data, columnNames);
              JTable table = new JTable( model )
                   //  Returning the Class of each column will allow different
                   //  renderers to be used based on Class
                   public Class getColumnClass(int column)
          System.out.println("getValueAt(0, column)"+getValueAt(0, 0));
                        return getValueAt(0, 0).getClass();
              table.setPreferredScrollableViewportSize(table.getPreferredSize());
              JScrollPane scrollPane = new JScrollPane( table );
              getContentPane().add( scrollPane );
         public static void main(String[] args)
              TableIcon frame = new TableIcon();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setVisible(true);
    }Urgent... pls help...
    Regards,
    Ciya.

    Hai Chris,
    Thanks for ur reply,
    Now Its throwing null pointer exception in the URL....
    Can u pls look into d code and tell me pls...
    import java.awt.Component;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import java.net.URL;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.table.TableCellRenderer;
    public class MyIcon extends JPanel
      private JScrollPane jScrollPane1 = new JScrollPane();
      private JTable jTable1;
      private GridBagLayout gridBagLayout1 = new GridBagLayout();
      public MyIcon()
        try
          jbInit();
        catch(Exception e)
          e.printStackTrace();
      private void jbInit() throws Exception
        this.setLayout(gridBagLayout1);
        jTable1 = new JTable(new AbstractTableModel()
         URL lURL = getClass().getResource("file:///D:/Eg/TWEETY.GIF");
          URL lURL2 = getClass().getResource("file:///D:/Eg/TWEETY.GIF");
        Object[][] data =
            {new ImageIcon(lURL), "Copy"},
            {new ImageIcon(lURL), "Add"},
          public int getRowCount()
            return 2;
         public int getColumnCount()
           return 2;
         public Object getValueAt(int row, int column)
           return data[row][column];
        jTable1.getColumnModel().getColumn(0).setCellRenderer(new Renderer());
        jScrollPane1.getViewport().add(jTable1, null);
        this.add(jScrollPane1, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(60, 20, 125, 25), -97, -287));
      public static void main(String a[])
        MyIcon c = new MyIcon();
        JFrame f = new JFrame();
        f.getContentPane().add(c);
        f.setSize(400,400);
        f.setVisible(true);
      class Renderer extends JLabel implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected,
    boolean hasFocus,
    int row, int column) {
    setIcon((ImageIcon) value);
    return this;
    }Ciya...

  • Cell rendering the JRadioButton in JTable(Most Urgent)

    Hai guys,
    How can I rendering the JRadioButton in JTable ?
    In JTable JCombo,JTexrField,JTextArea to be rendered.But I can't rendering the JRadioButton.
    This is urgent for me.
    By kavi...

    http://onesearch.sun.com/search/onesearch/index.jsp?qt=JRadioButton+in+JTable&qp=siteforumid%3Ajava57&chooseCat=allJava&col=developer-forums&site=dev

  • URGENT PLEASE ---How to open popup window after selecting a cell of JTable.

    Hi,
    I am struck at aproblem, I am developing an applet in which I am using TabbedPanes and each tabbed panel has either tables or some key information to display.
    My Problem is, I have a JTable, which has informations related to a perticular record, each record may or may not have some more hidden information. If a record has a hidden information, then the record's cell will contain a message " click here for more information " . after clicking this cell a window will open to show the hidden information.
    I have tried ListSelectionListener and MouseListener to the JTable but nothing is giving me the desired results.
    Please I you could suggest me about this.

    You say its urgent
    So urgent, so oh oh urgent
    Just wait and see
    How urgent my love can be
    Its urgent

  • 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();
    }

  • How do i add data from database to JTable ! Urgent

    How do i add data from database to the columns of JTable?.

    hi,
    Thanks for ur link. but this is just a part of my application which i am developing user interface in swing package for which i want to know how to show data to user in the table format where by table input data will be from the database. say something like todays activity is shown to the user in table format... So u have any idea of how to do this...

  • 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 needed in Checkbox in JTable

    I am trying to put a checkbox in the JTable. The value from the database is a string . The column name is checked. I want if hte value in the database is "yes" the column should be checked and if it is "no" it should not be checked or vice versa( if i check it, in database it should update the value as yes).
    I have the following code, it does not work. I try to click and it does not get clicked, Do you have anys suggestions P;ease help.
    if (checked == null)
    TableColumn column = table.getColumn("Checked");
    checked = new JCheckBox();
    // column.setCellRenderer(new CheckedBox());
    column.setCellEditor(new DefaultCellEditor(checked));
    checked.addItemListener(new ItemListener() {
    public void itemStateChanged(ItemEvent event)
    isChecked = checked.isSelected();
    class CheckedBox extends JCheckBox implements TableCellRenderer
    public CheckedBox()
    setHorizontalAlignment(JRadioButton.CENTER);
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column)
    setEnabled(((Boolean)value).booleanValue());
    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:display result from JTable

    need help making the following in my code work:
    1.how do i display the whole table in my code using a dialog box or JOptionPane.
    2. i want to display a message beneath the table show the total price of items selected from the JComboBox .
    3.is there any way i could add a method or sommething that display detail of each item seleted from the list in a seperate column of the JTable in my code.say for instance,if i selects beans,1 cup, 100 and it display protein in a seperate column in the JTable.
    Thanks in advance.
    my code:
    '\n'
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.table.*;
    import java.util.*;
    public class BreakFast extends JFrame implements ActionListener{
         private JList ingredient;
         private JTable table;
         private DefaultTableModel model;
         private JButton move;
         private String[] food;
         private JComboBox box,box1;
         private String[] units;
         private double[] price={100,150,200,250,300,350,400};
         private JButton finish;
         public BreakFast(){
              Container c=getContentPane();
              c.setLayout(new FlowLayout());
              food = new String[] {"Corn Flakes","Beans","Shredded Bread","Mushroom",
              "eggs","Milks","Butter","Sugar","water","Oil"};
              ingredient = new JList(food);
              ingredient.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
              ingredient.setVisibleRowCount(4);
              JPanel p = new JPanel();
              p.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
              move = new JButton(">>>");
              move.addActionListener(this);
              //meal = new JTextArea(5,20);
              //meal.setEditable(false);
              p.add(new JScrollPane(ingredient),"Wast");
              JPanel p2 = new JPanel();
              p2.setBorder(new BevelBorder(BevelBorder.RAISED));
              units = new String[]{"2 cups","3 cups","4 cups","5 cups","1 mudu","2 mudu",
                        "3 mudu","4 mudu","5 mudu","6 mudu","7 mudu","8 mudu","9 mudu",
                        "1 bag"};
              box = new JComboBox(units);
              box.addActionListener(this);
              box1 = new JComboBox();
              //box1.setEditable(true);
              box1.addActionListener(this);
              for(int i=0;i<price.length;i++){
                   box1.addItem(price);
              model = new DefaultTableModel();
              //model.addColumn("No.");
              model.addColumn("Food Items");
              model.addColumn("Units");
              model.addColumn("Price");
              table = new JTable(model);
              JScrollPane pane = new JScrollPane(table);
              pane.setPreferredSize(new Dimension(350,100));
              finish = new JButton("Finish");
              finish.addActionListener(this);
              p.add(box,"West");
              p.add(box1,"Center");
              p.add(move,"East");
              p2.add(pane,"North");
              p2.add(finish,"South");
              c.add(p);
              c.add(p2);
              setSize(450,300);
              setVisible(true);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public void actionPerformed(ActionEvent e){
         Object[] value = ingredient.getSelectedValues();
         if(e.getSource() == move){
         for(int i=0;i < value.length;i++){
         String word = (String)value[i];
         Vector<Object> data = new Vector<Object>();
         data.addElement( word );
    data.addElement( box.getSelectedItem() );
    data.addElement( box1.getSelectedItem());
         model.addRow( data );
         if(e.getSource() == finish){
              JOptionPane.showMessageDialog(BreakFast.this,table,"Selection Summary",JOptionPane.PLAIN_MESSAGE);
              System.exit(0);
         public static void main(String[] arg){
              new BreakFast();

    Multi-Post:
    http://forum.java.sun.com/thread.jspa?threadID=5122371&tstart=0
    Ignored.

  • JTable Display problem (urgent)

    Hi all,
    Does anyone here know how to make a all columnns in my table visible
    This is my code. It simple bunches up the columns but I need them spaced out.
    Thanks all :)
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    public class TableProblem extends JFrame {
    Vector rows, columnHeads;
    BorderLayout borderLayout1 = new BorderLayout();
    JScrollPane jScrollPane1 = new JScrollPane();
    JTable jTable1 = new JTable();
    public TableProblem ()
    testData(); // used to put data in the vectors for the table
    initTable(); // used to instantiate and setup the gui
    setSize(1100,600);
    show();
    public static void main(String[] args) {
    TableProblem tprob = new TableProblem();
    public void testData ()
    int mc = 100;
    int mr = 100;
    int k = 0;
    Vector temp;
    columnHeads = new Vector();
    for (int i=0; i<mc; i++)
    columnHeads.addElement(Integer.toString(i));
    rows = new Vector();
    for (int i=0; i<mr; i++)
    temp = new Vector();
    for (int j=0; j<mc; j++)
    temp.addElement(Integer.toString(k++));
    rows.addElement(temp);
    public void initTable()
    getContentPane().setLayout(borderLayout1);
    jTable1 = new JTable(rows,columnHeads);
    jScrollPane1 = JTable.createScrollPaneForTable(jTable1);
    getContentPane().add(jScrollPane1, BorderLayout.CENTER);
    jScrollPane1.getViewport().add(jTable1,null);
    jScrollPane1.getViewport().add(jTable1, null);
    jTable1.setMinimumSize(new Dimension(8000,2000));
    /****************************************************/

    If I understood you correctly, I think this is what you need:
    // Prohibit table from resizing itself
    jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    Regards,
    Boris

  • 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

Maybe you are looking for

  • Error Code :-5002 Error Message :Enter valid currency  , '51100000-01-001-0

    Hi all,          I have found a error "Error Code :-5002 Error Message :Enter valid currency  , '51100000-01-001-01'" while adding the DELIVERY document. I have made a customer and assign then "EURO" currency and add delivery document then it prompts

  • Connecting powerbook to HD TV

    My powerbook has a broken screen, but is otherwise fine. I want to sell it, as it has been replaced by insurance. I have deleted the hard drive, via firewire, but am unable to reinstall the software through firewire, as the old powerbook has the old

  • Error on Release to Accounting

    Hello Could anybody help me? When I access to transaction VF02, and try to Release to accounting a billing document, it shows me the error: Item category 40100 not allowed in accounting transaction 0200/0001 Does anybody know why? Thank you in advanc

  • Manual depreciation and Planned but not posted depreciation forwarded

    HI Expert, We would like to request for Product Enhancement for Fixed Asset Module due to the inconsistency in the computation for the following: u2022     The planned and un-posted depreciation is already considered as confirm transaction when they

  • How do I open multiple PDF windows on microsoft Surface?

    How do I open multiple windows on microsoft Surface? I'm a grad student and would like to have multiple PDF windows open or availible while I use Microsoft Word. Is this possible?