下面列出了javax.swing.JTable#setShowVerticalLines ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void initJsfComponentTableVisualProperties(JTable table) {
table.setRowSelectionAllowed(true);
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setTableHeader(null);
table.setRowHeight(jsfComponentsTable.getRowHeight() + 4);
table.setIntercellSpacing(new java.awt.Dimension(0, 0));
// set the color of the table's JViewport
table.getParent().setBackground(table.getBackground());
table.setShowHorizontalLines(false);
table.setShowVerticalLines(false);
table.getColumnModel().getColumn(0).setMaxWidth(30);
if (!panel.isMaven()) {
table.getColumnModel().getColumn(2).setMaxWidth(100);
}
}
public static void setupTable(JTable table, int selectionModel, TableModel model, MouseListener mouseListener,
int... colWidth) {
table.setFillsViewportHeight(true);
table.setFont(StyleConstants.FONT_MONOSPACE_LARGE);
table.setRowHeight(StyleConstants.TABLE_ROW_HEIGHT_DEFAULT);
table.setShowHorizontalLines(true);
table.setShowVerticalLines(false);
table.setGridColor(Color.lightGray);
table.getColumnModel().setColumnMargin(StyleConstants.TABLE_COLUMN_MARGIN_DEFAULT);
table.setRowMargin(StyleConstants.TABLE_ROW_MARGIN_DEFAULT);
table.setSelectionMode(selectionModel);
if (model != null) {
table.setModel(model);
} else {
table.setModel(new DefaultTableModel());
}
if (mouseListener != null) {
table.removeMouseListener(mouseListener);
table.addMouseListener(mouseListener);
}
for (int i = 0; i < colWidth.length; i++) {
table.getColumnModel().getColumn(i).setMinWidth(colWidth[i]);
table.getColumnModel().getColumn(i).setMaxWidth(colWidth[i]);
}
}
private void initTableVisualProperties(JTable table) {
table.setRowSelectionAllowed(true);
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setTableHeader(null);
table.setRowHeight(jBrowsersTable.getRowHeight() + 4);
table.setIntercellSpacing(new java.awt.Dimension(0, 0));
// set the color of the table's JViewport
table.getParent().setBackground(table.getBackground());
table.setShowHorizontalLines(false);
table.setShowVerticalLines(false);
table.getColumnModel().getColumn(0).setMaxWidth(30);
}
private void initTableVisualProperties(JTable table) {
//table.setGridColor(jTableCpC.getBackground());
table.setRowHeight(jTableCpC.getRowHeight() + 4);
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
table.setIntercellSpacing(new java.awt.Dimension(0, 0));
// set the color of the table's JViewport
table.getParent().setBackground(table.getBackground());
table.setShowHorizontalLines(false);
table.setShowVerticalLines(false);
TableColumn column = table.getColumnModel().getColumn(1);
JTableHeader header = table.getTableHeader();
column.setMaxWidth(24 + SwingUtilities.computeStringWidth(header.getFontMetrics(header.getFont()), String.valueOf(column.getHeaderValue())));
header.setReorderingAllowed(false);
}
private static void checkTableGridLines() {
TableModel dataModel = new AbstractTableModel() {
public int getColumnCount() {
return 10;
}
public int getRowCount() {
return 10;
}
public Object getValueAt(int row, int col) {
return " ";
}
};
DefaultTableCellRenderer r = new DefaultTableCellRenderer();
r.setOpaque(true);
r.setBackground(CELL_RENDERER_BACKGROUND_COLOR);
JTable table = new JTable(dataModel);
table.setSize(WIDTH, HEIGHT);
table.setDefaultRenderer(Object.class, r);
table.setGridColor(GRID_COLOR);
table.setShowGrid(true);
table.setShowHorizontalLines(true);
table.setShowVerticalLines(true);
table.setBackground(TABLE_BACKGROUND_COLOR);
checkTableGridLines(table);
}
private static void checkTableGridLines() {
TableModel dataModel = new AbstractTableModel() {
public int getColumnCount() {
return 10;
}
public int getRowCount() {
return 10;
}
public Object getValueAt(int row, int col) {
return " ";
}
};
DefaultTableCellRenderer r = new DefaultTableCellRenderer();
r.setOpaque(true);
r.setBackground(CELL_RENDERER_BACKGROUND_COLOR);
JTable table = new JTable(dataModel);
table.setSize(WIDTH, HEIGHT);
table.setDefaultRenderer(Object.class, r);
table.setGridColor(GRID_COLOR);
table.setShowGrid(true);
table.setShowHorizontalLines(true);
table.setShowVerticalLines(true);
table.setBackground(TABLE_BACKGROUND_COLOR);
checkTableGridLines(table);
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
createUIComponents();
contentPanel = new JPanel();
contentPanel.setLayout(new GridLayoutManager(7, 3, new Insets(0, 0, 0, 0), -1, -1));
contentPanel.add(userAccountPanel, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final JLabel label1 = new JLabel();
this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("ImportForm.SelectTeamProject"));
contentPanel.add(label1, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
teamProjectFilter = new JTextField();
contentPanel.add(teamProjectFilter, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
teamProjectScrollPane = new JScrollPane();
contentPanel.add(teamProjectScrollPane, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
teamProjectTable = new JTable();
teamProjectTable.setFillsViewportHeight(true);
teamProjectTable.setShowHorizontalLines(false);
teamProjectTable.setShowVerticalLines(false);
teamProjectScrollPane.setViewportView(teamProjectTable);
final JLabel label2 = new JLabel();
this.$$$loadLabelText$$$(label2, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("ImportForm.NewRepositoryName"));
contentPanel.add(label2, new GridConstraints(5, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
repositoryName = new JTextField();
contentPanel.add(repositoryName, new GridConstraints(6, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
refreshButton.setText("");
refreshButton.setToolTipText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("ImportDialog.RefreshButton.ToolTip"));
contentPanel.add(refreshButton, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
busySpinner = new BusySpinnerPanel();
contentPanel.add(busySpinner, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
helpPanel = new HelpPanel();
helpPanel.setHelpText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoLookupHelp.helpText"));
helpPanel.setPopupText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoLookupHelp.Instructions"));
contentPanel.add(helpPanel, new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
*/
private void $$$setupUI$$$()
{
contentPane = new JPanel();
contentPane.setLayout( new BorderLayout( 0, 0 ) );
final JScrollPane scrollPane1 = new JScrollPane();
contentPane.add( scrollPane1, BorderLayout.CENTER );
apiTable = new JTable();
apiTable.setShowVerticalLines( true );
scrollPane1.setViewportView( apiTable );
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
frameworksScrollPane = new JScrollPane();
frameworksTable = new JTable();
descriptionLabel = new JLabel();
separator = new JSeparator();
configPanel = new JPanel();
setFocusTraversalPolicy(null);
frameworksTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
frameworksTable.setShowHorizontalLines(false);
frameworksTable.setShowVerticalLines(false);
frameworksTable.setTableHeader(null);
frameworksScrollPane.setViewportView(frameworksTable);
frameworksTable.getAccessibleContext().setAccessibleName(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.frameworksTable.AccessibleContext.accessibleName")); // NOI18N
frameworksTable.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.frameworksTable.AccessibleContext.accessibleDescription")); // NOI18N
descriptionLabel.setText("DUMMY"); // NOI18N
configPanel.setLayout(new BorderLayout());
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addComponent(separator, GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(descriptionLabel)
.addContainerGap())
.addComponent(configPanel, GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
.addComponent(frameworksScrollPane, GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(frameworksScrollPane, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(separator, GroupLayout.PREFERRED_SIZE, 10, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(descriptionLabel)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(configPanel, GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE))
);
frameworksScrollPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.frameworksScrollPane.AccessibleContext.accessibleName")); // NOI18N
frameworksScrollPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.frameworksScrollPane.AccessibleContext.accessibleDescription")); // NOI18N
descriptionLabel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.descriptionLabel.AccessibleContext.accessibleName")); // NOI18N
configPanel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.configPanel.AccessibleContext.accessibleName")); // NOI18N
configPanel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.configPanel.AccessibleContext.accessibleDescription")); // NOI18N
getAccessibleContext().setAccessibleName(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.AccessibleContext.accessibleName")); // NOI18N
getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PhpFrameworksPanelVisual.class, "PhpFrameworksPanelVisual.AccessibleContext.accessibleDescription")); // NOI18N
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
createUIComponents();
contentPanel = new JPanel();
contentPanel.setLayout(new GridLayoutManager(10, 3, new Insets(0, 0, 0, 0), -1, -1));
contentPanel.setName("");
final JLabel label1 = new JLabel();
this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoCheckoutForm.SelectRepository"));
contentPanel.add(label1, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
repositoryFilter = new JTextField();
repositoryFilter.setName("");
contentPanel.add(repositoryFilter, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final JLabel label2 = new JLabel();
this.$$$loadLabelText$$$(label2, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoCheckoutForm.ParentDirectory"));
contentPanel.add(label2, new GridConstraints(5, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label3 = new JLabel();
this.$$$loadLabelText$$$(label3, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoCheckoutForm.DirectoryName"));
contentPanel.add(label3, new GridConstraints(7, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
directoryName = new JTextField();
directoryName.setName("");
contentPanel.add(directoryName, new GridConstraints(8, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
contentPanel.add(userAccountPanel, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
repositoryTableScrollPane = new JScrollPane();
contentPanel.add(repositoryTableScrollPane, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
repositoryTable = new JTable();
repositoryTable.setFillsViewportHeight(true);
repositoryTable.setName("");
repositoryTable.setShowHorizontalLines(false);
repositoryTable.setShowVerticalLines(false);
repositoryTableScrollPane.setViewportView(repositoryTable);
parentDirectory = new TextFieldWithBrowseButton();
contentPanel.add(parentDirectory, new GridConstraints(6, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
helpPanel = new HelpPanel();
helpPanel.setHelpText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoLookupHelp.helpText"));
helpPanel.setPopupText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoLookupHelp.Instructions"));
contentPanel.add(helpPanel, new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
advancedCheckBox = new JCheckBox();
advancedCheckBox.setText("example text");
contentPanel.add(advancedCheckBox, new GridConstraints(9, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
busySpinner = new BusySpinnerPanel();
contentPanel.add(busySpinner, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
refreshButton.setToolTipText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("CheckoutDialog.RefreshButton.ToolTip"));
contentPanel.add(refreshButton, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, 1, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}
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);
}
/**
* 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);
}
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);
}