use of javax.swing.JEditorPane in project adempiere by adempiere.
the class CAbstractBOMTree method preInit.
private void preInit() {
northPanel = new CPanel();
southPanel = new CPanel();
contentPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
nodeDescription = new JEditorPane("text/html", "");
nodeDescription.setOpaque(false);
nodeDescription.setEditable(false);
String columnName = null;
int columnId = -1;
if (BOMWrapper.BOM_TYPE_PRODUCT.equals(type())) {
columnName = MProduct.Table_Name + "_ID";
columnId = MColumn.getColumn_ID(MProduct.Table_Name, columnName);
} else if (BOMWrapper.BOM_TYPE_ORDER.equals(type())) {
columnName = MPPOrder.Table_Name + "_ID";
columnId = MColumn.getColumn_ID(MPPOrder.Table_Name, columnName);
}
MLookup lm = MLookupFactory.get(Env.getCtx(), getWindowNo(), 0, columnId, DisplayType.Search);
lookup = new VLookup(columnName, false, false, true, lm) {
public void setValue(Object obj) {
super.setValue(obj);
dispatchPropertyChange();
}
;
};
}
use of javax.swing.JEditorPane in project adempiere by adempiere.
the class HelpInfo method createAndShowGui.
// METHODS
// =======
/**
* Create the GUI and show it
* @param component the calling component
*/
public void createAndShowGui(Component component) {
// title
setTitle(s_logger.localizeMessage("guiHelpTitle"));
// load icons
ArrayList<Image> images = new ArrayList<Image>();
images.add(getImage("AD16.png"));
images.add(getImage("AD32.png"));
setIconImages(images);
// content pane
Container pane = getContentPane();
Locale locale = Locale.getDefault();
pane.setComponentOrientation(ComponentOrientation.getOrientation(locale));
pane.setLayout(new GridBagLayout());
// help text
JEditorPane info = new JEditorPane();
info.setEditable(false);
info.setContentType("text/html");
HTMLDocument htmlDoc = (HTMLDocument) info.getEditorKit().createDefaultDocument();
info.setDocument(htmlDoc);
info.setText(getHelpText());
info.setCaretPosition(0);
// scrollable pane for help text
JScrollPane infoPane = new JScrollPane();
infoPane.setBorder(BorderFactory.createLoweredBevelBorder());
infoPane.setPreferredSize(new Dimension(500, 400));
infoPane.getViewport().add(info, null);
pane.add(infoPane, getInfoPaneConstraints());
// close button
m_buttonClose = new JButton(s_logger.localizeMessage("guiButtonClose"));
m_buttonClose.setMnemonic(new Integer(s_logger.localizeMessage("guiButtonCloseMnemonic")));
m_buttonClose.setIcon(new ImageIcon(getImage("Cancel16.png")));
m_buttonClose.addActionListener(this);
pane.add(m_buttonClose, getCloseConstraints());
// show dialog
pack();
validate();
m_buttonClose.requestFocusInWindow();
setLocationRelativeTo(component);
setVisible(true);
}
use of javax.swing.JEditorPane in project jmeter by apache.
the class TextBoxDialoger method createDialogBox.
private void createDialogBox() {
JFrame mainFrame = GuiPackage.getInstance().getMainFrame();
String title = //$NON-NLS-1$
editable ? //$NON-NLS-1$
JMeterUtils.getResString("textbox_title_edit") : //$NON-NLS-1$
JMeterUtils.getResString("textbox_title_view");
// modal dialog box
dialog = new JDialog(mainFrame, title, true);
// Close action dialog box when tapping Escape key
JPanel content = (JPanel) dialog.getContentPane();
content.registerKeyboardAction(this, KeyStrokes.ESC, JComponent.WHEN_IN_FOCUSED_WINDOW);
textBox = new JEditorPane();
textBox.setEditable(editable);
JScrollPane textBoxScrollPane = GuiUtils.makeScrollPane(textBox);
JPanel btnBar = new JPanel();
btnBar.setLayout(new FlowLayout(FlowLayout.RIGHT));
if (editable) {
//$NON-NLS-1$
JButton cancelBtn = new JButton(JMeterUtils.getResString("textbox_cancel"));
cancelBtn.setActionCommand(CANCEL_COMMAND);
cancelBtn.addActionListener(this);
//$NON-NLS-1$
JButton saveBtn = new JButton(JMeterUtils.getResString("textbox_save_close"));
saveBtn.setActionCommand(SAVE_CLOSE_COMMAND);
saveBtn.addActionListener(this);
btnBar.add(cancelBtn);
btnBar.add(saveBtn);
} else {
//$NON-NLS-1$
JButton closeBtn = new JButton(JMeterUtils.getResString("textbox_close"));
closeBtn.setActionCommand(CLOSE_COMMAND);
closeBtn.addActionListener(this);
btnBar.add(closeBtn);
}
// Prepare dialog box
Container panel = dialog.getContentPane();
dialog.setMinimumSize(new Dimension(400, 250));
panel.add(textBoxScrollPane, BorderLayout.CENTER);
panel.add(btnBar, BorderLayout.SOUTH);
// determine location on screen
Point p = mainFrame.getLocationOnScreen();
Dimension d1 = mainFrame.getSize();
Dimension d2 = dialog.getSize();
dialog.setLocation(p.x + (d1.width - d2.width) / 2, p.y + (d1.height - d2.height) / 2);
dialog.pack();
}
use of javax.swing.JEditorPane in project ChatGameFontificator by GlitchCog.
the class ControlWindow method constructAboutPopup.
/**
* Construct the popup dialog containing the About message
*/
private void constructAboutPopup() {
aboutPane = new JEditorPane("text/html", ABOUT_CONTENTS);
aboutPane.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent e) {
if (EventType.ACTIVATED.equals(e.getEventType())) {
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(URI.create("https://" + e.getDescription()));
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
});
aboutPane.setEditable(false);
}
use of javax.swing.JEditorPane in project jabref by JabRef.
the class EntryEditorTabRelatedArticles method setHtmlText.
/**
* Takes a List of HTML snippets stored in the field "html_representation" of a list of bibentries and sets it in the JEditorPane
*
* @param list of bib entries having a field html_representation
*/
public void setHtmlText(List<BibEntry> list) {
StringBuilder htmlContent = new StringBuilder();
URL url = IconTheme.getIconUrl("mdlListIcon");
htmlContent.append("<html><head><title></title></head><body bgcolor='#ffffff'>");
htmlContent.append("<ul style='list-style-image:(");
htmlContent.append(url);
htmlContent.append(")'>");
list.stream().map(bibEntry -> bibEntry.getField("html_representation")).filter(Optional::isPresent).map(o -> "<li style='margin: 5px'>" + o.get() + "</li>").forEach(html -> htmlContent.append(html));
htmlContent.append("</ul>");
htmlContent.append("<br><div style='margin-left: 5px'>");
htmlContent.append("<a href='http://mr-dlib.org/information-for-users/information-about-mr-dlib-for-jabref-users/#'>");
htmlContent.append(Localization.lang("What_is_Mr._DLib?"));
htmlContent.append("</a></div>");
htmlContent.append("</body></html>");
this.setText(htmlContent.toString());
}
Aggregations