JTextPane f = new JTextPane(); f.setContentType("text/html"); // let the text pane know this is what you want f.setText("<html>Hello World</html>"); // showing off f.setEditable(false); // as before f.setBackground(null); // this is the same as a JLabel f.setBorder(null); // remove the border
jTextPane_nextSentence.setBackground(new java.awt.Color(245, 245, 245)); jTextPane_nextSentence.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jTextPane_nextSentence.setEditable(false);
jTextPane_nextSentence.setBackground(new java.awt.Color(245, 245, 245)); jTextPane_nextSentence.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jTextPane_nextSentence.setFont(new java.awt.Font("Tahoma", 0, 24));
void notifyOnErrorForOperator(final JComponent component, Exception ex) { String message; if (ex instanceof JSONParseException) { message = StringUtils.removeStart(ex.getMessage(), "\n"); } else { message = String.format("%s: %s", ex.getClass().getSimpleName(), ex.getMessage()); } final NonOpaquePanel nonOpaquePanel = new NonOpaquePanel(); JTextPane textPane = Messages.configureMessagePaneUi(new JTextPane(), message); textPane.setFont(COURIER_FONT); textPane.setBackground(MessageType.ERROR.getPopupBackground()); nonOpaquePanel.add(textPane, BorderLayout.CENTER); nonOpaquePanel.add(new JLabel(MessageType.ERROR.getDefaultIcon()), BorderLayout.WEST); UIUtil.invokeLaterIfNeeded(() -> JBPopupFactory.getInstance().createBalloonBuilder(nonOpaquePanel) .setFillColor(MessageType.ERROR.getPopupBackground()) .createBalloon() .show(new RelativePoint(component, new Point(0, 0)), Balloon.Position.above) ); }
@Override public void actionPerformed(ActionEvent e) { if (showingDetails) { main.remove(details); main.validate(); main.setPreferredSize(MESSAGE_SIZE); } else { if (details == null) { details = createDetailedMessage(error); StringBuilder buffer = new StringBuilder(); stacktrace.setText(generateStackTrace(error, buffer).toString()); stacktrace.setCaretPosition(0); stacktrace.setBackground(main.getBackground()); stacktrace.setPreferredSize(STACKTRACE_SIZE); } main.add(details, BorderLayout.CENTER); main.validate(); main.setPreferredSize(TOTAL_SIZE); } showingDetails = !showingDetails; showDetails.setText(showingDetails ? "<< Hide Details" : "Show Details >>"); ErrorDialog.this.pack(); } });
/** * At time of writing this method does not work as expected (Java 1.6.x). * Therefore use {@link #setBackgroundColor()} instead * @param background the background to set */ @Override public final void setBackground(Color background) { super.setBackground(background); }
private JTextPane setTextPane(final JTextPane messageTextPane) { messageTextPane.setBackground(Color.WHITE); messageTextPane.setEditable(false); return messageTextPane; } private void addTextPane(final BroadcastMessage bm, TrUI mainWindow) {
private void applyBackgroundToMiddlePanel(Color color) { this.text.setBackground(color); this.container.setBackground(color); this.middlePanel.setBackground(color); }
JTextPane jtp = new JTextPane(); jtp.setBackground(Color.white); jtp.setText("text to print"); boolean show = true; try { jtp.print(null, null, show, null, null, show); } catch (java.awt.print.PrinterException ex) { ex.printStackTrace(); }
private JTextPane getBaseTextPane() { base = new JTextPane(); base.setEditable(false); base.setBackground(getBackground()); return base; }
JTextPane jtp = new JTextPane(); jtp.setBackground(Color.white); jtp.setText(text);//Set text to print. try { jtp.print(null, null, true, null, null, true); } catch (java.awt.print.PrinterException ex) { ex.printStackTrace(); }
JTextPane f = new JTextPane(); f.setContentType("text/html"); // let the text pane know this is what you want f.setEditable(false); // as before f.setBackground(null); // this is the same as a JLabel f.setBorder(null); // remove the border
JTextPane createSimplePane() { JTextPane textPane = new JTextPane(); textPane.setMargin(new Insets(1, 1, 1, 1)); textPane.setBackground(Color.WHITE); textPane.setForeground(Color.BLACK); return textPane; }
/** * Create the panel. */ public WelcomePanel() { setLayout(new MigLayout("", "[450px]", "[grow]")); JTextPane welcomeText = new JTextPane(); welcomeText.setEditable(false); welcomeText.setBackground(UIManager.getColor("control")); welcomeText.setText("Welcome to the OneBusAway Quick-Start wizard. This wizard will walk you through configuring the OneBusAway application with your transit data and starting the application."); add(welcomeText, "cell 0 0,grow"); }
/** * Create the panel. */ public WelcomePanel() { setLayout(new MigLayout("", "[450px]", "[grow]")); JTextPane welcomeText = new JTextPane(); welcomeText.setEditable(false); welcomeText.setBackground(UIManager.getColor("control")); welcomeText.setText("Welcome to the OneBusAway Quick-Start wizard. This wizard will walk you through configuring the OneBusAway application with your transit data and starting the application."); add(welcomeText, "cell 0 0,grow"); }
private void decorateContent(SwingLayoutTheme layoutTheme) { String contentColor = layoutTheme.findProperty("text-foreground-color"); String contentBackgroundColor = layoutTheme.findProperty("text-background-color"); this.content.setForeground(Color.decode(contentColor)); this.content.setBackground(Color.decode(contentBackgroundColor)); } }
private void decorateDescription(SwingLayoutTheme layoutTheme) { String descriptionColor = layoutTheme.findProperty("text-foreground-color"); this.description.setForeground(Color.decode(descriptionColor)); String descriptionBackgroundColor = layoutTheme.findProperty("text-background-color"); this.description.setBackground(Color.decode(descriptionBackgroundColor)); }
public CloudSdkPanel() { warningMessage.setVisible(false); warningMessage.setBackground(cloudSdkPanel.getBackground()); warningMessage.addHyperlinkListener(new BrowserOpeningHyperLinkListener()); warningIcon.setVisible(false); warningIcon.setIcon(RunConfigurations.ConfigurationWarning); checkManagedSdkFeatureStatus(); initEvents(); }
private void initDebugTextPane() { HTMLEditorKit htmlEditorKit = new HTMLEditorKit(); HTMLDocument htmlDocument = new HTMLDocument(); debugTextPane.setEditable(false); debugTextPane.setBackground(Color.WHITE); debugTextPane.setEditorKit(htmlEditorKit); htmlEditorKit.install(debugTextPane); debugTextPane.setDocument(htmlDocument); }
/** Creates new form SelectModePanel */ public SelectModePanel(SelectModeDescriptorPanel controller) { this.controller = controller; initComponents(); instructions.setEditorKit(new HTMLEditorKit()); instructions.setBackground(instructionPanel.getBackground()); disableHostSensitiveComponents(); refreshRunnable = new RefreshRunnable(); refreshSourceFolderTask = RP2.create(refreshRunnable); addListeners(); }