<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1765364</guid>
        <pubDate>Thu, 15 Nov 2007 08:54:27 +0000</pubDate>
        <title>Проблема с выводом строк таблицы</title>
        <link>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1765364</link>
        <description><![CDATA[erslgoeirjh: Проблема решена&#33;<br><br>У JTable есть свойство preferredSize и есть соответствующие функции getPreferredSIze и setPreferredSize. Их и надо использовать для задания количества строк, которые прокручиваются JScrollPane-ом. Строке в таблице у меня соответствуют 16 пикселей.]]></description>
        <author>erslgoeirjh</author>
        <category>Java</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758611</guid>
        <pubDate>Fri, 09 Nov 2007 13:51:35 +0000</pubDate>
        <title>Проблема с выводом строк таблицы</title>
        <link>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758611</link>
        <description><![CDATA[Alien: <strong class='tag-b'>erslgoeirjh</strong>, ты изменяешь количество строк в модели. После того, как добавил строку методом myTM.setRowCount(...) укажи, сколько стало строк в модели.<br>
<br>
А вообще, лучше бы запихнул данные в конструктор DefaultTableModel и это добавил в таблицу. Потом спокойно себе добавляешь и тд.<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">Object[][] data = {{&quot;1&quot;, &quot;2&quot;}};</div><div class="code_line">Object[] column = {&quot;3&quot;, &quot;4&quot;};</div><div class="code_line">DefaultTableModel d = new DefaultTableModel(data, column);</div><div class="code_line">JTable table = new JTable(d);</div><div class="code_line">JScrollPane sp = new JScrollPane(table);</div><div class="code_line">Object[] dat = {&quot;3&quot;, &quot;4&quot;};</div><div class="code_line">d.insertRow(1, dat);</div><div class="code_line">add(sp);</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script>]]></description>
        <author>Alien</author>
        <category>Java</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758570</guid>
        <pubDate>Fri, 09 Nov 2007 13:26:45 +0000</pubDate>
        <title>Проблема с выводом строк таблицы</title>
        <link>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758570</link>
        <description><![CDATA[wind: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=209675&view=findpost&p=1758414'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Grab&#091;SSAU&#093; &#064; <time class="tag-quote__quoted-time" datetime="2007-11-09T12:36:40+00:00">09.11.07, 12:36</time></span><div class='quote '>Можно выложить весь код?</div></div><br>
Если кода очень много, прикрепите его к сообщению в виде архива.]]></description>
        <author>wind</author>
        <category>Java</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758414</guid>
        <pubDate>Fri, 09 Nov 2007 12:36:40 +0000</pubDate>
        <title>Проблема с выводом строк таблицы</title>
        <link>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758414</link>
        <description><![CDATA[Grab[SSAU]: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=209675&view=findpost&p=1758405'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>erslgoeirjh &#064; <time class="tag-quote__quoted-time" datetime="2007-11-09T12:32:24+00:00">09.11.07, 12:32</time></span><div class='quote '>На самом деле у меня вместо DefaultTableModel используется некая MyTableModel, являющаяся потомком DefaultTableModel. В ней я переопределил метод isCellEditable.</div></div><br>
<br>
при использовании конструктора a-la:<br>
<br>
 <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">JTable jTable1 = JTable(data, columnnames);</div></ol></div></div></div></div><br>
<br>
создается объект <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">DefaultTableModel</div></ol></div></div></div></div>.<br>
<br>
Я немного не понимаю, как тогда все работает  ;) Можно выложить весь код?]]></description>
        <author>Grab[SSAU]</author>
        <category>Java</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758405</guid>
        <pubDate>Fri, 09 Nov 2007 12:32:24 +0000</pubDate>
        <title>Проблема с выводом строк таблицы</title>
        <link>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758405</link>
        <description><![CDATA[erslgoeirjh: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=209675&view=findpost&p=1758238'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>wind &#064; <time class="tag-quote__quoted-time" datetime="2007-11-09T11:31:19+00:00">09.11.07, 11:31</time></span><div class='quote '>При использовании DefaultTableModel заботиться об уведомлении таблицы не нужно.<br>
<br>
<strong class='tag-b'>erslgoeirjh</strong>, код в студию.</div></div><br>
На самом деле у меня вместо DefaultTableModel используется некая MyTableModel, являющаяся потомком DefaultTableModel. В ней я переопределил метод isCellEditable.<br>
<br>
Вот код:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">MyTableModel myTM;</div><div class="code_line">jTable1.setModel(myTM);</div><div class="code_line">&nbsp;</div><div class="code_line">//...</div><div class="code_line">&nbsp;</div><div class="code_line">int rowscount = myTM.getRowsCount();</div><div class="code_line">int currow = 0;</div><div class="code_line">InputStream fileIn = FileInputStream(filename); // filename -- некоторое имя файла</div><div class="code_line">byte buff = new byte[79];</div><div class="code_line">while (fileIn.read(buff)!=-1) {</div><div class="code_line">&nbsp;&nbsp;if (currow&#62;=rowscount) {</div><div class="code_line">&nbsp;&nbsp; &nbsp;Object obj = {&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;};</div><div class="code_line">&nbsp;&nbsp; &nbsp;myTM.insertRow(currow, obj);</div><div class="code_line">&nbsp;&nbsp; &nbsp;rowscount = myTM.getRowCount();</div><div class="code_line">&nbsp;&nbsp;}</div><div class="code_line">&nbsp;&nbsp;s = new String(buff);</div><div class="code_line">&nbsp;&nbsp;// обработка строки s</div><div class="code_line">&nbsp;&nbsp;myTM.setValueAt(s1, currow, 2); // s1 -- некоторая подстрока из строки s</div><div class="code_line">&nbsp;&nbsp;// ...</div><div class="code_line">&nbsp;&nbsp;currow++;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
Метод fireTableDataChanged() не помогает.]]></description>
        <author>erslgoeirjh</author>
        <category>Java</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758238</guid>
        <pubDate>Fri, 09 Nov 2007 11:31:19 +0000</pubDate>
        <title>Проблема с выводом строк таблицы</title>
        <link>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758238</link>
        <description><![CDATA[wind: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=209675&view=findpost&p=1758188'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Alien &#064; <time class="tag-quote__quoted-time" datetime="2007-11-09T11:04:10+00:00">09.11.07, 11:04</time></span><div class='quote '>После добавления данных в таблицу вызывай метод обновления данных fireTableDataChanged()</div></div><br>
При использовании DefaultTableModel заботиться об уведомлении таблицы не нужно.<br>
<br>
<strong class='tag-b'>erslgoeirjh</strong>, код в студию.]]></description>
        <author>wind</author>
        <category>Java</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758188</guid>
        <pubDate>Fri, 09 Nov 2007 11:04:10 +0000</pubDate>
        <title>Проблема с выводом строк таблицы</title>
        <link>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758188</link>
        <description><![CDATA[Alien: После добавления данных в таблицу вызывай метод обновления данных <strong class='tag-b'>fireTableDataChanged()</strong>]]></description>
        <author>Alien</author>
        <category>Java</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758116</guid>
        <pubDate>Fri, 09 Nov 2007 10:13:55 +0000</pubDate>
        <title>Проблема с выводом строк таблицы</title>
        <link>https://forum.sources.ru/index.php?showtopic=209675&amp;view=findpost&amp;p=1758116</link>
        <description><![CDATA[erslgoeirjh: Есть таблица jTable1. Она определена в начале программы как табица из 24 строк и 6 столбцов:<br>
Object[][] data = {{&quot;...&quot;,...,&quot;...&quot;},{&quot;...&quot;,...,&quot;...&quot;},...,{&quot;...&quot;,...,&quot;...&quot;}};<br>
Object[] columnnames = {&quot;...&quot;,&quot;...&quot;,&quot;...&quot;,&quot;...&quot;,&quot;...&quot;,&quot;...&quot;};<br>
JTable jTable1 = JTable(data, columnnames);<br>
Есть myTableModel, определённая как<br>
DefaultTableModel myTableModel = (DefaultTableModel)jTable1.getModel();<br>
С помощью функции myTableModel.insertRow() в таблицу вставляется новая строка, так, что реально число строк в таблице становится больше 24. Таблица помещена в ScrollPane.<br>
<br>
Но после этого добавления строк в таблицу при прокрутке в ScrollPane показываются всё равно только первые 24 строк таблицы. Как сделать, чтобы при прокрутке показывались все строки таблицы?]]></description>
        <author>erslgoeirjh</author>
        <category>Java</category>
      </item>
	
      </channel>
      </rss>
	