List of usage examples for javax.swing JTable AUTO_RESIZE_OFF
int AUTO_RESIZE_OFF
To view the source code for javax.swing JTable AUTO_RESIZE_OFF.
Click Source Link
From source file:GeMSE.GS.Analysis.Stats.OneSampleCovariancePanel.java
/** * 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.//from ww w . j a v a2 s . c om */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { BiasCorrectedCB = new javax.swing.JCheckBox(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); HeatmapL = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); matrixDG = new javax.swing.JTable(); BiasCorrectedCB.setText("bias corrected"); BiasCorrectedCB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BiasCorrectedCBActionPerformed(evt); } }); HeatmapL.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); HeatmapL.setText("GeMSE"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout .setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(HeatmapL, javax.swing.GroupLayout.DEFAULT_SIZE, 607, Short.MAX_VALUE) .addContainerGap())); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(HeatmapL, javax.swing.GroupLayout.DEFAULT_SIZE, 444, Short.MAX_VALUE) .addContainerGap())); jTabbedPane1.addTab(" Heat Map ", jPanel1); matrixDG.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { {}, {}, {}, {} }, new String[] { })); matrixDG.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); matrixDG.setCellSelectionEnabled(true); matrixDG.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); jScrollPane1.setViewportView(matrixDG); jTabbedPane1.addTab(" Grid View ", jScrollPane1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(BiasCorrectedCB) .addGap(0, 0, Short.MAX_VALUE)) .addComponent(jTabbedPane1)) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(BiasCorrectedCB) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTabbedPane1).addContainerGap())); }
From source file:core.reporting.ImportFromFile.java
private void validateCSVFile() { Iterable<CSVRecord> inrlst = null; try {/*from ww w.ja v a 2 s. c o m*/ Reader in = new FileReader(csvInputFile); inrlst = (new CSVParser(in, CSVFormat.EXCEL.withHeader()).getRecords()); } catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } int err = validateRecord(inrlst); // error found, show errors in system log ServiceRequest sr = null; putClientProperty(TConstants.JTABLE_AUTO_RESIZE_MODE, JTable.AUTO_RESIZE_OFF); if (err > 0) { String wc = "t_sluserid = '" + Session.getUserName() + "' AND t_slflag = 'ie'"; sr = new ServiceRequest(ServiceRequest.DB_QUERY, "t_system_log", wc); putClientProperty(TConstants.ICON_PARAMETERS, "0;;t_sltype"); putClientProperty(TConstants.SHOW_COLUMNS, "t_slmessage"); saveAction.setEnabled(false); } else { sr = new ServiceRequest(ServiceRequest.CLIENT_GENERATED_LIST, "", tempBuffer); sr.setParameter(ServiceResponse.RECORD_MODEL, ConnectionManager.getAccessTo(recordModel.getTableName()).getModel()); putClientProperty(TConstants.ICON_PARAMETERS, "-1;aa"); putClientProperty(TConstants.SHOW_COLUMNS, fileColumns); saveAction.setEnabled(true); } setServiceRequest(sr); /* * File f = (File) evt.getNewValue(); Record rcon = * ConnectionManager.getAccessTo("t_connections").exist("t_cnname = 'CsvJdbc'"); String u = (String) * rcon.getFieldValue("t_cnurl"); // rcon.setFieldValue("t_cnurl", u.replace("<filename>", * f.getAbsolutePath())); rcon.setFieldValue("t_cnurl", u.replace("<filename>", f.getParent())); * ConnectionManager.connect(rcon); String tn = "CsvJdbc." + f.getName().split("[.]")[0]; Record rm = * ConnectionManager.getAccessTo(tn).getModel(); ServiceRequest sr = new ServiceRequest(ServiceRequest.DB_QUERY, * tn, null); sr.setParameter(ServiceRequest.ORDER_BY, "ficha"); setServiceRequest(sr); */ }
From source file:Visuals.PieChart.java
public JPanel addCharts() { ChartPanel piePanel = drawPieChart(); piePanel.setDomainZoomable(true);/* www .j a v a 2 s. c om*/ JPanel thisPiePanel = new JPanel(); String[][] finalRisks = new String[riskCount][4]; for (int i = 0; i < riskCount; i++) { finalRisks[i][0] = risks[i][0]; finalRisks[i][1] = risks[i][1]; finalRisks[i][2] = risks[i][2]; finalRisks[i][3] = risks[i][3]; } JTable table = new JTable(finalRisks, columns); //table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); TableRowSorter<TableModel> sorter = new TableRowSorter<>(table.getModel()); table.setRowSorter(sorter); List<RowSorter.SortKey> sortKeys = new ArrayList<>(); int columnIndexToSort = 2; sortKeys.add(new RowSorter.SortKey(columnIndexToSort, SortOrder.ASCENDING)); sorter.setSortKeys(sortKeys); sorter.sort(); TableColumn tcol = table.getColumnModel().getColumn(2); table.removeColumn(tcol); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.getColumnModel().getColumn(1).setPreferredWidth(600); table.getColumnModel().getColumn(2).setPreferredWidth(600); JLabel right = new JLabel( " "); thisPiePanel.add(right, BorderLayout.EAST); table.setShowHorizontalLines(true); table.setRowHeight(40); JScrollPane tableScrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); Dimension d = table.getPreferredSize(); tableScrollPane .setPreferredSize(new Dimension((d.width - 400), (table.getRowHeight() + 1) * (riskCount + 1))); table.setEnabled(false); thisPiePanel.setLayout(new BorderLayout()); if (riskCount == 0) { thisPiePanel.add(piePanel, BorderLayout.CENTER); } else { thisPiePanel.add(right, BorderLayout.EAST); thisPiePanel.add(piePanel, BorderLayout.CENTER); thisPiePanel.add(tableScrollPane, BorderLayout.SOUTH); } thisPiePanel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1)); return thisPiePanel; }
From source file:com.floreantpos.bo.ui.explorer.MenuItemExplorer.java
public MenuItemExplorer() { tableModel = new BeanTableModel<MenuItem>(MenuItem.class); tableModel.addColumn(POSConstants.ID.toUpperCase(), "id"); //$NON-NLS-1$ tableModel.addColumn(POSConstants.NAME.toUpperCase(), "name"); //$NON-NLS-1$ tableModel.addColumn(POSConstants.TRANSLATED_NAME.toUpperCase(), "translatedName"); //$NON-NLS-1$ tableModel.addColumn(POSConstants.PRICE.toUpperCase() + " (" + CurrencyUtil.getCurrencySymbol() + ")", //$NON-NLS-1$//$NON-NLS-2$ "price"); //$NON-NLS-1$ tableModel.addColumn(Messages.getString("MenuItemExplorer.16"), "stockAmount"); //$NON-NLS-1$ //$NON-NLS-2$ tableModel.addColumn(POSConstants.VISIBLE.toUpperCase(), "visible"); //$NON-NLS-1$ tableModel.addColumn(POSConstants.FOOD_GROUP.toUpperCase(), "parent"); //$NON-NLS-1$ tableModel.addColumn(POSConstants.TAX.toUpperCase(), "tax"); //$NON-NLS-1$ tableModel.addColumn(Messages.getString("MenuItemExplorer.21"), "sortOrder"); //$NON-NLS-1$ //$NON-NLS-2$ tableModel.addColumn(Messages.getString("MenuItemExplorer.23"), "buttonColor"); //$NON-NLS-1$ //$NON-NLS-2$ tableModel.addColumn(Messages.getString("MenuItemExplorer.25"), "textColor"); //$NON-NLS-1$ //$NON-NLS-2$ tableModel.addColumn(POSConstants.IMAGE.toUpperCase(), "imageData"); //$NON-NLS-1$ List<MenuItem> findAll = MenuItemDAO.getInstance().getMenuItems(); tableModel.addRows(findAll);/* www . j a v a 2 s .c o m*/ table = new JXTable(tableModel); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.setDefaultRenderer(Object.class, new CustomCellRenderer()); table.setRowHeight(60); setLayout(new BorderLayout(5, 5)); add(new JScrollPane(table)); add(createButtonPanel(), BorderLayout.SOUTH); add(buildSearchForm(), BorderLayout.NORTH); resizeColumnWidth(table); table.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { if (me.getClickCount() == 2) { doEditSelectedMenuItem(); } } }); }
From source file:joinery.impl.Display.java
public static <V> void show(final DataFrame<V> df) { final List<Object> columns = new ArrayList<>(df.columns()); final List<Class<?>> types = df.types(); SwingUtilities.invokeLater(new Runnable() { @Override//w w w. jav a2 s . c o m public void run() { final JFrame frame = new JFrame(title(df)); final JTable table = new JTable(new AbstractTableModel() { private static final long serialVersionUID = 1L; @Override public int getRowCount() { return df.length(); } @Override public int getColumnCount() { return df.size(); } @Override public Object getValueAt(final int row, final int col) { return df.get(row, col); } @Override public String getColumnName(final int col) { return String.valueOf(columns.get(col)); } @Override public Class<?> getColumnClass(final int col) { return types.get(col); } }); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.add(new JScrollPane(table)); frame.pack(); frame.setVisible(true); } }); }
From source file:Visuals.RingChart.java
public JPanel addAVCharts() { JPanel thisPanel = new JPanel(); thisPanel.setLayout(new BorderLayout()); int tempCriticalCount = 0, tempUpdatedCount = 0; String[][] criticalList = new String[critical][4]; String[][] updatedList = new String[low][4]; for (int i = 0; i < riskCount; i++) { if (risks[i][2].equals("Critical")) { criticalList[tempCriticalCount][0] = risks[i][0]; criticalList[tempCriticalCount][1] = risks[i][1]; criticalList[tempCriticalCount][3] = risks[i][3]; tempCriticalCount++;//w w w.j a v a2 s. c om } if (risks[i][2].equals("Low")) { updatedList[tempUpdatedCount][0] = risks[i][0]; updatedList[tempUpdatedCount][1] = risks[i][1]; tempUpdatedCount++; } } JTable criticalTable = new JTable(criticalList, criticalColumns); JTable updatedTable = new JTable(updatedList, updatedColumns); TableColumn tcol = criticalTable.getColumnModel().getColumn(2); criticalTable.removeColumn(tcol); TableColumn tcol2 = updatedTable.getColumnModel().getColumn(2); updatedTable.removeColumn(tcol2); criticalTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); updatedTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); criticalTable.setEnabled(false); updatedTable.setEnabled(false); int width = 0; for (int i = 0; i < 3; i++) { for (int row = 0; row < criticalTable.getRowCount(); row++) { TableCellRenderer renderer = criticalTable.getCellRenderer(row, i); Component comp = criticalTable.prepareRenderer(renderer, row, i); width = Math.max(comp.getPreferredSize().width, width); } criticalTable.getColumnModel().getColumn(i).setPreferredWidth(width); width = 0; } for (int i = 0; i < 2; i++) { for (int row = 0; row < updatedTable.getRowCount(); row++) { TableCellRenderer renderer = updatedTable.getCellRenderer(row, i); Component comp = updatedTable.prepareRenderer(renderer, row, i); width = Math.max(comp.getPreferredSize().width, width); } updatedTable.getColumnModel().getColumn(i).setPreferredWidth(width); width = 0; } criticalTable.setShowHorizontalLines(true); criticalTable.setRowHeight(40); updatedTable.setShowHorizontalLines(true); updatedTable.setRowHeight(40); JScrollPane criticalTableScrollPane = new JScrollPane(criticalTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); JScrollPane updatedTableScrollPane = new JScrollPane(updatedTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); Dimension d = criticalTable.getPreferredSize(); criticalTableScrollPane.setPreferredSize( new Dimension((d.width - 400), (criticalTable.getRowHeight() + 1) * (tempCriticalCount + 1))); Dimension d2 = updatedTable.getPreferredSize(); updatedTableScrollPane.setPreferredSize( new Dimension((d.width - 400), (updatedTable.getRowHeight() + 1) * (tempUpdatedCount + 1))); Font titleFonts = new Font("Calibri", Font.BOLD, 30); JLabel criticalLabel = new JLabel(" Critical "); criticalLabel.setFont(titleFonts); criticalLabel.setForeground(new Color(230, 27, 27)); JPanel leftPanel = new JPanel(); leftPanel.setLayout(new BorderLayout()); leftPanel.add(criticalLabel, BorderLayout.WEST); leftPanel.add(criticalTableScrollPane, BorderLayout.CENTER); JLabel updatedLabel = new JLabel(" Updated "); updatedLabel.setFont(titleFonts); updatedLabel.setForeground(new Color(47, 196, 6)); JPanel rightPanel = new JPanel(); rightPanel.setLayout(new BorderLayout()); rightPanel.add(updatedLabel, BorderLayout.WEST); rightPanel.add(updatedTableScrollPane, BorderLayout.CENTER); if (tempCriticalCount != 0) thisPanel.add(leftPanel, BorderLayout.NORTH); if (tempUpdatedCount != 0) thisPanel.add(rightPanel, BorderLayout.SOUTH); return thisPanel; }
From source file:edu.ku.brc.specify.plugins.sgr.SGRResultsDisplay.java
private JTable createTable(DefaultTableModel resultsTableModel, final List<List<Color>> rowColors) { JTable table = new JTable(resultsTableModel) { public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int colIndex) { Component c = super.prepareRenderer(renderer, rowIndex, colIndex); final Color bgColor = isCellSelected(rowIndex, colIndex) ? getSelectionBackground() : rowColors.get(rowIndex).get(colIndex); c.setBackground(bgColor);//w w w .jav a 2 s . co m return c; } }; DefaultTableCellRenderer tcr = getTableCellRenderer();//model.getRowInfoList()); for (int i = 0; i < resultsTableModel.getColumnCount(); i++) { if (resultsTableModel.getColumnClass(i) != Boolean.class) { table.setDefaultRenderer(resultsTableModel.getColumnClass(i), tcr); } } table.setCellSelectionEnabled(true); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); UIHelper.makeTableHeadersCentered(table, false); table.setDefaultRenderer(String.class, new BiColorTableCellRenderer(false)); table.setRowHeight(ROW_HEIGHT); autoResizeColWidth(table, resultsTableModel); return table; }
From source file:com.clough.android.adbv.view.MainFrame.java
public MainFrame() { initComponents();/*from w w w. ja va 2s.com*/ setIconImage(ValueHolder.Icons.APPLICATION.getImage()); setExtendedState(JFrame.MAXIMIZED_BOTH); Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); double windowWidth = screenDimension.getWidth(); double windowHeight = screenDimension.getHeight(); int frameWidth = (int) (windowWidth * (3d / 4d)); int frameHeight = (int) (windowHeight * (3d / 4d)); setMinimumSize(new Dimension(frameWidth, frameHeight)); setLocation((int) ((windowWidth - frameWidth) / 2d), (int) ((windowHeight - frameHeight) / 2d)); int deviderSize = (int) (frameWidth * (1d / 100d)); int deviderLocationForSpliter0 = (int) (frameWidth / 5d); splitPane0.setDividerLocation(deviderLocationForSpliter0); int deviderLocationForSpliter1 = (int) (frameWidth * (6d / 7d)); splitPane1.setDividerLocation(deviderLocationForSpliter1); int subDeviderLocation = (int) (frameHeight / 6d); splitPane2.setDividerLocation(subDeviderLocation); queryHistoryContainerPanel.setMinimumSize(new Dimension(deviderLocationForSpliter0, 0)); queryRootConatinerPanel.setMinimumSize(new Dimension(0, subDeviderLocation)); queryingTextArea.requestFocus(); resultTable.setModel(new DefaultTableModel() { @Override public boolean isCellEditable(int row, int column) { return false; } }); defaultTableModel = (DefaultTableModel) resultTable.getModel(); resultTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); tableColumnAdjuster = new TableColumnAdjuster(resultTable); historyContainingPanel.setLayout(new GridLayout(0, 1)); }
From source file:com.vgi.mafscaling.OpenLoop.java
private void createRunTables(JPanel dataRunPanel) { GridBagConstraints gbc_run = new GridBagConstraints(); gbc_run.anchor = GridBagConstraints.PAGE_START; gbc_run.insets = new Insets(0, 2, 0, 2); for (int i = 0; i < RunCount; ++i) { runTables[i] = new JTable(); JTable table = runTables[i]; table.getTableHeader().setReorderingAllowed(false); table.setModel(new DefaultTableModel(RunRowsCount, 3)); table.setColumnSelectionAllowed(true); table.setCellSelectionEnabled(true); table.setBorder(new LineBorder(new Color(0, 0, 0))); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); table.getColumnModel().getColumn(0) .setHeaderValue("<html><center>Engine<br>Speed<br>(RPM)<br></center></html>"); table.getColumnModel().getColumn(1) .setHeaderValue("<html><center>MAF<br>Sensor<br>Voltage<br></center></html>"); table.getColumnModel().getColumn(2) .setHeaderValue("<html><center>AFR<br>Error<br>%<br></center></html>"); Utils.initializeTable(table, ColumnWidth); excelAdapter.addTable(table, true, false); gbc_run.gridx = i;/*from w ww. ja v a2s.co m*/ gbc_run.gridy = 0; dataRunPanel.add(table.getTableHeader(), gbc_run); gbc_run.gridy = 1; dataRunPanel.add(table, gbc_run); } }
From source file:Visuals.BarChart.java
public JPanel addCharts() { ChartPanel barPanel = drawBarChart(); barPanel.setDomainZoomable(true);// www . j a v a 2 s .c o m JPanel thisBarPanel = new JPanel(); thisBarPanel.setLayout(new BorderLayout()); String[][] finalRisks = new String[riskCount][4]; for (int i = 0; i < riskCount; i++) { finalRisks[i][0] = risks[i][0]; finalRisks[i][1] = risks[i][1]; finalRisks[i][2] = risks[i][2]; finalRisks[i][3] = risks[i][3]; } JTable table = new JTable(finalRisks, columns); //table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); TableRowSorter<TableModel> sorter = new TableRowSorter<>(table.getModel()); table.setRowSorter(sorter); List<RowSorter.SortKey> sortKeys = new ArrayList<>(); int columnIndexToSort = 2; sortKeys.add(new RowSorter.SortKey(columnIndexToSort, SortOrder.ASCENDING)); sorter.setSortKeys(sortKeys); sorter.sort(); TableColumn tcol = table.getColumnModel().getColumn(2); table.removeColumn(tcol); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.getColumnModel().getColumn(1).setPreferredWidth(600); table.getColumnModel().getColumn(2).setPreferredWidth(600); table.setShowHorizontalLines(true); table.setRowHeight(40); table.setEnabled(false); JScrollPane tableScrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); Dimension d = table.getPreferredSize(); tableScrollPane .setPreferredSize(new Dimension((d.width - 400), (table.getRowHeight() + 1) * (riskCount + 1))); JLabel right = new JLabel( " "); thisBarPanel.add(right, BorderLayout.EAST); thisBarPanel.add(barPanel, BorderLayout.CENTER); thisBarPanel.add(tableScrollPane, BorderLayout.SOUTH); return thisBarPanel; }