开发者

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 ic开发者_如何学Goons that i drop to the main windows and reside it and move it for this what Java swing component shell i use?


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


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);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜