Java Code Examples for javax.swing.JEditorPane#setText()
The following examples show how to use
javax.swing.JEditorPane#setText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HTMLDialogBox.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
/** * Turns HTML into a clickable dialog text component. * @param html String of valid HTML. * @return a JTextComponent with the HTML inside. */ public JTextComponent createHyperlinkListenableJEditorPane(String html) { final JEditorPane bottomText = new JEditorPane(); bottomText.setContentType("text/html"); bottomText.setEditable(false); bottomText.setText(html); bottomText.setOpaque(false); final HyperlinkListener hyperlinkListener = new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) { if (hyperlinkEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(hyperlinkEvent.getURL().toURI()); } catch (IOException | URISyntaxException exception) { // Auto-generated catch block exception.printStackTrace(); } } } } }; bottomText.addHyperlinkListener(hyperlinkListener); return bottomText; }
Example 2
Source File: ScriptEditor.java From ramus with GNU General Public License v3.0 | 6 votes |
@Override public JComponent createComponent() { JScrollPane pane = new JScrollPane(); editorPane = new JEditorPane(); pane.setViewportView(editorPane); if (scriptPath.endsWith(".js")) editorPane.setContentType("text/javascript"); byte[] bs = framework.getEngine().getStream(scriptPath); if (bs == null) bs = new byte[]{}; try { editorPane.setText(new String(bs, "UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } if (!saveScriptAction.isEnabled()) editorPane.setEditable(false); return pane; }
Example 3
Source File: ObjectivePanel.java From triplea with GNU General Public License v3.0 | 6 votes |
EditorPaneCellEditor() { super(new JTextField()); final JEditorPane textArea = new JEditorPane(); textArea.setEditable(false); textArea.setContentType("text/html"); final JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setBorder(null); editorComponent = scrollPane; delegate = new DefaultCellEditor.EditorDelegate() { private static final long serialVersionUID = 5746645959173385516L; @Override public void setValue(final Object value) { textArea.setText((value != null) ? value.toString() : ""); } @Override public Object getCellEditorValue() { return textArea.getText(); } }; }
Example 4
Source File: InflateReader.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public void actionPerformed(ActionEvent e) { JDialog dlg = new JDialog(((Main) PacketSamurai.getUserInterface()).getMainFrame(), "Text"); dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dlg.setSize(350, 400); dlg.setLocationRelativeTo(((Main) PacketSamurai.getUserInterface()).getMainFrame()); JEditorPane sourceDisplay = new JEditorPane(); sourceDisplay.setEditable(false); sourceDisplay.setContentType("text/plain"); sourceDisplay.setText(_xml); dlg.add(new JScrollPane(sourceDisplay)); dlg.setVisible(true); }
Example 5
Source File: HTMLReader.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public void actionPerformed(ActionEvent e) { JDialog dlg = new JDialog(((Main) PacketSamurai.getUserInterface()).getMainFrame(),"HTML"); dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dlg.setSize(350, 400); dlg.setLocationRelativeTo(((Main) PacketSamurai.getUserInterface()).getMainFrame()); JTabbedPane tabPane = new JTabbedPane(); // HTML JEditorPane htmlDisplay = new JEditorPane(); htmlDisplay.setEditable(false); htmlDisplay.setContentType("text/html"); htmlDisplay.setText(_html); // Source JEditorPane sourceDisplay = new JEditorPane(); sourceDisplay.setEditable(false); sourceDisplay.setContentType("text/plain"); sourceDisplay.setText(_html); tabPane.add(new JScrollPane(htmlDisplay), "HTML"); tabPane.add(new JScrollPane(sourceDisplay), "Source"); dlg.add(tabPane); dlg.setVisible(true); }
Example 6
Source File: WordMatchTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testMultiDocs() throws Exception { JEditorPane pane = new JEditorPane(); pane.setText("abc ax ec ajo"); JFrame frame = new JFrame(); frame.getContentPane().add(pane); frame.pack(); // Allows to EditorRegistry.register() to make an item in the component list EditorApiPackageAccessor.get().setIgnoredAncestorClass(JEditorPane.class); EditorApiPackageAccessor.get().register(pane); Document doc = new PlainDocument(); WordMatch wordMatch = WordMatch.get(doc); // 012345678901234567890123456789 doc.insertString(0, "abc a x ahoj", null); int docLen = doc.getLength(); int offset = 5; wordMatch.matchWord(offset, false); compareText(doc, offset - 1, "abc ", docLen + 2); wordMatch.matchWord(offset, false); compareText(doc, offset - 1, "ahoj ", docLen + 3); wordMatch.matchWord(offset, false); compareText(doc, offset - 1, "ax ", docLen + 1); wordMatch.matchWord(offset, false); compareText(doc, offset - 1, "ajo ", docLen + 2); wordMatch.matchWord(offset, false); compareText(doc, offset - 1, "ajo ", docLen + 2); pane.setText(""); // Ensure this doc would affect WordMatch for other docs }
Example 7
Source File: JavaCodeTemplateProcessorTest.java From netbeans with Apache License 2.0 | 5 votes |
private void doTestTemplateInsert(String template, String code, String expected) throws Exception { clearWorkDir(); FileObject testFile = FileUtil.toFileObject(getWorkDir()).createData("Test.java"); EditorKit kit = new JavaKit(); JEditorPane pane = new JEditorPane(); pane.setEditorKit(kit); Document doc = pane.getDocument(); doc.putProperty(Document.StreamDescriptionProperty, testFile); doc.putProperty(Language.class, JavaTokenId.language()); doc.putProperty("mimeType", "text/x-java"); int caretOffset = code.indexOf('|'); assertTrue(caretOffset != (-1)); String text = code.substring(0, caretOffset) + code.substring(caretOffset + 1); pane.setText(text); pane.setCaretPosition(caretOffset); try (OutputStream out = testFile.getOutputStream(); Writer w = new OutputStreamWriter(out)) { w.append(text); } CodeTemplateManager manager = CodeTemplateManager.get(doc); CodeTemplate ct = manager.createTemporary(template); CodeTemplateInsertHandler handler = new CodeTemplateInsertHandler(ct, pane, Arrays.asList(new JavaCodeTemplateProcessor.Factory()), OnExpandAction.INDENT); handler.processTemplate(); int resultCaretOffset = expected.indexOf('|'); assertTrue(resultCaretOffset != (-1)); String expectedText = expected.substring(0, resultCaretOffset) + expected.substring(resultCaretOffset + 1); assertEquals(expectedText, doc.getText(0, doc.getLength())); assertEquals(resultCaretOffset, pane.getCaretPosition()); }
Example 8
Source File: TransferMaskDialog.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
private JComponent createHelpPanel() { JEditorPane helpPane = new JEditorPane("text/html", null); helpPane.setEditable(false); helpPane.setPreferredSize(new Dimension(400, 120)); helpPane.setText("<html><body>Copying the <b>definition</b> of a mask means the mathematical expression " + "is evaluated in the target product. This is only possible, " + "if the bands which are used in this expression are present in the target product.<br/> " + "Copying the <b>pixel</b> means the data of the mask is transferred to the target product. " + "This is only possible when both product overlap spatially.</body></html>"); JScrollPane helpPanelScrollPane = new JScrollPane(helpPane); helpPanelScrollPane.setBorder(BorderFactory.createTitledBorder("Description")); return helpPanelScrollPane; }
Example 9
Source File: AboutDialog.java From FancyBing with GNU General Public License v3.0 | 5 votes |
private JPanel createPanel(String text) { JPanel panel = new JPanel(new GridLayout(1, 1)); JEditorPane editorPane = new JEditorPane(); editorPane.setBorder(GuiUtil.createEmptyBorder()); editorPane.setEditable(false); if (Platform.isMac()) { editorPane.setForeground(UIManager.getColor("Label.foreground")); editorPane.setBackground(UIManager.getColor("Label.background")); } else { editorPane.setForeground(Color.black); editorPane.setBackground(Color.white); } panel.add(editorPane); EditorKit editorKit = JEditorPane.createEditorKitForContentType("text/html"); editorPane.setEditorKit(editorKit); editorPane.setText(text); editorPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent event) { HyperlinkEvent.EventType type = event.getEventType(); if (type == HyperlinkEvent.EventType.ACTIVATED) { URL url = event.getURL(); if (! Platform.openInExternalBrowser(url)) m_messageDialogs.showError(null, i18n("MSG_ABOUT_OPEN_URL_FAIL"), "", false); } } }); return panel; }
Example 10
Source File: ModelItem.java From netbeans with Apache License 2.0 | 5 votes |
public void updatePostDataPane(JEditorPane pane, boolean rawData) { if (hasPostData()) { if (rawData) { pane.setEditorKit(CloneableEditorSupport.getEditorKit("text/plain")); pane.setText(getPostData()); } else { String contentType = stripDownContentType(getRequestHeaders()); reformatAndUseRightEditor(pane, getPostData(), contentType); } } }
Example 11
Source File: ModelItem.java From netbeans with Apache License 2.0 | 5 votes |
private static void reformatAndUseRightEditor(JEditorPane pane, String data, String contentType) { if (contentType == null) { contentType = "text/plain"; // NOI18N } else { contentType = contentType.trim(); } if ("application/javascript".equals(contentType)) { // check whether this JSONP response, that is a JS method call returning JSON: String json = getJSONPResponse(data); if (json != null) { data = json; contentType = "application/json"; } } if ("application/json".equals(contentType) || "text/x-json".equals(contentType)) { data = reformatJSON(data); contentType = "text/x-json"; } if ("application/xml".equals(contentType)) { contentType = "text/xml"; } EditorKit editorKit; try { editorKit = CloneableEditorSupport.getEditorKit(contentType); } catch (IllegalArgumentException iaex) { contentType = "text/plain"; // NOI18N editorKit = CloneableEditorSupport.getEditorKit(contentType); } pane.setEditorKit(editorKit); pane.setText(data); }
Example 12
Source File: DefaultHtmlPrintElement.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Dimension getComputedSize(JRGenericPrintElement element) { String htmlContent = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HTML_CONTENT); JEditorPane editorPane = new JEditorPane(); editorPane.setEditorKitForContentType("text/html", new SynchronousImageLoaderKit()); editorPane.setContentType("text/html"); editorPane.setText(htmlContent); editorPane.setBorder(null); return editorPane.getPreferredSize(); }
Example 13
Source File: ModelItem.java From netbeans with Apache License 2.0 | 4 votes |
private void updateFramesImpl(JEditorPane pane, boolean rawData) throws BadLocationException { Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE); StyledDocument doc = (StyledDocument)pane.getDocument(); Style timingStyle = doc.addStyle("timing", defaultStyle); StyleConstants.setForeground(timingStyle, Color.lightGray); Style infoStyle = doc.addStyle("comment", defaultStyle); StyleConstants.setForeground(infoStyle, Color.darkGray); StyleConstants.setBold(infoStyle, true); SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss:SSS"); pane.setText(""); StringBuilder sb = new StringBuilder(); int lastFrameType = -1; for (Network.WebSocketFrame f : wsRequest.getFrames()) { int opcode = f.getOpcode(); if (opcode == 0) { // "continuation frame" opcode = lastFrameType; } else { lastFrameType = opcode; } if (opcode == 1) { // "text frame" if (!rawData) { doc.insertString(doc.getLength(), formatter.format(f.getTimestamp()), timingStyle); doc.insertString(doc.getLength(), f.getDirection() == Network.Direction.SEND ? " SENT " : " RECV ", timingStyle); } doc.insertString(doc.getLength(), f.getPayload()+"\n", defaultStyle); } else if (opcode == 2) { // "binary frame" if (!rawData) { doc.insertString(doc.getLength(), formatter.format(f.getTimestamp()), timingStyle); doc.insertString(doc.getLength(), f.getDirection() == Network.Direction.SEND ? " SENT " : " RECV ", timingStyle); } // XXX: binary data??? doc.insertString(doc.getLength(), f.getPayload()+"\n", defaultStyle); } else if (opcode == 8) { // "close frame" if (!rawData) { doc.insertString(doc.getLength(), formatter.format(f.getTimestamp()), timingStyle); doc.insertString(doc.getLength(), f.getDirection() == Network.Direction.SEND ? " SENT " : " RECV ", timingStyle); } doc.insertString(doc.getLength(), "Frame closed\n", infoStyle); } } data = sb.toString(); pane.setCaretPosition(0); }
Example 14
Source File: CheckForUpdateAction.java From nextreports-designer with Apache License 2.0 | 4 votes |
private JComponent createPanel(String html) { System.setProperty("awt.useSystemAAFontSettings", "on"); final JEditorPane editorPane = new JEditorPane(); HTMLEditorKit kit = new HTMLEditorKit(); editorPane.setEditorKit(kit); editorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); editorPane.setFont(new Font("Arial", Font.PLAIN, 12)); editorPane.setPreferredSize(new Dimension(350, 120)); editorPane.setEditable(false); editorPane.setContentType("text/html"); editorPane.setBackground(new Color(234, 241, 248)); Document doc = kit.createDefaultDocument(); editorPane.setDocument(doc); editorPane.setText(html); // Add Hyperlink listener to process hyperlinks editorPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(final HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) { EventQueue.invokeLater(new Runnable() { public void run() { SwingUtilities.getWindowAncestor(editorPane).setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); editorPane.setToolTipText(e.getURL().toExternalForm()); } }); } else if (e.getEventType() == HyperlinkEvent.EventType.EXITED) { EventQueue.invokeLater(new Runnable() { public void run() { SwingUtilities.getWindowAncestor(editorPane).setCursor(Cursor.getDefaultCursor()); editorPane.setToolTipText(null); } }); } else if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { FileUtil.openUrl(e.getURL().toString(), AboutAction.class); } } }); editorPane.addMouseListener(mouseListener); JScrollPane sp = new JScrollPane(editorPane); return sp; }
Example 15
Source File: FmtOptions.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void refreshPreview() { JEditorPane pane = (JEditorPane) getPreviewComponent(); try { int rm = previewPrefs.getInt(RIGHT_MARGIN, getDefaultAsInt(RIGHT_MARGIN)); pane.putClientProperty("TextLimitLine", rm); //NOI18N } catch (NumberFormatException e) { // Ignore it } Rectangle visibleRectangle = pane.getVisibleRect(); pane.setText(previewText); pane.setIgnoreRepaint(true); final Document doc = pane.getDocument(); if (doc instanceof BaseDocument) { final Reformat reformat = Reformat.get(doc); reformat.lock(); try { ((BaseDocument) doc).runAtomic(new Runnable() { @Override public void run() { try { reformat.reformat(0, doc.getLength()); } catch (BadLocationException ble) { LOGGER.log(Level.WARNING, null, ble); } } }); } finally { reformat.unlock(); } } else { LOGGER.warning(String.format("Can't format %s; it's not BaseDocument.", doc)); //NOI18N } pane.setIgnoreRepaint(false); pane.scrollRectToVisible(visibleRectangle); pane.repaint(100); }
Example 16
Source File: TutorialBrowser.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
private Component createContentPanel() { contentGbc = new GridBagConstraints(); contentPanel = new JPanel(new GridBagLayout()) { @Override public Dimension getPreferredSize() { return new Dimension(getParent().getWidth(), super.getPreferredSize().height); } }; contentPanel.setBackground(Colors.WHITE); jEditorPane = new JEditorPane() { @Override public Dimension getPreferredSize() { return new Dimension(getParent().getWidth(), super.getPreferredSize().height); } }; jEditorPane.setEditable(false); contentGbc.gridx = 0; contentGbc.gridy = 0; contentGbc.weightx = 1.0f; contentGbc.fill = GridBagConstraints.HORIZONTAL; contentPanel.add(jEditorPane, contentGbc); // add filler at bottom contentGbc.gridy += 1; contentGbc.weighty = 1.0f; contentGbc.fill = GridBagConstraints.BOTH; contentPanel.add(new JLabel(), contentGbc); // prepare contentGbc for feedback form contentGbc.gridy += 1; contentGbc.weighty = 0.0f; contentGbc.fill = GridBagConstraints.HORIZONTAL; scrollPane = new ExtendedJScrollPane(contentPanel); scrollPane.setBorder(null); HTMLEditorKit kit = new HTMLEditorKit(); jEditorPane.setEditorKit(kit); jEditorPane.setMargin(new Insets(0, 0, 0, 0)); Document doc = kit.createDefaultDocument(); jEditorPane.setDocument(doc); jEditorPane.setText(String.format(INFO_TEMPLATE, NO_TUTORIAL_SELECTED)); jEditorPane.addHyperlinkListener(e -> { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { ActionStatisticsCollector.INSTANCE.log(ActionStatisticsCollector.TYPE_GETTING_STARTED, TUTORIAL_BROWSER_DOCK_KEY, "open_remote_url"); RMUrlHandler.handleUrl(e.getURL().toString()); } }); return scrollPane; }
Example 17
Source File: FmtOptions.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void refreshPreview() { JEditorPane pane = (JEditorPane) getPreviewComponent(); try { int rm = previewPrefs.getInt(rightMargin, provider.getDefaultAsInt(rightMargin)); pane.putClientProperty("TextLimitLine", rm); //NOI18N } catch( NumberFormatException e ) { // Ignore it } Rectangle visibleRectangle = pane.getVisibleRect(); pane.setText(previewText); pane.setIgnoreRepaint(true); final Document doc = pane.getDocument(); if (doc instanceof BaseDocument) { final Reformat reformat = Reformat.get(doc); reformat.lock(); try { ((BaseDocument) doc).runAtomic(new Runnable() { @Override public void run() { try { reformat.reformat(0, doc.getLength()); } catch (BadLocationException ble) { LOGGER.log(Level.WARNING, null, ble); } } }); } finally { reformat.unlock(); } } else { LOGGER.warning(String.format("Can't format %s; it's not BaseDocument.", doc)); //NOI18N } pane.setIgnoreRepaint(false); pane.scrollRectToVisible(visibleRectangle); pane.repaint(100); }
Example 18
Source File: HostView.java From visualvm with GNU General Public License v2.0 | 4 votes |
@Override protected DataViewComponent createComponent() { //Data area for master view: JEditorPane generalDataArea = new JEditorPane(); generalDataArea.setText("Below you see the system properties of" + " all running apps!"); generalDataArea.setBorder(BorderFactory.createEmptyBorder(14, 8, 14, 8)); //Master view: DataViewComponent.MasterView masterView = new DataViewComponent.MasterView("All System Properties", null, generalDataArea); //Configuration of master view: DataViewComponent.MasterViewConfiguration masterConfiguration = new DataViewComponent.MasterViewConfiguration(false); //Add the master view and configuration view to the component: dvc = new DataViewComponent(masterView, masterConfiguration); //Get all the applications deployed to the host: Set apps = host.getRepository().getDataSources(Application.class); //Get the iterator: Iterator it = apps.iterator(); //Set count to zero: int count = 0; //Iterate through our applications: while (it.hasNext()) { //Increase the count: count = count + 1; //Now we have our application: Application app = (Application) it.next(); //Get the process id: String pid = count + ": " + (String.valueOf(app.getPid())); //Get the system properties: Properties jvmProperties = null; jvm = JvmFactory.getJVMFor(app); if (jvm.isGetSystemPropertiesSupported()) { jvmProperties = jvm.getSystemProperties(); } //Extrapolate the name from the type: ApplicationType appType = ApplicationTypeFactory.getApplicationTypeFor(app); String appName = appType.getName(); //Put the first application top left: if (count == 1) { dvc.addDetailsView(new SystemPropertiesViewSupport(jvmProperties).getDetailsView(app, appName), DataViewComponent.TOP_LEFT); // //Put the second application top right: } else if (count == 2) { dvc.addDetailsView(new SystemPropertiesViewSupport(jvmProperties).getDetailsView(app, appName), DataViewComponent.TOP_RIGHT); // // //Put the third application bottom left: } else if (count == 3) { dvc.addDetailsView(new SystemPropertiesViewSupport(jvmProperties).getDetailsView(app, appName), DataViewComponent.BOTTOM_LEFT); //Put the fourth application bottom right: } else if (count == 4) { dvc.addDetailsView(new SystemPropertiesViewSupport(jvmProperties).getDetailsView(app, appName), DataViewComponent.BOTTOM_RIGHT); //Put all other applications bottom right, //which creates tabs within the bottom right tab } else { dvc.addDetailsView(new SystemPropertiesViewSupport(jvmProperties).getDetailsView(app, appName), DataViewComponent.BOTTOM_RIGHT); } } return dvc; }
Example 19
Source File: XArrayDataViewer.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static Component loadArray(Object value) { Component comp = null; if (isViewableValue(value)) { Object[] arr; if (value instanceof Collection) { arr = ((Collection<?>) value).toArray(); } else if (value instanceof Map) { arr = ((Map<?,?>) value).entrySet().toArray(); } else if (value instanceof Object[]) { arr = (Object[]) value; } else { int length = Array.getLength(value); arr = new Object[length]; for (int i = 0; i < length; i++) { arr[i] = Array.get(value, i); } } JEditorPane arrayEditor = new JEditorPane(); arrayEditor.setContentType("text/html"); arrayEditor.setEditable(false); Color evenRowColor = arrayEditor.getBackground(); int red = evenRowColor.getRed(); int green = evenRowColor.getGreen(); int blue = evenRowColor.getBlue(); String evenRowColorStr = "rgb(" + red + "," + green + "," + blue + ")"; Color oddRowColor = new Color( red < 20 ? red + 20 : red - 20, green < 20 ? green + 20 : green - 20, blue < 20 ? blue + 20 : blue - 20); String oddRowColorStr = "rgb(" + oddRowColor.getRed() + "," + oddRowColor.getGreen() + "," + oddRowColor.getBlue() + ")"; Color foreground = arrayEditor.getForeground(); String textColor = String.format("%06x", foreground.getRGB() & 0xFFFFFF); StringBuilder sb = new StringBuilder(); sb.append("<html><body text=#"+textColor+"><table width=\"100%\">"); for (int i = 0; i < arr.length; i++) { if (i % 2 == 0) { sb.append("<tr style=\"background-color: " + evenRowColorStr + "\"><td><pre>" + (arr[i] == null ? arr[i] : htmlize(arr[i].toString())) + "</pre></td></tr>"); } else { sb.append("<tr style=\"background-color: " + oddRowColorStr + "\"><td><pre>" + (arr[i] == null ? arr[i] : htmlize(arr[i].toString())) + "</pre></td></tr>"); } } if (arr.length == 0) { sb.append("<tr style=\"background-color: " + evenRowColorStr + "\"><td></td></tr>"); } sb.append("</table></body></html>"); arrayEditor.setText(sb.toString()); JScrollPane scrollp = new JScrollPane(arrayEditor); comp = scrollp; } return comp; }
Example 20
Source File: ValueRetroTab.java From jeveassets with GNU General Public License v2.0 | 4 votes |
private void setData(JEditorPane jEditorPane, Value value) { if (value == null) { value = new Value("", Settings.getNow()); //Create empty } Output output = new Output(); output.addHeading(TabsValues.get().columnTotal()); output.addValue(value.getTotal()); output.addNone(); output.addHeading(TabsValues.get().columnWalletBalance()); output.addValue(value.getBalanceTotal()); output.addNone(); output.addHeading(TabsValues.get().columnAssets()); output.addValue(value.getAssetsTotal()); output.addNone(); output.addHeading(TabsValues.get().columnSellOrders()); output.addValue(value.getSellOrders()); output.addNone(); output.addHeading(TabsValues.get().columnEscrowsToCover()); output.addValue(value.getEscrows(), value.getEscrowsToCover()); output.addNone(); output.addHeading(TabsValues.get().columnBestAsset()); output.addValue(value.getBestAssetName(), value.getBestAssetValue()); output.addNone(2); output.addHeading(TabsValues.get().columnBestShip()); output.addValue(value.getBestShipName(), value.getBestShipValue()); output.addNone(2); /* //FIXME - No room for Best Ship Fitted output.addHeading(TabsValues.get().columnBestShipFitted()); output.addValue(value.getBestShipFittedName(), value.getBestShipFittedValue()); output.addNone(2); */ output.addHeading(TabsValues.get().columnBestModule()); output.addValue(value.getBestModuleName(), value.getBestModuleValue()); output.addNone(2); jEditorPane.setText(output.getOutput()); jEditorPane.setCaretPosition(0); }