List of usage examples for javax.swing JEditorPane JEditorPane
public JEditorPane()
JEditorPane
. From source file:pcgen.gui2.tabs.SummaryInfoTab.java
SummaryInfoTab() { this.tabTitle = new TabTitle(Tab.SUMMARY); this.basicsPanel = new JPanel(); this.todoPanel = new JPanel(); this.scoresPanel = new JPanel(); this.racePanel = new JPanel(); this.classPanel = new JPanel(); this.characterNameField = new JTextField(); this.characterTypeComboBox = new JComboBox<>(); this.random = new JButton(); FontManipulation.xsmall(random);/*from w w w . j a v a2s .c o m*/ this.playerNameField = new JTextField(); this.expField = new JFormattedTextField(NumberFormat.getIntegerInstance()); this.nextlevelField = new JFormattedTextField(NumberFormat.getIntegerInstance()); this.xpTableComboBox = new JComboBox<>(); this.expmodField = new JFormattedTextField(NumberFormat.getIntegerInstance()); this.addLevelsField = new JFormattedTextField(NumberFormat.getIntegerInstance()); this.removeLevelsField = new JFormattedTextField(NumberFormat.getIntegerInstance()); this.statsTable = new JTable(); this.classLevelTable = new JTable(); this.languageTable = new JTable(); this.genderComboBox = new JComboBox<>(); this.handsComboBox = new JComboBox<>(); this.alignmentComboBox = new JComboBox<>(); this.deityComboBox = new JComboBox<>(); this.raceComboBox = new JComboBox<>(); this.ageComboBox = new JComboBox<>(); this.classComboBox = new JComboBox<>(); this.tabLabelField = new JTextField(); this.ageField = new JFormattedTextField(NumberFormat.getIntegerInstance()); this.generateRollsButton = new JButton(); this.rollMethodButton = new JButton(); this.createMonsterButton = new JButton(); this.addLevelsButton = new JButton(); this.removeLevelsButton = new JButton(); this.expaddButton = new JButton(); this.expsubtractButton = new JButton(); this.hpButton = new JButton(); this.totalHPLabel = new JLabel(); this.infoPane = new JEditorPane(); this.statTotalLabel = new JLabel(); this.statTotal = new JLabel(); this.modTotalLabel = new JLabel(); this.modTotal = new JLabel(); this.todoPane = new JEditorPane(); this.infoBoxRenderer = new InfoBoxRenderer(); this.classBoxRenderer = new ClassBoxRenderer(); initComponents(); }
From source file:pl.otros.logview.gui.Log4jPatternParserEditor.java
private void createGui() { this.setLayout(new BorderLayout()); heading1Font = new JLabel().getFont().deriveFont(20f).deriveFont(Font.BOLD); heading2Font = new JLabel().getFont().deriveFont(14f).deriveFont(Font.BOLD); loadLog = new JButton("Load log", Icons.FOLDER_OPEN); testParser = new JButton("Test parser", Icons.WRENCH_ARROW); saveParser = new JButton("Save", Icons.DISK); logFileContent = new JTextArea(); DefaultSyntaxKit.initKit();//from w w w . j ava2 s . c o m propertyEditor = new JEditorPane(); logFileContent = new JTextArea(); logViewPanel = new LogViewPanel(new LogDataTableModel(), TableColumns.ALL_WITHOUT_LOG_SOURCE, otrosApplication); JPanel panelEditorActions = new JPanel(new BorderLayout(5, 5)); JToolBar actionsToolBar = new JToolBar("Actions"); actionsToolBar.setFloatable(false); actionsToolBar.add(testParser); actionsToolBar.add(saveParser); JToolBar propertyEditorToolbar = new JToolBar(); JLabel labelEditProperties = new JLabel("Edit your properties: and test parser"); labelEditProperties.setFont(heading2Font); propertyEditorToolbar.add(labelEditProperties); panelEditorActions.add(propertyEditorToolbar, BorderLayout.NORTH); panelEditorActions.add(actionsToolBar, BorderLayout.SOUTH); panelEditorActions.add(new JScrollPane(propertyEditor)); logFileContentLabel = new JLabel(" Load your log file, paste from clipboard or drag and drop file. "); JToolBar loadToolbar = new JToolBar(); loadToolbar.add(logFileContentLabel); loadToolbar.add(loadLog); logFileContentLabel.setFont(heading2Font); JPanel logContentPanel = new JPanel(new BorderLayout(5, 5)); logContentPanel.add(new JScrollPane(logFileContent)); logContentPanel.add(loadToolbar, BorderLayout.NORTH); JSplitPane northSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); northSplit.setOneTouchExpandable(true); northSplit.add(logContentPanel); northSplit.add(panelEditorActions); JPanel southPanel = new JPanel(new BorderLayout(5, 5)); JLabel labelParsingResult = new JLabel(" Parsing result:"); labelParsingResult.setFont(heading1Font); southPanel.add(labelParsingResult, BorderLayout.NORTH); southPanel.add(logViewPanel); JSplitPane mainSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); mainSplit.setOneTouchExpandable(true); mainSplit.add(northSplit); mainSplit.add(southPanel); mainSplit.setDividerLocation(0.5f); add(mainSplit); propertyEditor.setContentType("text/properties"); }
From source file:pl.otros.logview.gui.message.editor.MessageColorizerEditor.java
public MessageColorizerEditor(PluginableElementsContainer<MessageColorizer> container, StatusObserver observer) {// w w w .j a va 2 s .c o m this.container = container; statusObserver = observer; this.setLayout(new BorderLayout()); DefaultSyntaxKit.initKit(); editorPane = new JEditorPane(); JScrollPane comp = new JScrollPane(editorPane); JLabel propertyEditorLabel = new JLabel("Enter you message colorizer properties"); editorPane.setContentType("text/properties"); label = new JLabel(); String defaultContent = getDefaultContent(); try { editorPane.getDocument().insertString(0, defaultContent, null); } catch (BadLocationException e1) { LOGGER.severe(String.format("Can't set text: %s", e1.getMessage())); } deleyedSwingInvoke = new DelayedSwingInvoke() { @Override protected void performActionHook() { refreshView(); } }; DocumentListener documentListener = new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { deleyedSwingInvoke.performAction(); } @Override public void insertUpdate(DocumentEvent e) { deleyedSwingInvoke.performAction(); } @Override public void changedUpdate(DocumentEvent e) { } }; editorPane.getDocument().addDocumentListener(documentListener); JLabel textPaneLabel = new JLabel("Enter log message body"); textPane = new JTextPane(); textPane.getDocument().addDocumentListener(documentListener); JPanel north = new JPanel(new BorderLayout()); north.add(propertyEditorLabel, BorderLayout.NORTH); north.add(comp); JPanel south = new JPanel(new BorderLayout()); south.add(textPaneLabel, BorderLayout.NORTH); south.add(new JScrollPane(textPane)); JSplitPane jSplitPaneEditors = new JSplitPane(SwingConstants.HORIZONTAL, north, south); jSplitPaneEditors.setOneTouchExpandable(true); jSplitPaneEditors.setDividerLocation(0.5d); this.add(jSplitPaneEditors); this.add(label, BorderLayout.SOUTH); }
From source file:se.nawroth.asciidoc.browser.AsciidocBrowserApplication.java
public AsciidocBrowserApplication(final String[] args) { super("Asciidoc Browser"); setIconImage(Icons.APPLICATION.image()); setSize(1200, 1024);//w w w .j a va 2 s . c om addWindowListener(new WindowAdapter() { @Override public void windowClosing(final WindowEvent e) { actionExit(); } }); JPanel buttonPanel = new JPanel(); backButton = new JButton(""); backButton.setIcon(Icons.BACK.icon()); backButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { actionBack(); } }); buttonPanel.setLayout(new MigLayout("", "[1px][][][][]", "[1px]")); JButton btnOptionsbutton = new JButton(""); btnOptionsbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { settingsDialog.setVisible(true); } }); btnOptionsbutton.setIcon(Icons.OPTIONS.icon()); buttonPanel.add(btnOptionsbutton, "flowx,cell 0 0"); backButton.setEnabled(false); buttonPanel.add(backButton, "cell 0 0,grow"); forwardButton = new JButton(""); forwardButton.setIcon(Icons.FORWARD.icon()); forwardButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { actionForward(); } }); forwardButton.setEnabled(false); buttonPanel.add(forwardButton, "cell 0 0,grow"); getContentPane().setLayout(new MigLayout("", "[793.00px,grow]", "[44px][930px]")); getContentPane().add(buttonPanel, "cell 0 0,growx,aligny top"); locationTextField = new JTextField(65); locationTextField.setText(""); locationTextField.addKeyListener(new KeyAdapter() { @Override public void keyReleased(final KeyEvent e) { int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_ENTER || keyCode == KeyEvent.VK_TAB) { actionGo(); refreshDocumentTree(); } } }); locationTextField.setTransferHandler( new TextFieldTransferHandler(locationTextField.getTransferHandler(), new Runnable() { @Override public void run() { locationTextField.setText(""); } }, new Runnable() { @Override public void run() { actionGo(); refreshDocumentTree(); } })); homebutton = new JButton(""); homebutton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { locationTextField.setText(Settings.getHome()); actionGo(); refreshDocumentTree(); } }); refreshButton = new JButton(""); refreshButton.setToolTipText("Refresh"); refreshButton.setEnabled(false); refreshButton.setIcon(Icons.REFRESH.icon()); refreshButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { actionGo(); refreshPreview(); } }); buttonPanel.add(refreshButton, "cell 1 0"); homebutton.setIcon(Icons.HOME.icon()); buttonPanel.add(homebutton, "cell 2 0"); buttonPanel.add(locationTextField, "cell 3 0,grow"); treeSourceSplitPane = new JSplitPane(); treeSourceSplitPane.setResizeWeight(0.3); getContentPane().add(treeSourceSplitPane, "cell 0 1,grow"); treeScrollPane = new JScrollPane(); treeScrollPane.setMinimumSize(new Dimension(200, 200)); treeSourceSplitPane.setLeftComponent(treeScrollPane); documentTree = new DocumentTree(documentModel); documentTree.setCellRenderer(new TooltipsTreeCellRenderer()); ToolTipManager.sharedInstance().registerComponent(documentTree); ToolTipManager.sharedInstance().setInitialDelay(INITIAL_TOOLTIP_DELAY); ToolTipManager.sharedInstance().setReshowDelay(0); documentTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(final TreeSelectionEvent tse) { TreePath newLeadSelectionPath = tse.getNewLeadSelectionPath(); if (newLeadSelectionPath != null && !newLeadSelectionPath.equals(currentSelectionPath)) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) newLeadSelectionPath .getLastPathComponent(); FileWrapper file = (FileWrapper) node.getUserObject(); showFile(file, true); refreshPreview(); } } }); treeScrollPane.setViewportView(documentTree); sourceEditorPane = new JEditorPane(); sourceEditorPane.setContentType("text/html"); sourceEditorPane.setEditable(false); sourceEditorPane.addHyperlinkListener(new HandleHyperlinkUpdate()); JScrollPane fileScrollPane = new JScrollPane(sourceEditorPane); fileScrollPane.setMinimumSize(new Dimension(600, 600)); documentTabbedPane = new JTabbedPane(SwingConstants.BOTTOM); documentTabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(final ChangeEvent ce) { refreshPreview(); } }); sourceLogSplitPane = new JSplitPane(); sourceLogSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); treeSourceSplitPane.setRightComponent(sourceLogSplitPane); sourceLogSplitPane.setTopComponent(documentTabbedPane); documentTabbedPane.add(fileScrollPane); documentTabbedPane.setTitleAt(0, "Source"); browserPane = new BrowserPane(); previewScrollPane = new JScrollPane(browserPane); documentTabbedPane.addTab("Preview", null, previewScrollPane, null); console = new JConsole(); System.setErr(console.getErr()); System.setOut(console.getOut()); sourceLogSplitPane.setBottomComponent(console); executor = new AsciidocExecutor(); }
From source file:storybook.toolkit.swing.SwingUtil.java
public static JTextComponent createTextComponent(MainFrame mainFrame) { JTextComponent tc;//from w w w . j a v a2 s . co m if (BookUtil.isUseHtmlScenes(mainFrame)) { tc = new JEditorPane(); JEditorPane ep = (JEditorPane) tc; ep.setEditorKitForContentType("text/html", new WysiwygHTMLEditorKit()); ep.setContentType("text/html"); } else { tc = new UndoableTextArea(); UndoableTextArea ta = (UndoableTextArea) tc; ta.setLineWrap(true); ta.setWrapStyleWord(true); ta.getUndoManager().discardAllEdits(); } return tc; }
From source file:tk.elevenk.restfulrobot.gui.EditorWindow.java
public EditorWindow() { super();/* w w w .j ava 2s . c om*/ this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); fileOpen = false; editor = new JEditorPane(); editor.setText(""); editorScrollPane = new JScrollPane(editor); editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); this.setMaximumSize(new Dimension(800, 600)); this.setMinimumSize(new Dimension(320, 240)); this.add(editorScrollPane); }
From source file:tvbrowser.ui.settings.channel.ChannelGroupInfoDialog.java
/** * Create the GUI/*from w ww . j a v a 2s .c om*/ */ private void initGui() { UiUtilities.registerForClosing(this); JPanel panel = (JPanel) getContentPane(); panel.setBorder(Borders.DLU4_BORDER); panel.setLayout(new FormLayout("fill:default:grow, default", "fill:default:grow, 3dlu, default")); CellConstraints cc = new CellConstraints(); final JEditorPane infoPanel = new JEditorPane(); infoPanel.setEditorKit(new ExtendedHTMLEditorKit()); ExtendedHTMLDocument doc = (ExtendedHTMLDocument) infoPanel.getDocument(); infoPanel.setEditable(false); infoPanel.setText(generateHtml(doc)); infoPanel.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent evt) { if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { URL url = evt.getURL(); if (url != null) { Launch.openURL(url.toString()); } } } }); final JScrollPane scrollPane = new JScrollPane(infoPanel); panel.add(scrollPane, cc.xyw(1, 1, 2)); JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK)); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { infoPanel.scrollRectToVisible(new Rectangle(0, 0)); } }); panel.add(ok, cc.xy(2, 3)); setSize(500, 350); }
From source file:tvbrowser.ui.settings.PluginInfoDialog.java
/** * Create the GUI/*from w ww.j a v a2 s . co m*/ */ private void initGui() { JPanel panel = (JPanel) getContentPane(); panel.setBorder(Borders.DLU4_BORDER); panel.setLayout(new FormLayout("fill:default:grow, default", "fill:default:grow, 3dlu, default")); CellConstraints cc = new CellConstraints(); JEditorPane infoPanel = new JEditorPane(); infoPanel.setEditorKit(new ExtendedHTMLEditorKit()); ExtendedHTMLDocument doc = (ExtendedHTMLDocument) infoPanel.getDocument(); infoPanel.setEditable(false); infoPanel.setText(generateHtml(doc)); infoPanel.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent evt) { if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { URL url = evt.getURL(); if (url != null) { Launch.openURL(url.toString()); } } } }); panel.add(new JScrollPane(infoPanel), cc.xyw(1, 1, 2)); JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK)); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { close(); } }); panel.add(ok, cc.xy(2, 3)); Settings.layoutWindow("pluginInfoDialog", this, new Dimension(700, 500)); UiUtilities.registerForClosing(this); }
From source file:uk.ac.ucl.cs.cmic.giftcloud.uploadapp.GiftCloudDialogs.java
public void showMessage(final String message) throws HeadlessException { final JPanel messagePanel = new JPanel(new GridBagLayout()); final JEditorPane textField = new JEditorPane(); textField.setContentType("text/html"); textField.setText(message);/*from w w w . j av a2 s . c o m*/ textField.setEditable(false); textField.setBackground(null); textField.setBorder(null); textField.setEditable(false); textField.setForeground(UIManager.getColor("Label.foreground")); textField.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true); textField.setFont(UIManager.getFont("Label.font")); textField.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(e.getURL().toURI()); } catch (IOException e1) { // Ignore failure to launch URL } catch (URISyntaxException e1) { // Ignore failure to launch URL } } } } }); messagePanel.add(textField); textField.setAlignmentX(SwingConstants.CENTER); JOptionPane.showMessageDialog(mainFrame.getContainer(), messagePanel, applicationName, JOptionPane.INFORMATION_MESSAGE, icon); }