List of usage examples for javax.swing JEditorPane JEditorPane
public JEditorPane()
JEditorPane
. From source file:org.jannocessor.ui.RenderPreviewDialog.java
private JComponent createOutput(String title, String content) { editor = new JEditorPane(); JScrollPane scroll = new JScrollPane(editor, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scroll.setMinimumSize(new Dimension(100, 100)); editor.setContentType("text/java_output"); editor.setEditable(false);//from w ww .j a v a 2s. c o m editor.setText(content); editor.addKeyListener(keyListener); JLabel header = new JLabel(title); Box box = Box.createVerticalBox(); box.add(header); box.add(scroll); return box; }
From source file:org.jivesoftware.sparkimpl.updater.CheckUpdates.java
public void downloadUpdate(final File downloadedFile, final SparkVersion version) { final java.util.Timer timer = new java.util.Timer(); // Prepare HTTP post final GetMethod post = new GetMethod(version.getDownloadURL()); // Get HTTP client Protocol.registerProtocol("https", new Protocol("https", new EasySSLProtocolSocketFactory(), 443)); final HttpClient httpclient = new HttpClient(); String proxyHost = System.getProperty("http.proxyHost"); String proxyPort = System.getProperty("http.proxyPort"); if (ModelUtil.hasLength(proxyHost) && ModelUtil.hasLength(proxyPort)) { try {// ww w .j a va2s.co m httpclient.getHostConfiguration().setProxy(proxyHost, Integer.parseInt(proxyPort)); } catch (NumberFormatException e) { Log.error(e); } } // Execute request try { int result = httpclient.executeMethod(post); if (result != 200) { return; } long length = post.getResponseContentLength(); int contentLength = (int) length; bar = new JProgressBar(0, contentLength); } catch (IOException e) { Log.error(e); } final JFrame frame = new JFrame(Res.getString("title.downloading.im.client")); frame.setIconImage(SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_IMAGE).getImage()); titlePanel = new TitlePanel(Res.getString("title.upgrading.client"), Res.getString("message.version", version.getVersion()), SparkRes.getImageIcon(SparkRes.SEND_FILE_24x24), true); final Thread thread = new Thread(new Runnable() { public void run() { try { InputStream stream = post.getResponseBodyAsStream(); long size = post.getResponseContentLength(); ByteFormat formater = new ByteFormat(); sizeText = formater.format(size); titlePanel.setDescription(Res.getString("message.version", version.getVersion()) + " \n" + Res.getString("message.file.size", sizeText)); downloadedFile.getParentFile().mkdirs(); FileOutputStream out = new FileOutputStream(downloadedFile); copy(stream, out); out.close(); if (!cancel) { downloadComplete = true; promptForInstallation(downloadedFile, Res.getString("title.download.complete"), Res.getString("message.restart.spark")); } else { out.close(); downloadedFile.delete(); } UPDATING = false; frame.dispose(); } catch (Exception ex) { // Nothing to do } finally { timer.cancel(); // Release current connection to the connection pool once you are done post.releaseConnection(); } } }); frame.getContentPane().setLayout(new GridBagLayout()); frame.getContentPane().add(titlePanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); frame.getContentPane().add(bar, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); JEditorPane pane = new JEditorPane(); boolean displayContentPane = version.getChangeLogURL() != null || version.getDisplayMessage() != null; try { pane.setEditable(false); if (version.getChangeLogURL() != null) { pane.setEditorKit(new HTMLEditorKit()); pane.setPage(version.getChangeLogURL()); } else if (version.getDisplayMessage() != null) { pane.setText(version.getDisplayMessage()); } if (displayContentPane) { frame.getContentPane().add(new JScrollPane(pane), new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); } } catch (IOException e) { Log.error(e); } frame.getContentPane().setBackground(Color.WHITE); frame.pack(); if (displayContentPane) { frame.setSize(600, 400); } else { frame.setSize(400, 100); } frame.setLocationRelativeTo(SparkManager.getMainWindow()); GraphicUtils.centerWindowOnScreen(frame); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent windowEvent) { thread.interrupt(); cancel = true; UPDATING = false; if (!downloadComplete) { JOptionPane.showMessageDialog(SparkManager.getMainWindow(), Res.getString("message.updating.cancelled"), Res.getString("title.cancelled"), JOptionPane.ERROR_MESSAGE); } } }); frame.setVisible(true); thread.start(); timer.scheduleAtFixedRate(new TimerTask() { int seconds = 1; public void run() { ByteFormat formatter = new ByteFormat(); long value = bar.getValue(); long average = value / seconds; String text = formatter.format(average) + "/Sec"; String total = formatter.format(value); titlePanel.setDescription(Res.getString("message.version", version.getVersion()) + " \n" + Res.getString("message.file.size", sizeText) + "\n" + Res.getString("message.transfer.rate") + ": " + text + "\n" + Res.getString("message.total.downloaded") + ": " + total); seconds++; } }, 1000, 1000); }
From source file:org.knime.ext.textprocessing.nodes.view.documentviewer2.DocumentPanel2.java
/** * Creates new instance of {@code DocumentPanel} with given document view model to show, and the preferred width and * height to set.// www.j a v a 2 s .c o m * * @param docViewModel The document view model. * @param preferredWidth The preferred width to set. * @param preferredHeight The preferred height to set. */ public DocumentPanel2(final DocumentViewModel docViewModel, final int preferredWidth, final int preferredHeight) { super(new BorderLayout()); if (docViewModel == null) { throw new IllegalArgumentException("Document view model may not be null!"); } m_docViewModel = docViewModel; m_fulltextPane = new JEditorPane(); m_fulltextPane.setContentType("text/html"); m_fulltextPane.setEditable(false); m_fulltextPane.setCaretPosition(0); m_fulltextPane.addHyperlinkListener(new LinkListener()); m_fulltextPane.setToolTipText("Select text and right click."); HTMLEditorKit editorKit = new HTMLEditorKit(); // Adding stylesheet to the document StyleSheet sheet = editorKit.getStyleSheet(); sheet.addRule( "html, body {margin: 0; padding: 4px; color: #000000; font-family: 'Roboto', sans-serif; background: #ffffff; font-size: 12px;}"); sheet.addRule("table { border-collapse: collapse; }"); sheet.addRule("th, td { border: 1px solid #000000; padding: 10px 15px; }"); sheet.addRule( ".docHeading {display: block; font-size: 15px; font-weight: bold; margin: 5px 0 30px 0; width: 100%;}"); sheet.addRule( ".sep { width:100%; border-bottom: 1px dashed #8c8b8b ; top: 10%; bottom: 20%; position: absolute; margin: 10px 0 10px 0;}"); sheet.addRule(".subHeading { font-weight: 500; font-style: italic; text-transform: lowercase; }"); editorKit.setStyleSheet(sheet); m_fulltextPane.setEditorKit(editorKit); Document doc = editorKit.createDefaultDocument(); m_fulltextPane.setDocument(doc); m_fulltextPane.setText(getPreparedText()); m_rightClickMenue = new JPopupMenu(); JMenuItem item; for (String source : SearchEngines.getInstance().getSearchEngineNames()) { item = new JMenuItem(source); item.addActionListener(new RightClickMenueListener()); m_rightClickMenue.add(item); } m_fulltextPane.setComponentPopupMenu(m_rightClickMenue); JScrollPane jsp = new JScrollPane(m_fulltextPane); jsp.setPreferredSize(new Dimension(preferredWidth, preferredHeight)); add(jsp, BorderLayout.CENTER); }
From source file:org.mindswap.swoop.renderer.BaseEntityRenderer.java
/** * Create a JEditorPane given the contentType (text/plain or text/html) * and make other default settings (add hyperlink listener, editable false) * @param contentType//w w w . j a v a2 s .c om * @return */ public static JEditorPane getEditorPane(String contentType, TermsDisplay TD) { JEditorPane editorPane = null; if (contentType.equals("text/plain")) editorPane = new JEditorPane(); else if (contentType.equals("text/html")) { editorPane = new JEditorPane(); editorPane.addHyperlinkListener(TD); } else if (contentType.equals("text/xml")) editorPane = new JEditorPane(); else throw new RuntimeException("Cannot create an editor pane for content type " + contentType); editorPane.setEditable(false); editorPane.setContentType(contentType); // adding to UI listeners of TermsDisplay //editorPane.getDocument().addDocumentListener(TD); editorPane.addMouseListener(TD); editorPane.addKeyListener(TD); return editorPane; }
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private PanelWizardStep newStep1(final MainFrameTab ifrm) { final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); final PanelWizardStep step = new PanelWizardStep( localeDelegate.getMessage("dbtransfer.import.step1.1", "Konfigurationsdatei"), localeDelegate.getMessage("dbtransfer.import.step1.2", "Bitte w\u00e4hlen Sie eine Konfigurationsdatei aus.")); final JLabel lbFile = new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.3", "Datei")); utils.initJPanel(step,/*w ww .java 2s. c om*/ new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }, new double[] { 20, TableLayout.PREFERRED, lbFile.getPreferredSize().height, TableLayout.FILL }); final JButton btnBrowse = new JButton("..."); //final JProgressBar progressBar = new JProgressBar(0, 230); final JCheckBox chbxImportAsNuclon = new JCheckBox( localeDelegate.getMessage("configuration.transfer.import.as.nuclon", "Import als Nuclon")); chbxImportAsNuclon.setEnabled(false); final JEditorPane editWarnings = new JEditorPane(); editWarnings.setContentType("text/html"); editWarnings.setEditable(false); editWarnings.setBackground(Color.WHITE); final JScrollPane scrollWarn = new JScrollPane(editWarnings); scrollWarn.setPreferredSize(new Dimension(680, 250)); scrollWarn.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); scrollWarn.getVerticalScrollBar().setUnitIncrement(20); scrollWarn.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollWarn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JScrollPane scrollPrev = new JScrollPane(jpnPreviewContent); scrollPrev.setPreferredSize(new Dimension(680, 250)); scrollPrev.setBorder(new LineBorder(Color.LIGHT_GRAY, 1)); scrollPrev.getVerticalScrollBar().setUnitIncrement(20); scrollPrev.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPrev.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JPanel jpnPreview = new JPanel(new BorderLayout()); jpnPreview.add(jpnPreviewHeader, BorderLayout.NORTH); jpnPreview.add(scrollPrev, BorderLayout.CENTER); jpnPreview.add(jpnPreviewFooter, BorderLayout.SOUTH); jpnPreview.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); jpnPreview.setBackground(Color.WHITE); jpnPreviewHeader.setBackground(Color.WHITE); jpnPreviewContent.setBackground(Color.WHITE); jpnPreviewFooter.setBackground(Color.WHITE); final JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(localeDelegate.getMessage("configuration.transfer.prepare.warnings.tab", "Warnungen"), scrollWarn); final String sDefaultPreparePreviewTabText = localeDelegate .getMessage("configuration.transfer.prepare.preview.tab", "Vorschau der Schema Aenderungen"); tabbedPane.addTab(sDefaultPreparePreviewTabText, jpnPreview); final JLabel lbNewUser = new JLabel(); step.add(lbFile, "0,0"); step.add(tfTransferFile, "1,0"); step.add(btnBrowse, "2,0"); step.add(chbxImportAsNuclon, "1,1");//step.add(progressBar, "1,1"); step.add(lbNewUser, "0,2,3,2"); step.add(tabbedPane, "0,3,3,3"); tfTransferFile.setEditable(false); final ActionListener prepareImportAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { ifrm.lockLayerWithProgress(Transfer.TOPIC_CORRELATIONID_PREPARE); Thread t = new Thread() { @Override public void run() { step.setComplete(false); boolean blnTransferWithWarnings = false; //progressBar.setValue(0); //progressBar.setVisible(true); try { String fileName = tfTransferFile.getText(); if (StringUtils.isNullOrEmpty(fileName)) { return; } File f = new File(fileName); long size = f.length(); final InputStream fin = new BufferedInputStream(new FileInputStream(f)); final byte[] transferFile; try { transferFile = utils.getBytes(fin, (int) size); } finally { fin.close(); } resetStep2(); importTransferObject = getTransferFacadeRemote().prepareTransfer(isNuclon, transferFile); chbxImportAsNuclon.setEnabled(importTransferObject.getTransferOptions() .containsKey(TransferOption.IS_NUCLON_IMPORT_ALLOWED)); step.setComplete(!importTransferObject.result.hasCriticals()); if (!importTransferObject.result.hasCriticals() && !importTransferObject.result.hasWarnings()) { editWarnings.setText(localeDelegate.getMessage( "configuration.transfer.prepare.no.warnings", "Keine Warnungen")); } else { editWarnings.setText("<html><body><font color=\"#800000\">" + importTransferObject.result.getCriticals() + "</font>" + (importTransferObject.result.hasCriticals() ? "<br />" : "") + importTransferObject.result.getWarnings() + "</body></html>"); } int iPreviewSize = importTransferObject.getPreviewParts().size(); blnTransferWithWarnings = setupPreviewPanel(importTransferObject.getPreviewParts()); tabbedPane.setTitleAt(1, sDefaultPreparePreviewTabText + (iPreviewSize == 0 ? "" : " (" + iPreviewSize + ")")); lbNewUser.setText( "Neue Benutzer" + ": " + (importTransferObject.getNewUserCount() == 0 ? "keine" : importTransferObject.getNewUserCount())); } catch (Exception e) { // progressBar.setVisible(false); Errors.getInstance().showExceptionDialog(ifrm, e); } finally { btnBrowse.setEnabled(true); // progressBar.setVisible(false); ifrm.unlockLayer(); } if (blnTransferWithWarnings) { JOptionPane.showMessageDialog(jpnPreviewContent, localeDelegate.getMessage( "dbtransfer.import.step1.19", "Nicht alle Statements knnen durchgefhrt werden!\nBitte kontrollieren Sie die mit rot markierten Eintrge!", "Warning", JOptionPane.WARNING_MESSAGE)); } } }; t.start(); } }; final ActionListener browseAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { final JFileChooser filechooser = utils.getFileChooser( localeDelegate.getMessage("configuration.transfer.file.nuclet", "Nuclet-Dateien"), ".nuclet"); final int iBtn = filechooser.showOpenDialog(ifrm); if (iBtn == JFileChooser.APPROVE_OPTION) { final File file = filechooser.getSelectedFile(); if (file != null) { tfTransferFile.setText(""); btnBrowse.setEnabled(false); //progressBar.setVisible(true); String fileName = file.getPath(); if (StringUtils.isNullOrEmpty(fileName)) { return; } tfTransferFile.setText(fileName); prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare")); } } } }; final ActionListener importAsNuclonAction = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { isNuclon = chbxImportAsNuclon.isSelected(); prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare")); } }; btnBrowse.addActionListener(browseAction); chbxImportAsNuclon.addActionListener(importAsNuclonAction); // progressBar.setVisible(false); return step; }
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private PanelWizardStep newStep5(final MainFrameTab ifrm) { final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); final JLabel lbResult = new JLabel(); final JEditorPane editLog = new JEditorPane(); final JScrollPane scrollLog = new JScrollPane(editLog); final JLabel lbStructureChangeResult = new JLabel( localeDelegate.getMessage("dbtransfer.import.step5.1", "\u00c4nderungen am Datenbankschema")); final JButton btnSaveStructureChangeScript = new JButton( localeDelegate.getMessage("dbtransfer.import.step5.2", "Script speichern") + "..."); final JButton btnSaveStructureChangeLog = new JButton( localeDelegate.getMessage("dbtransfer.import.step5.3", "Log speichern") + "..."); editLog.setContentType("text/html"); editLog.setEditable(false);//w w w . j a v a 2 s . c o m final PanelWizardStep step = new PanelWizardStep( localeDelegate.getMessage("dbtransfer.import.step5.4", "Ergebnis"), localeDelegate.getMessage( "dbtransfer.import.step5.5", "Hier wird Ihnen das Ergebnis des Imports angezeigt.")) { @Override public void prepare() { if (!importTransferResult.hasWarnings() && !importTransferResult.hasCriticals()) { lbResult.setText(localeDelegate.getMessage("dbtransfer.import.step5.6", "Import erfolgreich!")); this.setComplete(true); } else { lbResult.setText( localeDelegate.getMessage("dbtransfer.import.step5.7", "Ein Problem ist aufgetreten!")); blnSaveOfLogRecommend = true; } StringBuffer sbLog = new StringBuffer(); sbLog.append("<html><body>"); if (!importTransferResult.foundReferences.isEmpty()) { sbLog.append(localeDelegate.getMessage("dbtransfer.import.step5.8", "Folgende Konfigurationsobjekte sollten entfernt werden, werden aber noch verwendet") + ":<br />"); for (Pair<String, String> reference : importTransferResult.foundReferences) { sbLog.append( "- " + reference.y + " (" + localeDelegate.getLabelFromMetaDataVO( MetaDataClientProvider.getInstance().getEntity(reference.x)) + ")<br />"); } sbLog.append("<br />" + localeDelegate.getMessage("dbtransfer.import.step5.9", "Passen Sie Ihre Konfiguration dahingehend an oder bearbeiten Sie die Daten,\nwelche noch auf die Konfigurationsobjekte verweisen.")); sbLog.append("<br />"); } sbLog.append("<font color=\"#800000\">" + importTransferObject.result.getCriticals() + "</font>" + (importTransferObject.result.hasCriticals() ? "<br />" : "")); sbLog.append(importTransferResult.getWarnings()); sbLog.append("</body></html>"); editLog.setText(sbLog.toString()); } }; utils.initJPanel(step, new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }, new double[] { 20, TableLayout.FILL, TableLayout.PREFERRED }); step.add(lbResult, "0,0,3,0"); step.add(scrollLog, "0,1,3,1"); step.add(lbStructureChangeResult, "0,2"); step.add(btnSaveStructureChangeScript, "1,2"); step.add(btnSaveStructureChangeLog, "2,2"); btnSaveStructureChangeScript.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { try { UIUtils.showWaitCursorForFrame(ifrm, true); final StringBuffer sbSql = new StringBuffer(); org.apache.commons.collections.CollectionUtils.forAllDo(importTransferResult.script, new Closure() { @Override public void execute(Object element) { sbSql.append("<DDL>" + element + "</DDL>\n\n"); } }); final JFileChooser filechooser = utils.getFileChooser( localeDelegate.getMessage("configuration.transfer.file.sql", "SQL-Dateien"), ".import-sql.txt"); filechooser.setSelectedFile(new File(tfTransferFile.getText() + ".import-sql.txt")); final int iBtn = filechooser.showSaveDialog(step); if (iBtn == JFileChooser.APPROVE_OPTION) { final File file = filechooser.getSelectedFile(); if (file != null) { String fileName = file.getPath(); if (!fileName.toLowerCase().endsWith(".import-sql.txt")) { fileName += ".import-sql.txt"; } File outFile = new File(fileName); final Writer out = new BufferedWriter(new FileWriter(outFile)); try { out.write(sbSql.toString()); } finally { out.close(); } if (blnSaveOfScriptRecommend) { step.setComplete(true); } } } } catch (Exception e) { Errors.getInstance().showExceptionDialog(ifrm, e); } finally { UIUtils.showWaitCursorForFrame(ifrm, false); } } }); btnSaveStructureChangeLog.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { try { UIUtils.showWaitCursorForFrame(ifrm, true); final JFileChooser filechooser = utils.getFileChooser( localeDelegate.getMessage("configuration.transfer.file.log", "Log-Dateien"), ".import-log.html"); filechooser.setSelectedFile(new File(tfTransferFile.getText() + ".import-log.html")); final int iBtn = filechooser.showSaveDialog(step); if (iBtn == JFileChooser.APPROVE_OPTION) { final File file = filechooser.getSelectedFile(); if (file != null) { String fileName = file.getPath(); if (!fileName.toLowerCase().endsWith(".import-log.html")) { fileName += ".import-log.html"; } File outFile = new File(fileName); final Writer out = new BufferedWriter(new FileWriter(outFile)); try { out.write(editLog.getText()); } finally { out.close(); } if (blnSaveOfLogRecommend) { step.setComplete(true); } } } } catch (Exception e) { Errors.getInstance().showExceptionDialog(ifrm, e); } finally { UIUtils.showWaitCursorForFrame(ifrm, false); } } }); return step; }
From source file:org.omegat.gui.scripting.ScriptingWindow.java
private void initWindowLayout() { // set default size and position frame.setBounds(50, 80, 1150, 650);// w ww.ja va2 s. c o m StaticUIUtils.persistGeometry(frame, Preferences.SCRIPTWINDOW_GEOMETRY_PREFIX); frame.getContentPane().setLayout(new BorderLayout(0, 0)); m_scriptList = new JList<>(); JScrollPane scrollPaneList = new JScrollPane(m_scriptList); m_scriptList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { if (!evt.getValueIsAdjusting()) { onListSelectionChanged(); } } }); m_scriptList.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { ListModel<ScriptItem> lm = m_scriptList.getModel(); int index = m_scriptList.locationToIndex(e.getPoint()); if (index > -1) { m_scriptList.setToolTipText(lm.getElementAt(index).getFile().getName()); } } }); m_txtResult = new JEditorPane(); JScrollPane scrollPaneResults = new JScrollPane(m_txtResult); //m_txtScriptEditor = new StandardScriptEditor(); m_txtScriptEditor = getScriptEditor(); m_txtScriptEditor.initLayout(this); JSplitPane splitPane1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, m_txtScriptEditor.getPanel(), scrollPaneResults); splitPane1.setOneTouchExpandable(true); splitPane1.setDividerLocation(430); Dimension minimumSize1 = new Dimension(100, 50); //scrollPaneEditor.setMinimumSize(minimumSize1); scrollPaneResults.setMinimumSize(minimumSize1); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollPaneList, splitPane1); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(250); Dimension minimumSize = new Dimension(100, 50); scrollPaneList.setMinimumSize(minimumSize); scrollPaneResults.setMinimumSize(minimumSize); frame.getContentPane().add(splitPane, BorderLayout.CENTER); JPanel panelSouth = new JPanel(); FlowLayout fl_panelSouth = (FlowLayout) panelSouth.getLayout(); fl_panelSouth.setAlignment(FlowLayout.LEFT); frame.getContentPane().add(panelSouth, BorderLayout.SOUTH); setupRunButtons(panelSouth); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.setJMenuBar(createMenuBar()); }
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Formats the text and displays it in a {@link JEditorPane}. * // w w w.j a va 2 s. c o m * @param text The text to display. * @return See above. */ public static JEditorPane buildTextEditorPane(String text) { if (text == null) text = ""; JEditorPane textPane = new JEditorPane(); textPane.setContentType("text/html"); textPane.setText(text); textPane.setOpaque(false); textPane.setEditable(false); textPane.setFocusable(false); return textPane; }
From source file:org.pentaho.reporting.engine.classic.demo.util.CompoundDemoFrame.java
protected JComponent createDescriptionTextPane(final URL url) { final JEditorPane editorPane = new JEditorPane(); editorPane.setEditable(false);/*from w w w .j a v a 2 s . c o m*/ editorPane.setPreferredSize(new Dimension(400, 200)); if (url != null) { try { editorPane.setPage(url); } catch (IOException e) { logger.error("Failed to load demo description", e); editorPane.setText("Unable to load the demo description. Error: " + e.getMessage()); } } else { editorPane.setText("Unable to load the demo description. No such resource."); } return new JScrollPane(editorPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); }
From source file:org.rdv.datapanel.StringDataPanel.java
private void initPanel() { panel = new JPanel(); panel.setLayout(new BorderLayout()); messages = new JEditorPane(); messages.setEditable(false);//from www . j a v a 2s . c o m messages.setContentType("text/html"); scrollPane = new JScrollPane(messages, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); panel.add(scrollPane, BorderLayout.CENTER); }