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


Java JTable.setFillsViewportHeight方法代碼示例

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


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

示例1: TablePrintDemo

import javax.swing.JTable; //導入方法依賴的package包/類
public TablePrintDemo() {
    super();
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    table = new JTable(new MyTableModel());
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    // Add the scroll pane to this panel.
    add(scrollPane);

    // Add a print button.
    JButton printButton = new JButton("Print");
    printButton.setAlignmentX(Component.CENTER_ALIGNMENT);
    printButton.addActionListener(this);
    add(printButton);

}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:22,代碼來源:TablePrintDemo.java

示例2: TableFTFEditDemo

import javax.swing.JTable; //導入方法依賴的package包/類
public TableFTFEditDemo() {
    super(new GridLayout(1, 0));

    JTable table = new JTable(new MyTableModel());
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    // Set up stricter input validation for the integer column.
    table.setDefaultEditor(Integer.class, new IntegerEditor(0, 100));

    // If we didn't want this editor to be used for other
    // Integer columns, we'd do this:
    // table.getColumnModel().getColumn(3).setCellEditor(
    // new IntegerEditor(0, 100));

    // Add the scroll pane to this panel.
    add(scrollPane);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:22,代碼來源:TableFTFEditDemo.java

示例3: TableDialogEditDemo

import javax.swing.JTable; //導入方法依賴的package包/類
public TableDialogEditDemo() {
    super(new GridLayout(1, 0));

    JTable table = new JTable(new MyTableModel());
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    // Set up renderer and editor for the Favorite Color column.
    table.setDefaultRenderer(Color.class, new ColorRenderer(true));
    table.setDefaultEditor(Color.class, new ColorEditor());

    // Add the scroll pane to this panel.
    add(scrollPane);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:TableDialogEditDemo.java

示例4: TableRenderDemo

import javax.swing.JTable; //導入方法依賴的package包/類
public TableRenderDemo() {
    super(new GridLayout(1, 0));

    JTable table = new JTable(new MyTableModel());
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    // Set up column sizes.
    initColumnSizes(table);

    // Fiddle with the Sport column's cell editors/renderers.
    setUpSportColumn(table, table.getColumnModel().getColumn(2));

    // Add the scroll pane to this panel.
    add(scrollPane);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:TableRenderDemo.java

示例5: init

import javax.swing.JTable; //導入方法依賴的package包/類
private void init() {
        this.setLayout(new BorderLayout());
        tableListTable = new JTable(this.tableModel);
        tableListTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
        tableListTable.setFillsViewportHeight(false);
        tableListTable.setDragEnabled(false);
        tableListTable.setColumnSelectionAllowed(false);
        tableListTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        
//        //
//        // Set the column widths
//        //
//        tableListTable.getColumnModel().getColumn(0).setPreferredWidth(40);
//        tableListTable.getColumnModel().getColumn(1).setPreferredWidth(20);
//        tableListTable.getColumnModel().getColumn(3).setPreferredWidth(40);
        
        JScrollPane scrollPane = new JScrollPane(tableListTable);
        //scrollPane.setPreferredSize(new Dimension(DesignerVisualization.WINDOW_WIDTH, 175));
        //scrollPane.setMaximumSize(this.columnSetTable.getPreferredScrollableViewportSize());
        this.add(scrollPane, BorderLayout.CENTER);
    }
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:22,代碼來源:TableListPanel.java

示例6: SimpleTableDemo

import javax.swing.JTable; //導入方法依賴的package包/類
public SimpleTableDemo() {
    super(new GridLayout(1, 0));

    String[] columnNames = { "First Name", "Last Name", "Sport", "# of Years", "Vegetarian" };

    Object[][] data = { { "Kathy", "Smith", "Snowboarding", new Integer(5), new Boolean(false) },
            { "John", "Doe", "Rowing", new Integer(3), new Boolean(true) },
            { "Sue", "Black", "Knitting", new Integer(2), new Boolean(false) },
            { "Jane", "White", "Speed reading", new Integer(20), new Boolean(true) },
            { "Joe", "Brown", "Pool", new Integer(10), new Boolean(false) } };

    final JTable table = new JTable(data, columnNames);
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);

    if (DEBUG) {
        table.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                printDebugData(table);
            }
        });
    }

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    // Add the scroll pane to this panel.
    add(scrollPane);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:30,代碼來源:SimpleTableDemo.java

示例7: TableDemo

import javax.swing.JTable; //導入方法依賴的package包/類
public TableDemo() {
    super(new GridLayout(1, 0));

    JTable table = new JTable(new MyTableModel());
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    // Add the scroll pane to this panel.
    add(scrollPane);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:TableDemo.java

示例8: TableSortDemo

import javax.swing.JTable; //導入方法依賴的package包/類
public TableSortDemo() {
    super(new GridLayout(1, 0));

    JTable table = new JTable(new MyTableModel());
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);
    table.setAutoCreateRowSorter(true);

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    // Add the scroll pane to this panel.
    add(scrollPane);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:15,代碼來源:TableSortDemo.java

示例9: GraphicTable

import javax.swing.JTable; //導入方法依賴的package包/類
public GraphicTable() {
	graphicTable = new JTable();
	
	graphicTable.setEnabled(false);
	graphicTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
	graphicTable.setMinimumSize(graphicTable.getPreferredScrollableViewportSize());
	graphicTable.setPreferredScrollableViewportSize(graphicTable.getPreferredSize());
	graphicTable.setFillsViewportHeight(true);
	graphicTable.getTableHeader().setReorderingAllowed(false);
	graphicTable.setColumnSelectionAllowed(true);
	graphicTable.setRowSelectionAllowed(true);
	graphicTable.setRowSelectionAllowed(true);
	//(ListSelectionModel.SINGLE_SELECTION);
}
 
開發者ID:tteguayco,項目名稱:JITRAX,代碼行數:15,代碼來源:GraphicTable.java

示例10: createContent

import javax.swing.JTable; //導入方法依賴的package包/類
@Override
protected JPanel createContent() {
	JPanel content = new JPanel();
	GroupLayout layout = new GroupLayout(content);
	content.setLayout(layout);
	layout.setAutoCreateGaps(true);
	layout.setAutoCreateContainerGaps(true);

	// parameters panel
	hhTable = new JTable();
	hhTable.setAutoscrolls(true);
	JScrollPane resScrollPane = new JScrollPane(hhTable);
	resScrollPane
			.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
	resScrollPane
			.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	hhTable.setFillsViewportHeight(true);
	hhTable.setPreferredScrollableViewportSize(new Dimension(400, 100));
	hhTableModel = new MyTableModel();
	hhTable.setModel(hhTableModel);
	hhTable.setDefaultRenderer(Class.class, new MyClassTableCellRenderer());
	hhTable.setDefaultEditor(Double.class, new MyDoubleTableCellEditor());
	hhTableModel.addColumn("Select");
	hhTableModel.addColumn("Hidden Hop Mapping");
	hhTableModel.addColumn("Factor");
	JPanel hhPanel = new JPanel();
	hhPanel.setBorder(BorderFactory.createTitledBorder("Hidden Hops"));
	hhPanel.add(resScrollPane);

	// create the content for the hh panel
	for (Class<?> hh : getAllHhs()) {
		try {
			hh.getDeclaredField(new String("factor"));
			// add a row to the factor table.
			hhTableModel
					.addRow(new Object[] { false, hh, new Double(0.0) });
		} catch (NoSuchFieldException ex) {
		}
	}
	// add the panels
	layout.setHorizontalGroup(layout.createParallelGroup().addComponent(
			hhPanel));
	layout.setVerticalGroup(layout.createSequentialGroup().addComponent(
			hhPanel));

	return content;
}
 
開發者ID:KeepTheBeats,項目名稱:alevin-svn2,代碼行數:48,代碼來源:HiddenHopsDialog.java

示例11: createTable

import javax.swing.JTable; //導入方法依賴的package包/類
private static JTable createTable() {
    DefaultTableModel model = new DefaultTableModel();
    JTable table = new JTable(model);
    table.setFillsViewportHeight(true);
    return table;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:7,代碼來源:bug6219960.java

示例12: createCredentialPanel

import javax.swing.JTable; //導入方法依賴的package包/類
JPanel createCredentialPanel() {
	JPanel box = new JPanel(new BorderLayout(5, 5));
	box.setOpaque(false);
	box.setBorder(new EmptyBorder(10, 0, 0, 10));

	model = new CredentialTableModel();
	Authenticator.getInstance().addObserver(model);
	table = new JTable(model);

	if (System.getProperty("xdm.defaulttheme") != null) {
		table.getTableHeader().setDefaultRenderer(
				new XDMTableHeaderRenderer());
	}
	table.setFillsViewportHeight(true);

	JScrollPane jsp = new JScrollPane(table);
	// jsp.setOpaque(false);
	// jsp.getViewport().setOpaque(false);

	jsp.setPreferredSize(new Dimension(10, 10));
	// box.add(table);
	box.add(jsp);

	Box b = Box.createHorizontalBox();
	b.add(Box.createHorizontalGlue());

	addAuth = new JButton(getString("LBL_ADD_AUTH"));
	addAuth.setName("LBL_ADD_AUTH");
	addAuth.addActionListener(this);
	removeAuth = new JButton(getString("LBL_DEL_AUTH"));
	removeAuth.setName("LBL_DEL_AUTH");
	removeAuth.addActionListener(this);
	editAuth = new JButton(getString("LBL_EDT_AUTH"));
	editAuth.setName("LBL_EDT_AUTH");
	editAuth.addActionListener(this);

	addAuth.setPreferredSize(removeAuth.getPreferredSize());
	editAuth.setPreferredSize(removeAuth.getPreferredSize());

	b.add(addAuth);
	b.add(Box.createHorizontalStrut(10));
	b.add(removeAuth);
	b.add(Box.createHorizontalStrut(10));
	b.add(editAuth);
	box.add(b, BorderLayout.SOUTH);
	return box;
}
 
開發者ID:kmarius,項目名稱:xdman,代碼行數:48,代碼來源:ConfigDialog.java


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