🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #12850

Re: ResultSet in jTable

#12850
From: Andreas Meyer
Date: Sun, 25 Oct 1998 00:00
67 lines
2522 bytes
Hi Dirk,

my feeling is that Pierre Latecoere has answered your question in this
group.
Locate the message "RE: problems with JTABLE". You can accompish this by
using Netscapes Search message facility, searching for the string
"problems". Then
just pick the reply from Pierre Latecoere. Below is what he wrote:

Best regards
Andreas Meyer

Hackenberg & Partner, A Renaissance Worldwide Company
EMail: am@hackenberg.de


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Hi,

Here is some code that could help you. This method binds a JTable with a
DataSet. A table header is attached to the table.
I have develooped a complete new bean. If you need it let me know.

Pierre
pml@urbanet.ch

 private void bindDataSet() {
  TableColumn column = null;
  if (dataSet != null)
   {
   pmTableModel dm = new pmTableModel(dataSet, this);

   //DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
   Table=new JTable(dm);
   Table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
   JTableHeader tH=new JTableHeader();
   tH=Table.getTableHeader();
   tH.setPreferredSize(new Dimension(1000, 15));
   tH.setAutoscrolls(true);
   tH.setVisible(true);
   tH.setResizingAllowed(true);
   try {
    for (int j = 0; j < dataSet.getColumnCount(); j++)
     {String t=dataSet.getColumn(j).getCaption();
      column=Table.getColumnModel().getColumn(j);
      column.setHeaderValue(t);
        formt(j);
     }//boucle j
   tH.setUpdateTableInRealTime(false);}
   catch (DataSetException e) {e.printStackTrace();}
   this.setColumnHeaderView(tH);
   this.getViewport().add(Table, null);
   }
  }
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Dirk Borkenhagen wrote:

> Hi,
>
> can someone tell me how I can put a ResultSet directly in a JTable?
> Or must I first create a TableModel or a Array to put the data in the
> JTable??
>
> Thanks for help
>
> Dirk
Technical Details
Message-ID: <3633141C.445DDA6E@hackenberg.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <70v0jj$2319@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,c7140ae55bda2556
X-Google-Attributes: gid111d45,public
From: Andreas Meyer <am@hackenberg.de>
Subject: Re: ResultSet in jTable
Date: 1998/10/25
Message-ID: <3633141C.445DDA6E@hackenberg.de>
X-Deja-AN: 404839260
Content-Transfer-Encoding: 7bit
References: <70v0jj$2319@forums.borland.com>
To: Dirk Borkenhagen <dborkenhagen@usa.net>
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing