How can i give input like a table?

Hi,

Here in this example we are giving height,width,depth into the jframe dialog box and we process the value and make a calculation.so like

this how can i give input like a table of 6*6 where each column have some value and need to use with in that program?

 

Is it possible if yes ,Does anyone know how to perform it?

 

 

want to give input like this

 

7 comments
Comment actions Permalink

This is more of a general Swing question, probably better asked elsewhere. Once you figure out the code needed to do it in plain Java with Swing then we can help you with generating this code from MPS.

0
Comment actions Permalink

Sorry My Mistake,

Instead of giving input like this, can we do any change in editor and display like a table and can able to process the values in that table?

0
Comment actions Permalink

You can try this:

1) Add language "jetbrains.mps.lang.editor.table" as "Used Language" to the editor aspect of your language.

2) Add Table cell in your Editor


3) Open inspector of this cell (View -> Tool Windows -> Inspector)
4) Add dependency "jetbrains.mps.lang.editor.table.runtime" to your editor aspect
5) return AbstractTableModel implementation for table cell
6) implement required methods of AbstractTableModel (Ctrl + O inside inspector)

0
Comment actions Permalink

Is there any Seperate full documentation available for this Tables concept ?

0
Comment actions Permalink

No. I can't find anything more or less detailed documentation. But methods have quite intuitive names so it's not very difficult to understand how to implement this.

0
Comment actions Permalink

Here i done all thing  like getColumn() and getRows(),after that there is a getValueAt().

What we have to code inside that or what is the use of that method? 

 

0
Comment actions Permalink

Think about table like this:

When MPS render your table MPS should understand what kind of node MPS should show. MPS tell you like "what node is present at 1;1". You give him node and then MPS will create cells for this node. Because MPS can't show you just text data but MPS can create cell to show you data from this node.

As you see, method getValueAt should return node to present in table.

You should describe it like "return this node at position row and column".

You can't return just text, you should always return node. If you want to return text you should create concept with editor that show text.

As for example, you can create new node<StringLiteral>, set node text and return it from this method.

0

Please sign in to leave a comment.