Adding JTable on an image..............??help need.....edited

i am using JFame
on JFrame i hav added JTabbedpane....
on one of the tab i hav added image on whole background....
on that tab i hav added JTable....
but when i add JTable on that tab .....instead of adding table on that image...it add image on background with no image
that no color part shoud be covered with part of image added on a tab
and also i want to position (x,y) of JTable on tab.....
so i hav used gridLayout so that it looks better....but that not i want.....
here is the code.... check search tab
//project.java
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
class tdsgui{
JFrame f,pass;
JTabbedPane jtp = new JTabbedPane();
JApplet obj=new JApplet();
JMenuBar mb=new JMenuBar();
public tdsgui(){
f=new JFrame("TELEPHONE DIRECTORY SYSTEM");
JMenu m1=new JMenu("File");
JMenu m2=new JMenu("About");
JMenu m3=new JMenu("Help");
mb.add(m1);
mb.add(m2);
mb.add(m3);
JMenuItem mi1=new JMenuItem("Save");
JMenuItem mi2=new JMenuItem("Exit");
JMenuItem mi3=new JMenuItem("save as");
mi3.setVisible(true);
m1.add(mi1);
m1.add(mi3);
m1.add(mi2);
public void launch(){
jtp.addTab(" REGISTRATION ",new registerpanel());
jtp.addTab(" MODIFY ",new updatepanel());
jtp.addTab(" SEARCH ", new searchpanel());
f.add(mb);
f.setJMenuBar(mb);
f.add(jtp);
f.setSize(500,600);
f.setVisible(true);
public class project{
public static void main(String args[]){
tdsgui next=new tdsgui();
next.launch();
class registerpanel extends JPanel{
public registerpanel(){
class updatepanel extends JPanel{
public updatepanel(){
class searchpanel extends JPanel{
public searchpanel(){
Icon icon = new ImageIcon("Sunset.jpg");
JLabel label = new JLabel(icon);
add(label);
this.setLayout(new GridLayout(2,0));
final String[] colHeads = { "Name", "Phone", "Fax" };
final String[][] data = {
{ "Gail", "4567", "8675" },
{ "Ken", "7566", "5555" },
{ "Viviane", "5634", "5887" },
{ "Melanie", "7345", "9222" },
{ "Anne", "1237", "3333" },
{ "John", "5656", "3144" }
// Create the table
JTable table = new JTable(data, colHeads);
JTableHeader header = table.getTableHeader();
table.setRowHeight(20);
TableColumn column = table.getColumnModel().getColumn(0);
table.setCellSelectionEnabled(true);
table.getTableHeader().setPreferredSize(new Dimension(0,30));
table.setFont(new Font("Dialog", Font.BOLD, 15));
table.setBackground(Color.green);
header.setFont(new Font("Courier",Font.BOLD,25));
header.setBackground(Color.yellow);
//label.add(table,BorderLayout.CENTER);
// Add table to a scroll pane
int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp = new JScrollPane(table, v, h);
// Add scroll pane to the content pane
this.add(jsp, BorderLayout.SOUTH);
add image i ur system....make changes on searchpanel class
thanks in advance...

on one of the tab i hav added image on whole background....no you haven't - you've added a JLabel to a GridLayout JPanel
I have no idea what you're really trying to do, but here's a tab with image background and transparent table (except for the header)
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
class tdsgui{
JFrame f;
JTabbedPane jtp = new JTabbedPane();
public tdsgui(){
f=new JFrame("TELEPHONE DIRECTORY SYSTEM");
public void launch(){
jtp.addTab(" REGISTRATION ",new registerpanel());
jtp.addTab(" MODIFY ",new updatepanel());
jtp.addTab(" SEARCH ", new searchpanel());
f.add(jtp);
f.setSize(500,600);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
class project{
public static void main(String args[]){
tdsgui next=new tdsgui();
next.launch();
class registerpanel extends JPanel{
public registerpanel(){
class updatepanel extends JPanel{
public updatepanel(){
class searchpanel extends JPanel{
Image img;
public searchpanel(){
try{img = javax.imageio.ImageIO.read(new java.net.URL(getClass().getResource("Test.gif"), "Test.gif"));}
catch(Exception e){}//do nothing - handled in paintComponent
this.setLayout(new GridLayout(2,0));
final String[] colHeads = { "Name", "Phone", "Fax" };
final String[][] data = {
{ "Gail", "4567", "8675" },
{ "Ken", "7566", "5555" },
{ "Viviane", "5634", "5887" },
{ "Melanie", "7345", "9222" },
{ "Anne", "1237", "3333" },
{ "John", "5656", "3144" }
JTable table = new JTable(data, colHeads);
table.setOpaque(false);
table.setBackground(new Color(0,0,0,0));
JScrollPane jsp = new JScrollPane(table);
jsp.setOpaque(false);
jsp.getViewport().setOpaque(false);
this.add(jsp);
public void paintComponent(Graphics g){
super.paintComponent(g);
if(img != null) g.drawImage(img,0,0,this.getWidth(), this.getHeight(),this);
}

Similar Messages

  • Adding JTable on an image..............??help need

    i am using JFame
    on JFrame i hav added JTabbedpane....
    on one of the tab i hav added image on whole background....
    on that tab i hav added JTable....
    but when i add JTable on that tab .....instead of adding table on that image...it add image on background with no image
    that no color part shoud be covered with part of image added on a tab
    and also i want to position (x,y) of JTable on tab.....
    so i hav used gridLayout so that it looks better....but that not i want.....
    here is the code.... check search tab
    //project.java
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    class tdsgui{
    JFrame f,pass;
    JTabbedPane jtp = new JTabbedPane();
    JApplet obj=new JApplet();
    JMenuBar mb=new JMenuBar();
    public tdsgui(){
    f=new JFrame("TELEPHONE DIRECTORY SYSTEM");
    JMenu m1=new JMenu("File");
    JMenu m2=new JMenu("About");
    JMenu m3=new JMenu("Help");
    mb.add(m1);
    mb.add(m2);
    mb.add(m3);
    JMenuItem mi1=new JMenuItem("Save");
    JMenuItem mi2=new JMenuItem("Exit");
    JMenuItem mi3=new JMenuItem("save as");
    mi3.setVisible(true);
    m1.add(mi1);
    m1.add(mi3);      
    m1.add(mi2);
    public void launch(){
    jtp.addTab(" REGISTRATION ",new registerpanel());
    jtp.addTab(" MODIFY ",new updatepanel());
    jtp.addTab(" SEARCH ", new searchpanel());
    f.add(mb);
    f.setJMenuBar(mb);
    f.add(jtp);
    f.setSize(500,600);
    f.setVisible(true);
    public class project{
    public static void main(String args[]){
    tdsgui next=new tdsgui();
    next.launch();
    class registerpanel extends JPanel{
    public registerpanel(){
    class updatepanel extends JPanel{
    public updatepanel(){
    class searchpanel extends JPanel{
    public searchpanel(){
    Icon icon = new ImageIcon("Sunset.jpg");
         JLabel label = new JLabel(icon);
    add(label);
    this.setLayout(new GridLayout(2,0));
    final String[] colHeads = { "Name", "Phone", "Fax" };
    final String[][] data = {
    { "Gail", "4567", "8675" },
    { "Ken", "7566", "5555" },
    { "Viviane", "5634", "5887" },
    { "Melanie", "7345", "9222" },
    { "Anne", "1237", "3333" },
    { "John", "5656", "3144" }
    // Create the table
    JTable table = new JTable(data, colHeads);
    JTableHeader header = table.getTableHeader();
    table.setRowHeight(20);
    TableColumn column = table.getColumnModel().getColumn(0);
    table.setCellSelectionEnabled(true);
    table.getTableHeader().setPreferredSize(new Dimension(0,30));
    table.setFont(new Font("Dialog", Font.BOLD, 15));
    table.setBackground(Color.green);
    header.setFont(new Font("Courier",Font.BOLD,25));
    header.setBackground(Color.yellow);
    //label.add(table,BorderLayout.CENTER);
    // Add table to a scroll pane
    int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
    int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
    JScrollPane jsp = new JScrollPane(table, v, h);
    // Add scroll pane to the content pane
    this.add(jsp, BorderLayout.SOUTH);
    add image i ur system....make changes on searchpanel class
    thanks in advance...

    as was mentioned in your previous post, please use code tags when posting code here. Your current code is unformatted making it difficult to read. Also, when doing this, make sure that the pasted code has proper indentation before you use the code tags.
    To do this, you will need to paste already formatted code into the forum, highlight this code, and then press the "code" button at the top of the forum Message editor prior to posting the message. You may want to click on the Preview tab to make sure that your code is formatted correctly. Another way is to place the tag [code] at the top of your block of code and the tag [/code] at the bottom, like so:
    [code]
      // your code block goes here.
      // note the differences between the tag at the top vs the bottom.
    [/code]

  • Large image help needed please

    Hey all,
    I hope you can help - at this point I am nearing tears of frustration.. I have been working with CS4 for a month or so and just got a colour scanner. Installation of the scanner etc. went fine and I can now scan my artwork in to the pc.
    I knew there was a problem with scanning stuff in directly through photoshop so I used the software that came with my scanner to get my images. Here's where my problems start!
    I can use every graphics program you can possibly care to think of to open the image be it gimp, fireworks or illustrator but I can't get photoshop to open the file - it just hangs and stops responding. I have tried opening it in other software and saving it in various different formats including BMP, TIF, PNG and PSD but nothing I do will get photoshop to open them. I know its not the files themselves because every other program can open, edit and save them.
    please help me solve this problem because I know photoshop very well and don't want to have to learn a new program to edit my files in

    hobbes09
    I thought (hoped) this would have been figured out by now.  I'm aware that you cannot scan directly into Photoshop from Photoshop using the Vista 64 version  No twain available for 64 bit I believe.  However, since you are using the Vista 32 bit is it possible to use your scanner directly in Photoshop? 
    FILE>IMPORT>TWAIN>CANON SCANNER
    Is Photoshop working normally otherwise?

  • Creating Symbol Instances containing a dynamically set image - Help Needed

    I'm working on a site prototype that has many rollover images in the navigation. Each image is unique, but the rollover and rollout code is identical. I'm trying to create a single symbol that can be used for all of the rollovers, but need some help figuring this out, as it will significantly speed up my work.
    I think the pseudocode would work like this:
    Create a symbol that contains a default rollover image.
    In the symbol, add the rollover and rollout code. This adjusts transparency from 0 -> 100 and back.
    Create instances of the symbol over each item in the nav.
    For each instance, set a variable containing the name of the rollover image to be used.
    In that symbol instance, get the variable value.
    In that symbol instance, use the image name in the variable to replace the default image.
    Question: How do I make step 4-6 work? I have 1-3 working smoothly.P.S. My last dev work was waaaaay back with Director, PHP and ColdFusion. I still get basic principles such as using functions, objects, instances, inheritance etc, but the language has changed. And I have very very little experience with the DOM.
    Appendix: How I'm Doing This Manually
    There's a background image of the nav showing all of the unselected states
    Each item in the nav has a corresponding rollover image, in a series of elements layered on top of nav element. Each rollover has opacity initially set to 0%.
    Each image element has rollover, rollout and click triggers. Rollover and rollout triggers are identical for each. There's also a little more code with rollout that provides a quick fade. This means lots of copying identical code. I hate to think about having to change any part of that code.
    Thanks! Chassy

    Hi there,
    Perhaps a more simple solution would be to set up 1 global function that handles over/out states for all your buttons. On mouseenter/mouseleave of each button you would call this function to fade in/out your rollover graphic.
    Example:
    http://www.timjaramillo.com/code/edge/rollover4_multiple_btns
    Source:
    http://www.timjaramillo.com/code/edge/_source/rollover4_multiple_btns.zip
    Code on Stage.compositionReady (note there are btn symbols called btn_1, btn_2, btn_3, and all have an over state called "over" in them):
    var array_btns = ["btn_1", "btn_2", "btn_3"];// array to hold all your btns
    function setup_btns()
              // iterate through array_btns, add "mouseenter" and "mouseleave" for all
              for (var i=0; i<array_btns.length; i++){
                        // hide "over" state initially
                        sym.getSymbol( array_btns[i] ).$("over").hide();
                        sym.$( array_btns[i] ).mouseenter({obj:array_btns[i]}, function(e){
                                  var btn = e.data.obj;
                                  sym.getSymbol(btn).$("over").fadeIn(500);// show "over" graphic
                        sym.$( array_btns[i] ).mouseleave({obj:array_btns[i]}, function(e){
                                  var btn = e.data.obj;
                                  sym.getSymbol(btn).$("over").fadeOut(200);// hide "over" graphic
    setup_btns();

  • Find text and replace with image - Help needed

    Hi,<br /><br />We need to place the images as inline in the appropriate places.<br /><br />texttexttext<<test1.eps>>texttexttexttexttexttext<<test2.eps>>texttexttexttexttexttext< <test3.eps>>texttexttexttexttexttext<<test4.eps>>texttexttexttexttexttext<<test5.eps>>text texttext<br /><br />This code is helpful for placing a single image at a time, we are unable to place all the images in one shot, can anyone help me out.<br /><br />I am not a programmer.<br /><br />-----------<br />var myDoc = app.activeDocument; <br />app.findPreferences = app.changePreferences = null; <br />var math=document.search("test.eps"); <br />for (i=math.length-1; i >=0; i--)<br />{ myDir = Folder.selectDialog(); <br />AllGraphics = Folder(myDir).getFiles('test.eps') <br />for (i=0; i<math.length; i++) { app.select(anil1[i]); <br />     myDoc.place(AllGraphics[i],false); } }<br />-----------<br /><br />Note: I have taken this code from forum and we have made some changes on this.<br /><br />Kavya

    Jongware,<br /><br />I try running it but gives errors:<br /><br />Error Number: 55<br />Error String: Object does not support the property or method 'changePreferences'<br />Line: 24<br />Source: app.findPreferences = app.changePreferences = null;<br /><br />This is the code I used<br /><br />// Find text and replace with image for InDesign CS3 <br />// http://www.adobeforums.com/webx?128@@.3bbf275d.59b6f012<br />var heyItsAnArray = new Array ( <br /><br />   "it contains this line!", <br /><br />   "as well as this one", <br /><br />   "or even more!", <br /><br />   "test.eps" ); <br /><br />for (arrayCount=0; arrayCount<heyItsAnArray.length; arrayCount++) <br /><br />{ <br /><br />   replaceImg (heyItsAnArray[arrayCount]); <br /><br /> } <br /><br />function replaceImg (name) <br /><br />{ var myDoc = app.activeDocument;  <br />     app.findPreferences = app.changePreferences = null;  <br />     var math=document.search(name); <br />     for (i=math.length-1; i >=0; i--)  <br />     { myDir = Folder.selectDialog();  <br />          AllGraphics = Folder(myDir).getFiles(name)  <br />          for (i=0; i<math.length; i++) { app.select(anil1[i]); <br />               myDoc.place(AllGraphics[i],false); <br /><br />               } <br /><br />          } <br /><br />     }<br /><br />Michael

  • Watermarking Images - help needed

    I need to watermark some images and am really struggling to understand how to do it with Photoshop. I'm a complete novice so please forgive my ignorance.
    Please could someone help me out here by explaining in plain language how to do it, if it is at all possible.
    Many thanks in advance,

    http://movielibrary.lynda.com/html/modpage.asp?id=233
    Section 6: actions. Russell Brown's watermarking an image.
    J

  • How to make JPanel as JTable Cell Editor (Urgent help needed)

    Hi!
    I want to make JPanel (with a JTextField, 3 JLabels and 1 JTextArea) as cell editor for one column. Can somebody help me on this?
    Does anybody have any sample code? I will greatly appreciate ur help.
    Thanks,
    Snehal

    Okie. In "How to use JTables" page found in the JAVA website (there is a link from the JTable section of the JAVA API documentation), there is a sample code for a sample color chooser. What this does is, adds a button with its action listener set to pop up a color chooser window. In this, rendering is still through a JLabel.
    This example would be of good help to you. Plus, this example gives me a feeling that what u ask is possible.

  • Lion won't mount image - Help Needed

    When I try to mount any disk images to install software from the internet. the image mounts but is then automatically unmounted before I can do anything with it.
    Tried, Disk Utility repair, tried mounting from Disk Utility directly, tried reinstalling Lion, still doesn't work. Tried downloading different dmg files from different sources, still the same.
    Can someone help with a work around.
    MacBook Pro 13", Mid 2010, Lion 10.7.2
    Many thanks.
    Eric

    LiquidCD DOES HAVE mount feature, do not know whether uses its independent mount engine or uses sys engine, as attached. Click on its last icon on upper right, then choose image, then mount. Combined with your testing new user, which does not solve the issue, and still waiting with your testing LiquidCD feature, my guess is that you have a corrupt system or ImageMounter was erased or corrupt.
    You may test this by an interim solution: install a new system unto an external disk, if available, or unto a 16 GB flash drive (8 GB is not sufficient), and test there. I think you will do that sooner or later anyway, but is a simple test.

  • Adding keywords to multiple images - Help!

    I'm getting really frustrated. I've been a long time iPhoto user, but my husband bought me Aperture and I'm trying to move to it. . . .anyway, I'm trying to add keywords to some of my pictures (I miss my "hot keys"). I have the Keyword Controls open on the bottom of the split view window and I've set up a variety of keyword preset lists. . . Anyway, the problem that I am having is when I select multiple images to apply a keyword to, it is only applying the keyword to the "primary" (meaning the boldly outlined in white) image - even though the other images as selected (outlined in a less bold white boarder) the keywords are not assigned to them. It's like I have to add the keywords to each image one at a time. I've looked at a bunch of the material online and it's clear to me that you are SUPPOSED to be able to add keywords to multiple images at a time. Anybody have any idea what I'm doing wrong?

    Thanks for the tip, it was really bugging me! Pitty you cant just click on the Keyword in the display rather than have to drag and drop it! I know you can use the control bar but for each item here I think a max of 12 or so are displayed, when you use hundreds of keyword to catalog medical images its not very handy, iphoto was much easier in this regard!
    cheers
    Rper

  • Photomerge with 125 RAW photos, 16 megapixel images, Help Needed

    I have 125 raw photos that are 4912*3264 pixels  I am trying to photomerge all them using the Cylindrical setting.  And it is not working.  I have let it go for like 12 hours and nothing is happing. Windows task manager flashes "photoshop not resonding" then it goes away and back and repeats...  Processor peaks out only at like 15% after all images load and it starts to process.
    I tried going into Preferences and messed with ram allocation etc and other settings.
    Using latest PS version
    I am using CS6
    Windows 8 x64
    Intel Core i7 920
    18 Gig of Ram
    main drive for windows
    raid for casch
    disk for images
    Nvidia GTX 560 HD
    Any suggestions?

    It might be, that depending how the pano is arranged, that your actually exceeding the 300,000 x300,000 pixel limit in photoshop
    if indeed that is still the limit in photoshop cs6.
    Or you just don't have enough system resources for a pano (image) of that size.
    It's possible you could try to do the pano in sections and then assemble the finished result by hand in photoshop.

  • Serious help needed fixing an image gallery

    On my page
    http://www.dorff.nl/clients.html
    ive put this very nice gallery..
    The only problem is. I divided the gallery in 6 groups. But in every group you will see the same images. How can i change the images for each group seperately?
    I hope you understand what i ment.
    Regards Brian

    How i can use the four files you have send me?
    In dreamweaver im getting the message...
    lightbox.css is not on the disk
    prototype.css is not on the disk
    scriptaculous.css is not on the disk
    lightbox.js is not on the disk
    Date: Thu, 12 Apr 2012 12:37:39 -0600
    From: [email protected]
    To: [email protected]
    Subject: serious help needed fixing an image gallery
        Re: serious help needed fixing an image gallery
        created by adninjastrator in Dreamweaver - View the full discussion
    Here are 4 files you need:http://www.olympicdiscoverytrail.com/style_sheets/lightbox.csshttp://www.olympicdiscoveryt rail.com/style_sheets/prototype.jshttp://www.olympicdiscoverytrail.com/style_sheets/script aculous.js?loa d=effectshttp://www.olympicdiscoverytrail.com/style_sheets/lightbox.jsHere is an entire web page with working multiple galleries:
    Photo Gallery 1
        !images/125/paw_Carrie-Elwha.jpg|title=Elwha River Valley approaching the bridge|height=93|alt=Elwha River Valley approaching the bridge|width=125|src=images/125/paw_Carrie-Elwha.jpg|border=0!
    Photo Gallery 2
        !images/125/sw_IMG_1115-Downtown-Trail.jpg|title=Trail near High School close to downtown Sequim|height=83|alt=Trail near High School close to downtown Sequim|width=125|src=images/125/sw_IMG_1115-Downtown-Trail.jpg|border=0!
       </div>     <!-- close main_container -->
    </div>
    </body>
    </html>Here is a link to that working page on-line:http://www.olympicdiscoverytrail.com/trail_maps/slideshow.htmlThere is not much more I can do!You'll have to take the bull by the horns and start coding!Copy/Paste this HTML code into a new, blank page and edit the paths to all the .css, .js, and image files.Best of luck!Adninjastrator
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4330648#4330648
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4330648#4330648. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Dreamweaver by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

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

  • *Help Needed* Adding multiple emails/mailing list in the email subscription

    Help Needed
    Hi,
    Can someone help me in adding multiple email address/mailing list in the email subscription for interactive reports in Apex 4.
    pls mail me at [email protected]
    Regards,
    Sunny

    The doc does not mention a separator for the email addresses because we only support one email address per subscription. I have logged a task for our next release to look at expanding it and allowing multiple.
    -- Sharon

  • Help Needed..Fingerprint Identification..Image Manipulation

    Norfolk State University Student (Help Needed):
    I'm working on Fingerprint Identification using image correlation and/or a feature-based approach.  First, Goal is to minimize the lines of the minutia so that they are one pixel thick.  What services does Labview offer that will help me accomplish this task??

    Hey Snakehead...,
    Have you tried improving your original image with better lighting, better camera, better lens, etc.? What image processing have you done already, or are you starting from scratch? I agree with AnalogKid in providing some sample images to the forum so we can get an idea of what you are working with. Have you performed any morphology processing on the image? Have you tried edge detection functions? There are numerous functions that NI provides with their NI Vision software that will help you process your image, it is just finding the right combination that is the toughest part. Last, if you do have the Vision software, I might suggest taking a look at the Vision concepts manual to get an idea of the different functions and their capabilities. Let us know what kind of images you are working with and what you have done so far, and last, what you would like to eventually see. Thanks, and have a great day.
    Regards,
    DJ L.

  • Does In-Browser Editing now allow adding/changing links to images and text?

    There are images that link up to pages within the site and to external sites. When a client wants to change the image it needs to link to a new page. Is there a way they can now do that with in-browser editing?

    Hi Andria,
    Changing links is currently not possible with in-browser editing.
    Please post this as a feature request in the following feedback form :
    http://feedback.inbrowserediting.com/?url=
    Regards,
    Akshay

Maybe you are looking for

  • Black background in pdf smartform

    Hi Experts, My smartform has a black background. I mean to say that the text is all surrounded by a black back ground.. How do i change the color to white? Regards Abdullah

  • Neb ABAP Debugger Problem

    Hi Friends, I am working on SAP GUI 710 & ECC 6. When I am debugging, new abap debugger is opening and I can do analysis normally. When we finish the debugging and want to exit, the debugging session is not closing and i get the following message on

  • Problems with my New N9

    Hello, I have identified the following problem with my new N9 Map and drive icons are not opening I can not download from nokia store When it is not in use, the screen turns to green and drains the battery very fast. I need anti virus, Virus has atta

  • How to search case insensitive ?

    Is there any way to search case insensitive ? Because we use Remedy application, we can't change query like to use 'UPPER' or 'LOWER' functions. For example, SQL> desc test1 Name Null? Type A VARCHAR2(20) SQL> select * from test1; A TEST test SQL> se

  • Error: Specify secure port in the property Using ports 7001/7002

              Hi,           I have two node cluster using WL6.1, and Solaris.           Then, I also setup NSAPI plug in, and specify 2 nodes           in obj.conf file. But I tried to browse the URL.           I have "Secure port in property..." error m