user63898
user63898

Reputation: 30895

What components should I use for building a Java WYSIWYG HTML editor

I like to build java WYSIWYG HTML to practice my or better learn Java swing all the simple swing layouts and simple components i understand , but what should i use to represent tables text place holders html graphic Div representation and so on.. they all have to have drag and drop icons that i drop to the main windows and reside it and move it for this what Java swing component shell i use?

Upvotes: 0

Views: 2133

Answers (2)

Gilbert Le Blanc
Gilbert Le Blanc

Reputation: 51445

Basically, to draw grids and lines, you need to draw the HTML elements graphically on one or more JPanels.

You do this by overriding the paintComponent() method with your Graphics and Graphics2D method calls.

Here's a simple example:

 public void paintComponent(Graphics g) {
    // Dynamically calculate size information
    Dimension size = getSize();
    // diameter
    int d = Math.min(size.width, size.height); 
    int x = (size.width - d)/2;
    int y = (size.height - d)/2;

    // draw circle (color already set to foreground)
    g.fillOval(x, y, d, d);
    g.setColor(Color.black);
    g.drawOval(x, y, d, d);
}

Upvotes: 1

trashgod
trashgod

Reputation: 205785

You might look into metaphase editor, "A WYSIWYG HTML Editor Component for use in Java Applications." It's based on Charles Bell's HTMLDocumentEditor.

Upvotes: 1

Related Questions