Member Avatar

Hello, I have a observer pattern based JTable. With time it is poulated with new data packets. I use addRow functionalities to add my rows. But I want to put always the last coming datapackets at the top. How to do it??

0
1
Member Avatar

have various classes representing various types of program-genres (comedy, drama etc). I have a text file filled with '-' seperated values that get read by a class called Processing and puts them into a LinkedList. I have another class GUI_g that creates the GUI. It has 3 JTables. One for the list and 1 for each Channel. (Channel 1 and Channel 2). The JTable listTable gets filled from the linkedlist and whenever a user clicks on a row, the textfields' text changes accordingly. I tried with 3 fields (Title, Genre and Duration) and it worked, with the 3 textfields showing …

Member Avatar
0
4
Member Avatar

I have a GUI in which has a container for a JTable called 'listTable'. I want to populate the JTable with data stored in a linked list, using the AbstractTableModel. Basically, I have a LinkedList stored in Processing.java. It contains all the data retrieved from a text file. I created an AbstractTableModel to tell the JTable how to be populated. What I want to do now is to populate the JTable in GUI_g with "the contents of the linkedlist". Anyone can tell me how to do this? Here is the code: GUI_g: import java.awt.*; import javax.swing.*; import javax.swing.JTable; import java.util.List.*; …

Member Avatar
0
6
Member Avatar

Hello, I'm having a problem using the jTable plugin. I'm fairly new to using jquery. Here is my problem: I have an database name reg and has fields (fname, lname.....avatar). What i want is to show the contents of the database using jTable. Now, I don't know how to display the image I stored. I stored it using PHP. I have a folder in my localserver (I'm using WAMP) name "uploads". When I upload an image, the image will be saved in that folder and the name (i guess,) is stored in the database. I used longblob datatype. Hoping someone …

0
1
Member Avatar

Dear Friends, I have a frame which is a JSplitPane which is split horizontally into two. On the upper half I want a JFrame to appear and on the lower half I want a JTable to appear. I tired but couldn't get the answer correctly. Will anyone be able to help me out. Regards Sincerelibran

Member Avatar
-1
8
Member Avatar

Hi, i am beginner in java. I doing my final year project in Java Swing. So far, somehow through some online tutorials and articles, i learned to finish 30$ of my project. Now, i need to know how to insert the data from my database into Jtable and display it.... This is my project output message actually. So, please i need help to finish off my project successfully. For last three days, i went through lot of tutorials and articles but none can help in guiding to insert data (which is returned from database and saved in ResultSet obj) into …

Member Avatar
0
5
Member Avatar

Hello Everyone I have an Internal frame in my application which has a JTable populated with values from a database and a JButton which performs some operation when a row is selected from the JTable.When the user does not select a row from the JTable and clicks the JButton, I would like to show a message asking the user to select a row from the table first.I have tried a few things but none seemed to work.Could someone point me in the right direction please.Any help would be greatly appreciated. [CODE] /* * To change this template, choose Tools | …

Member Avatar
0
9
Member Avatar

Hi I am writing one simple program for upgrading my knowlegde from C# to Java but I am failed to attach ActionListener to JComboBox which is added to a cell of JTable at run time. Actually I want to perform update operation and delete operation on selecting Update or Delete item from JComboBox which is generated at runtime im a JTable. I am able to add JComboBox to the cell of JTable and also getting the seleted value from JComboBox on click event of JTable but, my requirement is not fullfilled by this. Here is my partial code - [CODE] …

Member Avatar
0
4
Member Avatar

i) My Table contains no of columns and a jcheckbox i the last column. ii) I am using a combobox to select certain value. iii) based on the value of combo box the jbutton loads the data into the table. iv) when i [B]reload[/B] the data into the table, the new data gets displayed in jtable. v) The problem is that, [U][B]When I press the Jcheckbox, the old data is getting displayed in jtable.[/B][/U] code is as below: [code] public class aap2 extends JFrame { @SuppressWarnings({ "unchecked", "rawtypes" }) static JComboBox year = new JComboBox(new Object[] {"2012-13", "2013-14", "2014-15", "2015-16","2016-17","2017- …

Member Avatar
0
8
Member Avatar

Hello I'm new to Java so all help appreciated I have already searched for similar threads but with no results helping me. I whant to save the data that I input in my Jtable to another Jtable. So the name address etc. that I input in the customer (kundGUI) class to be saved to my OrderGUI jtable after that I press the save(spara) button . Here is my customer class: [CODE] public class Kund { private String fNamn; private String efterNamn; private String email; private String adress; private String telefon; private String kundnr; public String getfNamn() { return fNamn; } …

Member Avatar
0
2
Member Avatar

Hello I'm new to Java so all help appreciated I have already searched for similar threads but with no results helping me I want to make the text in JTextField to search for the data in the JTable and highlight it. Here is my customer class: [CODE] public class Kund { private String fNamn; private String efterNamn; private String email; private String adress; private String telefon; private String kundnr; public String getfNamn() { return fNamn; } public void setfNamn(String fNamn) { this.fNamn = fNamn; } public String getEfterNamn() { return efterNamn; } public void setEfterNamn(String efterNamn) { this.efterNamn = efterNamn; …

Member Avatar
0
3
Member Avatar

Hy , I have a jTable , for printing it i`m using jTable.print(JTable.PrintMode.FIT_WIDTH). I have no problem with that. What i want to do is this (the table extends on 3 pages): On the first page the title should be "Bla bla bla" , and o the last page under the table it should print "Total : blablabla , blabla ...". I tried to use header and footer but it prints it o every page which is not what i want. Can anybody help me ? Thanks

Member Avatar
0
4
Member Avatar

Hi!! my application have 2 frames including tabel 1,tabel 2 when run time i insert values though textfileds to tabel 1 ,after inserting 5 or more then i click next button then display other frame with tabel 2 and tabel 2 must auto filled. my problm is last row(i already insert to 5 or more row to tabel1) only displaying in tabel2 here is my code: tabel1 [CODE] package tabels; import java.util.Vector; import javax.swing.table.DefaultTableModel; public class tabel1 extends javax.swing.JFrame { /** Creates new form tabel1 */ public tabel1() { initComponents(); setLocationRelativeTo(null ); } /////////THIS ARE AUTO GENRETECODES///////// @SuppressWarnings("unchecked") // <editor-fold …

Member Avatar
0
2
Member Avatar

Hi everyone... I just finished making a program for Video Rental in java..its not much..just retrieves the data from the DB and we can add or edit it...it works perfectly. But now, i want it to display the "Client Name" and "Client ID" field from my Client table and "movie Name" and "Movie ID" field from the Movies table in the database. I want it all to be displayed as a single table with 4 fields respectively but i can't see to do it. I know its a very basic thing but its not wrking fr me. I am attaching …

Member Avatar
0
4
Member Avatar

I want to increase column width automatically when record is added or record fetched from database in jtable in java.

Member Avatar
0
2
Member Avatar

I have to make a bank GUI and I have a Jlist that populates with the customer objects (viewable by name) and I can view their individual info... but when I select the customer, I also want to be able to pull their account info and put it in a jtable that is on the same frame. I have a class to create a model for the table (I don't need that, but was trying to figure it out)... I got it to work to put in customer info, but I can't get it to put in account info... Can …

0
1
Member Avatar

I'm trying to merge cells of the same row and after researching i found this link: [url]http://codeguru.earthweb.com/java/articles/139.shtml[/url] I downloaded the files and tried using it but it didn't run because of an error I don't understand:S can anybody help??

Member Avatar
0
2
Member Avatar

i wanted to create a gui java program that reads info from MySql then output it in a JTable. but i first tried to use the JTable because it was my first time to use it. It worked perfectly but when i tried to read from the database it doesn't display the JTable although i don't read anydata from the database here is the code. the function IDs() when called the JTable don't appear. [code] import java.awt.Dimension; import java.sql.*; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; public final class MyFrame extends JFrame{ String[] columnNames; Object[][] data; public MyFrame() throws …

Member Avatar
0
10
Member Avatar

I'm trying to create my own JTable, with every row containing 5 check boxes meaning that I have 5 columns and I want them all to have check boxes When I try that the table goes blank and nothing appears at all, so I can only put 1 per row. 1 2 3 4 5 ---------------------------------------------------- I1 | CB | CB | CB | CB | CB I2 | CB | CB | CB | CB | CB I3 | CB | CB | CB | CB | CB I4 | CB | CB | CB | CB | CB …

Member Avatar
0
4
Member Avatar

I'm writing an application for processing scientific data. The data is displayed in a jTable. I'm done with the data processing itself, now I want to do some conditional formatting to make interpretation easier for the end user. [LIST=1] [*]The last column of the table contains a threshold value, and if the data in a particular cell is below the threshold at the end of the row the fond needs to be changed to a different color. [*]On top of that, if a value is below zero the background color of that cell needs to be changed. This rule applies …

Member Avatar
0
19
Member Avatar

Heya guys, I am trying to make a desktop application for my assignment. I have to design an application that will have a JTable, JTextField and Buttons. I am done the GUI part. The input that user enters into the table should get stored into the database using an "insert" button(using JDBC). I know how to connect to the database and how to insert stuff into it. But I do not understand how can i edit my table and after the table is edited. The database should update. Also, how can i send string objects(input from the JTextField) into the …

Member Avatar
0
10
Member Avatar

i'm trying to populate a JList, and i saw that this is how it supose to work [code] JTable tabel = new JTable(); tabel = new JTable(row, cols); while (it.hasNext() && it1.hasNext() && it2.hasNext() && it3.hasNext() && it4.hasNext()) { Object ob[][] = { { it.next(), it1.next(), it2.next(), it3.next(), it4.next() }} DefaultTableModel model = new DefaultTableModel(ob, col); tabel = new JTable(model); }[/code] i have 5 fields which are populated from 5 ArrayLists, the data comes from a MySql Database, in my database i have 5 contact the problem is that it populates my table only with the first contact. If i …

Member Avatar
0
5
Member Avatar

I'm using a JTable with a DefaultTableModel. I use the Load Button for populating the JTable. Anyway, the problem I have is with the Delete row button. (defaulttablemodel.removeRow). This is the whole project: [code=java] package proiect1; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumn; import java.io.*; import javax.swing.event.*; import javax.swing.table.TableModel; import java.util.ArrayList; import javax.swing.table.AbstractTableModel; public class tabel extends javax.swing.JFrame implements TableModelListener { DefaultTableModel model1; private static ArrayList<clasaIntrebare> listaIntrebari = new ArrayList<clasaIntrebare>(); private static int n; public tabel() { initComponents(); model1= new DefaultTableModel() { @Override public boolean isCellEditable(int row, int column) { if (column == 2 || column == 1 || column == 6) return …

Member Avatar
0
3
Member Avatar

Hello, I want to use a JTable for displaying data loaded from a .txt file. The problem is that I don't see any methods for inserting a row. The code NetBeans generates is this: [code=java] jScrollPane1 = new javax.swing.JScrollPane(); tabel = new javax.swing.JTable(); label1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); tabel.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "column1", "column2", "column3", "column4" } ) { Class[] types = new Class [] { java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class }; [/code] From …

Member Avatar
0
6
Member Avatar

Hey guys, im getting a null pointer exception... but i dont know what is wrong. Im trying to get data from a hashmap, and place it in a swing tabel. [CODE=java] ArrayList planes_array[] = null; //planes_array[0] = new ArrayList(); for(int i=0; i<planes.size(); i++) { ArrayList tmp_array = new ArrayList(); tmp_array.add("1"); tmp_array.add("asdfaf"); tmp_array.add("12"); planes_array[i]=null; <--- null pointer on this row planes_array[i]=tmp_array; }[/CODE] Do you guys know what the problem is? or do you need more info? (what info?) Thx

Member Avatar
0
22
Member Avatar

Hi, I am trying to add rows to different tables. I have found this code on the web. But this is only for one JTable. I have three tables in one JFrame. How will I modify this code to three different tables. Thanks for your help. [CODE] firstTable = new JTable(Liste.first, Liste.headingsFirst); secondTable = new JTable(Liste.second, Liste.headingsSecond); thirdTable = new JTable(Liste.third, Liste.headingsThird);[/CODE] [CODE]DefaultTableModel 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"}); // there are now 2 rows with 2 columns // Append a row …

0
1
Member Avatar

Hi what i am trying to do here is highlight a particular cell in a table using a custom cell renderer. And by the way this is my first cell renderer so i am really not sure what to do! ok now here is the renderer I have written and what I want it to do is highlight the cell at the 1st row of the column through which I call it. But it does not seem to do it, all it does is highlight all the rows in that column once I click a particular cell. Please help me …

Member Avatar
0
15
Member Avatar

Hi guys, First, many thanks for reading my post, happy to have found you! I have data(objects) that is stored in a hashmap, my goal is to store this data in a JTable, using a separate cell for each entry, rather than starting on a new column each time. I am creating my own table model (as I want it to detect the correct data type, and customize the data in certain ways). My Hashmap is being initialised and fed in my table model's class. My question is: is there a way I can somehow create a new JTable by …

Member Avatar
0
8
Member Avatar

Hi i am new bie to swings. if i have a JTable. And i want to add number of rows with different number of columns like Employee1, Software Developer, swings Employee2, software developer What is the way of adding rows having different number of columns to a JTable Thanks.

Member Avatar
0
2
Member Avatar

[CODE] public void setTableModel(List<Users> users) { eraseTableRows(); for (int i = 0; i < users.size(); i++) { Users u = users.get(i); tm.insertRow(i, new Object[] { stuff }); } } private void eraseTableRows() { for (int i = 0; i > tm.getRowCount(); i++) { tm.removeRow(i); } [/CODE] i've tried this and the setRowCount and none of these work Thanks in advance

Member Avatar
0
2

The End.