Remove the Line No

Hi All,

I have one JTextArea , JList in a single JSplitPane ....when i enter

the data in TextArea the respective row no will be increased at left side in jlist .....and when i delete one line of Text from the TextArea automatically the row no in jlist need to be removed ....

How to achieve this functionality.....pls help me.

Thanks in advance

[376 byte] By [vasmhi_1981a] at [2007-11-27 5:04:36]
# 1

If you are just trying to get row numbers for you JTextArea then you should be adding a row header to your JScrollPane. This is done by adding a component to the scroll pane using the setRowHeaderView(...) method. Search the forum for this method and you will find line number components for this purpose.

camickra at 2007-7-12 10:22:59 > top of Java-index,Desktop,Core GUI APIs...
# 2

Hi Cramickr,

Thanks for your suggestion ...but Iam unable to get the

row numbers in left side jlist....can u please send the

code snippet to get it ?

My code is as follows....iam getting the no one only which is hard coded please verify this

<code>

final JTextArea EspeciesTmpespecienotas_especialesTxa = MiniFramework

.getTextArea(Notas_especialesTextConv);

EspeciesTmpespecienotas_especialesTxa.setRows(10);

final JList list = new JList();

list.setLayoutOrientation(JList.VERTICAL);

list.setEnabled(false);

final JSplitPane splitpane = new JSplitPane(

JSplitPane.HORIZONTAL_SPLIT, list,

EspeciesTmpespecienotas_especialesTxa);

splitpane.setDividerLocation(30);

splitpane.setDividerSize(2);

//final Object[] elnt = { "1" };

//list.setListData(elnt);

//Object[] elements = this.getListData(list);

splitpane.setOneTouchExpandable(true);

EspeciesTmpespecienotas_especialesTxa.setEditable(true);

EspeciesTmpespecienotas_especialesTxa.setLineWrap(true);

JScrollPane scroller = new JScrollPane(splitpane);

scroller

.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

scroller

.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

scroller.setRowHeaderView(list);

</code>

Thank you

vasmhi_1981a at 2007-7-12 10:22:59 > top of Java-index,Desktop,Core GUI APIs...