Java Code Examples for javax.swing.JTable#setOpaque()

The following examples show how to use javax.swing.JTable#setOpaque() . 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: KseFrame.java    From keystore-explorer with GNU General Public License v3.0 5 votes vote down vote up
private JScrollPane wrapKeyStoreTableInScrollPane(JTable jtKeyStore) {

		jtKeyStore.setOpaque(true);
		jtKeyStore.setShowGrid(false);
		jtKeyStore.setFillsViewportHeight(true);
		JScrollPane jspKeyStoreTable = PlatformUtil.createScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
				ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

		jspKeyStoreTable.setViewportView(jtKeyStore);
		jspKeyStoreTable.setBorder(BorderFactory.createEtchedBorder());
		jspKeyStoreTable.setFocusable(false);

		return jspKeyStoreTable;
	}
 
Example 2
Source File: SwingUtils.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
public static void makeTransparant(JTable table, JScrollPane scrollPane) {
	table.setOpaque(false);
	((DefaultTableCellRenderer)table.getDefaultRenderer(Object.class)).setOpaque(false);
	((DefaultTableCellRenderer)table.getDefaultRenderer(String.class)).setOpaque(false);
	((JComponent)table.getDefaultRenderer(Boolean.class)).setOpaque(false);
	((DefaultTableCellRenderer)table.getDefaultRenderer(Integer.class)).setOpaque(false);
	
	scrollPane.setOpaque(false);
	scrollPane.getViewport().setOpaque(false);
}
 
Example 3
Source File: DisplayTableModule.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
/**
	 * Create a new module and set the title.  Initialize the name and value arrays.
	 * Create the GUI
	 * 
	 * @param title
	 * @param size
	 */
	public DisplayTableModule(FoxSpacecraft sat, String title, int size, int modType) {
		fox = sat;
		this.size = size;
		this.title = title;
		TitledBorder border = new TitledBorder(null, title, TitledBorder.LEADING, TitledBorder.TOP, null, null);
		
		moduleType = modType;
		
		if (moduleType >= DISPLAY_VULCAN) {
			border.setTitleFont(new Font("SansSerif", Font.BOLD, 10));
			border.setTitleColor(vulcanFontColor);
		} else {
			border.setTitleFont(new Font("SansSerif", Font.BOLD, 12));	
			border.setTitleColor(Color.BLUE);
//			maxValue = new JLabel[size];
//			minValue = new JLabel[size];

		}
		this.setBorder(border);
		
		displayTableModel = new DisplayTableModel();
		table = new JTable(displayTableModel);
		table.setFillsViewportHeight(true);
		table.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
		table.setOpaque(false);
		
		add(new JScrollPane(table));
		
		//add(table);

		TableColumn column = null;
		column = table.getColumnModel().getColumn(0);
		column.setPreferredWidth(130);
		column.setMinWidth(60);
		data = new String[size][4];
		
		for (int i=1; i<4; i++) {
			column = table.getColumnModel().getColumn(i);
			//column.sizeWidthToFit();
			column.setPreferredWidth(25);
			column.setMinWidth(25);
		}

		
		fieldName = new String[size]; 
//		rtValue = new JLabel[size];
//		label = new JLabel[size];
//		row = new JPanel[size];
		graph = new GraphFrame[size];
		display = new int[size];
		initGui();
		
	}
 
Example 4
Source File: StatTableModel.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void initializeTable(JTable statsTable)
{
	JTableHeader tableHeader = statsTable.getTableHeader();
	tableHeader.setResizingAllowed(false);
	tableHeader.setReorderingAllowed(false);

	statsTable.setAutoCreateColumnsFromModel(false);
	DefaultTableColumnModel columnModel = new DefaultTableColumnModel();
	{
		TableColumn column =
				Utilities.createTableColumn(ABILITY_NAME, "Ability", new AbilityHeaderCellRenderer(), true);
		column.setIdentifier(ABILITY_COLUMN_ID);
		columnModel.addColumn(column);

		String htmlText = "<html><div align=\"center\">Final<br>Score</div></html>";
		column = Utilities.createTableColumn(FINAL_ABILITY_SCORE, htmlText, new FixedHeaderCellRenderer(htmlText),
			false);
		column.setCellRenderer(new ValueRenderer());
		columnModel.addColumn(column);

		TableCellRenderer renderer = new ModRenderer();
		htmlText = "<html><div align=\"center\">Ability<br>Mod</div></html>";
		column = Utilities.createTableColumn(ABILITY_MOD, htmlText, new FixedHeaderCellRenderer(htmlText), false);
		column.setCellRenderer(renderer);
		columnModel.addColumn(column);

		htmlText = "<html><div align=\"center\">Editable<br>Score</div></html>";
		column = Utilities.createTableColumn(EDITABLE_SCORE, htmlText, new FixedHeaderCellRenderer(htmlText),
			false);
		column.setIdentifier(EDITABLE_COLUMN_ID);
		columnModel.addColumn(column);

		htmlText = "<html><div align=\"center\">Race<br>Adj</div></html>";
		column = Utilities.createTableColumn(RACE_ADJ, htmlText, new FixedHeaderCellRenderer(htmlText), false);
		column.setCellRenderer(renderer);
		columnModel.addColumn(column);

		htmlText = "<html><div align=\"center\">Misc<br>Adj</div></html>";
		column = Utilities.createTableColumn(MISC_ADJ, htmlText, new FixedHeaderCellRenderer(htmlText), false);
		column.setCellRenderer(renderer);
		columnModel.addColumn(column);
	}
	statsTable.setColumnModel(columnModel);
	statsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
	statsTable.setShowVerticalLines(false);
	statsTable.setCellSelectionEnabled(false);
	statsTable.setFocusable(false);
	// XXX this should be calculated relative to font size and the size of a jspinner
	statsTable.setRowHeight(27);
	statsTable.setOpaque(false);
	tableHeader.setFont(FontManipulation.title(statsTable.getFont()));
	FontManipulation.large(statsTable);
}
 
Example 5
Source File: StatTableModel.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void initializeTable(JTable statsTable)
{
	JTableHeader tableHeader = statsTable.getTableHeader();
	tableHeader.setResizingAllowed(false);
	tableHeader.setReorderingAllowed(false);

	statsTable.setAutoCreateColumnsFromModel(false);
	DefaultTableColumnModel columnModel = new DefaultTableColumnModel();
	{
		TableColumn column =
				Utilities.createTableColumn(ABILITY_NAME, "Ability", new AbilityHeaderCellRenderer(), true);
		column.setIdentifier(ABILITY_COLUMN_ID);
		columnModel.addColumn(column);

		String htmlText = "<html><div align=\"center\">Final<br>Score</div></html>";
		column = Utilities.createTableColumn(FINAL_ABILITY_SCORE, htmlText, new FixedHeaderCellRenderer(htmlText),
			false);
		column.setCellRenderer(new ValueRenderer());
		columnModel.addColumn(column);

		TableCellRenderer renderer = new ModRenderer();
		htmlText = "<html><div align=\"center\">Ability<br>Mod</div></html>";
		column = Utilities.createTableColumn(ABILITY_MOD, htmlText, new FixedHeaderCellRenderer(htmlText), false);
		column.setCellRenderer(renderer);
		columnModel.addColumn(column);

		htmlText = "<html><div align=\"center\">Editable<br>Score</div></html>";
		column = Utilities.createTableColumn(EDITABLE_SCORE, htmlText, new FixedHeaderCellRenderer(htmlText),
			false);
		column.setIdentifier(EDITABLE_COLUMN_ID);
		columnModel.addColumn(column);

		htmlText = "<html><div align=\"center\">Race<br>Adj</div></html>";
		column = Utilities.createTableColumn(RACE_ADJ, htmlText, new FixedHeaderCellRenderer(htmlText), false);
		column.setCellRenderer(renderer);
		columnModel.addColumn(column);

		htmlText = "<html><div align=\"center\">Misc<br>Adj</div></html>";
		column = Utilities.createTableColumn(MISC_ADJ, htmlText, new FixedHeaderCellRenderer(htmlText), false);
		column.setCellRenderer(renderer);
		columnModel.addColumn(column);
	}
	statsTable.setColumnModel(columnModel);
	statsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
	statsTable.setShowVerticalLines(false);
	statsTable.setCellSelectionEnabled(false);
	statsTable.setFocusable(false);
	// XXX this should be calculated relative to font size and the size of a jspinner
	statsTable.setRowHeight(27);
	statsTable.setOpaque(false);
	tableHeader.setFont(FontManipulation.title(statsTable.getFont()));
	FontManipulation.large(statsTable);
}