Create and dynamically change buttons in jtable column

I am having a lot of problems fully grasping tablecellrenderer and tablecelleditor. I have researched a lot, looked in a lot of forums, but still can't solve my problem.
Without posting an sscce (because my code is probably very incorrect), how would I do the following:
Create a jtable with a column that has ButtonX in it. Then when another column in a specific row gets a certain value, ButtonX will change to ButtonY, but other rows will remain what they are already. In the following example, all rows started with ButtonX, but when Progress changed from Uploading to Complete, ButtonX became ButtonY.

Row Name Progress Abort/Complete
0 File 1 Complete ButtonY
1 File 2 Complete ButtonY
2 File 3 Uploading ButtonX

The buttons need to update accordingly if a row is deleted. For example if row 0 is deleted, it should look like:
Row Name Progress Abort/Complete
0 File 2 Complete ButtonY
1 File 3 Uploading ButtonX

Posted On: Monday 24th of September 2012 10:50:25 PM Total Views:  329
View Complete with Replies

Related Messages:

how to create dialog box in swing that will close automatically after some time.   (266 Views)
somebody ,please suggest me how to create dialog box in swing that will close automatically after some time
Error while trying to create a JTable   (229 Views)
I am taking elements from a Dom parser and writing its content into a JTable with TreeSelectionListener() of JTree to indicate which node's data is to be displayed. private TreeSelectionListener createSelectionListener() { return new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { TreePath path = e.getPath(); TreePath selected_path = e.getNewLeadSelectionPath(); selected_node = selected_path.getLastPathComponent().toString(); navpoint = xmlTree.name_compare(selected_node); content = xmlTree.content_return(); tables(); } }; } String selected_node() { return selected_node; } void tables () {//JTable table_node; String columnName[] = { "Name", "Value" }; Object rowData_node[][] = null; Object rowData_content[][] = null; JTable table_content = new JTable(rowData_content, columnName); NamedNodeMap elementAttributes = navpoint.getAttributes(); int numAttributes = elementAttributes.getLength(); for (int j = 0; j < numAttributes; j++) { Node attribute = elementAttributes.item(j); System.out.println("Node name :" + attribute.getNodeName()); System.out.println("Node Value :" + attribute.getNodeValue()); System.out.println("j :"+j); rowData_node[j][0] = attribute.getNodeName().toString(); rowData_node[j][1] = attribute.getNodeValue().toString(); } /*table_node = new JTable(rowData_node, columnName); right.add(table_node); table_node.setBounds(10, 10, 300, 300);*/ }
create a jtable which can combine and split and the image change also   (266 Views)
hi newbie here and would like to know how to create a jtable with default images and with specific column and rows that if you combine the cells the image enlarge and when split the image decreases.
why we use swing to create GUI application instead of AWT?   (216 Views)
we can also use AWT(Absract Window Toolkit).but when it is used to create component, it's called its native method. native method is written in C language. but C is platfom depended language. so, look and feel of the component is different for different platform(operating system). so, devloper can't make sure about appearence of his GUI. so,it's better to use swing rather than AWT. AWT component is heavyweighted means use more system resources(memory,processor time).
Can't create a brand new panel   (186 Views)
Morgan Morten wrote:Once the user clicks the button, a brand new panel is created That's true. on the frame (and of course, a new text field inside the panel) That's not true. I'm not sure what you mean by "on the frame" but at any rate you don't put that new JPanel into the JFrame in any way, so there's no way for it to be seen by the user. And I'm not sure what makes you think that a new text field is created in that panel -- I don't see any code which does that. I'm not going to suggest how you should fix that, because adding new components to an existing GUI is not a common thing to do. A lot of the time when you see code which is trying to do that, it was written by somebody who didn't know about better alternatives. And anyway I'm not sure what you expect to happen after you click the button a dozen times and have 13 panels in there somewhere. , why would you need a new panel and a new textfield when done with the sale, create a sale object from the data on the screen, save that to a db, then clear the screen
Why can't i create a new object?   (227 Views)
I am having a simple error. I want to create a jframe to say a player already exists and have created a class in its own right. I am new to swing, so am not even sure if this is the right thing to do Anyway there is an error when i try to create a new object and i cant for the life of me figure out what it is public void mouseClicked(MouseEvent e) { String firstname = txtFirstname.getText(); String secondname = txtSurname.getText(); if(!(Players.usercheck(firstname, secondname))) { Players.addplayer(firstname, secondname); PlayerAdded pla = new PlayerAdded(firstname, secondname); pla.setVisible(true); } else { UserExists userexists = new UserExists(); userexists.setvisible(true); } } });
make all components visble, when jframe size changed horizontally or vertically   (268 Views)
Hi I have developed user interface in swing with two panels, lower panel and upper panel, both uses FormLayout and used BorderLayout to add these panels to JFrame. When the JFrame size is changed horizontally or vertically some components are not visible in JFrame going out. Please help how to minimize the size of all the components to make visble, when JFrame size is changed. Many
Why do the sizes of my components change when I specify a look-and-feel?   (152 Views)
Why do the sizes of my components/containers change when I specify a look-and-feel or change look-and-feel repeatedly,with different layouts or without layout
easiest way to create & setting jpanels?   (285 Views)
I am try to creating 21 jpanels with different ways... 1. drag & drop from eclipse windowsbuilder 21 times so each time its code like with settings also JPanel panel_example = new JPanel(); panel_example.setBackground(new Color(245, 245, 245)); panel_example.setFont(new Font("Trebuchet MS", Font.PLAIN, 12)); panel_example.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_example.setBounds(78, 68, 86, 82); panel_example.setLayout(new BorderLayout(0, 0));
Is it possible to create a compound button in swing?   (272 Views)
compound button, or what ever you might call it, is it possible to create a button or group of buttons to look like this the said button should be able to act as individual buttons like, button_north, button_center, button_south, button_east and button_west. looking forward to possible hints on how to come up with the said component.
Synth change JComboBox Arrow size   (347 Views)
I have a synth XML that I'm using to change the appearance but with the CombBox, I got the arrow to use my image but now it keeps stretching to the largest size. How can I make the arrow appear smaller
JTextArea size changes on pressing TAB key   (332 Views)
When i enter data inside JTextArea, and press TAB key to move to next textfield/ or anything, it doesn't moves. Instead it changes the size of JTextArea each time i press TAB key. By using "setTabSize(0);" i can stop it from re-sizing the textarea, but how to move to the next textfield
How to create the Jtable in which one column contain the check box or String   (162 Views)
Hi , i want to create the Jtable in which one column contain the check box (which is a boolean value) or String i created the Check box as public Class getColumnClass(int column) { return getValueAt(0, column).getClass(); } This function return me boolean value "True" or "False" my problem is that, in the 1st column and 5 row i need to display the "check box" and next row from 6 to 10 of the same column i need to display string. .
API to track clipboard changes ?   (145 Views)
Is there any API which will notify me (Listener) whenever any changes occurs at system clipboard I already know a method (by using Timer) to track clipboard changes but I think if i check for clipboard's data at 100ms then lots of CPU (which has just single core) time will be wasted
how to display text on image which keeps on getting changed ?   (246 Views)
I have successfully manage to display a text on JLabel but when ever i m changing that text , the other text is displayed on the same image to try to rub the orignally writen text with graphics2d.drawString("",210,50);
How do I change the "BOLD" property of the contents of a text-field at run-time in JAVA ?   (190 Views)
I am doing this program where there are around 20 text-fields which are initially configured to BOLD in design time. At run-time, the user fills out some of the text-fields out of the given 20. Based on that value, there will be some mathematics upon which the rest fields will be filled at run-time. So, what I want is once the user finished and initiates an event , the empty text-fields BOLD property should go to PLAIN instead of "BOLD". I do not want to change anything else( font , color , etc. ). Just want the BOLD propery to go from "BOLD" to "PLAIN" !!! Plzzz Help............ !!!
How can I change DefaultCellEditor#setClickCountToStart(int) for DefaultTreeCellEditor   (141 Views)
because TreeCellEditor is availble only at 3rd. mouse click my SSCCE demonstrate a.m. issue import java.awt.BorderLayout; import javax.swing.*; import javax.swing.tree.DefaultTreeCellEditor; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreeCellEditor; public class TreeEdit { public static void main(String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Object array[] = {Boolean.TRUE, Boolean.FALSE, ""}; JTree tree = new JTree(array); tree.setEditable(true); tree.setRootVisible(true); DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tree.getCellRenderer(); String elements[] = {"A", "B", "C", "D"}; JComboBox comboBox = new JComboBox(elements); comboBox.setEditable(true); TreeCellEditor comboEditor = new DefaultCellEditor(comboBox); TreeCellEditor editor = new DefaultTreeCellEditor(tree, renderer, comboEditor); tree.setCellEditor(editor); JScrollPane scrollPane = new JScrollPane(tree); frame.add(scrollPane, BorderLayout.CENTER); frame.setSize(300, 150); frame.setVisible(true); } }
how to create java application that scans picture with handyscan   (219 Views)
I am creating a java application such that if the user when run the application and when prompt to scan the user will scan by pressing a button on the handyscan magiscscan miscns(a handheld scanner by skypix handheld) and the scanned image will appear on the screen
how to create alarm/remainder in my app?   (115 Views)
i am trying to create a birthday alarm app. i am creating a form, and storing and fetching data from files. the problem is, when someone's birthday is there on some day, system should alarm or something like this, i don't know how to implement this
how to change third level sub menu item position?   (238 Views)
I have a popup menu up to four level. Let's say : Aaaaaaa->Bbbbbbb->Ccccccc->Ddddddd When mouse is right clicked at right bottom of the screen Popup menu is shown. If I move mouse on Aaaaaaa since no place for second level, Bbbbbbb is shown at left of Aaaaaaa, then if I move mouse on Bbbbbbb then Ccccccc appears at right of Bbbbbbb. Problem is here, I want Ccccccc is displayed left of Bbbbbbb and Ddddddd is at left of Ccccccc. sub menus should opened towards left. Note: This of course should be reverse when I right click at left bottom of screen. This time I want all submenus will be opened at right of it's parent.