当前位置: 首页>>代码示例>>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;未经允许,请勿转载。