com.sun.swingset3.demos.Stacker Java Examples

The following examples show how to use com.sun.swingset3.demos.Stacker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TableDemo.java    From littleluck with Apache License 2.0 4 votes vote down vote up
protected void initComponents() {
    setLayout(new BorderLayout());

    controlPanel = createControlPanel();
    add(controlPanel, BorderLayout.NORTH);

    //<snip>Create JTable
    oscarTable = new JTable(oscarModel);
    //</snip>

    //</snip>Set JTable display properties
    oscarTable.setColumnModel(createColumnModel());
    oscarTable.setAutoCreateRowSorter(true);
    oscarTable.setRowHeight(26);
    oscarTable.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
    oscarTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    oscarTable.setIntercellSpacing(new Dimension(0, 0));
    //</snip>

    //<snip>Initialize preferred size for table's viewable area
    Dimension viewSize = new Dimension();
    viewSize.width = oscarTable.getColumnModel().getTotalColumnWidth();
    viewSize.height = 10 * oscarTable.getRowHeight();
    oscarTable.setPreferredScrollableViewportSize(viewSize);
    //</snip>

    //<snip>Customize height and alignment of table header
    JTableHeader header = oscarTable.getTableHeader();
    header.setPreferredSize(new Dimension(30, 26));
    TableCellRenderer headerRenderer = header.getDefaultRenderer();
    if (headerRenderer instanceof JLabel) {
        ((JLabel) headerRenderer).setHorizontalAlignment(JLabel.CENTER);
    }
    //</snip>

    LuckScrollPane scrollpane = new LuckScrollPane(oscarTable);
    dataPanel = new Stacker(scrollpane);
    add(dataPanel, BorderLayout.CENTER);

    add(createStatusBar(), BorderLayout.SOUTH);

}
 
Example #2
Source File: TableDemo.java    From beautyeye with Apache License 2.0 4 votes vote down vote up
protected void initComponents() {
	setLayout(new BorderLayout());

	controlPanel = createControlPanel();
	add(controlPanel, BorderLayout.NORTH);

	// <snip>Create JTable
	oscarTable = new JTable(oscarModel);
	// </snip>

	// </snip>Set JTable display properties
	oscarTable.setColumnModel(createColumnModel());
	oscarTable.setAutoCreateRowSorter(true);
	oscarTable.setRowHeight(26);
	oscarTable.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
	oscarTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	oscarTable.setIntercellSpacing(new Dimension(0, 0));
	// </snip>

	// <snip>Initialize preferred size for table's viewable area
	Dimension viewSize = new Dimension();
	viewSize.width = oscarTable.getColumnModel().getTotalColumnWidth();
	viewSize.height = 10 * oscarTable.getRowHeight();
	oscarTable.setPreferredScrollableViewportSize(viewSize);
	// </snip>

	// <snip>Customize height and alignment of table header
	JTableHeader header = oscarTable.getTableHeader();
	header.setPreferredSize(new Dimension(30, 26));
	TableCellRenderer headerRenderer = header.getDefaultRenderer();
	if (headerRenderer instanceof JLabel) {
		((JLabel) headerRenderer).setHorizontalAlignment(JLabel.CENTER);
	}
	// </snip>

	JScrollPane scrollpane = new JScrollPane(oscarTable);
	dataPanel = new Stacker(scrollpane);
	add(dataPanel, BorderLayout.CENTER);

	add(createStatusBar(), BorderLayout.SOUTH);

}
 
Example #3
Source File: TableDemo.java    From Darcula with Apache License 2.0 4 votes vote down vote up
protected void initComponents() {
    setLayout(new BorderLayout());

    controlPanel = createControlPanel();
    add(controlPanel, BorderLayout.NORTH);

    //<snip>Create JTable
    oscarTable = new JTable(oscarModel);
    //</snip>

    //</snip>Set JTable display properties
    oscarTable.setColumnModel(createColumnModel());
    oscarTable.setAutoCreateRowSorter(true);
    oscarTable.setRowHeight(26);
    oscarTable.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
    oscarTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    oscarTable.setIntercellSpacing(new Dimension(0, 0));
    //</snip>

    //<snip>Initialize preferred size for table's viewable area
    Dimension viewSize = new Dimension();
    viewSize.width = oscarTable.getColumnModel().getTotalColumnWidth();
    viewSize.height = 10 * oscarTable.getRowHeight();
    oscarTable.setPreferredScrollableViewportSize(viewSize);
    //</snip>

    //<snip>Customize height and alignment of table header
    JTableHeader header = oscarTable.getTableHeader();
    header.setPreferredSize(new Dimension(30, 26));
    TableCellRenderer headerRenderer = header.getDefaultRenderer();
    if (headerRenderer instanceof JLabel) {
        ((JLabel) headerRenderer).setHorizontalAlignment(JLabel.CENTER);
    }
    //</snip>

    JScrollPane scrollpane = new JScrollPane(oscarTable);
    dataPanel = new Stacker(scrollpane);
    add(dataPanel, BorderLayout.CENTER);

    add(createStatusBar(), BorderLayout.SOUTH);

}