List of usage examples for javax.swing JTextPane JTextPane
public JTextPane()
JTextPane
. From source file:org.apache.ftpserver.gui.LoggerPanel.java
/** * Initialize UI components.//w ww. java2s. c o m */ private void initComponents() { setLayout(new BorderLayout()); // add top combo panel JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); add(topPanel, BorderLayout.NORTH); JLabel comboLab = new JLabel("Log Level :: "); comboLab.setForeground(Color.black); topPanel.add(comboLab); m_logCombo = new JComboBox(LEVELS); m_logCombo.setSelectedIndex(LEVEL_INFO); Dimension dim = new Dimension(90, 22); m_logCombo.setPreferredSize(dim); m_logCombo.setMaximumSize(dim); m_logCombo.setToolTipText("Set Log Level"); m_logCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent evt) { m_logLevel = m_logCombo.getSelectedIndex(); } }); topPanel.add(m_logCombo); // add text pane m_logTxt = new JTextPane(); m_logTxt.setFont(new Font("Monospaced", Font.PLAIN, 12)); m_logTxt.setEditable(false); m_doc = m_logTxt.getDocument(); JPanel noWrapPanel = new JPanel(new BorderLayout()); noWrapPanel.add(m_logTxt); add(new JScrollPane(noWrapPanel), BorderLayout.CENTER); // add clear button panel JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); add(bottomPanel, BorderLayout.SOUTH); JButton clearAction = new JButton("Clear"); clearAction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { m_doc.remove(0, m_doc.getLength()); } catch (Exception ex) { ex.printStackTrace(); } } }); bottomPanel.add(clearAction); }
From source file:org.apache.tika.gui.TikaGUI.java
private JEditorPane addCard(JPanel panel, String type, String name) { JEditorPane editor = new JTextPane(); editor.setBackground(Color.WHITE); editor.setContentType(type);// w ww .j a v a 2 s . c o m editor.setTransferHandler(new ParsingTransferHandler(editor.getTransferHandler(), this)); panel.add(new JScrollPane(editor), name); return editor; }
From source file:org.cagrid.installer.steps.PresentLicenseStep.java
public void init(WizardModel m) { this.model = (CaGridInstallerModel) m; setLayout(new BorderLayout()); setSize(new Dimension(475, 161)); JPanel licensePanel = new JPanel(); licensePanel.setBackground(Color.WHITE); JTextPane textPane = new JTextPane(); licensePanel.add(textPane);/*from w w w .ja va 2 s. co m*/ JScrollPane scrollPane = new JScrollPane(licensePanel); scrollPane.setPreferredSize(new Dimension(475, 150)); add(scrollPane, BorderLayout.CENTER); try { StringBuilder sb = new StringBuilder(); BufferedReader r = new BufferedReader( new InputStreamReader(getClass().getResourceAsStream("/cagrid_license.txt"))); String line = null; while ((line = r.readLine()) != null) { sb.append(line).append("\n"); } textPane.setText(sb.toString()); textPane.setFont(textPane.getFont().deriveFont((float) 10)); } catch (Exception ex) { String msg = "Error loading license: " + ex.getMessage(); logger.error(msg, ex); JOptionPane.showMessageDialog(null, msg, this.model.getMessage("error"), JOptionPane.ERROR_MESSAGE); } JPanel controlPanel = new JPanel(); controlPanel.setLayout(new GridBagLayout()); add(controlPanel, BorderLayout.SOUTH); JLabel label = new JLabel(this.model.getMessage("accept.license")); controlPanel.add(label); JCheckBox checkBox = new JCheckBox(); checkBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent evt) { PresentLicenseStep.this.setComplete(evt.getStateChange() == ItemEvent.SELECTED); } }); controlPanel.add(checkBox); }
From source file:org.colombbus.tangara.AboutWindow.java
private JScrollPane getTextZone() { if (scroll == null) { credits = new JTextPane(); String text = creditText(); credits.setContentType("text/html"); credits.setText(text);/*from w w w . j av a2s. co m*/ credits.setFont(new Font("Arial", Font.PLAIN, 20)); credits.setEditable(false); credits.setOpaque(false); scroll = new JScrollPane(credits); scroll.getViewport().setOpaque(false); scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scroll.setPreferredSize( new Dimension((windowWidth * 3 / 4) - marginLeft, windowHeight / 2 - marginBottom)); scroll.setOpaque(false); scroll.setBorder(new EmptyBorder(0, 0, 0, 0)); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { scroll.getVerticalScrollBar().setValue(0); } }); } return scroll; }
From source file:org.colombbus.tangara.CommandSelection.java
/** * This method initializes fileContents/*from ww w . j a va 2 s .com*/ * * @return javax.swing.JTextArea */ private JTextPane getFileContents() { if (fileContents == null) { fileContents = new JTextPane(); fileContents.setName("fileContents"); } return fileContents; }
From source file:org.drugis.addis.gui.WelcomeDialog.java
private JTextPane createLabel(String txt) { JTextPane pane = new JTextPane(); pane.setText(txt);/*from ww w . j ava 2 s. c om*/ setBorder(pane); pane.setEditable(false); return pane; }
From source file:org.drugis.addis.gui.wizard.AddStudyWizard.java
private static JComponent buildTip(String tip) { JTextPane area = new JTextPane(); StyledDocument doc = area.getStyledDocument(); addStylesToDoc(doc);/*from w w w. j a v a2 s . com*/ area.setBackground(new Color(255, 180, 180)); try { doc.insertString(0, "x", doc.getStyle("tip")); doc.insertString(doc.getLength(), " Tip: \n", doc.getStyle("bold")); doc.insertString(doc.getLength(), tip, doc.getStyle("regular")); } catch (BadLocationException e) { e.printStackTrace(); } area.setEditable(false); JScrollPane pane = new JScrollPane(area); pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); pane.setPreferredSize(TextComponentFactory.textPaneDimension(area, 270, 70)); pane.setWheelScrollingEnabled(true); pane.getVerticalScrollBar().setValue(0); return pane; }
From source file:org.echocat.velma.dialogs.AboutDialog.java
protected void createIntroduction(@Nonnull Resources resources) { final URL iconUrl = resources.getIconUrl(48); final StringBuilder body = new StringBuilder(); body.append("<html>"); body.append("<head><style>" + "td { margin-right: 10px; }" + "</style></head>"); body.append("<body style='font-family: sans; font-size: 1em'><table><tr>"); body.append("<td valign='top'><img src='").append(iconUrl).append("' /></td>"); body.append("<td valign='top'>"); body.append("<h2>").append(escapeHtml4(resources.getApplicationName())); final String version = resources.getVersion(); if (!isEmpty(version)) { body.append("<br/><span style='font-size: 0.6em'>") .append(resources.formatEscaped("versionText", version)).append("</span>"); }/*from w ww . ja v a2 s.co m*/ body.append("</h2>"); body.append("<p>Copyright 2011-2012 <a href='https://echocat.org'>echocat</a></p>"); body.append("<p><a href='http://mozilla.org/MPL/2.0/'>") .append(resources.formatEscaped("licensedUnder", "MPL 2.0")).append("</a></p>"); body.append("<p><table cellpadding='0' cellspacing='0'>"); body.append("<tr><td>").append(resources.formatEscaped("xHomepage", "echocat")) .append(":</td><td><a href='https://echocat.org'>echocat.org</a></td></tr>"); body.append("<tr><td>").append(resources.formatEscaped("xHomepage", "Velma")) .append(":</td><td><a href='https://velma.echocat.org'>velma.echocat.org</a></td></tr>"); body.append("</table></p>"); body.append("<h4>").append(resources.formatEscaped("developers")) .append("</h4><table cellpadding='0' cellspacing='0'>"); body.append( "<tr><td>Gregor Noczinski</td><td><a href='mailto:gregor@noczinski.eu'>gregor@noczinski.eu</a></td><td><a href='https://github.com/blaubaer'>github.com/blaubaer</a></td></tr>"); body.append("</table>"); body.append("</td>"); body.append("</tr></table></body></html>"); final JTextPane text = new JTextPane(); text.setMargin(new Insets(0, 0, 0, 0)); text.setContentType("text/html"); text.setText(body.toString()); text.setFont(new Font(DIALOG, PLAIN, 12)); text.setBackground(new Color(255, 255, 255, 0)); text.setEditable(false); text.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == ACTIVATED && isDesktopSupported()) { final Desktop desktop = getDesktop(); if (desktop.isSupported(BROWSE)) { try { desktop.browse(e.getURL().toURI()); } catch (IOException | URISyntaxException exception) { LOG.error("Could not open " + e.getURL() + " because of an exception.", exception); } } else { LOG.error("Could not open " + e.getURL() + " because browse is not supported by desktop."); } } repaint(); } }); text.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { repaint(); } @Override public void mousePressed(MouseEvent e) { repaint(); } @Override public void mouseReleased(MouseEvent e) { repaint(); } @Override public void mouseEntered(MouseEvent e) { repaint(); } @Override public void mouseExited(MouseEvent e) { repaint(); } }); add(text, new CC().spanX(2).growX().minWidth("10px")); }
From source file:org.geworkbench.engine.ccm.ComponentConfigurationManagerWindow.java
/** * Set up the GUI// w ww .java 2 s. c o m * * @param void * @return void */ private void initComponents() { frame = new JFrame("geWorkbench - Component Configuration Manager"); topPanel = new JPanel(); displayLabel = new JLabel(); String[] displayChoices = { DISPLAY_FILTER_ALL, DISPLAY_ONLY_LOADED, DISPLAY_ONLY_UNLOADED }; displayComboBox = new JComboBox(displayChoices); showByTypeLabel = new JLabel(); String[] showByTypeChoices = new String[PluginComponent.categoryList.size() + 2]; showByTypeChoices[0] = SHOW_BY_TYPE_ALL; int index = 1; for (String s : PluginComponent.categoryList) { showByTypeChoices[index] = s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase(); index++; } ; showByTypeChoices[index] = SHOW_BY_TYPE_OTHERS; Arrays.sort(showByTypeChoices); showByTypeComboBox = new JComboBox(showByTypeChoices); showByTypeComboBox.setMaximumRowCount(showByTypeChoices.length); keywordSearchLabel = new JLabel("Keyword search:"); keywordSearchField = new JTextField("Enter Text"); splitPane = new JSplitPane(); scrollPaneForTextPane = new JScrollPane(); textPane = new JTextPane(); bottompanel = new JPanel(); CellConstraints cc = new CellConstraints(); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { ccmWindow = null; } }); viewLicenseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { viewLicense_actionPerformed(e); } }); applyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { applyCcmSelections_actionPerformed(e); } }); resetButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { resetCcmSelections_actionPerformed(e); } }); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { closeCcmSelections_actionPerformed(e); } }); //======== frame ======== { Container frameContentPane = frame.getContentPane(); frameContentPane.setLayout(new BorderLayout()); //======== outerPanel ======== { frameContentPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); //======== topPanel ======== { FormLayout topPanelLayout = new FormLayout( " 32dlu, default, 4dlu, default, 32dlu, default, 4dlu, default, 32dlu, default, 4dlu, 64dlu, 32dlu", "center:25dlu"); topPanel.setLayout(topPanelLayout); //---- displayLabel ---- displayLabel.setText("Display:"); topPanel.add(displayLabel, cc.xy(2, 1)); //======== scrollPaneForTopList1 ======== { //---- displayComboBox ---- ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { ItemSelectable is = (ItemSelectable) actionEvent.getSource(); Object[] selections = is.getSelectedObjects(); String selection = (String) selections[0]; ccmTableModel.setLoadedFilterValue(selection); sorter.setRowFilter(combinedFilter); ccmTableModel.fireTableDataChanged(); } }; displayComboBox.addActionListener(actionListener); } topPanel.add(displayComboBox, cc.xy(4, 1)); //---- showByTypeLabel ---- showByTypeLabel.setText("Show by type:"); topPanel.add(showByTypeLabel, cc.xy(6, 1)); //======== scrollPaneForTopList2 ======== { //---- showByTypeComboBox ---- ActionListener actionListener2 = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { ItemSelectable is = (ItemSelectable) actionEvent.getSource(); Object[] selections = is.getSelectedObjects(); String selection = (String) selections[0]; ccmTableModel.setTypeFilterValue(selection); sorter.setRowFilter(combinedFilter); ccmTableModel.fireTableDataChanged(); } }; showByTypeComboBox.addActionListener(actionListener2); } topPanel.add(showByTypeComboBox, cc.xy(8, 1)); //---- topLabel3 ---- topPanel.add(keywordSearchLabel, cc.xy(10, 1)); //======== scrollPaneForTopList3 ======== { // ---- keywordSearchField ---- KeyListener actionListener3 = new KeyListener() { public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { String text = keywordSearchField.getText(); ccmTableModel.setKeywordFilterValue(text); sorter.setRowFilter(combinedFilter); ccmTableModel.fireTableDataChanged(); } public void keyTyped(KeyEvent e) { } }; keywordSearchField.setText("Enter Text"); keywordSearchField.addKeyListener(actionListener3); } topPanel.add(keywordSearchField, cc.xy(12, 1)); } // Top Panel frameContentPane.add(topPanel, BorderLayout.NORTH); //======== splitPane ======== { splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPane.setResizeWeight(0.5); //======== scrollPaneForTable ======== { //---- table ---- ccmTableModel = new CCMTableModel(manager); setOriginalChoices(); table = new JTable(ccmTableModel); sorter = new TableRowSorter<CCMTableModel>(ccmTableModel); table.setRowSorter(sorter); table.setDefaultRenderer(Object.class, new CellRenderer()); table.setDefaultRenderer(CCMTableModel.ImageLink.class, new ImageLinkRenderer()); table.setDefaultRenderer(CCMTableModel.HyperLink.class, new HyperLinkRenderer()); table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); ListSelectionModel cellSM = table.getSelectionModel(); cellSM.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); cellSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { boolean adjusting = e.getValueIsAdjusting(); if (adjusting) { return; } int selectedRow = table.getSelectedRow(); ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { textPane.setText(" "); } else { String description = (String) ccmTableModel.getValueAt( table.convertRowIndexToModel(selectedRow), CCMTableModel.DESCRIPTION_INDEX); textPane.setText(description); if (textPane.getCaretPosition() > 1) { textPane.setCaretPosition(1); } } } }); table.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(java.awt.event.MouseEvent event) { launchBrowser(); } }); TableColumn column = table.getColumnModel().getColumn(CCMTableModel.SELECTION_INDEX); column.setMaxWidth(50); column = table.getColumnModel().getColumn(CCMTableModel.VERSION_INDEX); column.setMaxWidth(60); column = table.getColumnModel().getColumn(CCMTableModel.TUTORIAL_URL_INDEX); column.setMaxWidth(70); column = table.getColumnModel().getColumn(CCMTableModel.TOOL_URL_INDEX); column.setMaxWidth(70); scrollPaneForTable = new JScrollPane(table); } splitPane.setTopComponent(scrollPaneForTable); //======== scrollPaneForTextPane ======== { //---- textPane ---- textPane.setEditable(false); scrollPaneForTextPane.setViewportView(textPane); } splitPane.setBottomComponent(scrollPaneForTextPane); } //======== splitPane ========. frameContentPane.add(splitPane, BorderLayout.CENTER); //======== bottompanel ======== { bottompanel.setLayout(new FormLayout("20dlu," + "default, 4dlu, " + // view License "default,200dlu, " + // Apply "default, 4dlu, " + // Reset "default, 4dlu, " + // Cancel "default " // Close , "center:25dlu")); viewLicenseButton.setText("View License"); bottompanel.add(viewLicenseButton, cc.xy(2, 1)); //---- applyButton ---- applyButton.setText("Apply"); bottompanel.add(applyButton, cc.xy(6, 1)); //---- resetButton ---- resetButton.setText("Reset"); bottompanel.add(resetButton, cc.xy(8, 1)); //---- closeButton ---- closeButton.setText("Close"); bottompanel.add(closeButton, cc.xy(10, 1)); } //======== bottompanel ========. frameContentPane.add(bottompanel, BorderLayout.SOUTH); } //======== outerPanel ======== frame.pack(); frame.setLocationRelativeTo(frame.getOwner()); } // ============ frame ============ topPanel.setVisible(true); splitPane.setVisible(true); scrollPaneForTable.setVisible(true); table.setVisible(true); scrollPaneForTextPane.setVisible(true); textPane.setVisible(true); bottompanel.setVisible(true); sorter.setRowFilter(combinedFilter); frame.setVisible(true); splitPane.setDividerLocation(.7d); }
From source file:org.geworkbench.engine.ccm.ComponentConfigurationManagerWindow2.java
/** * Set up the GUI/* ww w. ja v a 2 s. c o m*/ * * @param void * @return void */ private void initComponents() { frame = new JFrame("geWorkbench - Component Configuration Manager"); topPanel = new JPanel(); displayLabel = new JLabel(); String[] displayChoices = { DISPLAY_FILTER_ALL, DISPLAY_ONLY_LOADED, DISPLAY_ONLY_UNLOADED }; displayComboBox = new JComboBox(displayChoices); showByTypeLabel = new JLabel(); String[] showByTypeChoices = new String[PluginComponent.categoryList.size() + 2]; showByTypeChoices[0] = SHOW_BY_TYPE_ALL; int index = 1; for (String s : PluginComponent.categoryList) { showByTypeChoices[index] = s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase(); index++; } ; showByTypeChoices[index] = SHOW_BY_TYPE_OTHERS; Arrays.sort(showByTypeChoices); showByTypeComboBox = new JComboBox(showByTypeChoices); showByTypeComboBox.setMaximumRowCount(showByTypeChoices.length); keywordSearchLabel = new JLabel("Keyword search:"); keywordSearchField = new JTextField("Enter Text"); splitPane = new JSplitPane(); scrollPaneForTextPane = new JScrollPane(); textPane = new JTextPane(); bottompanel = new JPanel(); CellConstraints cc = new CellConstraints(); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { ccmWindow = null; } }); viewLicenseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { viewLicense_actionPerformed(e); } }); applyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { applyCcmSelections_actionPerformed(e); } }); resetButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { resetCcmSelections_actionPerformed(e); } }); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { closeCcmSelections_actionPerformed(e); } }); componentUpdateButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { componentRemoteUpdate_actionPerformed(e); } }); //======== frame ======== { Container frameContentPane = frame.getContentPane(); frameContentPane.setLayout(new BorderLayout()); //======== outerPanel ======== { frameContentPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); //======== topPanel ======== { FormLayout topPanelLayout = new FormLayout( " 32dlu, default, 4dlu, default, 32dlu, default, 4dlu, default, 32dlu, default, 4dlu, 64dlu, 32dlu", "center:25dlu"); topPanel.setLayout(topPanelLayout); //---- displayLabel ---- displayLabel.setText("Display:"); topPanel.add(displayLabel, cc.xy(2, 1)); //======== scrollPaneForTopList1 ======== { //---- displayComboBox ---- ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { ItemSelectable is = (ItemSelectable) actionEvent.getSource(); Object[] selections = is.getSelectedObjects(); String selection = (String) selections[0]; ccmTableModel.setLoadedFilterValue(selection); sorter.setRowFilter(combinedFilter); ccmTableModel.fireTableDataChanged(); } }; displayComboBox.addActionListener(actionListener); } topPanel.add(displayComboBox, cc.xy(4, 1)); //---- showByTypeLabel ---- showByTypeLabel.setText("Show by type:"); topPanel.add(showByTypeLabel, cc.xy(6, 1)); //======== scrollPaneForTopList2 ======== { //---- showByTypeComboBox ---- ActionListener actionListener2 = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { ItemSelectable is = (ItemSelectable) actionEvent.getSource(); Object[] selections = is.getSelectedObjects(); String selection = (String) selections[0]; ccmTableModel.setTypeFilterValue(selection); sorter.setRowFilter(combinedFilter); ccmTableModel.fireTableDataChanged(); } }; showByTypeComboBox.addActionListener(actionListener2); } topPanel.add(showByTypeComboBox, cc.xy(8, 1)); //---- topLabel3 ---- topPanel.add(keywordSearchLabel, cc.xy(10, 1)); //======== scrollPaneForTopList3 ======== { // ---- keywordSearchField ---- KeyListener actionListener3 = new KeyListener() { public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { String text = keywordSearchField.getText(); ccmTableModel.setKeywordFilterValue(text); sorter.setRowFilter(combinedFilter); ccmTableModel.fireTableDataChanged(); } public void keyTyped(KeyEvent e) { } }; keywordSearchField.setText("Enter Text"); keywordSearchField.addKeyListener(actionListener3); } topPanel.add(keywordSearchField, cc.xy(12, 1)); } // Top Panel frameContentPane.add(topPanel, BorderLayout.NORTH); //======== splitPane ======== { splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPane.setResizeWeight(0.5); //======== scrollPaneForTable ======== { //---- table ---- ccmTableModel = new CCMTableModel2(manager.componentConfigurationManager); setOriginalChoices(); table = new JTable(ccmTableModel); sorter = new TableRowSorter<CCMTableModel2>(ccmTableModel); table.setRowSorter(sorter); table.setDefaultRenderer(Object.class, new CellRenderer()); table.setDefaultRenderer(CCMTableModel2.ImageLink.class, new ImageLinkRenderer()); table.setDefaultRenderer(CCMTableModel2.HyperLink.class, new HyperLinkRenderer()); table.setDefaultRenderer(CCMTableModel2.DownloadLink.class, new DownloadLinkRenderer()); table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); ListSelectionModel cellSM = table.getSelectionModel(); cellSM.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); cellSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { boolean adjusting = e.getValueIsAdjusting(); if (adjusting) { return; } int[] selectedRow = table.getSelectedRows(); ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { textPane.setText(" "); } else { String description = (String) ccmTableModel.getValueAt( table.convertRowIndexToModel(selectedRow[0]), CCMTableModel2.DESCRIPTION_INDEX); textPane.setText(description); if (textPane.getCaretPosition() > 1) { textPane.setCaretPosition(1); } } if (table.getSelectedRow() >= 0) { int modelColumn = table.convertColumnIndexToModel(table.getSelectedColumn()); if (modelColumn == CCMTableModel2.AVAILABLE_UPDATE_INDEX) installRemoteComponent(); else launchBrowser(); } } }); TableColumn column = table.getColumnModel().getColumn(CCMTableModel2.SELECTION_INDEX); column.setMaxWidth(50); column = table.getColumnModel().getColumn(CCMTableModel2.VERSION_INDEX); column.setMaxWidth(60); column = table.getColumnModel().getColumn(CCMTableModel2.AVAILABLE_UPDATE_INDEX); column.setMaxWidth(60); column = table.getColumnModel().getColumn(CCMTableModel2.TUTORIAL_URL_INDEX_2); column.setMaxWidth(70); column = table.getColumnModel().getColumn(CCMTableModel2.TOOL_URL_INDEX_2); column.setMaxWidth(70); scrollPaneForTable = new JScrollPane(table); } splitPane.setTopComponent(scrollPaneForTable); //======== scrollPaneForTextPane ======== { //---- textPane ---- textPane.setEditable(false); scrollPaneForTextPane.setViewportView(textPane); } splitPane.setBottomComponent(scrollPaneForTextPane); } //======== splitPane ========. frameContentPane.add(splitPane, BorderLayout.CENTER); //======== bottompanel ======== { bottompanel.setLayout(new FormLayout("20dlu," + "default, 4dlu, " + // view License "default,100dlu, " + // Component Update "default, 4dlu, " + // Apply "default, 4dlu, " + // Reset "default, 4dlu, " + // Cancel "default " // Close , "center:25dlu")); viewLicenseButton.setText("View License"); bottompanel.add(viewLicenseButton, cc.xy(2, 1)); //---- componentUpdateButton ---- bottompanel.add(componentUpdateButton, cc.xy(6, 1)); //---- applyButton ---- applyButton.setText("Apply"); bottompanel.add(applyButton, cc.xy(8, 1)); //---- resetButton ---- resetButton.setText("Reset"); bottompanel.add(resetButton, cc.xy(10, 1)); //---- closeButton ---- closeButton.setText("Close"); bottompanel.add(closeButton, cc.xy(12, 1)); } //======== bottompanel ========. frameContentPane.add(bottompanel, BorderLayout.SOUTH); } //======== outerPanel ======== frame.pack(); frame.setLocationRelativeTo(frame.getOwner()); } // ============ frame ============ topPanel.setVisible(true); splitPane.setVisible(true); scrollPaneForTable.setVisible(true); table.setVisible(true); scrollPaneForTextPane.setVisible(true); textPane.setVisible(true); bottompanel.setVisible(true); sorter.setRowFilter(combinedFilter); frame.setVisible(true); splitPane.setDividerLocation(.7d); }