defaulttablemodel

Refresh a jTable

若如初见. 提交于 2019-12-02 08:47:17
I can't seem to get my table to refresh. I created a refresh button that calls jTable1.repaint(); private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) // Reader Refresh jTable1.repaint(); } I also tried just recalling the RegistryValues again in the button like RegistryValues.arp(null); private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) // Reader Refresh RegistryValues.arp(null); } Also tried combining the registryvalues and repaint in the button. Below is the code for my jTable . The RegistryValues are from another class that uses JNA to read the registry if

I want to update table when Button is clicked

和自甴很熟 提交于 2019-12-02 04:32:00
I am newbie of Swing. I want to update table after click button (done button). I think data correct but the screen does not work. The followings are explanation of my program check checkBoxes and the click Done button the bottom layer should change. there is no main This is my code: import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing

Complex use of JTable, TableModel and others

好久不见. 提交于 2019-12-01 14:31:45
I have some problems with the manage of two JTable, and relative data. I had make this GUI: I explain the use: In the first jTable I have a list of vehicles (trucks, cars...) and relative info. In the second jTable I have a list of vehicles that I want make "available" (i.e. a sw agent starts), with the press of the green arrow. So, is a sublist of the first list: the row selected in the first table are copied in the second. First problem: In the first column I have a explicative image of the kind of vehicle (you can see a truck in the example). In the third and fifth column I have different

Jtable Look and feel of editing cell

微笑、不失礼 提交于 2019-12-01 14:20:43
There is a JTable with DefaultTableModel . There is table's setforeground , setbackground and setselectioncolor methods. Also when you are editing the cell you have table.setDefaultEditor(Object.class, new DefaultCellEditor(field)) method to change the editing cell's font color. Now how to change the border color of the editing cell. Thankyou.` trashgod You can use any of the following keys in UIManager.put() to affect the corresponding Border : Table.focusCellHighlightBorder Table.scrollPaneBorder TableHeader.cellBorder For example: UIManager.put("Table.focusCellHighlightBorder", new

Complex use of JTable, TableModel and others

喜夏-厌秋 提交于 2019-12-01 12:29:50
问题 I have some problems with the manage of two JTable, and relative data. I had make this GUI: I explain the use: In the first jTable I have a list of vehicles (trucks, cars...) and relative info. In the second jTable I have a list of vehicles that I want make "available" (i.e. a sw agent starts), with the press of the green arrow. So, is a sublist of the first list: the row selected in the first table are copied in the second. First problem: In the first column I have a explicative image of the

show an image when hover over a jtable cell

元气小坏坏 提交于 2019-12-01 11:11:44
I have a JTable created with a DefaultTableModel, and I want to show an image when the mouse hovers over a particular cell of that JTable, and I need the image to be different for each cell. Thanks in advance Paul Samsotha You can override prepareRenderer of the JTable and setToolTip for the cell/column/row component, and use some HTML for the tooltop, as see here and here For each different image you will need to get a different URL as the src of the img tag. You'll need to know some basic HTML for this. You can obtain an URL by using getClass().getResource() for images in the class path. Or

Java add/remove row to JTable?

好久不见. 提交于 2019-11-30 19:34:14
问题 I am trying to figure out how to add and remove rows from a JTabel. I want to remove rows based on the first column which is a unique ID. I am currently creating my table like this: String[] colName = new String[] { "ID#", "Country", "Name", "Page titel", "Page URL", "Time" }; Object[][] products = new Object[][] { { "867954", "USA", "Todd", "Start", "http://www.url.com", "00:04:13" }, { "522532", "USA", "Bob", "Start", "http://www.url.com", "00:04:29" }, { "4213532", "USA", "Bill", "Start",

calculating in jtable with %, total

坚强是说给别人听的谎言 提交于 2019-11-29 18:15:32
I am almost at the end of my project and have some problems solving it. I m a chef who wants his own application what is relevant for his own bussines My form is called Recipes and have Qty unitprice, % used. So lets say, you have 1kg apples for 5 euro. At the end of cleaning you just have 800 grams of apples. So i have paid 20 percent more. example Item is always 100%, Qty 5, Unitprice 5, Used% 100% total = 25 Qty 5, Unitprice 5, Used% 70%, Total= 32.5 ( must increase with 30 percent) At the end I would have to calculate the Foodcost. So "Total Cost / Selling price * 100" I m stuck with this

re-size JTable when useing Default table model

二次信任 提交于 2019-11-29 17:40:41
I have a JTable built using DefaultModel which is displayed in JPane but I would like to re-size the table to make it bigger. Could any one please explain how I could do that? I have tried the following code: TableColumnModel colsize = t1.getColumnModel(); for(int i=0; i<cols; i++){ colsize.getColumn(i).setPreferredWidth(200); } but it did not work. To size up the table#setPreferredSize(). table.setPreferredSize(new Dimension(500, 500)); To size up the columns table#getColumn(). table.getColumn(columnNames[0]).setPreferredWidth(100); table.getColumn(columnNames[1]).setPreferredWidth(400); I

Jtable doesn't refresh/update data

浪尽此生 提交于 2019-11-29 12:39:25
I have a problem with JTable / JScrollPane . My data table is not refreshing/updating. I am using DefultTableModel and according to the code everything is fine and I don't have any errors. Also I have a table with paging and that's why I am using action listeners and buttons "prev" and "next". I am passing from other function to function that is coded in class where is JTable . Problem is that I fill arrays which contains data for table but table won't update/refresh it. Here is my code. Thanks advance. BIG EDIT Old code was removed. I added new codes that will help you guys/girls to