當前位置: 首頁>>代碼示例>>Java>>正文


Java JXTable.getModel方法代碼示例

本文整理匯總了Java中org.jdesktop.swingx.JXTable.getModel方法的典型用法代碼示例。如果您正苦於以下問題:Java JXTable.getModel方法的具體用法?Java JXTable.getModel怎麽用?Java JXTable.getModel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jdesktop.swingx.JXTable的用法示例。


在下文中一共展示了JXTable.getModel方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: interactiveTableSortComparableAndStringValue

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Issue #1156-swingx: sort must use comparable
 * 
 * visually check that the custom string value for the color column is
 * used for sorting.
 */
public void interactiveTableSortComparableAndStringValue() {
    JXTable table = new JXTable(new AncientSwingTeam());
    table.setDefaultRenderer(Color.class, new DefaultTableRenderer(sv));
    
    JTable core = new JTable(table.getModel());
    core.setAutoCreateRowSorter(true);
    JXFrame frame = wrapWithScrollingInFrame(table, core, "JXTable <--> JTable: Compare sorting of color column");
    
    show(frame);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:17,代碼來源:ComponentAdapterClientTest.java

示例2: exportToCSV

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Static function for exporting a JXTable to a CSV text file
 * 
 * @param table - table to export
 * @param file - file to export to
 */
public static void exportToCSV(JXTable table, File file) {
	
	int i = 0;
	int j = 0;
	
	try
	{
		TableModel model = table.getModel();
		FileWriter csv = new FileWriter(file);
		
		for (i = 0; i < model.getColumnCount(); i++)
		{
			csv.write(model.getColumnName(i) + ",");
		}
		
		csv.write(System.getProperty("line.separator"));
		
		for (i = 0; i < model.getRowCount(); i++)
		{
			for (j = 0; j < (model.getColumnCount()); j++)
			{
				if (model.getValueAt(i, j) == null)
				{
					csv.write("" + ",");
				}
				else
				{
					csv.write(model.getValueAt(i, j).toString() + ",");
				}
			}
			csv.write(System.getProperty("line.separator"));
		}
		csv.close();
	}
	catch (IOException e)
	{
		JOptionPane.showMessageDialog(App.mainFrame, "Error saving file '" + file.getName() + "'\n" + e.getLocalizedMessage());
		e.printStackTrace();
	}
}
 
開發者ID:petebrew,項目名稱:fhaes,代碼行數:47,代碼來源:TableUtils.java

示例3: getTableModel

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
public static <T extends AbstractTableModel> T getTableModel(JXTable pTable) {
    return (T) pTable.getModel();
}
 
開發者ID:Torridity,項目名稱:dsworkbench,代碼行數:4,代碼來源:TableHelper.java

示例4: interactiveCheckBoxEditorSelectBackground

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Issue #??-swingx: first click in unselected (in terms of 
 * listSelection, not checkBox) checkbox does not change 
 * the editor background to selected. 
 * 
 * Suspected culprit is the editor: the click starts the 
 * edit, but doesn't update the background of the editor
 * itself. Once selected, the editor will be selected as well.
 * 
 * Core issue: Problem is that at the time of getting the
 * editing component, the row is not yet selected. Based on 
 * shouldSelectedCell, the table's row selection is updated 
 * _after_ installing the editing component.
 * 
 * Options:
 * - override changeSelection to special case the editing comp
 * - tweak the editor to config the renderer with isSelected == true
 *  (or with shouldSelect)
 *  
 */
public void interactiveCheckBoxEditorSelectBackground() {
    JXTable table = new JXTable(new AncientSwingTeam());
    JTable core = new JTable(table.getModel());
    
    JComponent comp = Box.createHorizontalBox();
    comp.add(new JScrollPane(table));
    comp.add(new JScrollPane(core));
    showInFrame(comp, "compare checkbox editor x <-> core");
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:30,代碼來源:RendererVisualCheck.java


注:本文中的org.jdesktop.swingx.JXTable.getModel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。