List of usage examples for javax.swing JTable JTable
public JTable(TableModel dm)
JTable
that is initialized with dm
as the data model, a default column model, and a default selection model. From source file:cz.lidinsky.editor.Editor.java
/** * Create main frame of the editor/* ww w . ja v a2s . co m*/ */ protected void createMainFrame() { // Create and set up the window frame = new JFrame("GUI Editor"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // split the main window split = new JSplitPane(); frame.add(split); // split the right side JSplitPane rightSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); split.setBottomComponent(rightSplit); // Add component tree navigator treeModel = new TreeModel(); guiStructureTree = new Tree(treeModel); guiStructureTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); guiStructureTree.setDragEnabled(true); guiStructureTree.setTransferHandler(new TreeTransferHandler()); JScrollPane treeScroll = new JScrollPane(guiStructureTree); rightSplit.setLeftComponent(treeScroll); treeModel.addTreeModelListener(this); // add screens component split.setLeftComponent(treeModel.createRootVisualComponent()); treeModel.configureRootVisualComponent(); // Create file handling class file = new FileHandling(frame); file.addFileEventListener(treeModel); file.addFileEventListener(this); // Create edit handling class edit = new EditHandling(guiStructureTree); // Create layout handling class //layout = new LayoutHandling(guiStructureTree); // Add property editor table propertyTableModel = new KeyValueTableModel(); propertyTable = new JTable(propertyTableModel); propertyTable.setDefaultRenderer(Object.class, new ObjectPropertiesTableRenderer()); TableCellEditor tableCellEditor = new TableCellEditor(); propertyTable.setDefaultEditor(Object.class, tableCellEditor); guiStructureTree.addTreeSelectionListener(tableCellEditor); JScrollPane tableScroll = new JScrollPane(propertyTable); rightSplit.setBottomComponent(tableScroll); guiStructureTree.addTreeSelectionListener(this); propertyTableModel.addTableModelListener(guiStructureTree); // Add a link component -> tree componentToTreeLink = new ComponentToTreeLink(guiStructureTree); // Add a menu Menu menuBar = new Menu(settings); frame.setJMenuBar(menuBar); // Edit menu edit.addMenu(menuBar); }
From source file:org.angnysa.yaba.swing.BudgetFrame.java
private void buildReconciliationTable() { reconciliationModel = new ReconciliationTableModel(service); reconciliationTable = new JTable(reconciliationModel); reconciliationTable.setRowHeight((int) (reconciliationTable.getRowHeight() * 1.2)); reconciliationTable.setDefaultEditor(LocalDate.class, new CustomCellEditor(new JFormattedTextField(new JodaLocalDateFormat()))); reconciliationTable.setDefaultEditor(Double.class, new CustomCellEditor(new JFormattedTextField(NumberFormat.getNumberInstance()))); reconciliationTable.setDefaultRenderer(LocalDate.class, new FormattedTableCellRenderer(new JodaLocalDateFormat())); reconciliationTable.setDefaultRenderer(Double.class, new FormattedTableCellRenderer(TransactionAmountFormatFactory.getFormat())); reconciliationTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); reconciliationTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete"); //$NON-NLS-1$ reconciliationTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "delete"); //$NON-NLS-1$ reconciliationTable.getActionMap().put("delete", new AbstractAction() { //$NON-NLS-1$ private static final long serialVersionUID = 1L; @Override//from w w w. ja va2s.com public void actionPerformed(ActionEvent e) { int row = reconciliationTable.getSelectedRow(); if (row >= 0) { reconciliationModel.deleteRow(row); } } }); transactionTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int row = transactionTable.getSelectedRow(); if (row >= 0) { row = transactionTable.getRowSorter().convertRowIndexToModel(row); TransactionDefinition td = transactionModel.getTransactionForRow(row); if (td != null) { reconciliationModel.setCurrentTransactionId(td.getId()); } else { reconciliationModel.setCurrentTransactionId(-1); } } else { reconciliationModel.setCurrentTransactionId(-1); } } } }); }
From source file:edu.ku.brc.specify.dbsupport.cleanuptools.LocalityCleanup.java
public void doCleanup() { String sql = "SELECT LocalityName, cnt FROM (SELECT LocalityName, COUNT(LocalityName) as cnt FROM locality GROUP BY LocalityName) T1 WHERE cnt > 1 ORDER BY cnt desc "; for (Object[] cols : BasicSQLUtils.query(sql)) { items.add(new LocalityInfo((String) cols[0], (Integer) cols[1], true)); }/*from w w w. j a v a2 s . c o m*/ DefaultTableModel model = new DefaultTableModel() { /* (non-Javadoc) * @see javax.swing.table.DefaultTableModel#getColumnCount() */ @Override public int getColumnCount() { return header != null ? header.length : 0; } /* (non-Javadoc) * @see javax.swing.table.DefaultTableModel#getColumnName(int) */ @Override public String getColumnName(int column) { return header != null ? header[column] : ""; } /* (non-Javadoc) * @see javax.swing.table.DefaultTableModel#getRowCount() */ @Override public int getRowCount() { return items != null ? items.size() : 0; } /* (non-Javadoc) * @see javax.swing.table.DefaultTableModel#getValueAt(int, int) */ @Override public Object getValueAt(int row, int column) { LocalityInfo locInfo = items != null ? items.get(row) : null; if (locInfo != null) { switch (column) { case 0: return locInfo.isIncluded(); case 1: return locInfo.getLocalityName(); case 2: return locInfo.getCnt(); } } return null; } /* (non-Javadoc) * @see javax.swing.table.AbstractTableModel#getColumnClass(int) */ @Override public Class<?> getColumnClass(int columnIndex) { switch (columnIndex) { case 0: return Boolean.class; case 1: return String.class; case 2: return Integer.class; } return String.class; } /* (non-Javadoc) * @see javax.swing.table.DefaultTableModel#isCellEditable(int, int) */ @Override public boolean isCellEditable(int row, int column) { return column == 0; } /* (non-Javadoc) * @see javax.swing.table.DefaultTableModel#setValueAt(java.lang.Object, int, int) */ @Override public void setValueAt(Object aValue, int row, int column) { if (column == 0) { LocalityInfo locInfo = items != null ? items.get(row) : null; if (locInfo != null) { locInfo.setIncluded((Boolean) aValue); } } } }; JTable table = new JTable(model); CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "f:p:g")); pb.add(UIHelper.createScrollPane(table), cc.xy(1, 1)); pb.setDefaultDialogBorder(); CustomDialog dlg = new CustomDialog(null, "Locality Duplicates", true, pb.getPanel()); dlg.setVisible(true); if (!dlg.isCancelled()) { doFixDuplicates(); } }
From source file:org.esa.beam.visat.toolviews.diag.TileCacheMonitor.java
/** * Creates a new monitor panel./*from w ww. j ava 2 s .co m*/ * * @return the monitor panel */ public JPanel createPanel() { JPanel mainPanel = new JPanel(new BorderLayout()); CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time")); this.datasets = new TimeSeriesCollection[4]; this.datasets[0] = addSubPlot(plot, "#Tiles"); this.datasets[1] = addSubPlot(plot, "#Hits"); this.datasets[2] = addSubPlot(plot, "#Misses"); this.datasets[3] = addSubPlot(plot, "Mem (kB)"); JFreeChart chart = new JFreeChart(plot); LegendTitle legend = (LegendTitle) chart.getSubtitle(0); legend.setPosition(RectangleEdge.RIGHT); legend.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0, 4, 0, 4)); chart.setBorderPaint(Color.black); chart.setBorderVisible(true); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4)); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(60000.0); // 60 seconds textarea = new JTextArea(); tableModel = new TileCacheTableModel(); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 470)); chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); tabbedPane = new JTabbedPane(); tabbedPane.add(CACHE_INFO_TAB, new JScrollPane(textarea)); tabbedPane.add(CACHE_CHART_TAB, chartPanel); tabbedPane.add(IMAGES_TAB, new JScrollPane(new JTable(tableModel))); tabbedPane.setSelectedIndex(0); mainPanel.add(tabbedPane); return mainPanel; }
From source file:com.emental.mindraider.ui.panels.ConceptAttachmentsJPanel.java
public void init() { JPanel pp;/* w w w . ja v a 2 s .co m*/ setBorder(new TitledBorder(Messages.getString("ConceptJPanel.attachments"))); setLayout(new BorderLayout()); // button pp = new JPanel(); pp.setLayout(new GridLayout(3, 1)); JButton jbutton = new JButton("", IconsRegistry.getImageIcon("attach.png")); jbutton.setToolTipText(Messages.getString("ConceptJPanel.attachLocalResourceToConcept")); jbutton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // some concept must be selected - select graph node according // to the selected concept =-> touchgraph // method needed if (conceptJPanel.getConceptResource() == null) { JOptionPane.showMessageDialog(MindRaider.mainJFrame, Messages.getString("ConceptJPanel.attachResourceWarning"), Messages.getString("ConceptJPanel.attachmentError"), JOptionPane.ERROR_MESSAGE); return; } new AttachmentJDialog(conceptJPanel.getConceptResource()); } }); pp.add(jbutton); // @todo edit resource description // jbutton=new JButton("",IconsRegistry.getImageIcon("attachLink.png")); // jbutton.setToolTipText("Attach web resource to concept"); // jbutton.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // } // }); // pp.add(jbutton); // attach another concept/folder/resource... - perhaps extra frame with // radio jbutton = new JButton("", IconsRegistry.getImageIcon("launch.png")); jbutton.setToolTipText(Messages.getString("ConceptJPanel.showAttachment")); jbutton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (attachmentsTableModel.attachments != null) { if (attachments.getSelectedRow() == -1) { JOptionPane.showMessageDialog(MindRaider.mainJFrame, Messages.getString("ConceptJPanel.selectAttachmentToLaunch"), Messages.getString("ConceptJPanel.attachmentError"), JOptionPane.ERROR_MESSAGE); return; } String uri = attachmentsTableModel.attachments[attachments.getSelectedRow()].getUrl(); if (uri != null) { Node node = new Node(); node.setLabel(uri); node.setURL(uri); node.setType( MindRaider.spidersColorProfileRegistry.getCurrentProfile().getLiteralNodeType()); MindRaider.spidersGraph.handleDoubleSelect(node); } } } }); pp.add(jbutton); jbutton = new JButton("", IconsRegistry.getImageIcon("explorerDiscardSmall.png")); jbutton.setToolTipText(Messages.getString("ConceptJPanel.removeAttachment")); pp.add(jbutton); jbutton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (attachmentsTableModel.attachments != null) { if (getAttachments().getSelectedRow() != -1) { logger.debug(Messages.getString("ConceptJPanel.removingAttachment", getAttachments().getSelectedRow())); String attachUrl = getAttachmentsTableModel().attachments[getAttachments().getSelectedRow()] .getUrl(); logger.debug(Messages.getString("ConceptJPanel.removingAttachmentUrl", attachUrl)); if (conceptJPanel.getConceptResource() != null) { // check, that selected node is type of literal // (helper on spiders graph) MindRaider.noteCustodian.removeAttachment( MindRaider.profile.getActiveOutlineUri().toString(), conceptJPanel.getConceptResource(), attachUrl); conceptJPanel.refresh(); MindRaider.spidersGraph.renderModel(); return; } } JOptionPane.showMessageDialog(MindRaider.mainJFrame, Messages.getString("ConceptJPanel.selectAttachmentToRemove"), Messages.getString("ConceptJPanel.attachmentError"), JOptionPane.ERROR_MESSAGE); } } }); add(pp, BorderLayout.EAST); // table attachmentsTableModel = new AttachmentsTableModel(); attachments = new JTable(attachmentsTableModel) { private static final long serialVersionUID = 1L; public String getToolTipText(MouseEvent e) { String tip = null; java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); AttachmentsTableModel model = (AttachmentsTableModel) getModel(); tip = Messages.getString("ConceptJPanel.attachmentUrl") + model.attachments[rowIndex].getUrl(); // You can omit this part if you know you don't // have any renderers that supply their own tool // tips. // tip = super.getToolTipText(e); return tip; } }; TableColumn column = attachments.getColumnModel().getColumn(0); column.setMaxWidth(50); attachments.setRowHeight(20); attachments.setAutoscrolls(true); attachments.setPreferredScrollableViewportSize(new Dimension(500, 70)); JScrollPane scrollPane = new JScrollPane(attachments); add(scrollPane, BorderLayout.CENTER); }
From source file:edu.ku.brc.stats.StatGroupTable.java
/** * Constructor with the localized name of the Group * @param name name of the group (already been localized) * @param useSeparator use non-border separator titles *//*from w w w .j a v a2s.co m*/ public StatGroupTable(final String name, final String[] columnNames, final boolean useSeparator, final int numRows) { this.name = name; this.useSeparator = useSeparator; this.skinItem = SkinsMgr.getSkinItem("StatGroup"); if (progressIcon == null) { progressIcon = IconManager.getIcon("Progress", IconManager.IconSize.Std16); } setLayout(new BorderLayout()); setBackground(Color.WHITE); model = new StatGroupTableModel(this, columnNames); //table = numRows > SCROLLPANE_THRESOLD ? (new SortableJTable(new SortableTableModel(model))) : (new JTable(model)); if (numRows > SCROLLPANE_THRESOLD) { table = new SortableJTable(new SortableTableModel(model)) { protected void configureEnclosingScrollPane() { Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } // scrollPane.setColumnHeaderView(getTableHeader()); //scrollPane.getViewport().setBackingStoreEnabled(true); scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder")); } } } }; } else { table = new JTable(model) { protected void configureEnclosingScrollPane() { Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } // scrollPane.setColumnHeaderView(getTableHeader()); //scrollPane.getViewport().setBackingStoreEnabled(true); scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder")); } } } }; } table.setShowVerticalLines(false); table.setShowHorizontalLines(false); if (SkinsMgr.shouldBeOpaque(skinItem)) { table.setOpaque(false); setOpaque(false); } else { table.setOpaque(true); setOpaque(true); } table.addMouseMotionListener(new TableMouseMotion()); table.addMouseListener(new LinkListener()); if (table.getColumnModel().getColumnCount() == 1) { table.getColumnModel().getColumn(0) .setCellRenderer(new StatGroupTableCellRenderer(SwingConstants.CENTER, 1)); } else { table.getColumnModel().getColumn(0) .setCellRenderer(new StatGroupTableCellRenderer(SwingConstants.LEFT, 2)); table.getColumnModel().getColumn(1) .setCellRenderer(new StatGroupTableCellRenderer(SwingConstants.RIGHT, 2)); } //table.setRowSelectionAllowed(true); if (numRows > SCROLLPANE_THRESOLD) { scrollPane = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); if (table instanceof SortableJTable) { ((SortableJTable) table).installColumnHeaderListeners(); } scrollPane.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.setBorder(BorderFactory.createEmptyBorder()); //scrollPane.getViewport().setBorder(BorderFactory.createEmptyBorder()); } if (useSeparator) { setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); CellConstraints cc = new CellConstraints(); if (StringUtils.isNotEmpty(name)) { builder.addSeparator(name, cc.xy(1, 1)); } builder.add(scrollPane != null ? scrollPane : table, cc.xy(1, 2)); builder.getPanel().setOpaque(false); add(builder.getPanel()); } else { setBorder(BorderFactory.createEmptyBorder(15, 2, 2, 2)); setBorder(BorderFactory.createCompoundBorder(new CurvedBorder(new Color(160, 160, 160)), getBorder())); add(scrollPane != null ? scrollPane : table, BorderLayout.CENTER); } }
From source file:zet.gui.assignmentEditor.JAssignmentPanel.java
/** * Adds all components to the panel./*from w w w .j ava 2s.co m*/ */ private void addComponents() { setLayout(new BorderLayout()); initDistributions(); // Create the main table tablemodel = new AssignmentTableModel(); tablemodel.addTableModelListener(e -> { drawCharts(); }); distributionTable = new JTable(tablemodel); distributionTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); distributionTable.getSelectionModel().addListSelectionListener((ListSelectionEvent e) -> { drawCharts(); }); distributions = new JComboBox<>(); distributions.addItem(loc.getString("gui.AssignmentEditor.Distribution.NormalDistribution")); distributions.addItem(loc.getString("gui.AssignmentEditor.Distribution.UniformDistribution")); distributions.addItem(loc.getString("gui.AssignmentEditor.Distribution.ExponentialDistribution")); distributions.addItem(loc.getString("gui.AssignmentEditor.Distribution.ErlangDistribution")); distributions.addItem(loc.getString("gui.AssignmentEditor.Distribution.HyperExponentialDistribution")); distributionTable.getColumnModel().getColumn(COL_DISTRIBUTION) .setCellEditor(new DefaultCellEditor(distributions)); distributionTable.getColumnModel().getColumn(COL_PARAM1).setCellEditor(new SelectingCellEditor()); distributionTable.getColumnModel().getColumn(COL_PARAM2).setCellEditor(new SelectingCellEditor()); distributionTable.getColumnModel().getColumn(COL_PARAM3).setCellEditor(new SelectingCellEditor()); distributionTable.getColumnModel().getColumn(COL_PARAM4).setCellEditor(new SelectingCellEditor()); distributionTable.getColumnModel().getColumn(COL_PARAM3).setCellRenderer(new InactiveRenderer()); distributionTable.getColumnModel().getColumn(COL_PARAM4).setCellRenderer(new InactiveRenderer()); add(getRightPanel(), BorderLayout.CENTER); final JPanel leftPanel = getLeftPanel(); leftPanel.setMaximumSize(new Dimension(200, 0)); add(leftPanel, BorderLayout.WEST); assignmentSelector.displayAssignments(myProject.getProject()); }
From source file:dbseer.gui.user.DBSeerDataSet.java
public DBSeerDataSet() { live = new Boolean(false); Boolean[] trueFalse = { Boolean.TRUE, Boolean.FALSE }; JComboBox trueFalseBox = new JComboBox(trueFalse); final DefaultCellEditor dce = new DefaultCellEditor(trueFalseBox); uniqueVariableName = "dataset_" + UUID.randomUUID().toString().replace('-', '_'); uniqueModelVariableName = "mv_" + UUID.randomUUID().toString().replace('-', '_'); name = "Unnamed dataset"; tableModel = new DBSeerDataSetTableModel(null, new String[] { "Name", "Value" }, true); tableModel.addTableModelListener(this); table = new JTable(tableModel) { @Override//from w w w. j av a 2s . com public TableCellEditor getCellEditor(int row, int col) { if ((row == DBSeerDataSet.TYPE_USE_ENTIRE_DATASET || row > TYPE_NUM_TRANSACTION_TYPE + numTransactionTypes) && col == 1) return dce; return super.getCellEditor(row, col); } }; DefaultTableCellRenderer customRenderder = new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable jTable, Object o, boolean b, boolean b2, int row, int col) { Component cell = super.getTableCellRendererComponent(jTable, o, b, b2, row, col); if (row == DBSeerDataSet.TYPE_START_INDEX || row == DBSeerDataSet.TYPE_END_INDEX) { if (((Boolean) table.getValueAt(DBSeerDataSet.TYPE_USE_ENTIRE_DATASET, 1)) .booleanValue() == true) { cell.setForeground(Color.LIGHT_GRAY); } else { cell.setForeground(Color.BLACK); } } else if (row == DBSeerDataSet.TYPE_NUM_TRANSACTION_TYPE) { cell.setForeground(Color.LIGHT_GRAY); } else { cell.setForeground(Color.BLACK); } return cell; } }; table.getColumnModel().getColumn(0).setCellRenderer(customRenderder); table.getColumnModel().getColumn(1).setCellRenderer(customRenderder); table.setFillsViewportHeight(true); table.getColumnModel().getColumn(0).setMaxWidth(400); table.getColumnModel().getColumn(0).setPreferredWidth(300); table.getColumnModel().getColumn(1).setPreferredWidth(600); table.setRowHeight(20); this.useEntireDataSet = true; for (String header : tableHeaders) { if (header.equalsIgnoreCase("Use Entire DataSet")) tableModel.addRow(new Object[] { header, Boolean.TRUE }); else tableModel.addRow(new Object[] { header, "" }); } for (int i = 0; i < numTransactionTypes; ++i) { tableModel.addRow(new Object[] { "Name of Transaction Type " + (i + 1), "Type " + (i + 1) }); DBSeerTransactionType type = new DBSeerTransactionType("Type " + (i + 1), true); transactionTypes.add(type); } for (int i = 0; i < transactionTypes.size(); ++i) { DBSeerTransactionType txType = transactionTypes.get(i); if (txType.isEnabled()) { tableModel.addRow(new Object[] { "Use Transaction Type " + (i + 1), Boolean.TRUE }); } else { tableModel.addRow(new Object[] { "Use Transaction Type " + (i + 1), Boolean.FALSE }); } } this.updateTable(); dataSetLoaded = false; isCurrent = false; tableModel.setUseEntireDataSet(this.useEntireDataSet.booleanValue()); }
From source file:de.unidue.inf.is.ezdl.gframedl.components.AboutDialog.java
private JPanel getContent() { JPanel panel = new JPanel(new GridBagLayout()); JLabel iconLabel = new JLabel(new ImageIcon(Images.LOGO_EZDL_LARGE_SINGLE.getImage())); JTextArea licenseTextArea = new JTextArea(licenseText); licenseTextArea.setEditable(false);/* ww w .j a v a2s .co m*/ licenseTextArea.setLineWrap(true); licenseTextArea.setWrapStyleWord(true); licenseTextArea.setOpaque(false); licenseTextArea.setBorder(BorderFactory.createEmptyBorder()); JScrollPane licenseScrollPane = new JScrollPane(licenseTextArea); JTable propertiesTable = new JTable(tableModel); propertiesTable.setBackground(Color.WHITE); propertiesTable.setShowGrid(false); JScrollPane propertiesScrollPane = new JScrollPane(propertiesTable); propertiesScrollPane.setBackground(Color.WHITE); propertiesScrollPane.getViewport().setBackground(Color.WHITE); JButton closeButton = new JButton(I18nSupport.getInstance().getLocString("ezdl.controls.close")); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(I18nSupport.getInstance().getLocString("ezdl.licence"), licenseScrollPane); tabbedPane.addTab(I18nSupport.getInstance().getLocString("ezdl.properties"), propertiesScrollPane); tabbedPane.setBackground(Color.WHITE); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.insets = new Insets(0, 0, 0, 0); c.anchor = GridBagConstraints.CENTER; panel.add(iconLabel, c); c.gridx = 0; c.gridy = 1; c.weightx = 1; c.weighty = 1; c.anchor = GridBagConstraints.CENTER; c.fill = GridBagConstraints.BOTH; c.insets = new Insets(10, 20, 10, 20); panel.add(tabbedPane, c); c.gridy = 2; c.fill = GridBagConstraints.NONE; c.weighty = 0; c.insets = new Insets(0, 20, 10, 20); panel.add(closeButton, c); panel.setBackground(Color.WHITE); return panel; }
From source file:edu.harvard.mcz.imagecapture.RunnableJobReportDialog.java
/** * This method initializes jTable //from w ww.ja v a2 s. c o m * * @return javax.swing.JTable */ private JTable getJTable() { if (jTable == null) { jTable = new JTable(model); //jTable.setModel(model); } return jTable; }