Frei nutzbarer HTML Editor

xadoX

Aktives Mitglied
Hey Leute,

kennt Ihr fertige Java HTML-Editoren, die man kostenlos in ein Java Projekt einbinden darf?

Danke für eure Antworten!
 

xadoX

Aktives Mitglied
Ja genau, einen freien (einfachen) WYSIWYG-Editor den man in eigene Java-Programme einbauen kann.
Idealerweise sollte er sich entweder in SWING oder SWT integrieren lassen.
 

xadoX

Aktives Mitglied

Die Online-Demo sieht sehr gut aus. Wenn man allerdings einen formatierten Text in das Edit Fenster kopiert, so zeigt er nur den reinen Text an, ohne jegliche Formatierung.

kafenio.org - Kafenio.editor
hexidec codex : Java : Ekit
JXHTMLedit | Download JXHTMLedit software for free at SourceForge.net

Hier können Bilder leider nicht vergrößert bzw. verkleinert werden. Des Weiteren finde ich bei kaum einem Editor Informationen über die Integretation in ein Projekt...

Hat jemand Ahnung wie man z.b. hexidec oder Kafenio oder shef integriert?
 
Zuletzt bearbeitet:
F

freak_007

Gast
Ich habe es aus Demo.java kopiert.[Vom src von SHEF]
Java:
import java.io.IOException;
import java.io.InputStream;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import net.atlanticbb.tantlinger.io.IOUtils;

/**
 *
 * @author Bob Tantlinger
 */
public class Demo {

    public Demo() {
        


        HTMLEditorPane editor = new HTMLEditorPane();
        InputStream in = Demo.class.getResourceAsStream("/net/atlanticbb/tantlinger/shef/htmlsnip.txt");
        try{
            editor.setText(IOUtils.read(in));
        }catch(IOException ex) {
            ex.printStackTrace();
        } finally {
            IOUtils.close(in);
        }

        JFrame frame = new JFrame();
        JMenuBar menuBar = new JMenuBar();
        menuBar.add(editor.getEditMenu());
        menuBar.add(editor.getFormatMenu());
        menuBar.add(editor.getInsertMenu());
        frame.setJMenuBar(menuBar);

        frame.setTitle("HTML Editor Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(800, 600);
        frame.getContentPane().add(editor);
        frame.setVisible(true);
        
    }

    public static void main(String args[]) {

        try {
            UIManager.setLookAndFeel(
                UIManager.getSystemLookAndFeelClassName());
        } catch(Exception ex){}


        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
               new Demo();
            }
        });
    }

}
 
F

freak_007

Gast
Jetzt vom EKit.java
Java:
/*

GNU Lesser General Public License



Ekit - Java Swing HTML Editor & Viewer

Copyright (C) 2000 Howard Kistler



This library is free software; you can redistribute it and/or

modify it under the terms of the GNU Lesser General Public

License as published by the Free Software Foundation; either

version 2.1 of the License, or (at your option) any later version.



This library is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

Lesser General Public License for more details.



You should have received a copy of the GNU Lesser General Public

License along with this library; if not, write to the Free Software

Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/




import java.awt.BorderLayout;

import java.awt.GridLayout;

import java.awt.GridBagLayout;

import java.awt.GridBagConstraints;

import java.awt.event.WindowEvent;

import java.awt.event.WindowListener;

import java.io.File;

import java.io.FileWriter;

import java.net.MalformedURLException;

import java.net.URL;

import java.util.Vector;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.JToolBar;



import com.hexidec.ekit.EkitCore;

import com.hexidec.ekit.EkitCoreSpell;



/** Ekit

  * App for editing and saving HTML in a Java text component

  *

  * @author Howard Kistler

  * @version 1.5

  *

  * REQUIREMENTS

  * Java 2 (JDK 1.5 or higher)

  * Swing Library

  */



public class Ekit extends JFrame implements WindowListener

{

	private EkitCore ekitCore;



	private File currentFile = (File)null;



	/** Master Constructor

	  * @param sDocument         [String]  A text or HTML document to load in the editor upon startup.

	  * @param sStyleSheet       [String]  A CSS stylesheet to load in the editor upon startup.

	  * @param sRawDocument      [String]  A document encoded as a String to load in the editor upon startup.

	  * @param urlStyleSheet     [URL]     A URL reference to the CSS style sheet.

	  * @param includeToolBar    [boolean] Specifies whether the app should include the toolbar.

	  * @param showViewSource    [boolean] Specifies whether or not to show the View Source window on startup.

	  * @param showMenuIcons     [boolean] Specifies whether or not to show icon pictures in menus.

	  * @param editModeExclusive [boolean] Specifies whether or not to use exclusive edit mode (recommended on).

	  * @param sLanguage         [String]  The language portion of the Internationalization Locale to run Ekit in.

	  * @param sCountry          [String]  The country portion of the Internationalization Locale to run Ekit in.

	  * @param base64            [boolean] Specifies whether the raw document is Base64 encoded or not.

	  * @param debugMode         [boolean] Specifies whether to show the Debug menu or not.

	  * @param useSpellChecker   [boolean] Specifies whether to include the spellchecker or not.

	  * @param multiBar          [boolean] Specifies whether to use multiple toolbars or one big toolbar.

	  * @param enterBreak        [boolean] Specifies whether the ENTER key should insert breaks instead of paragraph tags.

	  */

	public Ekit(String sDocument, String sStyleSheet, String sRawDocument, URL urlStyleSheet, boolean includeToolBar, boolean showViewSource, boolean showMenuIcons, boolean editModeExclusive, String sLanguage, String sCountry, boolean base64, boolean debugMode, boolean useSpellChecker, boolean multiBar, boolean enterBreak)

	{

		if(useSpellChecker)

		{

			ekitCore = new EkitCoreSpell(false, sDocument, sStyleSheet, sRawDocument, null, urlStyleSheet, includeToolBar, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64, debugMode, true, multiBar, (multiBar ? EkitCore.TOOLBAR_DEFAULT_MULTI : EkitCore.TOOLBAR_DEFAULT_SINGLE), enterBreak);

		}

		else

		{

			ekitCore = new EkitCore(false, sDocument, sStyleSheet, sRawDocument, null, urlStyleSheet, includeToolBar, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64, debugMode, false, multiBar, (multiBar ? EkitCore.TOOLBAR_DEFAULT_MULTI : EkitCore.TOOLBAR_DEFAULT_SINGLE), enterBreak);

		}



		ekitCore.setFrame(this);



		/* Add the components to the app */

		if(includeToolBar)

		{

			if(multiBar)

			{

				this.getContentPane().setLayout(new GridBagLayout());

				GridBagConstraints gbc = new GridBagConstraints();

				gbc.fill       = GridBagConstraints.HORIZONTAL;

				gbc.anchor     = GridBagConstraints.NORTH;

				gbc.gridheight = 1;

				gbc.gridwidth  = 1;

				gbc.weightx    = 1.0;

				gbc.weighty    = 0.0;

				gbc.gridx      = 1;



				gbc.gridy      = 1;

				this.getContentPane().add(ekitCore.getToolBarMain(includeToolBar), gbc);



				gbc.gridy      = 2;

				this.getContentPane().add(ekitCore.getToolBarFormat(includeToolBar), gbc);



				gbc.gridy      = 3;

				this.getContentPane().add(ekitCore.getToolBarStyles(includeToolBar), gbc);



				gbc.anchor     = GridBagConstraints.SOUTH;

				gbc.fill       = GridBagConstraints.BOTH;

				gbc.weighty    = 1.0;

				gbc.gridy      = 4;

				this.getContentPane().add(ekitCore, gbc);

			}

			else

			{

				this.getContentPane().setLayout(new BorderLayout());

				this.getContentPane().add(ekitCore, BorderLayout.CENTER);

				this.getContentPane().add(ekitCore.getToolBar(includeToolBar), BorderLayout.NORTH);

			}

		}

		else

		{

			this.getContentPane().setLayout(new BorderLayout());

			this.getContentPane().add(ekitCore, BorderLayout.CENTER);

		}



		this.setJMenuBar(ekitCore.getMenuBar());



		this.addWindowListener(this);



		this.updateTitle();

		this.pack();

		this.setVisible(true);

	}



	public Ekit()

	{

		this(null, null, null, null, true, false, true, true, null, null, false, false, false, true, false);

	}



	/* WindowListener methods */

	public void windowClosing(WindowEvent we)

	{

		this.dispose();

		System.exit(0);

	}

	public void windowOpened(WindowEvent we)      { ; }

	public void windowClosed(WindowEvent we)      { ; }

	public void windowActivated(WindowEvent we)   { ; }

	public void windowDeactivated(WindowEvent we) { ; }

	public void windowIconified(WindowEvent we)   { ; }

	public void windowDeiconified(WindowEvent we) { ; }



	/** Convenience method for updating the application title bar

	  */

	private void updateTitle()

	{

		this.setTitle(ekitCore.getAppName() + (currentFile == null ? "" : " - " + currentFile.getName()));

	}



	/** Usage method

	  */

	public static void usage()

	{

		System.out.println("usage: com.hexidec.ekit.Ekit [-t|t+|T] [-s|S] [-m|M] [-x|X] [-b|B] [-v|V] [-p|P] [-fFILE] [-cCSS] [-rRAW] [-uURL] [-lLANG] [-d|D] [-h|H|?]");

		System.out.println("       Each option contained in [] brackets is optional,");

		System.out.println("       and can be one of the values separated be the | pipe.");

		System.out.println("       Each option must be proceeded by a - hyphen.");

		System.out.println("       The options are:");

		System.out.println("         -t|t+|T : -t = single toolbar, -t+ = multiple toolbars, -T = no toolbar");

		System.out.println("         -s|S    : -s = show source window on startup, -S = hide source window");

		System.out.println("         -m|M    : -m = show icons on menus, -M = no menu icons");

		System.out.println("         -x|X    : -x = exclusive document/source windows, -X = use split window");

		System.out.println("         -b|B    : -b = use Base64 document encoding, -B = use regular encoding");

		System.out.println("         -v|V    : -v = include spell checker, -V = omit spell checker");

		System.out.println("         -p|P    : -p = ENTER key inserts paragraph, -P = inserts break");

		System.out.println("         -fFILE  : load HTML document on startup (replace FILE with file name)");

		System.out.println("         -cCSS   : load CSS stylesheet on startup (replace CSS with file name)");

		System.out.println("         -rRAW   : load raw document on startup (replace RAW with file name)");

		System.out.println("         -uURL   : load document at URL on startup (replace URL with file URL)");

		System.out.println("         -lLANG  : specify the starting language (defaults to your locale)");

		System.out.println("                    replace LANG with xx_XX format (e.g., US English is en_US)");

		System.out.println("         -d|D    : -d = DEBUG mode on, -D = DEBUG mode off (developers only)");

		System.out.println("         -h|H|?  : print out this help information");

		System.out.println("         ");

		System.out.println("The defaults settings are equivalent to: -t+ -S -m -x -B -V -p -D");

		System.out.println("         ");

		System.out.println("For further information, read the README file.");

	}



	/** Main method

	  */

	public static void main(String[] args)

	{

		String sDocument = null;

		String sStyleSheet = null;

		String sRawDocument = null;

		URL urlStyleSheet = null;

		boolean includeToolBar = true;

		boolean multibar = true;

		boolean includeViewSource = false;

		boolean includeMenuIcons = true;

		boolean modeExclusive = true;

		String sLang = null;

		String sCtry = null;

		boolean base64 = false;

		boolean debugOn = false;

		boolean spellCheck = false;

		boolean enterBreak = false;

		for(int i = 0; i < args.length; i++)

		{

			if     (args[i].equals("-h") ||

					args[i].equals("-H") ||

					args[i].equals("-?"))     { usage(); }

			else if(args[i].equals("-t"))     { includeToolBar = true; multibar = false; }

			else if(args[i].equals("-t+"))    { includeToolBar = true; multibar = true; }

			else if(args[i].equals("-T"))     { includeToolBar = false; multibar = false; }

			else if(args[i].equals("-s"))     { includeViewSource = true; }

			else if(args[i].equals("-S"))     { includeViewSource = false; }

			else if(args[i].equals("-m"))     { includeMenuIcons = true; }

			else if(args[i].equals("-M"))     { includeMenuIcons = false; }

			else if(args[i].equals("-x"))     { modeExclusive = true; }

			else if(args[i].equals("-X"))     { modeExclusive = false; }

			else if(args[i].equals("-b"))     { base64 = true; }

			else if(args[i].equals("-B"))     { base64 = false; }

			else if(args[i].startsWith("-f")) { sDocument = args[i].substring(2, args[i].length()); }

			else if(args[i].startsWith("-c")) { sStyleSheet = args[i].substring(2, args[i].length()); }

			else if(args[i].startsWith("-r")) { sRawDocument = args[i].substring(2, args[i].length()); }

			else if(args[i].equals("-v"))     { spellCheck = true; }

			else if(args[i].equals("-V"))     { spellCheck = false; }

			else if(args[i].equals("-p"))     { enterBreak = false; }

			else if(args[i].equals("-P"))     { enterBreak = true; }

			else if(args[i].startsWith("-u"))

			{

				try

				{

					urlStyleSheet = new URL(args[i].substring(2, args[i].length()));

				}

				catch(MalformedURLException murle)

				{

					murle.printStackTrace(System.err);

				}

			}

			else if(args[i].startsWith("-l"))

			{

				if(args[i].indexOf('_') == 4 && args[i].length() >= 7)

				{

					sLang = args[i].substring(2, args[i].indexOf('_'));

					sCtry = args[i].substring(args[i].indexOf('_') + 1, args[i].length());

				}

			}

			else if(args[i].equals("-d"))     { debugOn = true; }

			else if(args[i].equals("-D"))     { debugOn = false; }

		}

		Ekit ekit = new Ekit(sDocument, sStyleSheet, sRawDocument, urlStyleSheet, includeToolBar, includeViewSource, includeMenuIcons, modeExclusive, sLang, sCtry, base64, debugOn, spellCheck, multibar, enterBreak);

	}



}
 
F

freak_007

Gast
Und jetzt Kaffenio.java
Java:
import java.awt.BorderLayout;

import java.awt.event.WindowEvent;

import java.awt.event.WindowListener;

import java.io.File;

import java.net.URL;

import java.lang.reflect.Constructor;

import javax.swing.JPanel;

import javax.swing.JFrame;



import de.xeinfach.kafenio.interfaces.KafenioContainerInterface;

import de.xeinfach.kafenio.interfaces.KafenioPanelConfigurationInterface;

import de.xeinfach.kafenio.interfaces.KafenioPanelInterface;

import de.xeinfach.kafenio.util.LeanLogger;



/**

 * Demo Implementation to run KafenioPanel as standalone application.

 * @author Karsten Pawlik

 */

public class Kafenio extends JFrame implements WindowListener, KafenioContainerInterface {

	

	private KafenioPanelConfigurationInterface config;

	private KafenioPanelInterface kafenioPanel;

	private File currentFile = (File)null;

	private SplashScreen splash;

	private static LeanLogger log = new LeanLogger("Kafenio.class");	

	/**

	 * creates a new Kafenio Editor Window object using the given parameters.

	 * @param conf the configuration for this object.

	 */

	public Kafenio(KafenioPanelConfigurationInterface iConfiguration) {

          super();

		showSplash();

		config = iConfiguration;

		config.setKafenioParent(this);



		try {

			//What follows is more complicated than necessary in order to demonstrate

			//plugin-like employment of Kafenio. Easy, non plugin way, would be: kafenioPanel = new KafenioPanel(config);

			Class kafenioPanelClass = Class.forName("de.xeinfach.kafenio.KafenioPanel");

			Class[] constructorParameterTyping = { KafenioPanelConfigurationInterface.class };

			Constructor kafenioPanelContructor = kafenioPanelClass.getConstructor( constructorParameterTyping );

			kafenioPanel  =(KafenioPanelInterface)kafenioPanelContructor.newInstance(new Object[]{ config });

		}

		catch (Exception ex) { // Probably class not found exception

			ex.printStackTrace();

			return;

		}



		/* Add the components to the app */

		this.getContentPane().setLayout(new BorderLayout());

		this.getContentPane().add((JPanel)kafenioPanel, BorderLayout.CENTER);



		//Example of use - remove bevels around buttons in Java1.4.2:

		//  kafenioPanel.getJToolBar1().setRollover(true);

		//  kafenioPanel.getJToolBar2().setRollover(true);



		this.addWindowListener(this);

		this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);

		this.updateTitle();

		this.pack();

		this.show();

		splash.destroy();

	}

	

	/**

	 * main method.

	 * @param args commandline arguments.

	 * <UL>

	 * <LI>-t | -T  = turn on/off toolbars</LI>

	 * <LI>-s | -S  = turn on/off sourceview on startup</LI>

	 * <LI>-m | -M  = turn on/off show menu icons</LI>

	 * <LI>-x | -X  = turn on/off exclusive edit mode</LI>

	 * <LI>-b | -B  = turn on/off base64 decoding of raw-document</LI>

	 * <LI>-8       = turn on unicode export of document text</LI>

	 * <LI>-f       = html document filepath to load</LI>

	 * <LI>-c       = css-file to load</LI>

	 * <LI>-r       = raw document filepath to load</LI>

	 * <LI>-u       = stylesheet URL</LI>

	 * <LI>-l       = language setting (i.e.: de_DE for german/germany)</LI>

	 * <LI>-d | -D  = turn on/off debug mode</LI>

	 * </UL>

	 */

	public static void main(String[] args) {

		KafenioPanelConfigurationInterface newConfig = null;

		try {

			newConfig = (KafenioPanelConfigurationInterface)

			Class.forName("de.xeinfach.kafenio.KafenioPanelConfiguration").newInstance();

		} catch (Exception ex) {}



		newConfig.setImageDir("file://");



		// Example of how to show only selected submenus and tool bar items:

		// boolean restrictMenus = false;

		// if (restrictMenus) {

		//   newConfig.setCustomMenuItems("edit view font format insert table forms search tools help");

		//   newConfig.setCustomToolBar1("save cut copy paste bold italic underline left center right justify");

		// }

             

		if (args.length > 0) {

			

			for(int i = 0; i < args.length; i++) {

				if (args[i].equals("-t")) { 

					newConfig.setShowToolbar(true);

					newConfig.setShowToolbar2(true); 

				} else if(args[i].equals("-T")) {

					newConfig.setShowToolbar(false);

					newConfig.setShowToolbar2(false); 

				} else if(args[i].equals("-s")) { 

					newConfig.setShowViewSource(true); 

				} else if(args[i].equals("-S")) {

					newConfig.setShowViewSource(false);

				} else if(args[i].equals("-m")) {

					newConfig.setShowMenuIcons(true); 

				} else if(args[i].equals("-M")) {

					newConfig.setShowMenuIcons(false); 

				} else if(args[i].equals("-b")) { 

					newConfig.setBase64(true);

				} else if(args[i].equals("-B")) { 

					newConfig.setBase64(false);

				} else if(args[i].equals("-8")) { 

					newConfig.setUnicode(true);

				} else if(args[i].startsWith("-f")) { 

					newConfig.setDocument(args[i].substring(2, args[i].length()));

				} else if(args[i].startsWith("-c")) { 

					newConfig.setStyleSheet(args[i].substring(2, args[i].length()));

				} else if(args[i].startsWith("-r")) { 

					newConfig.setRawDocument(args[i].substring(2, args[i].length()));

				} else if(args[i].startsWith("-u")) {

					try {

						newConfig.setUrlStyleSheet(new URL(args[i].substring(2, args[i].length())));

					} catch(Throwable e) {

						log.warn("Exception caught while trying to setURLStylesheet: " + e.fillInStackTrace());

					}

				} else if(args[i].startsWith("-l")) {

					if(args[i].indexOf('_') > -1) {

						newConfig.setLanguage(args[i].substring(2, args[i].indexOf('_')));

						newConfig.setCountry(args[i].substring(args[i].indexOf('_') + 1, args[i].length()));

					}

				} else if(args[i].equals("-d")) { 

					newConfig.setDebugMode(true); 

				} else if(args[i].equals("-D")) { 

					newConfig.setDebugMode(false); 

				}

			}

		}

		new Kafenio(newConfig);

	}



	/** 

	 * Convenience method for updating the application title bar

	 */

	private void updateTitle() {

		this.setTitle(kafenioPanel.getAppName() + (currentFile == null ? "" : " - " + currentFile.getName()));

	}

	

	/** (non-Javadoc)

	 * @see java.awt.event.WindowListener#windowActivated(java.awt.event.WindowEvent)

	 */

	public void windowActivated(WindowEvent e) {}



	/** (non-Javadoc)

	 * @see java.awt.event.WindowListener#windowClosed(java.awt.event.WindowEvent)

	 */

	public void windowClosed(WindowEvent e) {}



	/** (non-Javadoc)

	 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)

	 */

	public void windowClosing(WindowEvent e) {

		kafenioPanel.quitApp();

	}



	/** (non-Javadoc)

	 * @see java.awt.event.WindowListener#windowDeactivated(java.awt.event.WindowEvent)

	 */

	public void windowDeactivated(WindowEvent e) {}



	/** (non-Javadoc)

	 * @see java.awt.event.WindowListener#windowDeiconified(java.awt.event.WindowEvent)

	 */

	public void windowDeiconified(WindowEvent e) {}



	/** (non-Javadoc)

	 * @see java.awt.event.WindowListener#windowIconified(java.awt.event.WindowEvent)

	 */

	public void windowIconified(WindowEvent e) {}



	/** (non-Javadoc)

	 * @see java.awt.event.WindowListener#windowOpened(java.awt.event.WindowEvent)

	 */

	public void windowOpened(WindowEvent e) {}



	/**

	 * not an applet - no need to use pop-out functionality. do nothing.

	 */

	public void detachFrame() {}



	private void showSplash() {

		splash = new SplashScreen(30);

		log.info("Info: Displaying splash image for max. 30 seconds.");

		new Thread(splash).start();

	}





}
 

xadoX

Aktives Mitglied
Muss ich bei allen jeweils nur die jeweilige Jar-Datei in die Bibliothek meines Projekts einbinden und dann die von dir geposteten Codes benutzen um einen Editor zu erzeugen?
 
F

freak_007

Gast
Ja du machst das in dem du den Befehl zu kompilieren
Code:
javac -classpath <Pfad zum Jar> Main.java
Zum ausführen
Code:
java -classpath <Pfad zum Jar>
Außer du hast ein IDE indem kannst du es grafisch meistens lösen.
 

xadoX

Aktives Mitglied
Nutze Netbeans, da reicht es doch aus, die jeweilige Jar als externe Jar einzubinden oder?
Was passiert mit der Main Methode in der einzubindenden Jar-Datei. Löscht Netbeans die automatisch?
 
Zuletzt bearbeitet:
F

freak_007

Gast
Nein, du brauchst dir keine Sorgen machen. Wenn du dein eigenes Jar verwendest und von dort aus startest überspringt java die main Methode außer sie wird von dir direkt aufgerufen. sowie
Java:
MainKlasse.main(new String[0])
. Wenn du BibliotheksJar startest also direkt wird er die main Methode der Bibiothek nehmen.
 

xadoX

Aktives Mitglied
Hab jetzt vom SHEF die JAR genommen und als externe Jar in mein Projekt eingebunden.
Hab mir eine Klasse HTMLEditor erstellt:

Java:
public class HTMLEditor {
    public HTMLEditor(){
        HTMLEditorPane editor = new HTMLEditorPane();
        InputStream in = HTMLEditor.class.getResourceAsStream("/net/atlanticbb/tantlinger/shef/htmlsnip.txt");
        try{
            editor.setText(IOUtils.read(in));
        }catch(IOException ex) {
            gui.Gui.getInstance().makeErrorMessage(ex.toString());
        } finally {
            IOUtils.close(in);
        }

        JFrame frame = new JFrame();
        JMenuBar menuBar = new JMenuBar();
        menuBar.add(editor.getEditMenu());
        menuBar.add(editor.getFormatMenu());
        menuBar.add(editor.getInsertMenu());
        frame.setJMenuBar(menuBar);

        frame.setTitle("HTML Editor Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(800, 600);
        frame.getContentPane().add(editor);
        frame.setVisible(true);
    }

und von der Gui aus ruf ich sie wie folgt auf:

Java:
SwingUtilities.invokeLater(new Runnable() {
            public void run() {
               new HTMLEditor();
            }
        });

Leider führt da zu folgenden Fehlermeldungen:

Java:
Exception occurred during event dispatching:
java.lang.NoClassDefFoundError: novaworx/textpane/SyntaxTextPane
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at gui.HTMLEditor.<init>(HTMLEditor.java:21)
        at gui.Gui$29.run(Gui.java:1561)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
        at java.awt.Dialog$1.run(Dialog.java:1046)
        at java.awt.Dialog$3.run(Dialog.java:1098)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Dialog.show(Dialog.java:1096)
        at java.awt.Component.show(Component.java:1563)
        at java.awt.Component.setVisible(Component.java:1515)
        at java.awt.Window.setVisible(Window.java:842)
        at java.awt.Dialog.setVisible(Dialog.java:986)
        at gui.Gui.jButtonArtikelBearbeitenActionPerformed(Gui.java:1425)
        at gui.Gui.access$1700(Gui.java:38)
        at gui.Gui$22.actionPerformed(Gui.java:1155)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
        at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
        at java.awt.Component.processMouseEvent(Component.java:6263)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
        at java.awt.Component.processEvent(Component.java:6028)
        at java.awt.Container.processEvent(Container.java:2041)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
        at java.awt.Container.dispatchEventImpl(Container.java:2085)
        at java.awt.Window.dispatchEventImpl(Window.java:2478)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.ClassNotFoundException: novaworx.textpane.SyntaxTextPane
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 56 more

Musste noch die anderen JARs ausm LIB Ordner mit einbinden.
Problem gelöst
 
Zuletzt bearbeitet:
Ähnliche Java Themen
  Titel Forum Antworten Datum
G Swing Buttons in Layouts frei platzieren AWT, Swing, JavaFX & SWT 7
S Standpunkt von Componenten frei bestimmen AWT, Swing, JavaFX & SWT 10
R Kleine Panels auf einem großen Panel frei platzieren AWT, Swing, JavaFX & SWT 11
M Bilder frei positionieren? AWT, Swing, JavaFX & SWT 29
C JLabel in JMenuBar frei platzieren AWT, Swing, JavaFX & SWT 2
R Komponenten frei per Drag&Drop in (z.B.) Null-Layout bew AWT, Swing, JavaFX & SWT 2
T Swing: frei Objekte anordnen AWT, Swing, JavaFX & SWT 9
izoards HTML Editor AWT, Swing, JavaFX & SWT 3
H setToolTipText ignoriert HTML-Formatierung des anzuzeigenden Strings AWT, Swing, JavaFX & SWT 4
Yonnig Lokale HTML-Datei in Java GUI rendern AWT, Swing, JavaFX & SWT 4
kodela HTML-tags für JLabel AWT, Swing, JavaFX & SWT 9
C HTML Editor Eingabemaske kafenio Ersatz AWT, Swing, JavaFX & SWT 7
A JavaFX Daten in eine HTML-Table mit JS schreiben AWT, Swing, JavaFX & SWT 3
T JTextPane ignoriert HTML Zeilenumbruch <br> tag wegen eigenem HTMLEditorKit AWT, Swing, JavaFX & SWT 5
E Java FX FXML Problem mit html Scriptausführung AWT, Swing, JavaFX & SWT 2
K Html Editor AWT, Swing, JavaFX & SWT 3
B Swing HTML in JLabels AWT, Swing, JavaFX & SWT 6
S jLabel HTML Formatierung AWT, Swing, JavaFX & SWT 2
B JavaFX Java FX Html Template AWT, Swing, JavaFX & SWT 0
F JavaFX JavaFX HTMLEditor-Eingabe in Textarea als HTML anzeigen AWT, Swing, JavaFX & SWT 2
D Swing Breite einer HTML Tabelle in einer JTextPane AWT, Swing, JavaFX & SWT 6
R Swing JTable : Header der Spalten ergänzen mit caption (wie bei html-table) AWT, Swing, JavaFX & SWT 2
I LookAndFeel HTML Auflösung - Online Editor programmieren AWT, Swing, JavaFX & SWT 2
T HTML mit Java AWT, Swing, JavaFX & SWT 1
U Label zeigt nicht überall HTML Zeichen AWT, Swing, JavaFX & SWT 3
N JLabel HTML mit custom Font AWT, Swing, JavaFX & SWT 0
H RCP(SWT) Browser-Widget zeigt keine locale HTML-Dateien an AWT, Swing, JavaFX & SWT 1
F Submit eines HTML-Formulars in Vaadin AWT, Swing, JavaFX & SWT 3
T Swing HTML Text aus JLabel ohne "HTML-Tags" in String einlesen AWT, Swing, JavaFX & SWT 5
J JApplet, HTML und access denied exitVM.0 AWT, Swing, JavaFX & SWT 3
L Swing JToogleButton Vordergrundfarbe bei HTML String AWT, Swing, JavaFX & SWT 4
H Swing JApplet - HTML - ClassNotFoundException AWT, Swing, JavaFX & SWT 7
G Swing HTML Version AWT, Swing, JavaFX & SWT 11
S HTML in Java einbinden AWT, Swing, JavaFX & SWT 4
B JEditorPane lädt keine Schriftfarbe in HTML AWT, Swing, JavaFX & SWT 2
J JEditorPane mit HTML füllen AWT, Swing, JavaFX & SWT 2
N Swing JTree TreeCellRenderer mit html und automatischen Zeilenumbruch AWT, Swing, JavaFX & SWT 8
N Swing KomponentenHöhe an html-Inhalt anpassen AWT, Swing, JavaFX & SWT 4
F Applet JApplet per html einbinden - Main class kann nicht gefunden werden AWT, Swing, JavaFX & SWT 15
C html browser in Application nutzen AWT, Swing, JavaFX & SWT 10
S SWT Anzeigen einer lokalen HTML-Seite im Browser Widget über RAP nicht möglich AWT, Swing, JavaFX & SWT 3
S HTML Syntaxhighlighting AWT, Swing, JavaFX & SWT 7
S SWT HTML-WYSIWUG-Editor AWT, Swing, JavaFX & SWT 3
R Swing Renderproblem bei HTML in einer JTextPane AWT, Swing, JavaFX & SWT 12
N Swing JTextPane zur Anzeige von HTML AWT, Swing, JavaFX & SWT 2
N Applet JButton soll html Datei aus einem Ordner öffnen AWT, Swing, JavaFX & SWT 2
H JScrollPane - JEditorPane und HTML-Tabelle AWT, Swing, JavaFX & SWT 2
H Swing JEditorPane und HTML AWT, Swing, JavaFX & SWT 3
D System.out.println() gibt html-Tags mit aus AWT, Swing, JavaFX & SWT 2
P Swing HTML-Renderer AWT, Swing, JavaFX & SWT 15
G Swing JCheckBox, setEnabled(false) und HTML Text Problem AWT, Swing, JavaFX & SWT 5
J 2D-Grafik Html in drawString() AWT, Swing, JavaFX & SWT 2
L Applet In HTML einbinden klappt einfach nicht AWT, Swing, JavaFX & SWT 5
B WYSIWYG-HTML-Editor / Validator für JAVA AWT, Swing, JavaFX & SWT 2
N JCombobox wie in HTML AWT, Swing, JavaFX & SWT 6
H Swing HTML in einem JEditorPane zeilenweise hinzufügen ohne Inhalt jedes Mal neu zu laden AWT, Swing, JavaFX & SWT 4
G Swing JEdtitorPane und HTML Image Seite AWT, Swing, JavaFX & SWT 2
C Swing JTextPane zeigt HTML-Text aus Variable nicht an :( AWT, Swing, JavaFX & SWT 3
P Swing html mit bilder drin AWT, Swing, JavaFX & SWT 12
destroflyer Wort im JLabel verlinken (per HTML) AWT, Swing, JavaFX & SWT 3
R Swing JTextComponent und HTML AWT, Swing, JavaFX & SWT 7
D Nodes eines statischen JTrees sollen auf Anker (Textmarken) in einer HTML-Datei zeigen AWT, Swing, JavaFX & SWT 8
S Swing HTML-Text in JEditorPane einfärben AWT, Swing, JavaFX & SWT 5
D Darstellung in Swing wie HTML? AWT, Swing, JavaFX & SWT 2
H Mit JLabel HTML - formatierten Text anzeigen AWT, Swing, JavaFX & SWT 14
M Swing Kein update bei simulierten HTML-Link AWT, Swing, JavaFX & SWT 4
B Grafiken in JLabel mittels html AWT, Swing, JavaFX & SWT 5
E Swing JTextPane Inhalt(Text und Bilder) als HTML text bekommen AWT, Swing, JavaFX & SWT 3
B JEditorPane - Text und Graphik in HTML speichern AWT, Swing, JavaFX & SWT 4
K Alternative zu Applet mit HTML-Einbindung AWT, Swing, JavaFX & SWT 11
D Swing JEditorPane mit HTML aber ohne Bilder AWT, Swing, JavaFX & SWT 3
S Swing Text -> HTML: Caret-Koordinaten verschoben AWT, Swing, JavaFX & SWT 6
S JEditorPane soll HTML und dann Text anzeigen..? AWT, Swing, JavaFX & SWT 5
T HTML und JEditorPane AWT, Swing, JavaFX & SWT 6
J JList & HTML AWT, Swing, JavaFX & SWT 2
T HTML Seite neu laden mittels Applet AWT, Swing, JavaFX & SWT 2
N Performanceprobleme mit JLabel und HTML content AWT, Swing, JavaFX & SWT 5
A Oberfläche wir mit html-Frames aufbauen AWT, Swing, JavaFX & SWT 11
C JTextPane HTML und eigene Tags AWT, Swing, JavaFX & SWT 10
W HTML-Text mit relativer URL in JEditorPane einlesen AWT, Swing, JavaFX & SWT 10
C Suche fertigen HTML editor AWT, Swing, JavaFX & SWT 2
B HTML in Swing Components (JLabel) AWT, Swing, JavaFX & SWT 7
M JEditorPane lädt HTML ohne Bilder AWT, Swing, JavaFX & SWT 2
M JEditorPane lädt HTML ohne Bilder AWT, Swing, JavaFX & SWT 2
G Hilfe beim Erstellen eines eigenen Html-Editors! AWT, Swing, JavaFX & SWT 4
S drawString für HTML-Text? AWT, Swing, JavaFX & SWT 7
G Frage zu Labels mit html AWT, Swing, JavaFX & SWT 3
P HTML darstellen mit Java AWT, Swing, JavaFX & SWT 4
GilbertGrape Fehler bei HTML in JTextPane AWT, Swing, JavaFX & SWT 2
ARadauer swing html wysiwyg componente AWT, Swing, JavaFX & SWT 6
V "Anker" wie in HTML für JScrollPane? AWT, Swing, JavaFX & SWT 2
M html im Titel von JFrame AWT, Swing, JavaFX & SWT 9
M html aus einem Stream Laden und Anzeigen AWT, Swing, JavaFX & SWT 4
T Öffnen von SWT-Dialogboxen durch HTML-Link in HTML-Code AWT, Swing, JavaFX & SWT 4
B JTextPane und Image importieren in HTML String. AWT, Swing, JavaFX & SWT 2
J Html in JTextPane anzeigen? AWT, Swing, JavaFX & SWT 2
V Swing to HTML? AWT, Swing, JavaFX & SWT 4
A HTML-Datei öffnen AWT, Swing, JavaFX & SWT 3
A Noch mal Zusammenarbeit Java und HTML AWT, Swing, JavaFX & SWT 4
A Java und HTML AWT, Swing, JavaFX & SWT 8

Ähnliche Java Themen

Neue Themen


Oben