JTable in Netrexx

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

Quique Britto
Hi,

I am trying to create a simple table using netrexx but keep receiving the
u/m msg, any help will be appreciated.

The constructor 'JTable(java.lang.String[],java.lang.String[]' cannot be
found in the class 'javax.swing.table'

heres the code of the program:

/* **************** */
/*    JTable Test  */
/* **************** */

import javax.swing.

class SimpleTableDemo extends JFrame
  properties inheritable
  -- general variables
  titles = String[3]
  data  = String[3]

  -- frame variables
  jt         = JTable()
  jp        = JPanel()
  sp        = JScrollPane()
  mainwindow = JFrame()


method SimpleTableDemo()
  -- create frame
  mainwindow = JFrame()

  -- set properties for mainwindow
  mainwindow.addWindowListener( CloseWindowAdapter() )

  -- set frame characteristics
  mainwindow.setTitle( "Simple Table Demo" )
  mainwindow.setSize( 400,400 )

  -- center frame
  d = mainwindow.getToolkit().getScreenSize()
  s = mainwindow.getSize()
  mainwindow.setLocation((d.width - s.width) % 2, (d.height - s.height) % 2
)

  -- create jpanel
  jp = JPanel()
  jp.setLayout( BorderLayout() )

  -- create column names
  titles[0] = "Column 1"
  titles[1] = "Column 2"
  titles[2] = "Column 3"

  -- create some data
  data[0] = "pepe"
  data[1] = "maite"
  data[2] = "maria jose"

  -- create out Table instance
  jt = JTable( data, titles )

  -- add table to scrollpane
  sp.add( jt )
  jp.add( sp, BorderLayout.CENTER )

  -- show window
  mainwindow.setVisible( 1 )
  mainwindow.setBackground( Color.black )

return


method main( args=String[] ) static
  -- this is the first method (procedure) to be executed
  args = args

  -- window decorations
  JFrame.setDefaultLookAndFeelDecorated( 0 )

  -- create a table instance
  SimpleTableDemo()

return

class SimpleTableDemo.CloseWindowAdapter dependent extends WindowAdapter
  method windowClosing( e = WindowEvent )
  exit 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20090726/aef2827a/attachment.html
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

Kermit Kiser
Looks like the constructor wants a 2D array for data - [rows,columns] or
some such.

On 7/26/2009 2:18 PM, Quique Britto wrote:

> Hi,
>
> I am trying to create a simple table using netrexx but keep receiving
> the u/m msg, any help will be appreciated.
>
> The constructor 'JTable(java.lang.String[],java.lang.String[]' cannot
> be found in the class 'javax.swing.table'
>
> heres the code of the program:
>
> /* **************** */
> /*    JTable Test  */
> /* **************** */
>
> import javax.swing.
>
> class SimpleTableDemo extends JFrame
>   properties inheritable
>   -- general variables
>   titles = String[3]
>   data  = String[3]
>  
>   -- frame variables
>   jt         = JTable()
>   jp        = JPanel()
>   sp        = JScrollPane()
>   mainwindow = JFrame()
>
>
> method SimpleTableDemo()
>   -- create frame
>   mainwindow = JFrame()
>  
>   -- set properties for mainwindow
>   mainwindow.addWindowListener( CloseWindowAdapter() )
>  
>   -- set frame characteristics
>   mainwindow.setTitle( "Simple Table Demo" )
>   mainwindow.setSize( 400,400 )
>  
>   -- center frame
>   d = mainwindow.getToolkit().getScreenSize()
>   s = mainwindow.getSize()
>   mainwindow.setLocation((d.width - s.width) % 2, (d.height -
> s.height) % 2 )
>
>   -- create jpanel
>   jp = JPanel()
>   jp.setLayout( BorderLayout() )
>  
>   -- create column names
>   titles[0] = "Column 1"
>   titles[1] = "Column 2"
>   titles[2] = "Column 3"
>  
>   -- create some data
>   data[0] = "pepe"
>   data[1] = "maite"
>   data[2] = "maria jose"
>  
>   -- create out Table instance
>   jt = JTable( data, titles )
>    
>   -- add table to scrollpane
>   sp.add( jt )
>   jp.add( sp, BorderLayout.CENTER )
>  
>   -- show window
>   mainwindow.setVisible( 1 )
>   mainwindow.setBackground( Color.black )
>  
> return
>
>
> method main( args=String[] ) static  
>   -- this is the first method (procedure) to be executed
>   args = args
>
>   -- window decorations
>   JFrame.setDefaultLookAndFeelDecorated( 0 )
>
>   -- create a table instance
>   SimpleTableDemo()
>  
> return
>
> class SimpleTableDemo.CloseWindowAdapter dependent extends WindowAdapter
>   method windowClosing( e = WindowEvent )    
>   exit 0
> ------------------------------------------------------------------------
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20090726/c4ba9d1b/attachment.html
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

rvjansen
In reply to this post by Quique Britto
Hi Quique,

this is because JTable does not have a constructor that accepts two  
String Arrays. Try to do this with two Vectors - if it does not work  
then let me know.

best regards,

Ren? Jansen.

On 26 jul 2009, at 23:18, Quique Britto wrote:

> Hi,
>
> I am trying to create a simple table using netrexx but keep  
> receiving the u/m msg, any help will be appreciated.
>
> The constructor 'JTable(java.lang.String[],java.lang.String[]'  
> cannot be found in the class 'javax.swing.table'
>
> heres the code of the program:
>
> /* **************** */
> /*    JTable Test  */
> /* **************** */
>
> import javax.swing.
>
> class SimpleTableDemo extends JFrame
>   properties inheritable
>   -- general variables
>   titles = String[3]
>   data  = String[3]
>
>   -- frame variables
>   jt         = JTable()
>   jp        = JPanel()
>   sp        = JScrollPane()
>   mainwindow = JFrame()
>
>
> method SimpleTableDemo()
>   -- create frame
>   mainwindow = JFrame()
>
>   -- set properties for mainwindow
>   mainwindow.addWindowListener( CloseWindowAdapter() )
>
>   -- set frame characteristics
>   mainwindow.setTitle( "Simple Table Demo" )
>   mainwindow.setSize( 400,400 )
>
>   -- center frame
>   d = mainwindow.getToolkit().getScreenSize()
>   s = mainwindow.getSize()
>   mainwindow.setLocation((d.width - s.width) % 2, (d.height -  
> s.height) % 2 )
>
>   -- create jpanel
>   jp = JPanel()
>   jp.setLayout( BorderLayout() )
>
>   -- create column names
>   titles[0] = "Column 1"
>   titles[1] = "Column 2"
>   titles[2] = "Column 3"
>
>   -- create some data
>   data[0] = "pepe"
>   data[1] = "maite"
>   data[2] = "maria jose"
>
>   -- create out Table instance
>   jt = JTable( data, titles )
>
>   -- add table to scrollpane
>   sp.add( jt )
>   jp.add( sp, BorderLayout.CENTER )
>
>   -- show window
>   mainwindow.setVisible( 1 )
>   mainwindow.setBackground( Color.black )
>
> return
>
>
> method main( args=String[] ) static
>   -- this is the first method (procedure) to be executed
>   args = args
>
>   -- window decorations
>   JFrame.setDefaultLookAndFeelDecorated( 0 )
>
>   -- create a table instance
>   SimpleTableDemo()
>
> return
>
> class SimpleTableDemo.CloseWindowAdapter dependent extends  
> WindowAdapter
>   method windowClosing( e = WindowEvent )
>   exit 0
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>


Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

britten /Quique Britto (SPAIN VAL Export Mngr AMX)
Thks Rene,

how are vectors declared in Netrexx?

 
Quique



-----Mensaje original-----
De: [hidden email] [mailto:[hidden email]] En nombre de Ren? Jansen
Enviado el: lunes, 27 de julio de 2009 11:12
Para: IBM Netrexx
Asunto: Re: [Ibm-netrexx] JTable in Netrexx

Hi Quique,

this is because JTable does not have a constructor that accepts two String Arrays. Try to do this with two Vectors - if it does not work then let me know.

best regards,

Ren? Jansen.

On 26 jul 2009, at 23:18, Quique Britto wrote:

> Hi,
>
> I am trying to create a simple table using netrexx but keep receiving
> the u/m msg, any help will be appreciated.
>
> The constructor 'JTable(java.lang.String[],java.lang.String[]'  
> cannot be found in the class 'javax.swing.table'
>
> heres the code of the program:
>
> /* **************** */
> /*    JTable Test  */
> /* **************** */
>
> import javax.swing.
>
> class SimpleTableDemo extends JFrame
>   properties inheritable
>   -- general variables
>   titles = String[3]
>   data  = String[3]
>
>   -- frame variables
>   jt         = JTable()
>   jp        = JPanel()
>   sp        = JScrollPane()
>   mainwindow = JFrame()
>
>
> method SimpleTableDemo()
>   -- create frame
>   mainwindow = JFrame()
>
>   -- set properties for mainwindow
>   mainwindow.addWindowListener( CloseWindowAdapter() )
>
>   -- set frame characteristics
>   mainwindow.setTitle( "Simple Table Demo" )
>   mainwindow.setSize( 400,400 )
>
>   -- center frame
>   d = mainwindow.getToolkit().getScreenSize()
>   s = mainwindow.getSize()
>   mainwindow.setLocation((d.width - s.width) % 2, (d.height -
> s.height) % 2 )
>
>   -- create jpanel
>   jp = JPanel()
>   jp.setLayout( BorderLayout() )
>
>   -- create column names
>   titles[0] = "Column 1"
>   titles[1] = "Column 2"
>   titles[2] = "Column 3"
>
>   -- create some data
>   data[0] = "pepe"
>   data[1] = "maite"
>   data[2] = "maria jose"
>
>   -- create out Table instance
>   jt = JTable( data, titles )
>
>   -- add table to scrollpane
>   sp.add( jt )
>   jp.add( sp, BorderLayout.CENTER )
>
>   -- show window
>   mainwindow.setVisible( 1 )
>   mainwindow.setBackground( Color.black )
>
> return
>
>
> method main( args=String[] ) static
>   -- this is the first method (procedure) to be executed
>   args = args
>
>   -- window decorations
>   JFrame.setDefaultLookAndFeelDecorated( 0 )
>
>   -- create a table instance
>   SimpleTableDemo()
>
> return
>
> class SimpleTableDemo.CloseWindowAdapter dependent extends
> WindowAdapter
>   method windowClosing( e = WindowEvent )
>   exit 0
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>


_______________________________________________
Ibm-netrexx mailing list
[hidden email]




DISCLAIMER:
En cumplimiento del art?culo 5 de la Ley Org?nica de Protecci?n de Datos 15/1999, le informamos que sus datos personales est?n incorporados a un fichero denominado clientes, con la ?nica finalidad de mantener relaciones profesionales. Si lo desea puede ejercer los derechos de acceso, rectificaci?n, cancelaci?n u oposici?n de sus datos personales dirigi?ndose a: COSCO IBERIA  S.A. -Responsable Protecci?n de Datos- calle Casanova, 2, 6? planta de Barcelona (08011).
Este mensaje y cualquier documento que lleve adjunto, es confidencial y destinado ?nicamente a la persona o entidad a quien ha sido enviado. Si Usted ha recibido este mensaje por error, le informamos que el contenido en el mismo es reservado y el uso no autorizado est? prohibido legalmente,por ello,por favor , le rogamos que nos lo notifique al e-mail: [hidden email] o al tel?fono 93 304 71 26
Si su e-mail no ha podido ser entregado al buz?n de su destinatario,  por favor reenv?elo a la direcci?n [hidden email]
If your mail could not be delivered correctly, please resend it to [hidden email]


Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

rvjansen
Hi Quique,

something like:

titles = Vector()
titles.add(String("Column 1"))
titles.add(String("Column 2"))

If you use String then it does not need to know the comparison  
operator for type Rexx.

best regards,

Ren?.


On 27 jul 2009, at 11:16, britten /Quique Britto (SPAIN VAL Export  
Mngr AMX) wrote:

> Thks Rene,
>
> how are vectors declared in Netrexx?
>
>
> Quique
>
>
>
> -----Mensaje original-----
> De: [hidden email] [mailto:[hidden email]
> ] En nombre de Ren? Jansen
> Enviado el: lunes, 27 de julio de 2009 11:12
> Para: IBM Netrexx
> Asunto: Re: [Ibm-netrexx] JTable in Netrexx
>
> Hi Quique,
>
> this is because JTable does not have a constructor that accepts two  
> String Arrays. Try to do this with two Vectors - if it does not work  
> then let me know.
>
> best regards,
>
> Ren? Jansen.
>
> On 26 jul 2009, at 23:18, Quique Britto wrote:
>
>> Hi,
>>
>> I am trying to create a simple table using netrexx but keep receiving
>> the u/m msg, any help will be appreciated.
>>
>> The constructor 'JTable(java.lang.String[],java.lang.String[]'
>> cannot be found in the class 'javax.swing.table'
>>
>> heres the code of the program:
>>
>> /* **************** */
>> /*    JTable Test  */
>> /* **************** */
>>
>> import javax.swing.
>>
>> class SimpleTableDemo extends JFrame
>>  properties inheritable
>>  -- general variables
>>  titles = String[3]
>>  data  = String[3]
>>
>>  -- frame variables
>>  jt         = JTable()
>>  jp        = JPanel()
>>  sp        = JScrollPane()
>>  mainwindow = JFrame()
>>
>>
>> method SimpleTableDemo()
>>  -- create frame
>>  mainwindow = JFrame()
>>
>>  -- set properties for mainwindow
>>  mainwindow.addWindowListener( CloseWindowAdapter() )
>>
>>  -- set frame characteristics
>>  mainwindow.setTitle( "Simple Table Demo" )
>>  mainwindow.setSize( 400,400 )
>>
>>  -- center frame
>>  d = mainwindow.getToolkit().getScreenSize()
>>  s = mainwindow.getSize()
>>  mainwindow.setLocation((d.width - s.width) % 2, (d.height -
>> s.height) % 2 )
>>
>>  -- create jpanel
>>  jp = JPanel()
>>  jp.setLayout( BorderLayout() )
>>
>>  -- create column names
>>  titles[0] = "Column 1"
>>  titles[1] = "Column 2"
>>  titles[2] = "Column 3"
>>
>>  -- create some data
>>  data[0] = "pepe"
>>  data[1] = "maite"
>>  data[2] = "maria jose"
>>
>>  -- create out Table instance
>>  jt = JTable( data, titles )
>>
>>  -- add table to scrollpane
>>  sp.add( jt )
>>  jp.add( sp, BorderLayout.CENTER )
>>
>>  -- show window
>>  mainwindow.setVisible( 1 )
>>  mainwindow.setBackground( Color.black )
>>
>> return
>>
>>
>> method main( args=String[] ) static
>>  -- this is the first method (procedure) to be executed
>>  args = args
>>
>>  -- window decorations
>>  JFrame.setDefaultLookAndFeelDecorated( 0 )
>>
>>  -- create a table instance
>>  SimpleTableDemo()
>>
>> return
>>
>> class SimpleTableDemo.CloseWindowAdapter dependent extends
>> WindowAdapter
>>  method windowClosing( e = WindowEvent )
>>  exit 0
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>>
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>
>
> DISCLAIMER:
> En cumplimiento del art?culo 5 de la Ley Org?nica de Protecci?n de  
> Datos 15/1999, le informamos que sus datos personales est?n  
> incorporados a un fichero denominado clientes, con la ?nica  
> finalidad de mantener relaciones profesionales. Si lo desea puede  
> ejercer los derechos de acceso, rectificaci?n, cancelaci?n u  
> oposici?n de sus datos personales dirigi?ndose a: COSCO IBERIA  S.A.  
> -Responsable Protecci?n de Datos- calle Casanova, 2, 6? planta de  
> Barcelona (08011).
> Este mensaje y cualquier documento que lleve adjunto, es  
> confidencial y destinado ?nicamente a la persona o entidad a quien  
> ha sido enviado. Si Usted ha recibido este mensaje por error, le  
> informamos que el contenido en el mismo es reservado y el uso no  
> autorizado est? prohibido legalmente,por ello,por favor , le rogamos  
> que nos lo notifique al e-mail: [hidden email] o al  
> tel?fono 93 304 71 26
> Si su e-mail no ha podido ser entregado al buz?n de su  
> destinatario,  por favor reenv?elo a la direcci?n [hidden email]
> If your mail could not be delivered correctly, please resend it to [hidden email]
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>


Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

Quique Britto
Hi Rene,

been trying but still can't get a simple JTable working. I have replaced the
arrays with vectors (see below) and all compiles ok but I received a
Class.CastException once program is run.

full error descpription=
Exception in thread "main" java.lang.Class.CastException: java.lang.String
cannot be cast to java.util.Vector


..
..
-- create column names
  titles = Vector()
  titles.add( String( "Column 1" ))
  titles.add( String( "Column 2" ))
  titles.add( String( "Column 3" ))

  -- create some data
  data = Vector()
  data.add( String( "pepe" ))
  data.add( String( "maite" ))
  data.add( String( "maria jose" ))

  -- create out Table instance
  dm = DefaultTableModel( data, titles )
  jt = JTable( dm )
..
..

also tried jt = JTable( data, titles ) but same error

Thks for any help provided.

Quique




2009/7/27 Ren? Jansen <[hidden email]>

> Hi Quique,
>
> something like:
>
> titles = Vector()
> titles.add(String("Column 1"))
> titles.add(String("Column 2"))
>
> If you use String then it does not need to know the comparison operator for
> type Rexx.
>
> best regards,
>
> Ren?.
>
>
>
> On 27 jul 2009, at 11:16, britten /Quique Britto (SPAIN VAL Export Mngr
> AMX) wrote:
>
>  Thks Rene,
>>
>> how are vectors declared in Netrexx?
>>
>>
>> Quique
>>
>>
>>
>> -----Mensaje original-----
>> De: [hidden email] [mailto:
>> [hidden email]] En nombre de Ren? Jansen
>> Enviado el: lunes, 27 de julio de 2009 11:12
>> Para: IBM Netrexx
>> Asunto: Re: [Ibm-netrexx] JTable in Netrexx
>>
>> Hi Quique,
>>
>> this is because JTable does not have a constructor that accepts two String
>> Arrays. Try to do this with two Vectors - if it does not work then let me
>> know.
>>
>> best regards,
>>
>> Ren? Jansen.
>>
>> On 26 jul 2009, at 23:18, Quique Britto wrote:
>>
>>  Hi,
>>>
>>> I am trying to create a simple table using netrexx but keep receiving
>>> the u/m msg, any help will be appreciated.
>>>
>>> The constructor 'JTable(java.lang.String[],java.lang.String[]'
>>> cannot be found in the class 'javax.swing.table'
>>>
>>> heres the code of the program:
>>>
>>> /* **************** */
>>> /*    JTable Test  */
>>> /* **************** */
>>>
>>> import javax.swing.
>>>
>>> class SimpleTableDemo extends JFrame
>>>  properties inheritable
>>>  -- general variables
>>>  titles = String[3]
>>>  data  = String[3]
>>>
>>>  -- frame variables
>>>  jt         = JTable()
>>>  jp        = JPanel()
>>>  sp        = JScrollPane()
>>>  mainwindow = JFrame()
>>>
>>>
>>> method SimpleTableDemo()
>>>  -- create frame
>>>  mainwindow = JFrame()
>>>
>>>  -- set properties for mainwindow
>>>  mainwindow.addWindowListener( CloseWindowAdapter() )
>>>
>>>  -- set frame characteristics
>>>  mainwindow.setTitle( "Simple Table Demo" )
>>>  mainwindow.setSize( 400,400 )
>>>
>>>  -- center frame
>>>  d = mainwindow.getToolkit().getScreenSize()
>>>  s = mainwindow.getSize()
>>>  mainwindow.setLocation((d.width - s.width) % 2, (d.height -
>>> s.height) % 2 )
>>>
>>>  -- create jpanel
>>>  jp = JPanel()
>>>  jp.setLayout( BorderLayout() )
>>>
>>>  -- create column names
>>>  titles[0] = "Column 1"
>>>  titles[1] = "Column 2"
>>>  titles[2] = "Column 3"
>>>
>>>  -- create some data
>>>  data[0] = "pepe"
>>>  data[1] = "maite"
>>>  data[2] = "maria jose"
>>>
>>>  -- create out Table instance
>>>  jt = JTable( data, titles )
>>>
>>>  -- add table to scrollpane
>>>  sp.add( jt )
>>>  jp.add( sp, BorderLayout.CENTER )
>>>
>>>  -- show window
>>>  mainwindow.setVisible( 1 )
>>>  mainwindow.setBackground( Color.black )
>>>
>>> return
>>>
>>>
>>> method main( args=String[] ) static
>>>  -- this is the first method (procedure) to be executed
>>>  args = args
>>>
>>>  -- window decorations
>>>  JFrame.setDefaultLookAndFeelDecorated( 0 )
>>>
>>>  -- create a table instance
>>>  SimpleTableDemo()
>>>
>>> return
>>>
>>> class SimpleTableDemo.CloseWindowAdapter dependent extends
>>> WindowAdapter
>>>  method windowClosing( e = WindowEvent )
>>>  exit 0
>>> _______________________________________________
>>> Ibm-netrexx mailing list
>>> [hidden email]
>>>
>>>
>>
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>>
>>
>>
>>
>> DISCLAIMER:
>> En cumplimiento del art?culo 5 de la Ley Org?nica de Protecci?n de Datos
>> 15/1999, le informamos que sus datos personales est?n incorporados a un
>> fichero denominado clientes, con la ?nica finalidad de mantener relaciones
>> profesionales. Si lo desea puede ejercer los derechos de acceso,
>> rectificaci?n, cancelaci?n u oposici?n de sus datos personales dirigi?ndose
>> a: COSCO IBERIA  S.A. -Responsable Protecci?n de Datos- calle Casanova, 2,
>> 6? planta de Barcelona (08011).
>> Este mensaje y cualquier documento que lleve adjunto, es confidencial y
>> destinado ?nicamente a la persona o entidad a quien ha sido enviado. Si
>> Usted ha recibido este mensaje por error, le informamos que el contenido en
>> el mismo es reservado y el uso no autorizado est? prohibido legalmente,por
>> ello,por favor , le rogamos que nos lo notifique al e-mail:
>> [hidden email] o al tel?fono 93 304 71 26
>> Si su e-mail no ha podido ser entregado al buz?n de su destinatario,  por
>> favor reenv?elo a la direcci?n [hidden email]
>> If your mail could not be delivered correctly, please resend it to
>> [hidden email]
>>
>>
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>>
>>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20090731/20229c73/attachment.html
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

Patrick Forhan
On Fri, Jul 31, 2009 at 2:22 PM, Quique Britto<[hidden email]> wrote:
> ? -- create some data
> ? data = Vector()
> ? data.add( String( "pepe" ))
> ? data.add( String( "maite" ))
> ? data.add( String( "maria jose" ))

data should not be a vector of Strings.  It needs to be a vector of
vectors of strings.  I'm not a netrexx person quite yet, but I'm very
much a JTable person.  Assuming the syntax you're using is correct,
try this:

   -- create some data
   row1 = Vector()
   row1.add( String( "pepe" ))
   row1.add( String( "maite" ))
   row1.add( String( "maria jose" ))

   row2 = Vector()
   row2.add( String( "pepe2" ))
   row2.add( String( "maite2" ))
   row2.add( String( "maria jose2" ))

   data = Vector()
   data.add(row1);
   data.add(row2);

Two things:  I'd be willing to bet that String("pepe") is equivalent
to Java's new String("pepe"), which is creating unnecessary String
objects.  Just use the quoted strings directly.

Also, if you are serious about making a TableModel, you will
ultimately be happier with doing the implementation yourself, rather
than using DefaultTableModel and its Vector of Vectors of generic
data.  When you write your own impl, or extend AbstractTableModel, you
can use real objects to represent the rows.

Pat.
--
Defy mediocrity.

Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

Quique Britto
thks,

will try this later tonight. i eventually will use AbstractTableModel but i
thought i needed to get the default working in netrexx before i go further.


Quique




2009/8/1 Patrick Forhan <[hidden email]>

> On Fri, Jul 31, 2009 at 2:22 PM, Quique Britto<[hidden email]> wrote:
> >   -- create some data
> >   data = Vector()
> >   data.add( String( "pepe" ))
> >   data.add( String( "maite" ))
> >   data.add( String( "maria jose" ))
>
> data should not be a vector of Strings.  It needs to be a vector of
> vectors of strings.  I'm not a netrexx person quite yet, but I'm very
> much a JTable person.  Assuming the syntax you're using is correct,
> try this:
>
>   -- create some data
>   row1 = Vector()
>   row1.add( String( "pepe" ))
>   row1.add( String( "maite" ))
>   row1.add( String( "maria jose" ))
>
>   row2 = Vector()
>   row2.add( String( "pepe2" ))
>   row2.add( String( "maite2" ))
>   row2.add( String( "maria jose2" ))
>
>   data = Vector()
>   data.add(row1);
>   data.add(row2);
>
> Two things:  I'd be willing to bet that String("pepe") is equivalent
> to Java's new String("pepe"), which is creating unnecessary String
> objects.  Just use the quoted strings directly.
>
> Also, if you are serious about making a TableModel, you will
> ultimately be happier with doing the implementation yourself, rather
> than using DefaultTableModel and its Vector of Vectors of generic
> data.  When you write your own impl, or extend AbstractTableModel, you
> can use real objects to represent the rows.
>
> Pat.
> --
> Defy mediocrity.
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20090801/90e693b5/attachment-0001.html
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

Quique Britto
In reply to this post by Patrick Forhan
ok, now with the below code all compiles ok and no exception errors at
runtime but only the frame is displayed. (no jtable)
any ideas?

import javax.swing.

class SimpleTableDemo extends JFrame
  properties inheritable
  -- general variables


  -- frame variables
  jt         = JTable()
  jp         = JPanel()
  sp         = JScrollPane()
  mainwindow = JFrame()


method SimpleTableDemo()
  -- create frame
  mainwindow = JFrame()

  -- set properties for mainwindow
  mainwindow.addWindowListener( CloseWindowAdapter() )

  -- set frame characteristics
  mainwindow.setTitle( "Simple Table Demo" )
  mainwindow.setSize( 400,400 )

  -- center frame
  d = mainwindow.getToolkit().getScreenSize()
  s = mainwindow.getSize()
  mainwindow.setLocation((d.width - s.width) % 2, (d.height - s.height) % 2
)

  -- create jpanel
  jp = JPanel()
  jp.setLayout( BorderLayout() )

  -- create column names
  titles = Vector()
  titles.add( String( "Column 1" ))
  titles.add( String( "Column 2" ))
  titles.add( String( "Column 3" ))

  -- create some data
  row1 = Vector()
  row1.add( "pepe" )
  row1.add( "maite" )
  row1.add( "maria jose" )

  row2 = Vector()
  row2.add( "pepe2" )
  row2.add( "maite2" )
  row2.add( "maria jose2" )

  row3 = Vector()
  row3.add( "pepe3" )
  row3.add( "maite3" )
  row3.add( "maria jose3" )

  data = Vector()
  data.add( row1 )
  data.add( row2 )
  data.add( row3 )

  -- create out Table instance
  jt = JTable( data, titles )

  -- add table to scrollpane
  sp.add( jt )
  jp.add( sp, BorderLayout.CENTER )

  -- show window
  mainwindow.setVisible( 1 )

return


method main( args=String[] ) static
  -- this is the first method (procedure) to be executed
  args = args

  -- window decorations
  JFrame.setDefaultLookAndFeelDecorated( 0 )

  -- create a table instance
  SimpleTableDemo()

return

class SimpleTableDemo.CloseWindowAdapter dependent extends WindowAdapter
  method windowClosing( e = WindowEvent )
  exit 0

thks
Quique



2009/8/1 Patrick Forhan <[hidden email]>

> On Fri, Jul 31, 2009 at 2:22 PM, Quique Britto<[hidden email]> wrote:
> >   -- create some data
> >   data = Vector()
> >   data.add( String( "pepe" ))
> >   data.add( String( "maite" ))
> >   data.add( String( "maria jose" ))
>
> data should not be a vector of Strings.  It needs to be a vector of
> vectors of strings.  I'm not a netrexx person quite yet, but I'm very
> much a JTable person.  Assuming the syntax you're using is correct,
> try this:
>
>   -- create some data
>   row1 = Vector()
>   row1.add( String( "pepe" ))
>   row1.add( String( "maite" ))
>   row1.add( String( "maria jose" ))
>
>   row2 = Vector()
>   row2.add( String( "pepe2" ))
>   row2.add( String( "maite2" ))
>   row2.add( String( "maria jose2" ))
>
>   data = Vector()
>   data.add(row1);
>   data.add(row2);
>
> Two things:  I'd be willing to bet that String("pepe") is equivalent
> to Java's new String("pepe"), which is creating unnecessary String
> objects.  Just use the quoted strings directly.
>
> Also, if you are serious about making a TableModel, you will
> ultimately be happier with doing the implementation yourself, rather
> than using DefaultTableModel and its Vector of Vectors of generic
> data.  When you write your own impl, or extend AbstractTableModel, you
> can use real objects to represent the rows.
>
> Pat.
> --
> Defy mediocrity.
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20090802/520a6a38/attachment.html
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

Patrick Forhan
On Sat, Aug 1, 2009 at 3:00 PM, Quique Britto<[hidden email]> wrote:
> ok, now with the below code all compiles ok and no exception errors at
> runtime but only the frame is displayed. (no jtable)
> any ideas?

It appears you aren't adding jp (the JPanel) to mainWindow (the JFrame).

--
Defy mediocrity.
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

Quique Britto
correct, just added i jp the mainwindor (jframe)t but still only jframe
appears. (no jtable)
changed to flwg.:


..
..
row1 = Vector()
row1.add( String("pepe") )
row1.add( String("maite") )
row1.add( String("maria jose") )

row2 = Vector()
row2.add( String("pepe2") )
row2.add( String("maite2") )
row2.add( String("maria jose2") )

row3 = Vector()
row3.add( String("pepe3" ) )
row3.add( String("maite3") )
row3.add( String("maria jose3" ) )

data = Vector()
data.add( row1 )
data.add( row2 )
data.add( row3 )


this is the java file generated a for the vectors.

..
..
jp=new javax.swing.JPanel();
jp.setLayout((java.awt.LayoutManager)(new java.awt.BorderLayout()));


titles=new java.util.Vector();
titles.add((java.lang.Object)(new java.lang.String("Column 1")));
titles.add((java.lang.Object)(new java.lang.String("Column 2")));
titles.add((java.lang.Object)(new java.lang.String("Column 3")));


row1=new java.util.Vector();
row1.add((java.lang.Object)(new java.lang.String("pepe")));
row1.add((java.lang.Object)(new java.lang.String("maite")));
row1.add((java.lang.Object)(new java.lang.String("maria jose")));

row2=new java.util.Vector();
row2.add((java.lang.Object)(new java.lang.String("pepe2")));
row2.add((java.lang.Object)(new java.lang.String("maite2")));
row2.add((java.lang.Object)(new java.lang.String("maria jose2")));

row3=new java.util.Vector();
row3.add((java.lang.Object)(new java.lang.String("pepe3")));
row3.add((java.lang.Object)(new java.lang.String("maite3")));
row3.add((java.lang.Object)(new java.lang.String("maria jose3")));
..
..

Quique



2009/8/2 Patrick Forhan <[hidden email]>

> On Sat, Aug 1, 2009 at 3:00 PM, Quique Britto<[hidden email]> wrote:
> > ok, now with the below code all compiles ok and no exception errors at
> > runtime but only the frame is displayed. (no jtable)
> > any ideas?
>
> It appears you aren't adding jp (the JPanel) to mainWindow (the JFrame).
>
> --
> Defy mediocrity.
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20090802/0a273bc6/attachment.html
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

measel
In reply to this post by Quique Britto
Quique, the Jpanel needs to be added to the content pane of the frame -
 
 this.setJmenuBar(menuBar)
 this.setTitle("Journal entries")
 this.setSize(1000,300)
 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
 c = this.getContentPane()
 c.setLayout(BorderLayout())
...
  topPanel = JPanel()
  topPanel.setSize(490, 290)
  bl = BorderLayout()
  topPanel.setLayout(bl)
  topPanel.setBackground(Color.green)
  c.add(topPanel)
 
 
 
Also, I fought with vectors and here's (not pretty) code that worked for me.  
 

colnames = String[7]
colnames[0] = 'Name'
colnames[1] = 'Date/Time'
colnames[2] = 'Hosts'
colnames[3] = 'Process'
colnames[4] = 'Agents'
colnames[5] = 'Metrics'
colnames[6] = 'Duration (min)'
...
aobj = Object[20,7]
...
 aobj[n,0] = aname
 aobj[n,1] = sname
 aobj[n,2] = hregx
 aobj[n,3] = pregx
 aobj[n,4] = aregx
 aobj[n,5] = mregx
 aobj[n,6] = durx
...
crumbTable = JTable(aobj, colnames)
crumbTable.getModel().addTableModelListener(this)
...
scrollPane = JScrollPane(crumbTable)
topPanel.add(scrollPane, BorderLayout.CENTER)
topPanel.add(btnSelect, BorderLayout.SOUTH)
setVisible(1)

 


________________________________

From: [hidden email] [mailto:[hidden email]] On Behalf Of Quique Britto
Sent: Friday, July 31, 2009 4:22 PM
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] JTable in Netrexx


Hi Rene,

been trying but still can't get a simple JTable working. I have replaced the arrays with vectors (see below) and all compiles ok but I received a Class.CastException once program is run.

full error descpription=
Exception in thread "main" java.lang.Class.CastException: java.lang.String cannot be cast to java.util.Vector


..
..
-- create column names
  titles = Vector()
  titles.add( String( "Column 1" ))
  titles.add( String( "Column 2" ))
  titles.add( String( "Column 3" ))
 
  -- create some data
  data = Vector()
  data.add( String( "pepe" ))
  data.add( String( "maite" ))
  data.add( String( "maria jose" ))
 
  -- create out Table instance
  dm = DefaultTableModel( data, titles )
  jt = JTable( dm )
..
..

also tried jt = JTable( data, titles ) but same error

Thks for any help provided.

Quique





2009/7/27 Ren? Jansen <[hidden email]>


        Hi Quique,
       
        something like:
       
        titles = Vector()
        titles.add(String("Column 1"))
        titles.add(String("Column 2"))
       
        If you use String then it does not need to know the comparison operator for type Rexx.
       
        best regards,
       
        Ren?.
       
       
       
        On 27 jul 2009, at 11:16, britten /Quique Britto (SPAIN VAL Export Mngr AMX) wrote:
       
       

                Thks Rene,
               
                how are vectors declared in Netrexx?
               
               
                Quique
               
               
               
                -----Mensaje original-----
                De: [hidden email] [mailto:[hidden email]] En nombre de Ren? Jansen
                Enviado el: lunes, 27 de julio de 2009 11:12
                Para: IBM Netrexx
                Asunto: Re: [Ibm-netrexx] JTable in Netrexx
               
                Hi Quique,
               
                this is because JTable does not have a constructor that accepts two String Arrays. Try to do this with two Vectors - if it does not work then let me know.
               
                best regards,
               
                Ren? Jansen.
               
                On 26 jul 2009, at 23:18, Quique Britto wrote:
               
               

                        Hi,
                       
                        I am trying to create a simple table using netrexx but keep receiving
                        the u/m msg, any help will be appreciated.
                       
                        The constructor 'JTable(java.lang.String[],java.lang.String[]'
                        cannot be found in the class 'javax.swing.table'
                       
                        heres the code of the program:
                       
                        /* **************** */
                        /*    JTable Test  */
                        /* **************** */
                       
                        import javax.swing.
                       
                        class SimpleTableDemo extends JFrame
                         properties inheritable
                         -- general variables
                         titles = String[3]
                         data  = String[3]
                       
                         -- frame variables
                         jt         = JTable()
                         jp        = JPanel()
                         sp        = JScrollPane()
                         mainwindow = JFrame()
                       
                       
                        method SimpleTableDemo()
                         -- create frame
                         mainwindow = JFrame()
                       
                         -- set properties for mainwindow
                         mainwindow.addWindowListener( CloseWindowAdapter() )
                       
                         -- set frame characteristics
                         mainwindow.setTitle( "Simple Table Demo" )
                         mainwindow.setSize( 400,400 )
                       
                         -- center frame
                         d = mainwindow.getToolkit().getScreenSize()
                         s = mainwindow.getSize()
                         mainwindow.setLocation((d.width - s.width) % 2, (d.height -
                        s.height) % 2 )
                       
                         -- create jpanel
                         jp = JPanel()
                         jp.setLayout( BorderLayout() )
                       
                         -- create column names
                         titles[0] = "Column 1"
                         titles[1] = "Column 2"
                         titles[2] = "Column 3"
                       
                         -- create some data
                         data[0] = "pepe"
                         data[1] = "maite"
                         data[2] = "maria jose"
                       
                         -- create out Table instance
                         jt = JTable( data, titles )
                       
                         -- add table to scrollpane
                         sp.add( jt )
                         jp.add( sp, BorderLayout.CENTER )
                       
                         -- show window
                         mainwindow.setVisible( 1 )
                         mainwindow.setBackground( Color.black )
                       
                        return
                       
                       
                        method main( args=String[] ) static
                         -- this is the first method (procedure) to be executed
                         args = args
                       
                         -- window decorations
                         JFrame.setDefaultLookAndFeelDecorated( 0 )
                       
                         -- create a table instance
                         SimpleTableDemo()
                       
                        return
                       
                        class SimpleTableDemo.CloseWindowAdapter dependent extends
                        WindowAdapter
                         method windowClosing( e = WindowEvent )
                         exit 0
                        _______________________________________________
                        Ibm-netrexx mailing list
                        [hidden email]
                       
                       



                _______________________________________________
                Ibm-netrexx mailing list
                [hidden email]
               
               
               
               
                DISCLAIMER:
                En cumplimiento del art?culo 5 de la Ley Org?nica de Protecci?n de Datos 15/1999, le informamos que sus datos personales est?n incorporados a un fichero denominado clientes, con la ?nica finalidad de mantener relaciones profesionales. Si lo desea puede ejercer los derechos de acceso, rectificaci?n, cancelaci?n u oposici?n de sus datos personales dirigi?ndose a: COSCO IBERIA  S.A. -Responsable Protecci?n de Datos- calle Casanova, 2, 6? planta de Barcelona (08011).
                Este mensaje y cualquier documento que lleve adjunto, es confidencial y destinado ?nicamente a la persona o entidad a quien ha sido enviado. Si Usted ha recibido este mensaje por error, le informamos que el contenido en el mismo es reservado y el uso no autorizado est? prohibido legalmente,por ello,por favor , le rogamos que nos lo notifique al e-mail: [hidden email] o al tel?fono 93 304 71 26
                Si su e-mail no ha podido ser entregado al buz?n de su destinatario,  por favor reenv?elo a la direcci?n [hidden email]
                If your mail could not be delivered correctly, please resend it to [hidden email]
               
               
                _______________________________________________
                Ibm-netrexx mailing list
                [hidden email]
               
               



        _______________________________________________
        Ibm-netrexx mailing list
        [hidden email]
       
       


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20090803/0675e174/attachment-0001.html
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

Quique Britto
Hi again,

I have tried all solutions given in this thread but still not working.
again, any help will be appreciated.

Quique




2009/8/3 Measel, Mike <[hidden email]>

>  Quique, the Jpanel needs to be added to the content pane of the frame -
>
>  this.setJmenuBar(menuBar)
>  this.setTitle("Journal entries")
>  this.setSize(1000,300)
>  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
>  c = this.getContentPane()
>  c.setLayout(BorderLayout())
> ...
>   topPanel = JPanel()
>   topPanel.setSize(490, 290)
>   bl = BorderLayout()
>   topPanel.setLayout(bl)
>   topPanel.setBackground(Color.green)
>   c.add(topPanel)
>
>
>
> Also, I fought with vectors and here's (not pretty) code that worked for
> me.
>
>
> colnames = String[7]
> colnames[0] = 'Name'
> colnames[1] = 'Date/Time'
> colnames[2] = 'Hosts'
> colnames[3] = 'Process'
> colnames[4] = 'Agents'
> colnames[5] = 'Metrics'
> colnames[6] = 'Duration (min)'
> ...
> aobj = Object[20,7]
> ...
>  aobj[n,0] = aname
>  aobj[n,1] = sname
>  aobj[n,2] = hregx
>  aobj[n,3] = pregx
>  aobj[n,4] = aregx
>  aobj[n,5] = mregx
>  aobj[n,6] = durx
> ...
> crumbTable = JTable(aobj, colnames)
> crumbTable.getModel().addTableModelListener(this)
> ...
> scrollPane = JScrollPane(crumbTable)
> topPanel.add(scrollPane, BorderLayout.CENTER)
> topPanel.add(btnSelect, BorderLayout.SOUTH)
> setVisible(1)
>
>
>
>  ------------------------------
> *From:* [hidden email] [mailto:
> [hidden email]] *On Behalf Of *Quique Britto
> *Sent:* Friday, July 31, 2009 4:22 PM
> *To:* IBM Netrexx
> *Subject:* Re: [Ibm-netrexx] JTable in Netrexx
>
> Hi Rene,
>
> been trying but still can't get a simple JTable working. I have replaced
> the arrays with vectors (see below) and all compiles ok but I received a
> Class.CastException once program is run.
>
> full error descpription=
> Exception in thread "main" java.lang.Class.CastException: java.lang.String
> cannot be cast to java.util.Vector
>
>
> ..
> ..
> -- create column names
>   titles = Vector()
>   titles.add( String( "Column 1" ))
>   titles.add( String( "Column 2" ))
>   titles.add( String( "Column 3" ))
>
>   -- create some data
>   data = Vector()
>   data.add( String( "pepe" ))
>   data.add( String( "maite" ))
>   data.add( String( "maria jose" ))
>
>   -- create out Table instance
>   dm = DefaultTableModel( data, titles )
>   jt = JTable( dm )
> ..
> ..
>
> also tried jt = JTable( data, titles ) but same error
>
> Thks for any help provided.
>
> Quique
>
>
>
>
> 2009/7/27 Ren? Jansen <[hidden email]>
>
>> Hi Quique,
>>
>> something like:
>>
>> titles = Vector()
>> titles.add(String("Column 1"))
>> titles.add(String("Column 2"))
>>
>> If you use String then it does not need to know the comparison operator
>> for type Rexx.
>>
>> best regards,
>>
>> Ren?.
>>
>>
>>
>> On 27 jul 2009, at 11:16, britten /Quique Britto (SPAIN VAL Export Mngr
>> AMX) wrote:
>>
>> Thks Rene,
>>>
>>> how are vectors declared in Netrexx?
>>>
>>>
>>> Quique
>>>
>>>
>>>
>>> -----Mensaje original-----
>>> De: [hidden email] [mailto:
>>> [hidden email]] En nombre de Ren? Jansen
>>> Enviado el: lunes, 27 de julio de 2009 11:12
>>> Para: IBM Netrexx
>>> Asunto: Re: [Ibm-netrexx] JTable in Netrexx
>>>
>>> Hi Quique,
>>>
>>> this is because JTable does not have a constructor that accepts two
>>> String Arrays. Try to do this with two Vectors - if it does not work then
>>> let me know.
>>>
>>> best regards,
>>>
>>> Ren? Jansen.
>>>
>>> On 26 jul 2009, at 23:18, Quique Britto wrote:
>>>
>>> Hi,
>>>>
>>>> I am trying to create a simple table using netrexx but keep receiving
>>>> the u/m msg, any help will be appreciated.
>>>>
>>>> The constructor 'JTable(java.lang.String[],java.lang.String[]'
>>>> cannot be found in the class 'javax.swing.table'
>>>>
>>>> heres the code of the program:
>>>>
>>>> /* **************** */
>>>> /*    JTable Test  */
>>>> /* **************** */
>>>>
>>>> import javax.swing.
>>>>
>>>> class SimpleTableDemo extends JFrame
>>>>  properties inheritable
>>>>  -- general variables
>>>>  titles = String[3]
>>>>  data  = String[3]
>>>>
>>>>  -- frame variables
>>>>  jt         = JTable()
>>>>  jp        = JPanel()
>>>>  sp        = JScrollPane()
>>>>  mainwindow = JFrame()
>>>>
>>>>
>>>> method SimpleTableDemo()
>>>>  -- create frame
>>>>  mainwindow = JFrame()
>>>>
>>>>  -- set properties for mainwindow
>>>>  mainwindow.addWindowListener( CloseWindowAdapter() )
>>>>
>>>>  -- set frame characteristics
>>>>  mainwindow.setTitle( "Simple Table Demo" )
>>>>  mainwindow.setSize( 400,400 )
>>>>
>>>>  -- center frame
>>>>  d = mainwindow.getToolkit().getScreenSize()
>>>>  s = mainwindow.getSize()
>>>>  mainwindow.setLocation((d.width - s.width) % 2, (d.height -
>>>> s.height) % 2 )
>>>>
>>>>  -- create jpanel
>>>>  jp = JPanel()
>>>>  jp.setLayout( BorderLayout() )
>>>>
>>>>  -- create column names
>>>>  titles[0] = "Column 1"
>>>>  titles[1] = "Column 2"
>>>>  titles[2] = "Column 3"
>>>>
>>>>  -- create some data
>>>>  data[0] = "pepe"
>>>>  data[1] = "maite"
>>>>  data[2] = "maria jose"
>>>>
>>>>  -- create out Table instance
>>>>  jt = JTable( data, titles )
>>>>
>>>>  -- add table to scrollpane
>>>>  sp.add( jt )
>>>>  jp.add( sp, BorderLayout.CENTER )
>>>>
>>>>  -- show window
>>>>  mainwindow.setVisible( 1 )
>>>>  mainwindow.setBackground( Color.black )
>>>>
>>>> return
>>>>
>>>>
>>>> method main( args=String[] ) static
>>>>  -- this is the first method (procedure) to be executed
>>>>  args = args
>>>>
>>>>  -- window decorations
>>>>  JFrame.setDefaultLookAndFeelDecorated( 0 )
>>>>
>>>>  -- create a table instance
>>>>  SimpleTableDemo()
>>>>
>>>> return
>>>>
>>>> class SimpleTableDemo.CloseWindowAdapter dependent extends
>>>> WindowAdapter
>>>>  method windowClosing( e = WindowEvent )
>>>>  exit 0
>>>> _______________________________________________
>>>> Ibm-netrexx mailing list
>>>> [hidden email]
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Ibm-netrexx mailing list
>>> [hidden email]
>>>
>>>
>>>
>>>
>>> DISCLAIMER:
>>> En cumplimiento del art?culo 5 de la Ley Org?nica de Protecci?n de Datos
>>> 15/1999, le informamos que sus datos personales est?n incorporados a un
>>> fichero denominado clientes, con la ?nica finalidad de mantener relaciones
>>> profesionales. Si lo desea puede ejercer los derechos de acceso,
>>> rectificaci?n, cancelaci?n u oposici?n de sus datos personales dirigi?ndose
>>> a: COSCO IBERIA  S.A. -Responsable Protecci?n de Datos- calle Casanova, 2,
>>> 6? planta de Barcelona (08011).
>>> Este mensaje y cualquier documento que lleve adjunto, es confidencial y
>>> destinado ?nicamente a la persona o entidad a quien ha sido enviado. Si
>>> Usted ha recibido este mensaje por error, le informamos que el contenido en
>>> el mismo es reservado y el uso no autorizado est? prohibido legalmente,por
>>> ello,por favor , le rogamos que nos lo notifique al e-mail:
>>> [hidden email] o al tel?fono 93 304 71 26
>>> Si su e-mail no ha podido ser entregado al buz?n de su destinatario,  por
>>> favor reenv?elo a la direcci?n [hidden email]
>>> If your mail could not be delivered correctly, please resend it to
>>> [hidden email]
>>>
>>>
>>> _______________________________________________
>>> Ibm-netrexx mailing list
>>> [hidden email]
>>>
>>>
>>
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>>
>>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20090804/7744162a/attachment-0001.html
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

measel
Please post the code as you have it now so we can take a peek.
 
Btw, have you tried trace all ?

________________________________

From: [hidden email] [mailto:[hidden email]] On Behalf Of Quique Britto
Sent: Tuesday, August 04, 2009 7:10 AM
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] JTable in Netrexx


Hi again,

I have tried all solutions given in this thread but still not working.
again, any help will be appreciated.

Quique





2009/8/3 Measel, Mike <[hidden email]>


        Quique, the Jpanel needs to be added to the content pane of the frame -
         
         this.setJmenuBar(menuBar)
         this.setTitle("Journal entries")
         this.setSize(1000,300)
         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
         c = this.getContentPane()
         c.setLayout(BorderLayout())
        ...
          topPanel = JPanel()
          topPanel.setSize(490, 290)
          bl = BorderLayout()
          topPanel.setLayout(bl)
          topPanel.setBackground(Color.green)
          c.add(topPanel)
         
         
         
        Also, I fought with vectors and here's (not pretty) code that worked for me.  
         
       

        colnames = String[7]
        colnames[0] = 'Name'
        colnames[1] = 'Date/Time'
        colnames[2] = 'Hosts'
        colnames[3] = 'Process'
        colnames[4] = 'Agents'
        colnames[5] = 'Metrics'
        colnames[6] = 'Duration (min)'
        ...
       
        aobj = Object[20,7]
        ...
         aobj[n,0] = aname
         aobj[n,1] = sname
         aobj[n,2] = hregx
         aobj[n,3] = pregx
         aobj[n,4] = aregx
         aobj[n,5] = mregx
         aobj[n,6] = durx
        ...
        crumbTable = JTable(aobj, colnames)
        crumbTable.getModel().addTableModelListener(this)
        ...
        scrollPane = JScrollPane(crumbTable)
        topPanel.add(scrollPane, BorderLayout.CENTER)
        topPanel.add(btnSelect, BorderLayout.SOUTH)
        setVisible(1)
       
         
       

________________________________

        From: [hidden email] [mailto:[hidden email]] On Behalf Of Quique Britto
        Sent: Friday, July 31, 2009 4:22 PM
        To: IBM Netrexx
        Subject: Re: [Ibm-netrexx] JTable in Netrexx
       
       
        Hi Rene,
       
        been trying but still can't get a simple JTable working. I have replaced the arrays with vectors (see below) and all compiles ok but I received a Class.CastException once program is run.
       
        full error descpription=
        Exception in thread "main" java.lang.Class.CastException: java.lang.String cannot be cast to java.util.Vector
       
       
        ..
        ..
        -- create column names
          titles = Vector()
          titles.add( String( "Column 1" ))
          titles.add( String( "Column 2" ))
          titles.add( String( "Column 3" ))
         
          -- create some data
          data = Vector()
          data.add( String( "pepe" ))
          data.add( String( "maite" ))
          data.add( String( "maria jose" ))
         
          -- create out Table instance
          dm = DefaultTableModel( data, titles )
          jt = JTable( dm )
        ..
        ..
       
        also tried jt = JTable( data, titles ) but same error
       
        Thks for any help provided.
       
        Quique
       
       
       
       
       
        2009/7/27 Ren? Jansen <[hidden email]>
       

                Hi Quique,
               
                something like:
               
                titles = Vector()
                titles.add(String("Column 1"))
                titles.add(String("Column 2"))
               
                If you use String then it does not need to know the comparison operator for type Rexx.
               
                best regards,
               
                Ren?.
               
               
               
                On 27 jul 2009, at 11:16, britten /Quique Britto (SPAIN VAL Export Mngr AMX) wrote:
               
               

                        Thks Rene,
                       
                        how are vectors declared in Netrexx?
                       
                       
                        Quique
                       
                       
                       
                        -----Mensaje original-----
                        De: [hidden email] [mailto:[hidden email]] En nombre de Ren? Jansen
                        Enviado el: lunes, 27 de julio de 2009 11:12
                        Para: IBM Netrexx
                        Asunto: Re: [Ibm-netrexx] JTable in Netrexx
                       
                        Hi Quique,
                       
                        this is because JTable does not have a constructor that accepts two String Arrays. Try to do this with two Vectors - if it does not work then let me know.
                       
                        best regards,
                       
                        Ren? Jansen.
                       
                        On 26 jul 2009, at 23:18, Quique Britto wrote:
                       
                       

                                Hi,
                               
                                I am trying to create a simple table using netrexx but keep receiving
                                the u/m msg, any help will be appreciated.
                               
                                The constructor 'JTable(java.lang.String[],java.lang.String[]'
                                cannot be found in the class 'javax.swing.table'
                               
                                heres the code of the program:
                               
                                /* **************** */
                                /*    JTable Test  */
                                /* **************** */
                               
                                import javax.swing.
                               
                                class SimpleTableDemo extends JFrame
                                 properties inheritable
                                 -- general variables
                                 titles = String[3]
                                 data  = String[3]
                               
                                 -- frame variables
                                 jt         = JTable()
                                 jp        = JPanel()
                                 sp        = JScrollPane()
                                 mainwindow = JFrame()
                               
                               
                                method SimpleTableDemo()
                                 -- create frame
                                 mainwindow = JFrame()
                               
                                 -- set properties for mainwindow
                                 mainwindow.addWindowListener( CloseWindowAdapter() )
                               
                                 -- set frame characteristics
                                 mainwindow.setTitle( "Simple Table Demo" )
                                 mainwindow.setSize( 400,400 )
                               
                                 -- center frame
                                 d = mainwindow.getToolkit().getScreenSize()
                                 s = mainwindow.getSize()
                                 mainwindow.setLocation((d.width - s.width) % 2, (d.height -
                                s.height) % 2 )
                               
                                 -- create jpanel
                                 jp = JPanel()
                                 jp.setLayout( BorderLayout() )
                               
                                 -- create column names
                                 titles[0] = "Column 1"
                                 titles[1] = "Column 2"
                                 titles[2] = "Column 3"
                               
                                 -- create some data
                                 data[0] = "pepe"
                                 data[1] = "maite"
                                 data[2] = "maria jose"
                               
                                 -- create out Table instance
                                 jt = JTable( data, titles )
                               
                                 -- add table to scrollpane
                                 sp.add( jt )
                                 jp.add( sp, BorderLayout.CENTER )
                               
                                 -- show window
                                 mainwindow.setVisible( 1 )
                                 mainwindow.setBackground( Color.black )
                               
                                return
                               
                               
                                method main( args=String[] ) static
                                 -- this is the first method (procedure) to be executed
                                 args = args
                               
                                 -- window decorations
                                 JFrame.setDefaultLookAndFeelDecorated( 0 )
                               
                                 -- create a table instance
                                 SimpleTableDemo()
                               
                                return
                               
                                class SimpleTableDemo.CloseWindowAdapter dependent extends
                                WindowAdapter
                                 method windowClosing( e = WindowEvent )
                                 exit 0
                                _______________________________________________
                                Ibm-netrexx mailing list
                                [hidden email]
                               
                               



                        _______________________________________________
                        Ibm-netrexx mailing list
                        [hidden email]
                       
                       
                       
                       
                        DISCLAIMER:
                        En cumplimiento del art?culo 5 de la Ley Org?nica de Protecci?n de Datos 15/1999, le informamos que sus datos personales est?n incorporados a un fichero denominado clientes, con la ?nica finalidad de mantener relaciones profesionales. Si lo desea puede ejercer los derechos de acceso, rectificaci?n, cancelaci?n u oposici?n de sus datos personales dirigi?ndose a: COSCO IBERIA  S.A. -Responsable Protecci?n de Datos- calle Casanova, 2, 6? planta de Barcelona (08011).
                        Este mensaje y cualquier documento que lleve adjunto, es confidencial y destinado ?nicamente a la persona o entidad a quien ha sido enviado. Si Usted ha recibido este mensaje por error, le informamos que el contenido en el mismo es reservado y el uso no autorizado est? prohibido legalmente,por ello,por favor , le rogamos que nos lo notifique al e-mail: [hidden email] o al tel?fono 93 304 71 26
                        Si su e-mail no ha podido ser entregado al buz?n de su destinatario,  por favor reenv?elo a la direcci?n [hidden email]
                        If your mail could not be delivered correctly, please resend it to [hidden email]
                       
                       
                        _______________________________________________
                        Ibm-netrexx mailing list
                        [hidden email]
                       
                       



                _______________________________________________
                Ibm-netrexx mailing list
                [hidden email]
               
               



        _______________________________________________
        Ibm-netrexx mailing list
        [hidden email]
       
       
       


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20090804/7fd7c6a2/attachment.html
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

Quique Britto
I am currently writing a "how to to use Swing componets in Netrexx",
something similar to the chapter in the IBM redbook but upto date and
working examples of all current Swing componets.
Most are not complicated to use but there are some like the Jtable in which
I need help. The idea is to have two working examples, one using the
defaulttablemodel and the other (see below code) extending the
abstracttablemodel.


/* **************** */
/*    JTable Test  */
/* **************** */

import javax.swing.

class SimpleTableDemo extends JFrame
  properties inheritable
  -- general variables


  -- frame variables
  jt         = JTable()
  jp         = JPanel()
 sp         = JScrollPane()
  mainwindow = JFrame()


method SimpleTableDemo()
  -- create frame
  mainwindow = JFrame()

  -- set properties for mainwindow
  mainwindow.addWindowListener( CloseWindowAdapter() )

  -- set frame characteristics
  mainwindow.setTitle( "Simple Table Demo" )
  mainwindow.setSize( 800,400 )

  -- center frame
  d = mainwindow.getToolkit().getScreenSize()
  s = mainwindow.getSize()
  mainwindow.setLocation((d.width - s.width) % 2, (d.height - s.height) % 2
)

  -- create out Table instance
  fm = FileModel()
  jt = JTable( fm )

  -- create jscrollpane
  sp = JScrollPane( jt )

  -- add scrollpane to the mainwindow
  mainwindow.getContentPane().add( sp, BorderLayout.CENTER )

  -- show window
  mainwindow.setVisible( 1 )

return


method main( args=String[] ) static
  -- this is the first method (procedure) to be executed
  args = args

  -- window decorations
  JFrame.setDefaultLookAndFeelDecorated( 0 )

  -- create a table instance
  SimpleTableDemo()

return

class SimpleTableDemo.CloseWindowAdapter dependent extends WindowAdapter
  method windowClosing( e = WindowEvent )
  exit 0

class FileModel extends AbstractTableModel
  properties inheritable
  -- general variables
  titles = Vector()
  row1 = Vector(0
  row2 = Vector()
  data   = Vector()


  method FileModel()
  -- create column headers
  titles = Vector()
  titles.add( String( "Column 1" ))
  titles.add( String( "Column 2" ))

  -- create some data
  row1 = Vector()
  row1.add( String( "pepe" ))
  row1.add( String( "pepe2" ))

  row2 = Vector()
  row2.add( String( "javi" ))
  row2.add( String( "jave2" ))

  data = Vector()
  data.add( Vector( row1 ) )
  data.add( Vector( row2 ) )

return

method getRowCount() returns int
return data.Size()

method getColumnCount() returns int
return titles.Size()

method getValueAt( r = int, c = int) returns java.lang.Object
return data[ r,c ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> THIS PRODUCES AN ERROR
WHILE COMPILING



again, any help is appreciated.
Quique




2009/8/4 Measel, Mike <[hidden email]>

>  Please post the code as you have it now so we can take a peek.
>
> Btw, have you tried trace all ?
>
>  ------------------------------
> *From:* [hidden email] [mailto:
> [hidden email]] *On Behalf Of *Quique Britto
> *Sent:* Tuesday, August 04, 2009 7:10 AM
>
> *To:* IBM Netrexx
> *Subject:* Re: [Ibm-netrexx] JTable in Netrexx
>
> Hi again,
>
> I have tried all solutions given in this thread but still not working.
> again, any help will be appreciated.
>
> Quique
>
>
>
>
> 2009/8/3 Measel, Mike <[hidden email]>
>
>>  Quique, the Jpanel needs to be added to the content pane of the frame -
>>
>>  this.setJmenuBar(menuBar)
>>  this.setTitle("Journal entries")
>>  this.setSize(1000,300)
>>  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
>>  c = this.getContentPane()
>>  c.setLayout(BorderLayout())
>> ...
>>   topPanel = JPanel()
>>   topPanel.setSize(490, 290)
>>   bl = BorderLayout()
>>   topPanel.setLayout(bl)
>>   topPanel.setBackground(Color.green)
>>   c.add(topPanel)
>>
>>
>>
>> Also, I fought with vectors and here's (not pretty) code that worked for
>> me.
>>
>>
>> colnames = String[7]
>> colnames[0] = 'Name'
>> colnames[1] = 'Date/Time'
>> colnames[2] = 'Hosts'
>> colnames[3] = 'Process'
>> colnames[4] = 'Agents'
>> colnames[5] = 'Metrics'
>> colnames[6] = 'Duration (min)'
>> ...
>> aobj = Object[20,7]
>> ...
>>  aobj[n,0] = aname
>>  aobj[n,1] = sname
>>  aobj[n,2] = hregx
>>  aobj[n,3] = pregx
>>  aobj[n,4] = aregx
>>  aobj[n,5] = mregx
>>  aobj[n,6] = durx
>> ...
>> crumbTable = JTable(aobj, colnames)
>> crumbTable.getModel().addTableModelListener(this)
>> ...
>> scrollPane = JScrollPane(crumbTable)
>> topPanel.add(scrollPane, BorderLayout.CENTER)
>> topPanel.add(btnSelect, BorderLayout.SOUTH)
>> setVisible(1)
>>
>>
>>
>>  ------------------------------
>> *From:* [hidden email] [mailto:
>> [hidden email]] *On Behalf Of *Quique Britto
>> *Sent:* Friday, July 31, 2009 4:22 PM
>> *To:* IBM Netrexx
>> *Subject:* Re: [Ibm-netrexx] JTable in Netrexx
>>
>>   Hi Rene,
>>
>> been trying but still can't get a simple JTable working. I have replaced
>> the arrays with vectors (see below) and all compiles ok but I received a
>> Class.CastException once program is run.
>>
>> full error descpription=
>> Exception in thread "main" java.lang.Class.CastException: java.lang.String
>> cannot be cast to java.util.Vector
>>
>>
>> ..
>> ..
>> -- create column names
>>   titles = Vector()
>>   titles.add( String( "Column 1" ))
>>   titles.add( String( "Column 2" ))
>>   titles.add( String( "Column 3" ))
>>
>>   -- create some data
>>   data = Vector()
>>   data.add( String( "pepe" ))
>>   data.add( String( "maite" ))
>>   data.add( String( "maria jose" ))
>>
>>   -- create out Table instance
>>   dm = DefaultTableModel( data, titles )
>>   jt = JTable( dm )
>> ..
>> ..
>>
>> also tried jt = JTable( data, titles ) but same error
>>
>> Thks for any help provided.
>>
>> Quique
>>
>>
>>
>>
>> 2009/7/27 Ren? Jansen <[hidden email]>
>>
>>> Hi Quique,
>>>
>>> something like:
>>>
>>> titles = Vector()
>>> titles.add(String("Column 1"))
>>> titles.add(String("Column 2"))
>>>
>>> If you use String then it does not need to know the comparison operator
>>> for type Rexx.
>>>
>>> best regards,
>>>
>>> Ren?.
>>>
>>>
>>>
>>> On 27 jul 2009, at 11:16, britten /Quique Britto (SPAIN VAL Export Mngr
>>> AMX) wrote:
>>>
>>> Thks Rene,
>>>>
>>>> how are vectors declared in Netrexx?
>>>>
>>>>
>>>> Quique
>>>>
>>>>
>>>>
>>>> -----Mensaje original-----
>>>> De: [hidden email] [mailto:
>>>> [hidden email]] En nombre de Ren? Jansen
>>>> Enviado el: lunes, 27 de julio de 2009 11:12
>>>> Para: IBM Netrexx
>>>> Asunto: Re: [Ibm-netrexx] JTable in Netrexx
>>>>
>>>> Hi Quique,
>>>>
>>>> this is because JTable does not have a constructor that accepts two
>>>> String Arrays. Try to do this with two Vectors - if it does not work then
>>>> let me know.
>>>>
>>>> best regards,
>>>>
>>>> Ren? Jansen.
>>>>
>>>> On 26 jul 2009, at 23:18, Quique Britto wrote:
>>>>
>>>> Hi,
>>>>>
>>>>> I am trying to create a simple table using netrexx but keep receiving
>>>>> the u/m msg, any help will be appreciated.
>>>>>
>>>>> The constructor 'JTable(java.lang.String[],java.lang.String[]'
>>>>> cannot be found in the class 'javax.swing.table'
>>>>>
>>>>> heres the code of the program:
>>>>>
>>>>> /* **************** */
>>>>> /*    JTable Test  */
>>>>> /* **************** */
>>>>>
>>>>> import javax.swing.
>>>>>
>>>>> class SimpleTableDemo extends JFrame
>>>>>  properties inheritable
>>>>>  -- general variables
>>>>>  titles = String[3]
>>>>>  data  = String[3]
>>>>>
>>>>>  -- frame variables
>>>>>  jt         = JTable()
>>>>>  jp        = JPanel()
>>>>>  sp        = JScrollPane()
>>>>>  mainwindow = JFrame()
>>>>>
>>>>>
>>>>> method SimpleTableDemo()
>>>>>  -- create frame
>>>>>  mainwindow = JFrame()
>>>>>
>>>>>  -- set properties for mainwindow
>>>>>  mainwindow.addWindowListener( CloseWindowAdapter() )
>>>>>
>>>>>  -- set frame characteristics
>>>>>  mainwindow.setTitle( "Simple Table Demo" )
>>>>>  mainwindow.setSize( 400,400 )
>>>>>
>>>>>  -- center frame
>>>>>  d = mainwindow.getToolkit().getScreenSize()
>>>>>  s = mainwindow.getSize()
>>>>>  mainwindow.setLocation((d.width - s.width) % 2, (d.height -
>>>>> s.height) % 2 )
>>>>>
>>>>>  -- create jpanel
>>>>>  jp = JPanel()
>>>>>  jp.setLayout( BorderLayout() )
>>>>>
>>>>>  -- create column names
>>>>>  titles[0] = "Column 1"
>>>>>  titles[1] = "Column 2"
>>>>>  titles[2] = "Column 3"
>>>>>
>>>>>  -- create some data
>>>>>  data[0] = "pepe"
>>>>>  data[1] = "maite"
>>>>>  data[2] = "maria jose"
>>>>>
>>>>>  -- create out Table instance
>>>>>  jt = JTable( data, titles )
>>>>>
>>>>>  -- add table to scrollpane
>>>>>  sp.add( jt )
>>>>>  jp.add( sp, BorderLayout.CENTER )
>>>>>
>>>>>  -- show window
>>>>>  mainwindow.setVisible( 1 )
>>>>>  mainwindow.setBackground( Color.black )
>>>>>
>>>>> return
>>>>>
>>>>>
>>>>> method main( args=String[] ) static
>>>>>  -- this is the first method (procedure) to be executed
>>>>>  args = args
>>>>>
>>>>>  -- window decorations
>>>>>  JFrame.setDefaultLookAndFeelDecorated( 0 )
>>>>>
>>>>>  -- create a table instance
>>>>>  SimpleTableDemo()
>>>>>
>>>>> return
>>>>>
>>>>> class SimpleTableDemo.CloseWindowAdapter dependent extends
>>>>> WindowAdapter
>>>>>  method windowClosing( e = WindowEvent )
>>>>>  exit 0
>>>>> _______________________________________________
>>>>> Ibm-netrexx mailing list
>>>>> [hidden email]
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Ibm-netrexx mailing list
>>>> [hidden email]
>>>>
>>>>
>>>>
>>>>
>>>> DISCLAIMER:
>>>> En cumplimiento del art?culo 5 de la Ley Org?nica de Protecci?n de Datos
>>>> 15/1999, le informamos que sus datos personales est?n incorporados a un
>>>> fichero denominado clientes, con la ?nica finalidad de mantener relaciones
>>>> profesionales. Si lo desea puede ejercer los derechos de acceso,
>>>> rectificaci?n, cancelaci?n u oposici?n de sus datos personales dirigi?ndose
>>>> a: COSCO IBERIA  S.A. -Responsable Protecci?n de Datos- calle Casanova, 2,
>>>> 6? planta de Barcelona (08011).
>>>> Este mensaje y cualquier documento que lleve adjunto, es confidencial y
>>>> destinado ?nicamente a la persona o entidad a quien ha sido enviado. Si
>>>> Usted ha recibido este mensaje por error, le informamos que el contenido en
>>>> el mismo es reservado y el uso no autorizado est? prohibido legalmente,por
>>>> ello,por favor , le rogamos que nos lo notifique al e-mail:
>>>> [hidden email] o al tel?fono 93 304 71 26
>>>> Si su e-mail no ha podido ser entregado al buz?n de su destinatario,
>>>>  por favor reenv?elo a la direcci?n [hidden email]
>>>> If your mail could not be delivered correctly, please resend it to
>>>> [hidden email]
>>>>
>>>>
>>>> _______________________________________________
>>>> Ibm-netrexx mailing list
>>>> [hidden email]
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Ibm-netrexx mailing list
>>> [hidden email]
>>>
>>>
>>
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>>
>>
>>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20090804/5f7f790b/attachment-0001.html
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

Quique Britto
the DefaultTableModel example now works, here how I eventually got it
working.
thanks to all.

..
..
-- create column headers
  titles = Vector()
  titles.add( String( "Column 1" ))
  titles.add( String( "Column 2" ))

  -- create some data
  row1 = Vector()
  row1.add( String( "pepe" ))
  row1.add( String( "pepe2" ))

  row2 = Vector()
  row2.add( String( "javi" ))
  row2.add( String( "jave2" ))

  data = Vector()
  data.add( Vector( row1 ) )
  data.add( Vector( row2 ) )

  -- create out Table instance
  jt = JTable( data, titles )
..
..



2009/8/4 Quique Britto <[hidden email]>

> I am currently writing a "how to to use Swing componets in Netrexx",
> something similar to the chapter in the IBM redbook but upto date and
> working examples of all current Swing componets.
> Most are not complicated to use but there are some like the Jtable in which
> I need help. The idea is to have two working examples, one using the
> defaulttablemodel and the other (see below code) extending the
> abstracttablemodel.
>
>
> /* **************** */
> /*    JTable Test  */
> /* **************** */
>
> import javax.swing.
>
> class SimpleTableDemo extends JFrame
>   properties inheritable
>   -- general variables
>
>
>   -- frame variables
>   jt         = JTable()
>   jp         = JPanel()
>  sp         = JScrollPane()
>   mainwindow = JFrame()
>
>
> method SimpleTableDemo()
>   -- create frame
>   mainwindow = JFrame()
>
>   -- set properties for mainwindow
>   mainwindow.addWindowListener( CloseWindowAdapter() )
>
>   -- set frame characteristics
>   mainwindow.setTitle( "Simple Table Demo" )
>   mainwindow.setSize( 800,400 )
>
>   -- center frame
>   d = mainwindow.getToolkit().getScreenSize()
>   s = mainwindow.getSize()
>   mainwindow.setLocation((d.width - s.width) % 2, (d.height - s.height) % 2
> )
>
>   -- create out Table instance
>   fm = FileModel()
>   jt = JTable( fm )
>
>   -- create jscrollpane
>   sp = JScrollPane( jt )
>
>   -- add scrollpane to the mainwindow
>   mainwindow.getContentPane().add( sp, BorderLayout.CENTER )
>
>   -- show window
>   mainwindow.setVisible( 1 )
>
> return
>
>
> method main( args=String[] ) static
>   -- this is the first method (procedure) to be executed
>   args = args
>
>   -- window decorations
>   JFrame.setDefaultLookAndFeelDecorated( 0 )
>
>   -- create a table instance
>   SimpleTableDemo()
>
> return
>
> class SimpleTableDemo.CloseWindowAdapter dependent extends WindowAdapter
>   method windowClosing( e = WindowEvent )
>   exit 0
>
> class FileModel extends AbstractTableModel
>   properties inheritable
>   -- general variables
>   titles = Vector()
>   row1 = Vector(0
>   row2 = Vector()
>   data   = Vector()
>
>
>   method FileModel()
>   -- create column headers
>   titles = Vector()
>   titles.add( String( "Column 1" ))
>   titles.add( String( "Column 2" ))
>
>   -- create some data
>   row1 = Vector()
>   row1.add( String( "pepe" ))
>   row1.add( String( "pepe2" ))
>
>   row2 = Vector()
>   row2.add( String( "javi" ))
>   row2.add( String( "jave2" ))
>
>   data = Vector()
>   data.add( Vector( row1 ) )
>   data.add( Vector( row2 ) )
>
> return
>
> method getRowCount() returns int
> return data.Size()
>
> method getColumnCount() returns int
> return titles.Size()
>
> method getValueAt( r = int, c = int) returns java.lang.Object
> return data[ r,c ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> THIS PRODUCES AN ERROR
> WHILE COMPILING
>
>
>
> again, any help is appreciated.
> Quique
>
>
>
>
> 2009/8/4 Measel, Mike <[hidden email]>
>
>  Please post the code as you have it now so we can take a peek.
>>
>> Btw, have you tried trace all ?
>>
>>  ------------------------------
>> *From:* [hidden email] [mailto:
>> [hidden email]] *On Behalf Of *Quique Britto
>> *Sent:* Tuesday, August 04, 2009 7:10 AM
>>
>> *To:* IBM Netrexx
>> *Subject:* Re: [Ibm-netrexx] JTable in Netrexx
>>
>> Hi again,
>>
>> I have tried all solutions given in this thread but still not working.
>> again, any help will be appreciated.
>>
>> Quique
>>
>>
>>
>>
>> 2009/8/3 Measel, Mike <[hidden email]>
>>
>>>  Quique, the Jpanel needs to be added to the content pane of the frame -
>>>
>>>
>>>  this.setJmenuBar(menuBar)
>>>  this.setTitle("Journal entries")
>>>  this.setSize(1000,300)
>>>  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
>>>  c = this.getContentPane()
>>>  c.setLayout(BorderLayout())
>>> ...
>>>   topPanel = JPanel()
>>>   topPanel.setSize(490, 290)
>>>   bl = BorderLayout()
>>>   topPanel.setLayout(bl)
>>>   topPanel.setBackground(Color.green)
>>>   c.add(topPanel)
>>>
>>>
>>>
>>> Also, I fought with vectors and here's (not pretty) code that worked for
>>> me.
>>>
>>>
>>> colnames = String[7]
>>> colnames[0] = 'Name'
>>> colnames[1] = 'Date/Time'
>>> colnames[2] = 'Hosts'
>>> colnames[3] = 'Process'
>>> colnames[4] = 'Agents'
>>> colnames[5] = 'Metrics'
>>> colnames[6] = 'Duration (min)'
>>> ...
>>> aobj = Object[20,7]
>>> ...
>>>  aobj[n,0] = aname
>>>  aobj[n,1] = sname
>>>  aobj[n,2] = hregx
>>>  aobj[n,3] = pregx
>>>  aobj[n,4] = aregx
>>>  aobj[n,5] = mregx
>>>  aobj[n,6] = durx
>>> ...
>>> crumbTable = JTable(aobj, colnames)
>>> crumbTable.getModel().addTableModelListener(this)
>>> ...
>>> scrollPane = JScrollPane(crumbTable)
>>> topPanel.add(scrollPane, BorderLayout.CENTER)
>>> topPanel.add(btnSelect, BorderLayout.SOUTH)
>>> setVisible(1)
>>>
>>>
>>>
>>>  ------------------------------
>>> *From:* [hidden email] [mailto:
>>> [hidden email]] *On Behalf Of *Quique Britto
>>> *Sent:* Friday, July 31, 2009 4:22 PM
>>> *To:* IBM Netrexx
>>> *Subject:* Re: [Ibm-netrexx] JTable in Netrexx
>>>
>>>   Hi Rene,
>>>
>>> been trying but still can't get a simple JTable working. I have replaced
>>> the arrays with vectors (see below) and all compiles ok but I received a
>>> Class.CastException once program is run.
>>>
>>> full error descpription=
>>> Exception in thread "main" java.lang.Class.CastException:
>>> java.lang.String cannot be cast to java.util.Vector
>>>
>>>
>>> ..
>>> ..
>>> -- create column names
>>>   titles = Vector()
>>>   titles.add( String( "Column 1" ))
>>>   titles.add( String( "Column 2" ))
>>>   titles.add( String( "Column 3" ))
>>>
>>>   -- create some data
>>>   data = Vector()
>>>   data.add( String( "pepe" ))
>>>   data.add( String( "maite" ))
>>>   data.add( String( "maria jose" ))
>>>
>>>   -- create out Table instance
>>>   dm = DefaultTableModel( data, titles )
>>>   jt = JTable( dm )
>>> ..
>>> ..
>>>
>>> also tried jt = JTable( data, titles ) but same error
>>>
>>> Thks for any help provided.
>>>
>>> Quique
>>>
>>>
>>>
>>>
>>> 2009/7/27 Ren? Jansen <[hidden email]>
>>>
>>>> Hi Quique,
>>>>
>>>> something like:
>>>>
>>>> titles = Vector()
>>>> titles.add(String("Column 1"))
>>>> titles.add(String("Column 2"))
>>>>
>>>> If you use String then it does not need to know the comparison operator
>>>> for type Rexx.
>>>>
>>>> best regards,
>>>>
>>>> Ren?.
>>>>
>>>>
>>>>
>>>> On 27 jul 2009, at 11:16, britten /Quique Britto (SPAIN VAL Export Mngr
>>>> AMX) wrote:
>>>>
>>>> Thks Rene,
>>>>>
>>>>> how are vectors declared in Netrexx?
>>>>>
>>>>>
>>>>> Quique
>>>>>
>>>>>
>>>>>
>>>>> -----Mensaje original-----
>>>>> De: [hidden email] [mailto:
>>>>> [hidden email]] En nombre de Ren? Jansen
>>>>> Enviado el: lunes, 27 de julio de 2009 11:12
>>>>> Para: IBM Netrexx
>>>>> Asunto: Re: [Ibm-netrexx] JTable in Netrexx
>>>>>
>>>>> Hi Quique,
>>>>>
>>>>> this is because JTable does not have a constructor that accepts two
>>>>> String Arrays. Try to do this with two Vectors - if it does not work then
>>>>> let me know.
>>>>>
>>>>> best regards,
>>>>>
>>>>> Ren? Jansen.
>>>>>
>>>>> On 26 jul 2009, at 23:18, Quique Britto wrote:
>>>>>
>>>>> Hi,
>>>>>>
>>>>>> I am trying to create a simple table using netrexx but keep receiving
>>>>>> the u/m msg, any help will be appreciated.
>>>>>>
>>>>>> The constructor 'JTable(java.lang.String[],java.lang.String[]'
>>>>>> cannot be found in the class 'javax.swing.table'
>>>>>>
>>>>>> heres the code of the program:
>>>>>>
>>>>>> /* **************** */
>>>>>> /*    JTable Test  */
>>>>>> /* **************** */
>>>>>>
>>>>>> import javax.swing.
>>>>>>
>>>>>> class SimpleTableDemo extends JFrame
>>>>>>  properties inheritable
>>>>>>  -- general variables
>>>>>>  titles = String[3]
>>>>>>  data  = String[3]
>>>>>>
>>>>>>  -- frame variables
>>>>>>  jt         = JTable()
>>>>>>  jp        = JPanel()
>>>>>>  sp        = JScrollPane()
>>>>>>  mainwindow = JFrame()
>>>>>>
>>>>>>
>>>>>> method SimpleTableDemo()
>>>>>>  -- create frame
>>>>>>  mainwindow = JFrame()
>>>>>>
>>>>>>  -- set properties for mainwindow
>>>>>>  mainwindow.addWindowListener( CloseWindowAdapter() )
>>>>>>
>>>>>>  -- set frame characteristics
>>>>>>  mainwindow.setTitle( "Simple Table Demo" )
>>>>>>  mainwindow.setSize( 400,400 )
>>>>>>
>>>>>>  -- center frame
>>>>>>  d = mainwindow.getToolkit().getScreenSize()
>>>>>>  s = mainwindow.getSize()
>>>>>>  mainwindow.setLocation((d.width - s.width) % 2, (d.height -
>>>>>> s.height) % 2 )
>>>>>>
>>>>>>  -- create jpanel
>>>>>>  jp = JPanel()
>>>>>>  jp.setLayout( BorderLayout() )
>>>>>>
>>>>>>  -- create column names
>>>>>>  titles[0] = "Column 1"
>>>>>>  titles[1] = "Column 2"
>>>>>>  titles[2] = "Column 3"
>>>>>>
>>>>>>  -- create some data
>>>>>>  data[0] = "pepe"
>>>>>>  data[1] = "maite"
>>>>>>  data[2] = "maria jose"
>>>>>>
>>>>>>  -- create out Table instance
>>>>>>  jt = JTable( data, titles )
>>>>>>
>>>>>>  -- add table to scrollpane
>>>>>>  sp.add( jt )
>>>>>>  jp.add( sp, BorderLayout.CENTER )
>>>>>>
>>>>>>  -- show window
>>>>>>  mainwindow.setVisible( 1 )
>>>>>>  mainwindow.setBackground( Color.black )
>>>>>>
>>>>>> return
>>>>>>
>>>>>>
>>>>>> method main( args=String[] ) static
>>>>>>  -- this is the first method (procedure) to be executed
>>>>>>  args = args
>>>>>>
>>>>>>  -- window decorations
>>>>>>  JFrame.setDefaultLookAndFeelDecorated( 0 )
>>>>>>
>>>>>>  -- create a table instance
>>>>>>  SimpleTableDemo()
>>>>>>
>>>>>> return
>>>>>>
>>>>>> class SimpleTableDemo.CloseWindowAdapter dependent extends
>>>>>> WindowAdapter
>>>>>>  method windowClosing( e = WindowEvent )
>>>>>>  exit 0
>>>>>> _______________________________________________
>>>>>> Ibm-netrexx mailing list
>>>>>> [hidden email]
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Ibm-netrexx mailing list
>>>>> [hidden email]
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> DISCLAIMER:
>>>>> En cumplimiento del art?culo 5 de la Ley Org?nica de Protecci?n de
>>>>> Datos 15/1999, le informamos que sus datos personales est?n incorporados a
>>>>> un fichero denominado clientes, con la ?nica finalidad de mantener
>>>>> relaciones profesionales. Si lo desea puede ejercer los derechos de acceso,
>>>>> rectificaci?n, cancelaci?n u oposici?n de sus datos personales dirigi?ndose
>>>>> a: COSCO IBERIA  S.A. -Responsable Protecci?n de Datos- calle Casanova, 2,
>>>>> 6? planta de Barcelona (08011).
>>>>> Este mensaje y cualquier documento que lleve adjunto, es confidencial y
>>>>> destinado ?nicamente a la persona o entidad a quien ha sido enviado. Si
>>>>> Usted ha recibido este mensaje por error, le informamos que el contenido en
>>>>> el mismo es reservado y el uso no autorizado est? prohibido legalmente,por
>>>>> ello,por favor , le rogamos que nos lo notifique al e-mail:
>>>>> [hidden email] o al tel?fono 93 304 71 26
>>>>> Si su e-mail no ha podido ser entregado al buz?n de su destinatario,
>>>>>  por favor reenv?elo a la direcci?n [hidden email]
>>>>> If your mail could not be delivered correctly, please resend it to
>>>>> [hidden email]
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Ibm-netrexx mailing list
>>>>> [hidden email]
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Ibm-netrexx mailing list
>>>> [hidden email]
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Ibm-netrexx mailing list
>>> [hidden email]
>>>
>>>
>>>
>>
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20090804/42d9bdd5/attachment-0001.html
Reply | Threaded
Open this post in threaded view
|

JTable in Netrexx

measel
In reply to this post by Quique Britto
Change line 71 to return data  
 
Then it works.
 
________________________________

From: [hidden email] [mailto:[hidden email]] On Behalf Of Quique Britto
Sent: Tuesday, August 04, 2009 3:06 PM
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] JTable in Netrexx


I am currently writing a "how to to use Swing componets in Netrexx", something similar to the chapter in the IBM redbook but upto date and working examples of all current Swing componets.
Most are not complicated to use but there are some like the Jtable in which I need help. The idea is to have two working examples, one using the defaulttablemodel and the other (see below code) extending the abstracttablemodel.


/* **************** */
/*    JTable Test  */
/* **************** */

import javax.swing.

class SimpleTableDemo extends JFrame
  properties inheritable
  -- general variables


  -- frame variables
  jt         = JTable()
  jp         = JPanel()
 sp         = JScrollPane()
  mainwindow = JFrame()


method SimpleTableDemo()
  -- create frame
  mainwindow = JFrame()
 
  -- set properties for mainwindow
  mainwindow.addWindowListener( CloseWindowAdapter() )
 
  -- set frame characteristics
  mainwindow.setTitle( "Simple Table Demo" )
  mainwindow.setSize( 800,400 )
 
  -- center frame
  d = mainwindow.getToolkit().getScreenSize()
  s = mainwindow.getSize()
  mainwindow.setLocation((d.width - s.width) % 2, (d.height - s.height) % 2 )
 
  -- create out Table instance
  fm = FileModel()
  jt = JTable( fm )

  -- create jscrollpane
  sp = JScrollPane( jt )
 
  -- add scrollpane to the mainwindow
  mainwindow.getContentPane().add( sp, BorderLayout.CENTER )
 
  -- show window
  mainwindow.setVisible( 1 )
 
return


method main( args=String[] ) static  
  -- this is the first method (procedure) to be executed
  args = args

  -- window decorations
  JFrame.setDefaultLookAndFeelDecorated( 0 )

  -- create a table instance
  SimpleTableDemo()

return

class SimpleTableDemo.CloseWindowAdapter dependent extends WindowAdapter
  method windowClosing( e = WindowEvent )    
  exit 0
 
class FileModel extends AbstractTableModel
  properties inheritable
  -- general variables
  titles = Vector()
  row1 = Vector(0
  row2 = Vector()
  data   = Vector()

 
  method FileModel()
  -- create column headers
  titles = Vector()
  titles.add( String( "Column 1" ))
  titles.add( String( "Column 2" ))

  -- create some data
  row1 = Vector()
  row1.add( String( "pepe" ))
  row1.add( String( "pepe2" ))

  row2 = Vector()
  row2.add( String( "javi" ))
  row2.add( String( "jave2" ))

  data = Vector()
  data.add( Vector( row1 ) )
  data.add( Vector( row2 ) )

return
 
method getRowCount() returns int
return data.Size()

method getColumnCount() returns int
return titles.Size()

method getValueAt( r = int, c = int) returns java.lang.Object
return data[ r,c ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> THIS PRODUCES AN ERROR WHILE COMPILING



again, any help is appreciated.
Quique





2009/8/4 Measel, Mike <[hidden email]>


        Please post the code as you have it now so we can take a peek.
         
        Btw, have you tried trace all ?

________________________________

       
        From: [hidden email] [mailto:[hidden email]] On Behalf Of Quique Britto
       
        Sent: Tuesday, August 04, 2009 7:10 AM

        To: IBM Netrexx
        Subject: Re: [Ibm-netrexx] JTable in Netrexx
       

        Hi again,
       
        I have tried all solutions given in this thread but still not working.
        again, any help will be appreciated.
       
        Quique
       
       
       
       
       
        2009/8/3 Measel, Mike <[hidden email]>
       

                Quique, the Jpanel needs to be added to the content pane of the frame -
                 
                 this.setJmenuBar(menuBar)
                 this.setTitle("Journal entries")
                 this.setSize(1000,300)
                 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
                 c = this.getContentPane()
                 c.setLayout(BorderLayout())
                ...
                  topPanel = JPanel()
                  topPanel.setSize(490, 290)
                  bl = BorderLayout()
                  topPanel.setLayout(bl)
                  topPanel.setBackground(Color.green)
                  c.add(topPanel)
                 
                 
                 
                Also, I fought with vectors and here's (not pretty) code that worked for me.  
                 
               

                colnames = String[7]
                colnames[0] = 'Name'
                colnames[1] = 'Date/Time'
                colnames[2] = 'Hosts'
                colnames[3] = 'Process'
                colnames[4] = 'Agents'
                colnames[5] = 'Metrics'
                colnames[6] = 'Duration (min)'
                ...
               
                aobj = Object[20,7]
                ...
                 aobj[n,0] = aname
                 aobj[n,1] = sname
                 aobj[n,2] = hregx
                 aobj[n,3] = pregx
                 aobj[n,4] = aregx
                 aobj[n,5] = mregx
                 aobj[n,6] = durx
                ...
                crumbTable = JTable(aobj, colnames)
                crumbTable.getModel().addTableModelListener(this)
                ...
                scrollPane = JScrollPane(crumbTable)
                topPanel.add(scrollPane, BorderLayout.CENTER)
                topPanel.add(btnSelect, BorderLayout.SOUTH)
                setVisible(1)
               
                 
               

________________________________

                From: [hidden email] [mailto:[hidden email]] On Behalf Of Quique Britto
                Sent: Friday, July 31, 2009 4:22 PM
                To: IBM Netrexx
                Subject: Re: [Ibm-netrexx] JTable in Netrexx
               
               
                Hi Rene,
               
                been trying but still can't get a simple JTable working. I have replaced the arrays with vectors (see below) and all compiles ok but I received a Class.CastException once program is run.
               
                full error descpription=
                Exception in thread "main" java.lang.Class.CastException: java.lang.String cannot be cast to java.util.Vector
               
               
                ..
                ..
                -- create column names
                  titles = Vector()
                  titles.add( String( "Column 1" ))
                  titles.add( String( "Column 2" ))
                  titles.add( String( "Column 3" ))
                 
                  -- create some data
                  data = Vector()
                  data.add( String( "pepe" ))
                  data.add( String( "maite" ))
                  data.add( String( "maria jose" ))
                 
                  -- create out Table instance
                  dm = DefaultTableModel( data, titles )
                  jt = JTable( dm )
                ..
                ..
               
                also tried jt = JTable( data, titles ) but same error
               
                Thks for any help provided.
               
                Quique
               
               
               
               
               
                2009/7/27 Ren? Jansen <[hidden email]>
               

                        Hi Quique,
                       
                        something like:
                       
                        titles = Vector()
                        titles.add(String("Column 1"))
                        titles.add(String("Column 2"))
                       
                        If you use String then it does not need to know the comparison operator for type Rexx.
                       
                        best regards,
                       
                        Ren?.
                       
                       
                       
                        On 27 jul 2009, at 11:16, britten /Quique Britto (SPAIN VAL Export Mngr AMX) wrote:
                       
                       

                                Thks Rene,
                               
                                how are vectors declared in Netrexx?
                               
                               
                                Quique
                               
                               
                               
                                -----Mensaje original-----
                                De: [hidden email] [mailto:[hidden email]] En nombre de Ren? Jansen
                                Enviado el: lunes, 27 de julio de 2009 11:12
                                Para: IBM Netrexx
                                Asunto: Re: [Ibm-netrexx] JTable in Netrexx
                               
                                Hi Quique,
                               
                                this is because JTable does not have a constructor that accepts two String Arrays. Try to do this with two Vectors - if it does not work then let me know.
                               
                                best regards,
                               
                                Ren? Jansen.
                               
                                On 26 jul 2009, at 23:18, Quique Britto wrote:
                               
                               

                                        Hi,
                                       
                                        I am trying to create a simple table using netrexx but keep receiving
                                        the u/m msg, any help will be appreciated.
                                       
                                        The constructor 'JTable(java.lang.String[],java.lang.String[]'
                                        cannot be found in the class 'javax.swing.table'
                                       
                                        heres the code of the program:
                                       
                                        /* **************** */
                                        /*    JTable Test  */
                                        /* **************** */
                                       
                                        import javax.swing.
                                       
                                        class SimpleTableDemo extends JFrame
                                         properties inheritable
                                         -- general variables
                                         titles = String[3]
                                         data  = String[3]
                                       
                                         -- frame variables
                                         jt         = JTable()
                                         jp        = JPanel()
                                         sp        = JScrollPane()
                                         mainwindow = JFrame()
                                       
                                       
                                        method SimpleTableDemo()
                                         -- create frame
                                         mainwindow = JFrame()
                                       
                                         -- set properties for mainwindow
                                         mainwindow.addWindowListener( CloseWindowAdapter() )
                                       
                                         -- set frame characteristics
                                         mainwindow.setTitle( "Simple Table Demo" )
                                         mainwindow.setSize( 400,400 )
                                       
                                         -- center frame
                                         d = mainwindow.getToolkit().getScreenSize()
                                         s = mainwindow.getSize()
                                         mainwindow.setLocation((d.width - s.width) % 2, (d.height -
                                        s.height) % 2 )
                                       
                                         -- create jpanel
                                         jp = JPanel()
                                         jp.setLayout( BorderLayout() )
                                       
                                         -- create column names
                                         titles[0] = "Column 1"
                                         titles[1] = "Column 2"
                                         titles[2] = "Column 3"
                                       
                                         -- create some data
                                         data[0] = "pepe"
                                         data[1] = "maite"
                                         data[2] = "maria jose"
                                       
                                         -- create out Table instance
                                         jt = JTable( data, titles )
                                       
                                         -- add table to scrollpane
                                         sp.add( jt )
                                         jp.add( sp, BorderLayout.CENTER )
                                       
                                         -- show window
                                         mainwindow.setVisible( 1 )
                                         mainwindow.setBackground( Color.black )
                                       
                                        return
                                       
                                       
                                        method main( args=String[] ) static
                                         -- this is the first method (procedure) to be executed
                                         args = args
                                       
                                         -- window decorations
                                         JFrame.setDefaultLookAndFeelDecorated( 0 )
                                       
                                         -- create a table instance
                                         SimpleTableDemo()
                                       
                                        return
                                       
                                        class SimpleTableDemo.CloseWindowAdapter dependent extends
                                        WindowAdapter
                                         method windowClosing( e = WindowEvent )
                                         exit 0
                                        _______________________________________________
                                        Ibm-netrexx mailing list
                                        [hidden email]
                                       
                                       



                                _______________________________________________
                                Ibm-netrexx mailing list
                                [hidden email]
                               
                               
                               
                               
                                DISCLAIMER:
                                En cumplimiento del art?culo 5 de la Ley Org?nica de Protecci?n de Datos 15/1999, le informamos que sus datos personales est?n incorporados a un fichero denominado clientes, con la ?nica finalidad de mantener relaciones profesionales. Si lo desea puede ejercer los derechos de acceso, rectificaci?n, cancelaci?n u oposici?n de sus datos personales dirigi?ndose a: COSCO IBERIA  S.A. -Responsable Protecci?n de Datos- calle Casanova, 2, 6? planta de Barcelona (08011).
                                Este mensaje y cualquier documento que lleve adjunto, es confidencial y destinado ?nicamente a la persona o entidad a quien ha sido enviado. Si Usted ha recibido este mensaje por error, le informamos que el contenido en el mismo es reservado y el uso no autorizado est? prohibido legalmente,por ello,por favor , le rogamos que nos lo notifique al e-mail: [hidden email] o al tel?fono 93 304 71 26
                                Si su e-mail no ha podido ser entregado al buz?n de su destinatario,  por favor reenv?elo a la direcci?n [hidden email]
                                If your mail could not be delivered correctly, please resend it to [hidden email]
                               
                               
                                _______________________________________________
                                Ibm-netrexx mailing list
                                [hidden email]
                               
                               



                        _______________________________________________
                        Ibm-netrexx mailing list
                        [hidden email]
                       
                       



                _______________________________________________
                Ibm-netrexx mailing list
                [hidden email]
               
               
               



        _______________________________________________
        Ibm-netrexx mailing list
        [hidden email]
       
       
       


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20090804/769e6561/attachment-0001.html
Reply | Threaded
Open this post in threaded view
|

JMenuItem accelerator in Netrexx

britten /Quique Britto (SPAIN VAL Export Mngr AMX)
In reply to this post by Quique Britto
Hi all,
 
I would like to add and accelerator to file File menu to the "Quit"
item, the u/m does not compile.
 
-- define menu items for File menu
  filemenu_nm = "Quit"
  filemenu_it = JMenuItem( filemenu_nm )
  filemenu_it.addActionListener( this )
  filemenu_it.setActionCommand( filemenu_nm )

  filemenu_it.setAccelerator( KeyStroke.getKeyStroke( 'Q',
CTRL_DOWN_MASK ))
 
  menubar[0].add( filemenu_it )
 
 
 
the compiler does indicate the actual error but underlines (using jedit)
the "CTRL_DOWN_MASK"
 
 
any help is appreciated....thks
 
Cosco Iberia, S.A.
Export Trade Manager
Quique Britto
Tel.: 96-3939103
Fax.: 96-3939119
[hidden email] <blocked::mailto:[hidden email]>
 
Track, trace and monitor your shipments through internet. On
www.coscon.com <http://www.coscon.com/>
 
Office Hours .:
08.30 - 17.30 hrs (Mon/Thu)
08.30 - 14.00 hrs (Fri)    



DISCLAIMER:
En cumplimiento del articulo 5 de la Ley Organica de Proteccion de Datos 15/1999, le informamos que sus datos personales estan incorporados a un fichero denominado clientes, con la unica finalidad de mantener relaciones profesionales. Si lo desea puede ejercer los derechos de acceso, rectificacion, cancelacion u oposicion de sus datos personales dirigiendose a: COSCO IBERIA  S.A. -Responsable Proteccion de Datos- calle Casanova, 2, 6a planta de Barcelona (08011).
Este mensaje y cualquier documento que lleve adjunto, es confidencial y destinado unicamente a la persona o entidad a quien ha sido enviado. Si Usted ha recibido este mensaje por error, le informamos que el contenido en el mismo es reservado y el uso no autorizado esta prohibido legalmente,por ello,por favor , le rogamos que nos lo notifique al e-mail: [hidden email] o al telefono 93 304 71 26
Si su e-mail no ha podido ser entregado al buzon de su destinatario,  por favor reenvielo a la direccion [hidden email]
If your mail could not be delivered correctly, please resend it to [hidden email]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20100113/37f98425/attachment-0001.html
Reply | Threaded
Open this post in threaded view
|

RE: JMenuItem accelerator in Netrexx

britten /Quique Britto (SPAIN VAL Export Mngr AMX)
In reply to this post by Quique Britto
solved
 
Cosco Iberia, S.A.
Export Trade Manager
Quique Britto
Tel.: 96-3939103
Fax.: 96-3939119
[hidden email] <blocked::mailto:[hidden email]>
 
Track, trace and monitor your shipments through internet. On www.coscon.com <http://www.coscon.com/>
 
Office Hours .:
08.30 - 17.30 hrs (Mon/Thu)
08.30 - 14.00 hrs (Fri)
 

________________________________

De: britten /Quique Britto (SPAIN VAL Export Mngr AMX)
Enviado el: mi?rcoles, 13 de enero de 2010 14:18
Para: 'IBM Netrexx'
Asunto: JMenuItem accelerator in Netrexx


Hi all,
 
I would like to add and accelerator to file File menu to the "Quit" item, the u/m does not compile.
 
-- define menu items for File menu
  filemenu_nm = "Quit"
  filemenu_it = JMenuItem( filemenu_nm )
  filemenu_it.addActionListener( this )
  filemenu_it.setActionCommand( filemenu_nm )

  filemenu_it.setAccelerator( KeyStroke.getKeyStroke( 'Q', CTRL_DOWN_MASK ))
 
  menubar[0].add( filemenu_it )
 
 
 
the compiler does indicate the actual error but underlines (using jedit) the "CTRL_DOWN_MASK"
 
 
any help is appreciated....thks
 
Cosco Iberia, S.A.
Export Trade Manager
Quique Britto
Tel.: 96-3939103
Fax.: 96-3939119
[hidden email] <blocked::mailto:[hidden email]>
 
Track, trace and monitor your shipments through internet. On www.coscon.com <http://www.coscon.com/>
 
Office Hours .:
08.30 - 17.30 hrs (Mon/Thu)
08.30 - 14.00 hrs (Fri)    



DISCLAIMER:
En cumplimiento del art?culo 5 de la Ley Org?nica de Protecci?n de Datos 15/1999, le informamos que sus datos personales est?n incorporados a un fichero denominado clientes, con la ?nica finalidad de mantener relaciones profesionales. Si lo desea puede ejercer los derechos de acceso, rectificaci?n, cancelaci?n u oposici?n de sus datos personales dirigi?ndose a: COSCO IBERIA  S.A. -Responsable Protecci?n de Datos- calle Casanova, 2, 6? planta de Barcelona (08011).
Este mensaje y cualquier documento que lleve adjunto, es confidencial y destinado ?nicamente a la persona o entidad a quien ha sido enviado. Si Usted ha recibido este mensaje por error, le informamos que el contenido en el mismo es reservado y el uso no autorizado est? prohibido legalmente,por ello,por favor , le rogamos que nos lo notifique al e-mail: [hidden email] o al tel?fono 93 304 71 26
Si su e-mail no ha podido ser entregado al buz?n de su destinatario,  por favor reenv?elo a la direcci?n [hidden email]
If your mail could not be delivered correctly, please resend it to [hidden email]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20100113/c921ca5f/attachment.html