当前位置: 首页>>代码示例>>Java>>正文


Java JEditorPane.setEditable方法代码示例

本文整理汇总了Java中javax.swing.JEditorPane.setEditable方法的典型用法代码示例。如果您正苦于以下问题:Java JEditorPane.setEditable方法的具体用法?Java JEditorPane.setEditable怎么用?Java JEditorPane.setEditable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JEditorPane的用法示例。


在下文中一共展示了JEditorPane.setEditable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setEditable

import javax.swing.JEditorPane; //导入方法依赖的package包/类
public void setEditable(boolean b) {
    JEditorPane editor = editor();
    if (editor.isEditable() == b) return;
    
    editor.setEditable(b);

    if (b) {
        if (lastBgColor != null) editor.setBackground(lastBgColor);
        if (lastCaret != null) editor.setCaret(lastCaret);
    } else {
        lastBgColor = editor.getBackground();
        lastCaret = editor.getCaret();
        editor.setBackground(disabledBgColor);
        editor.setCaret(nullCaret);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:OQLEditor.java

示例2: HelpDialog

import javax.swing.JEditorPane; //导入方法依赖的package包/类
public HelpDialog() {
	setTitle(StringResource.getString("DEFAULT_TITLE"));
	setSize(640, 480);
	htmlPane = new JEditorPane();
	JPanel panel = new JPanel(new BorderLayout(5, 5));
	panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	panel.add(new JScrollPane(htmlPane));
	add(panel);
	model = new HelpListModel();
	helpList = new JList(values);
	JPanel p = new JPanel(new BorderLayout());
	p.add(createToolBar(), BorderLayout.NORTH);
	p.add(new JScrollPane(helpList));
	panel.add(p, BorderLayout.WEST);
	setIconImage(XDMIconMap.getIcon("APP_ICON").getImage());
	helpList.addListSelectionListener(this);
	htmlPane.setEditable(false);
	map.put(keys[0], getClass().getResource(
			"/help/browser_integration.html"));
	map.put(keys[1], getClass().getResource("/help/video_download.html"));
	map.put(keys[2], getClass().getResource("/help/refresh_link.html"));
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:23,代码来源:HelpDialog.java

示例3: createComponent

import javax.swing.JEditorPane; //导入方法依赖的package包/类
@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;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:20,代码来源:ScriptEditor.java

示例4: buildDetail

import javax.swing.JEditorPane; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void buildDetail(String id, JPanel panel) {
    if (this.id.equals(id)) return;

    panel.setLayout(new MigLayout("wrap 1, center"));

    JLabel header = Utility.localizedHeaderLabel(Messages.nameKey(id),
        SwingConstants.LEADING, FontLibrary.FontSize.SMALL);
    panel.add(header, "align center, wrap 20");

    JEditorPane editorPane = new JEditorPane("text/html",
        Messages.getDescription(id)) {

        @Override
        public void paintComponent(Graphics g) {
            Graphics2D graphics2d = (Graphics2D) g;
            graphics2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                                        RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
            /*
            graphics2d.setRenderingHint(RenderingHints.KEY_RENDERING,
                                        RenderingHints.VALUE_RENDER_QUALITY);
            graphics2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
                                        RenderingHints.VALUE_FRACTIONALMETRICS_ON);
            */
            super.paintComponent(graphics2d);
        }
    };
    editorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
                                 Boolean.TRUE);
    editorPane.setFont(panel.getFont());
    editorPane.setOpaque(false);
    editorPane.setEditable(false);
    editorPane.addHyperlinkListener(colopediaPanel);

    panel.add(editorPane, "width 95%");
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:40,代码来源:ConceptDetailPanel.java

示例5: FlickrSettingsPanel

import javax.swing.JEditorPane; //导入方法依赖的package包/类
public FlickrSettingsPanel()
{
	apiKey = new JTextField();
	apiSharedSecret = new JTextField();

	// Yuck, this seems to be the minimal amount of code to get a clickable
	// and styled link
	// (copied from the Cron link in the scheduler)
	JEditorPane apiKeyHelp = new JEditorPane();
	apiKeyHelp.setEditorKit(new HTMLEditorKit());
	apiKeyHelp.setDocument(new HTMLDocument());
	apiKeyHelp.setEditable(false);
	apiKeyHelp.setText("<html><head><style>" + "<!--a{color:#0000cc;text-decoration: none;}//--></style></head>"
		+ "<body>" + getString("settings.label.apikeyhelp"));
	apiKeyHelp.addHyperlinkListener(new HyperlinkListener()
	{
		@Override
		public void hyperlinkUpdate(HyperlinkEvent e)
		{
			if( e.getEventType() == HyperlinkEvent.EventType.ACTIVATED )
			{
				getClientService().showDocument(e.getURL(), null);
			}
		}
	});
	apiKeyHelp.setBackground(new JPanel().getBackground());

	add(apiKeyHelp, "span 2");

	add(new JLabel(getString("settings.label.apikey")));
	add(apiKey);
	add(new JLabel(getString("settings.label.apisharedsecret")));
	add(apiSharedSecret);
}
 
开发者ID:equella,项目名称:Equella,代码行数:35,代码来源:FlickrSettingsPanel.java

示例6: LongMessageDialog

import javax.swing.JEditorPane; //导入方法依赖的package包/类
/**
 * Creates a dialog to display a long message.
 *
 * @param owner
 *            the owner window in which the dialog is displayed
 * @param i18nKey
 *            the i18n key
 * @param message
 *            the actual message
 * @param i18nArgs
 *            additional i18n arguments
 * @since 6.5.0
 */
public LongMessageDialog(Window owner, String i18nKey, String message, Object... i18nArgs) {
	super(owner, i18nKey, ModalityType.APPLICATION_MODAL, i18nArgs);
	JEditorPane textComponent = new ExtendedHTMLJEditorPane("text/html", message);
	// so it does not steel ENTER from the default button
	textComponent.setFocusable(false);
	StyleSheet css = ((HTMLEditorKit) textComponent.getEditorKit()).getStyleSheet();
	css.addRule("body { margin : 0; font-family : sans-serif; font-size : 9px; font-style : normal; }");
	css.addRule(".error { font-weight:bold; color:red; font-style:plain; }");
	css.addRule("code { font-weight:bold; color:#000088; }");
	textComponent.setEditable(false);
	JScrollPane scrollPane = new ExtendedJScrollPane(textComponent);
	scrollPane.setBorder(createBorder());
	layoutDefault(scrollPane, NORMAL, makeCloseButton());
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:28,代码来源:LongMessageDialog.java

示例7: redraw

import javax.swing.JEditorPane; //导入方法依赖的package包/类
@Override
public void redraw() {
	// Redraws only if data has changed - Bertoli Marco
	if (!redrawNeeded)
		return;

	if (data.hasResults() && data.areResultsOK()
			&& data.getResults().getSaturationSectors().size() > 0) {
		if (data.getClasses() == 2) {
			this.removeAll();
			s2dp = new Sectors2DGraph(data);
			this.setLayout(new BorderLayout());
			this.add(new JabaCanvas(s2dp), BorderLayout.CENTER);
			this.add(new JLabel(JabaConstants.DESCRIPITION_GRAPH),
					BorderLayout.PAGE_END);
			repaint();
		} else if (data.getClasses() == 3) {
			this.removeAll();
			Sectors3DGraph s3dp = new Sectors3DGraph(data);
			this.setLayout(new BorderLayout());
			this.add(new JabaCanvas(s3dp), BorderLayout.CENTER);
			this.add(new JLabel(JabaConstants.DESCRIPITION_GRAPH),
					BorderLayout.PAGE_END);
			repaint();
		}
	} else {
		this.removeAll();
		JEditorPane synView = new JTextPane();
		synView.setContentType("text/html");
		synView.setEditable(false);
		JScrollPane synScroll = new JScrollPane(synView);
		synScroll
				.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		synScroll
				.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
		synView.setText("<html><body><center><font face=\"bold\" size=\"3\">Saturation Sectors will be here displayed once you solve the model.</font></center></body></html>");
		this.add(synScroll, BorderLayout.CENTER);
	}
	redrawNeeded = false;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:41,代码来源:SectorsGraphicPanel.java

示例8: redraw

import javax.swing.JEditorPane; //导入方法依赖的package包/类
public void redraw() {
	// We redraw only if data has changed - Sebastiano Spicuglia
	if (!redrawNeeded)
		return;
	this.removeAll();
	if (data.hasResults() && data.areResultsOK()
			&& data.getResults().getSaturationSectors().size() > 0) {
		if (data.getClasses() == 2) {
			this.removeAll();
			this.setLayout(new GridLayout(2, 1));
			JPanel tmp = new JPanel(new GridLayout(1, 2));
			tmp.add(new JabaCanvas(new Sectors2DGraph(data)));
			tmp.add(new JabaCanvas(new Convex2DGraph(data, mainWin)));
			this.add(tmp);
			this.add(new JabaCanvas(new PerformanceIndices2DGraph(data)));
			repaint();
		} else if (data.getClasses() == 3) {
			this.removeAll();
			this.setLayout(new GridLayout(1, 2));
			this.add(new JabaCanvas(new Sectors3DGraph(data)));
			this.add(new JabaCanvas(new Convex3DGraph(data, mainWin)));
			repaint();
		}
	} else {
		JEditorPane synView = new JTextPane();
		synView.setContentType("text/html");
		synView.setEditable(false);
		JScrollPane synScroll = new JScrollPane(synView);
		synScroll
				.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		synScroll
				.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
		synView.setText("<html><body><center><font face=\"bold\" size=\"3\">Graphs will be here displayed once you solve the model.</font></center></body></html>");
		this.add(synScroll);
		repaint();
	}
	redrawNeeded = false;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:39,代码来源:AllInOnePanel.java

示例9: aboutMenuItemActionPerformed

import javax.swing.JEditorPane; //导入方法依赖的package包/类
private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed
Font font = new JLabel().getFont();

// Load HTML and set style to match the application's style
String html
	= Translations.get(
		"RaceFrame.help.about",
		font.getFamily(),
		(font.isBold() ? "bold" : "normal"),
		"" + font.getSize() + "pt");

// Create HTML content pane
JEditorPane ep = new JEditorPane("text/html", html);

// Handle link clicks
ep.addHyperlinkListener((HyperlinkEvent e) -> {
    if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
	try {
	    Desktop.getDesktop().browse(e.getURL().toURI());
	} catch (IOException | URISyntaxException ex) {
	    Logger.getLogger(RaceFrame.class.getName()).log(Level.SEVERE, null, ex);
	}
    }
});
ep.setEditable(false);
ep.setBackground(new JOptionPane().getBackground());

// Show dialog
JOptionPane.showMessageDialog(null, ep);
   }
 
开发者ID:Follpvosten,项目名称:schneckenrennen,代码行数:31,代码来源:RaceFrame.java

示例10: SwingSpyPanel

import javax.swing.JEditorPane; //导入方法依赖的package包/类
/**
	 * Initialization.
	 */
	public SwingSpyPanel() {
		setPreferredSize(new Dimension(INITIAL_WIDTH, INITIAL_HEIGHT));
		setLayout(new BorderLayout());

		root = new DefaultMutableTreeNode();
		componentTree = new JTree(root);
		componentTree.setRootVisible(false);
		componentTree.setCellRenderer(new SwingComponentRenderer());
		componentTree.addTreeSelectionListener(new CustomSelectionListener());
//		add(new JScrollPane(componentTree), BorderLayout.CENTER);

		detailsData = new JEditorPane();
		detailsData.setBackground(new Color(250, 250, 250));
		detailsData.setForeground(new Color(33, 33, 33));
		detailsData.setBorder(BorderFactory.createLineBorder(new Color(100, 100, 244), 1));
		detailsData.setPreferredSize(new Dimension(150, INITIAL_HEIGHT));
		detailsData.setEditable(false);
		detailsData.setContentType("text/html");
		SwingUtil.enforceJEditorPaneFont(detailsData, font);
		detailsScrollPane = new JScrollPane(detailsData);
//		add(detailsScrollPane, BorderLayout.EAST);

		JSplitPane hPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(componentTree), detailsScrollPane);
		hPane.setContinuousLayout(true);
		hPane.setOneTouchExpandable(true);
		hPane.setDividerLocation(INITIAL_WIDTH - 200);
		add(hPane, BorderLayout.CENTER);

		componentData = new JEditorPane();
		componentData.setBackground(new Color(250, 250, 250));
		componentData.setForeground(new Color(33, 33, 33));
		componentData.setBorder(BorderFactory.createLineBorder(new Color(100, 100, 244), 1));
		componentData.setPreferredSize(new Dimension(INITIAL_WIDTH, 36));
		componentData.setEditable(false);
		componentData.setContentType("text/html");
		SwingUtil.enforceJEditorPaneFont(componentData, font);
		add(componentData, BorderLayout.SOUTH);

	}
 
开发者ID:igr,项目名称:swingspy,代码行数:43,代码来源:SwingSpyPanel.java

示例11: HelpWindow

import javax.swing.JEditorPane; //导入方法依赖的package包/类
public HelpWindow(String title, URL contents) {
  super(title);
  setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
  setJMenuBar(MenuManager.getInstance().getMenuBarFor(this));

  pane = new JEditorPane();
  pane.setEditable(false);
  pane.addHyperlinkListener(this);

  /*
   * Allow <src> tag to display images from the module DataArchive
   * where no pathname included in the image name.
   */
  pane.setContentType("text/html"); //$NON-NLS-1$
  XTMLEditorKit myHTMLEditorKit = new HtmlChart.XTMLEditorKit();
  pane.setEditorKit(myHTMLEditorKit);

  JScrollPane scroll = new ScrollPane(pane);
  add(scroll);
  update(contents);
  pack();
  Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
  int width = Math.max(d.width / 2, getSize().width);
  int height = Math.max(d.height / 2, getSize().height);
  width = Math.min(width, d.width * 2 / 3);
  height = Math.min(height, d.height * 2 / 3);
  setSize(width, height);
  setLocation(d.width / 2 - width / 2, 0);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:30,代码来源:HelpWindow.java

示例12: DialogHelpWindow

import javax.swing.JEditorPane; //导入方法依赖的package包/类
public DialogHelpWindow(String title, URL contents, Dialog parent) {
  super(parent);
  setTitle(title);
  setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
  //setJMenuBar(MenuManager.getInstance().getMenuBarFor(this));

  pane = new JEditorPane();
  pane.setEditable(false);
  pane.addHyperlinkListener(this);

  /*
   * Allow <src> tag to display images from the module DataArchive
   * where no pathname included in the image name.
   */
  pane.setContentType("text/html"); //$NON-NLS-1$
  XTMLEditorKit myHTMLEditorKit = new HtmlChart.XTMLEditorKit();
  pane.setEditorKit(myHTMLEditorKit);

  JScrollPane scroll = new ScrollPane(pane);
  add(scroll);
  update(contents);
  pack();
  Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
  int width = Math.max(d.width / 2, getSize().width);
  int height = Math.max(d.height / 2, getSize().height);
  width = Math.min(width, d.width * 2 / 3);
  height = Math.min(height, d.height * 2 / 3);
  setSize(width, height);
  setLocation(d.width / 2 - width / 2, 0);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:31,代码来源:DialogHelpWindow.java

示例13: makeEditorPane

import javax.swing.JEditorPane; //导入方法依赖的package包/类
/**
 * Create a JEditorPane that will convert the text into html with working hyperlinks.
 * This can be included in a messageDialog with, e.g.
 * JOptionPane.showMessageDialog(null, ep)
 * @param text
 * @return
 */
public static JEditorPane makeEditorPane(String text) {
    // for copying style
    JLabel label = new JLabel();
    Font font = label.getFont();

    // create some css from the label's font
    StringBuffer style = new StringBuffer("font-family:" + font.getFamily() + ";");
    style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";");
    style.append("font-size:" + font.getSize() + "pt;");
	
    //need to use editor pane and hyperlink listener so that we can include hyperlinks in help text
    JEditorPane ep = new JEditorPane("text/html", "<html><body style=\"" + style + "\">" //
            + text //
            + "</body></html>");

    ep.addHyperlinkListener(new HyperlinkListener()
    {
        @Override
        public void hyperlinkUpdate(HyperlinkEvent e)
        {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED))
            	BrowseURL.browseURL(e.getURL().toString());
        }
    });
	ep.setEditable(false);
	ep.setBackground(label.getBackground());
	
	return ep;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:37,代码来源:GeneralUtils.java

示例14: redraw

import javax.swing.JEditorPane; //导入方法依赖的package包/类
public void redraw() {
	// Redraws only if data has changed - Bertoli Marco
	if (old_data == data) {
		return;
	} else {
		old_data = data;
	}

	if (data.hasResults() && data.areResultsOK() && data.getResults().size() > 0) {
		if (data.getClasses() == 2) {
			this.removeAll();
			PanelConvex2D s2dp = new PanelConvex2D(data, mainWin);
			this.add(new JScrollPane(s2dp));
			repaint();
		} else if (data.getClasses() == 3) {
			this.removeAll();

			// Under costruction

			repaint();
		}
	} else {
		this.removeAll();
		JEditorPane synView = new JTextPane();
		synView.setContentType("text/html");
		synView.setEditable(false);
		JScrollPane synScroll = new JScrollPane(synView);
		synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
		synView
				.setText("<html><body><center><font face=\"bold\" size=\"3\">Saturation Sectors will be here displayed once you solve the model.</font></center></body></html>");
		this.add(synScroll);
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:35,代码来源:JabaWizard.java

示例15: getHardwareReportComponent

import javax.swing.JEditorPane; //导入方法依赖的package包/类
public static JComponent getHardwareReportComponent(CLPlatform platform) {
    List<Map<String, Object>> list = listInfos(platform);
    final String html = toHTML(list);

    JEditorPane ed = new JEditorPane();
    ed.setContentType("text/html");
    ed.setText(html);
    ed.setEditable(false);

    JPanel ret = new JPanel(new BorderLayout());
    ret.add("Center", new JScrollPane(ed));

    final String fileName = "HardwareReport.html";
    JButton bWrite = new JButton("Save " + fileName + "...");
    bWrite.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            FileDialog fd = new FileDialog((Frame)null, "Save " + fileName, FileDialog.SAVE);
            fd.setFile(fileName);
            fd.setVisible(true);
            if (fd.getFile() == null)
                return;

            try {
                File file = new File(new File(fd.getDirectory()), fd.getFile());
                file.getParentFile().mkdirs();
                Writer w = new OutputStreamWriter(new FileOutputStream(file), "utf-8");
                w.write(html);
                w.close();

                Platform.show(file);
            } catch (Throwable ex) {
                SetupUtils.exception(ex);
            }
        }

    });

    ret.add("South", bWrite);
    return ret;
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:41,代码来源:HardwareReport.java


注:本文中的javax.swing.JEditorPane.setEditable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。