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

The following examples show how to use javax.swing.JTable#setBorder() . 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: KeysTableView.java    From pgptool with GNU General Public License v3.0 6 votes vote down vote up
private JScrollPane initTableComponent() {
	table = new JTable();

	// Adjust some visual appearence
	table.setRowHeight(22);
	table.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

	// Add listeners
	selectionModel = new DefaultListSelectionModel();
	selectionModel.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
	selectionModel.addListSelectionListener(rowSelectionListener);
	table.setSelectionModel(selectionModel);
	table.addMouseListener(listMouseListener);
	initTableKeyListener();

	// Envelope in scrollpane
	scrollPane = new JScrollPane();
	scrollPane.addMouseListener(listMouseListener);
	scrollPane.setViewportView(table);
	return scrollPane;
}
 
Example 2
Source File: HistoryQuickSearchView.java    From pgptool with GNU General Public License v3.0 6 votes vote down vote up
private JScrollPane initTableComponent() {
	table = new JTable();

	// Adjust some visual appearance
	table.setRowHeight(22);
	table.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

	// Add listeners
	selectionModel = new DefaultListSelectionModel();
	selectionModel.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
	selectionModel.addListSelectionListener((evt) -> pm.setSelected(getSelectedRow()));
	table.setSelectionModel(selectionModel);
	table.addMouseListener(listMouseListener);

	table.getActionMap().put("confirmRow", enterAction);
	table.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "confirmRow");

	// Envelope in scrollpane
	scrollPane = new JScrollPane();
	scrollPane.setViewportView(table);
	return scrollPane;
}
 
Example 3
Source File: DownloadListView.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
public DownloadListView(JPanel container) {
	model = new DownloadTableModel();
	XDMApp.getInstance().addListener(model);
	table = new JTable(model);
	table.setTableHeader(null);
	table.setDefaultRenderer(DownloadEntry.class, new XDMTableCellRenderer());
	table.setRowHeight(XDMUtils.getScaledInt(70));
	table.setShowGrid(false);
	table.setFillsViewportHeight(true);
	table.setBorder(new EmptyBorder(0, 0, 0, 0));
	table.setDragEnabled(true);
	// table.getSelectionModel().addListSelectionListener(new
	// ListSelectionListener() {
	// @Override
	// public void valueChanged(ListSelectionEvent e) {
	// int selectedRow = e.getFirstIndex();
	// selectedId = model.getIdAt(selectedRow);
	// Logger.log("Selected id1: " + selectedId+" row: "+selectedRow);
	// }
	// });
	//
	// model.addTableModelListener(new TableModelListener() {
	// @Override
	// public void tableChanged(TableModelEvent e) {
	// if(selectedId!=null){
	// int index=model.getIndexOfId(selectedId);
	// Logger.log("Index of "+selectedId+" is: "+index);
	// if(index>-1){
	// table.setRowSelectionInterval(index, index);
	// }
	// }
	// }
	// });

	JScrollPane jsp = new JScrollPane(table);
	jsp.setBorder(new EmptyBorder(0, 0, 0, 0));

	container.add(jsp);
}
 
Example 4
Source File: PurchaseModeFrame.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void renewAbilityScoreCostTable()
{
	JTable abilityScoreCostTable = new JTable();

	abilityScoreCostTable.setBorder(new BevelBorder(BevelBorder.LOWERED));
	abilityScoreCostTable.setModel(purchaseModel);
	abilityScoreCostTable.setToolTipText(LanguageBundle.getString("in_Prefs_setCost")); //$NON-NLS-1$
	jScrollPane1.setViewportView(abilityScoreCostTable);
}
 
Example 5
Source File: PurchaseModeFrame.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void renewAbilityScoreCostTable()
{
	JTable abilityScoreCostTable = new JTable();

	abilityScoreCostTable.setBorder(new BevelBorder(BevelBorder.LOWERED));
	abilityScoreCostTable.setModel(purchaseModel);
	abilityScoreCostTable.setToolTipText(LanguageBundle.getString("in_Prefs_setCost")); //$NON-NLS-1$
	jScrollPane1.setViewportView(abilityScoreCostTable);
}
 
Example 6
Source File: TimeSeriesMatrixTopComponent.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private JPanel createTablePanel() {
    JPanel mainPanel = new JPanel(new BorderLayout(4, 4));
    matrixModel = new MatrixTableModel();
    JTable matrixTable = new JTable(matrixModel);
    matrixCellRenderer = new MatrixCellRenderer(matrixModel);
    matrixTable.setDefaultRenderer(Double.class, matrixCellRenderer);
    matrixTable.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
    mainPanel.add(BorderLayout.CENTER, matrixTable);
    return mainPanel;
}
 
Example 7
Source File: PropriedadesSistema.java    From JCEditor with GNU General Public License v2.0 4 votes vote down vote up
/**
* O construtor se encarrega de exibir todo o diálogo
* O método getProperty(), da classe System foi utilizado para obter as informações do sistema
*/
public PropriedadesSistema() {
	setTitle("Sobre este Computador");
	
	tabela = new JTable();
	tabela.setEnabled(false);
	tabela.setShowHorizontalLines(false);
	tabela.setShowVerticalLines(false);
	tabela.setBackground(new Color(238, 238, 238));

	label = new JLabel("Informações");
	label.setFont(new Font("Roboto Light", Font.PLAIN, 28));

	tabela.setModel(new DefaultTableModel(
		new Object[][] {
			{"Sistema Operacional", System.getProperty("os.name") + " " + System.getProperty("os.version")},
			{"Arquitetura", System.getProperty("os.arch")},
			{"Usuário", System.getProperty("user.name")},
			{"Idioma", loc.getDisplayLanguage()},
			{"Versão do Java", System.getProperty("java.version")},
			{"Pasta de instalação do Java", System.getProperty("java.home")},
			{"Class Path", System.getProperty("java.class.path")},

		},
		new String[] {null, null}
		));

	tabela.setBorder(BorderFactory.createTitledBorder(
		null, null,
		TitledBorder.DEFAULT_JUSTIFICATION,
		TitledBorder.DEFAULT_POSITION,
		new Font("Roboto Light", 1, 14)
		));

	this.addKeyListener(new KeyAdapter() {
		public void keyPressed(KeyEvent ev) {
			if (ev.getKeyCode() == KeyEvent.VK_ESCAPE) {
				PropriedadesSistema.this.dispose();
			}
		}
	});

	this.getContentPane().add(BorderLayout.NORTH, label);
	this.getContentPane().add(BorderLayout.CENTER, tabela);
	this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
	this.setResizable(false);
	this.setSize(397, 175);//145
	this.setLocationRelativeTo(null);
	this.setModal(true);
	this.setVisible(true);
}