Graphical editor

Hi,
I'm trying to make a graphical DTD editor. Right now I have a little problem with moveable objects and arrows. Perhaps someone can help me with this?
I'll try to describe my problem as good as I can. First, there should be some objects like squares or circles (moveable one). Second, every object have a different meaning (like square is some kind a node or value). So we have couple of squares and circles, we're connecting them with our arrows and we suppose to have a nice DTD document. Yes, I know ... Right now I need some information how to put one object on it place (when we click on the square it stops to move and we can play with another one). Please forgive me my English but I'm not an native speaker.
Cheers.
----some of my code---
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.BevelBorder;
import javax.swing.event.MouseInputAdapter;
import javax.swing.text.Highlighter;
import java.io.*;
public class DTDEdit extends JFrame
     OptionsTB     _op;
     FunctionsTB     _fu;     
     JTabbedPane _ta;
     * This is main constructor.
     * In here we're cooking all fancy stuff.
     * @param _ch is a JFileChooser. Thank to this he can open
     * a file.
     public DTDEdit() {
          _ta = new JTabbedPane();
          _op = new OptionsTB();
          _fu = new FunctionsTB();
          ImageIcon ic = new ImageIcon("images/icons/Earth-16x16.png");
          JPanel panel = new JPanel();
          //JPanel panel2 = new JPanel();          
          //TODO To nadal jest puste.
          SecondPanel panel2 = new SecondPanel();
          panel2.setVisible(true);
          panel.setBorder(new BevelBorder(BevelBorder.LOWERED));
OverlayLayout overlay = new OverlayLayout(panel);
panel.setLayout(overlay);
panel.add(new TopPanel("123"));
panel.add(new Overlay());
_ta.addTab("graphical",ic, panel);
_ta.addTab("source",ic, panel2);   
add(_ta, "Center");
          setJMenuBar(new Menu());
          getContentPane().add(_op, BorderLayout.NORTH);
          getContentPane().add(_fu, BorderLayout.WEST);
          pack();
     public int scWidth() //get width of screen number 1
          GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
     GraphicsDevice[] gs = ge.getScreenDevices();
     DisplayMode dm = gs[0].getDisplayMode();
     return dm.getWidth();
     public int scHeight() //get height of screen number 1
          GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
     GraphicsDevice[] gs = ge.getScreenDevices();
     DisplayMode dm = gs[0].getDisplayMode();
     return dm.getHeight();
     public static void main(String[] args) {
DTDEdit f = new DTDEdit();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(800,600);
f.setLocation(200, 200);
f.setVisible(true);
* This determines an movable editor
* @author Marcin
class Overlay extends JPanel
public Overlay()
setBackground(Color.LIGHT_GRAY);
* This is top panel.
* We're painting on it.
* @author Marcin
class TopPanel extends JPanel
Point loc;
int width, height, arcRadius;
Rectangle r;
String s;
public TopPanel(String s)
     this.s = s;
setOpaque(false);
width = 80;
height = 40;
arcRadius = 0;
r = new Rectangle(width, height);
TopRanger ranger = new TopRanger(this);
addMouseListener(ranger);
addMouseMotionListener(ranger);
protected void paintComponent(Graphics g)
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
if(loc == null)
init();
g2.setPaint(Color.DARK_GRAY);
g2.fillRoundRect(loc.x, loc.y, width, height, arcRadius, arcRadius);
g2.setPaint(Color.yellow);
g2.drawString(s, loc.x + 25, loc.y + 25);
//g2.drawRoundRect(loc.x, loc.y, width, height, arcRadius, arcRadius);
private void init()
int w = getWidth();
int h = getHeight();
loc = new Point();
loc.x = (w - width)/2;
loc.y = (h - height)/2;
r.x = loc.x;
r.y = loc.y;
public int getRectWidth()
     return width;
* In here we're enabling an mouse adapters.
* Thank's to this we can move what we had made :)
* @author Marcin
class TopRanger extends MouseInputAdapter
TopPanel top;
Point offset;
boolean dragging;
public TopRanger(TopPanel top)
this.top = top;
offset = new Point();
dragging = false;
public void mousePressed(MouseEvent e)
Point p = e.getPoint();
if(top.r.contains(p))
offset.x = p.x - top.r.x;
offset.y = p.y - top.r.y;
dragging = true;
public void mouseReleased(MouseEvent e)
dragging = false;
// update top.r
top.r.x = top.loc.x;
top.r.y = top.loc.y;
public void mouseDragged(MouseEvent e)
if(dragging)
top.loc.x = e.getX() - offset.x;
top.loc.y = e.getY() - offset.y;
top.r.setSize(65, 25);
top.repaint();
* Menus and other things.
* I've made this for two reasons
* 1) Every application has things like this.
* 2) It's a pretty cool when you don't have to
*      search for something in embedded option of
*      application.
* @author Marcin
//     Our little menu
class Menu extends JMenuBar                         //Still not finished
     JMenu File = new JMenu("File");
     JMenu Edit = new JMenu("Edit");
     JMenuItem firstItem = new JMenuItem("first");
     JMenuItem secondItem = new JMenuItem("second");
     Menu(){
          File.add(firstItem);
          add(File);
          Edit.add(secondItem);
          add(Edit);
class OptionsTB extends JToolBar implements ActionListener                    //Still not finished
     ImageIcon sa = new ImageIcon("images/icons/Save24.gif");
     ImageIcon op = new ImageIcon("images/icons/Open24.gif");
     JButton _open;
     JButton _save;
     Separator sep1;
     JFileChooser _ch;
     OptionsTB()
          _open  = new JButton("Open", op);
          sep1 = new Separator();
          _save  = new JButton("save", sa);
          _open.addActionListener(this);
          _save.addActionListener(this);
          _ch = new JFileChooser();
          add(_open);
          add(_save);
          add(sep1);
          setFloatable(false);
          setSize(100, 50);
// TODO Open and save handler
     public void actionPerformed(ActionEvent e)
          if( e.getSource() == _open){
               int returnVal = _ch.showOpenDialog(OptionsTB.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = _ch.getSelectedFile();
     //TODO We should have a file handler in here.
} else
if (e.getSource() == _save) {
     int returnVal = _ch.showSaveDialog(OptionsTB.this);
if (returnVal == JFileChooser.APPROVE_OPTION);
     File file = _ch.getSelectedFile();
          //TODO We should have a save handler in here.
class FunctionsTB extends JToolBar                    //Still not finished
     JButton _check;      
     ImageIcon star = new ImageIcon("images/icon/Star.png");
     FunctionsTB()
          _check = new JButton("Check", star);
          add(_check);
          setFloatable(false);
          setOrientation(VERTICAL);
          setSize(100, 50);
class SecondPanel extends JPanel
     JEditorPane pane;
     JScrollPane scroll;
     public SecondPanel() {
          pane = new JTextPane();
          //pane.setBackground(Color.BLACK);
          pane.setText("Pierwsza linia");
          pane.setBackground(Color.BLACK);
          pane.setForeground(Color.WHITE);
          pane.setEditable(false);
          scroll = new JScrollPane(pane);
          scroll.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
          scroll.setPreferredSize(new Dimension(600, 600));
          scroll.setMinimumSize(new Dimension(800, 600));
          add(scroll);
          JScrollPane scroll = new JScrollPane();
--- THE END OF MY STUFF ---

Hi nordvik_
I developed a component that does exactly what you are talking about. Would you be interested in buying a copy?
This is not a simple project, but if you're determined to build it yourself, here's a few hints
1. How are you going to represent your nodes? Will they be components? The advantage of this is that with Components its easy to set size, implement painting. The disadvantage is that it's difficult to draw lines between components, and they will likely absorb mouse events that are outside of the shape's area (unless all your shapes are rectangles)
2. How are you going to move + resize the components? If you search google for draggable.java/resizeable.java tjacobs01 you'll find some classes that I've previously posted that drag / resize components. This may or may not be helpful
3. How are you going to internally represent the connection lines? how are you going to draw them? How are you going to figure out start and end points?
If you're potentially interested in buying a copy of my source code, plz post your email address and I will contact you
Edited by: tjacobs01 on Aug 10, 2008 2:17 PM

Similar Messages

  • Looking for simple graphics editor

    PHOTOSHOP (even elements) is way too complicated for little old me -
    can anyone recommend a simple program - a graphics editor - the main thing I need to do is place a piece of text over an existing image.
    is there a little apple applet that does something like that?
    or something low-cost at the App store?
    w
    PS: am running Mavericks & looking forward to Yosemite, Sam!

    no kidding! I always use PREVIEW to view files, I had no idea that it could actually edit them.  thanks! will try immediately!
    w

  • EP6.0.2 Create new workflow template with graphical editor

    Hi!
    In the EP6 Content (Administration -> Workflow Content -> Workflow Templates) you can find an iview to generate templates for ad-hoc (java-) workflows.
    After installation the button "Create New Template" is disabled.
    How can I configure the EP to create new template with graphical editor? Or should I wait till SP4 is rleased?
    Regards,
    Henric

    Hi Henric,
    We have had to develop our own way of creating templates.   This area seems to be very underdeveloped at the moment.
    Paul

  • Graphical editor not working

    Hi,
    SAP Graphical editor not working.  I am getting the following error.
    EU_SCRP_WN32 : timeout during allocate / CPIC-CALL: 'ThSAPCMRCV'
    Last week its sucessfully working but suddenly happen this issue... This problem in development server only. In production server is sucessfully working.
    Please advise...
    Regards
    Rajesh.

    Hi Rajesh,
    It looks to be RFC connection issue.
    Refer to various solutions described in below SAP note
    101971 - 37527 Graphical full screen is not available (RFC)
    Alternative
    Workaround
    You can prevent the termination of the RFC connection by increasing the value of the timeout parameter for the relevant RFC destination. Call transaction SM59, choose the TCP/IP connection "EU_SCRP_WN32" and branch to the "Special Options" tab page. In the section "Keep-Alive-Timeout" select the option "Specify Timeout" and enter a longer wait time (for example, 300 seconds). Undo this change once you use the corrected program version.
    Hope this helps.
    Regards,
    Deepak Kori

  • Graphical editor PC, conversion problem

    Hi!
    I have the following problem.
    I want to create a text in the header of the document, for example invoice.
    I do it in the Graphical editor PC, which looks like a WORD (i double click my text and open in this way the editor).
    When I save and go back from the editor some special signs are converted badly.
    I tried to debug the code. Action 'Save' fill firstly iternal table with RTF data and then convert it to ITF table
    (FM compose_itf).
    Where is the bug? Maybe the RTF data is wrong or what is more probable there is some error in conversion?
    Any help would be appreciated.
    Best regards
    Peter
    Edited by: Piotr Jakubowski on Aug 27, 2008 11:41 PM

    Hi Karthik,
    These signs that cause problems are for example:
    'ê' (which is converted to 'ę'),
    'à' (which is converted to 'ŕ'),
    'ã' (which is converted to 'ă'),
    'õ' (which is converted to 'ő').
    Data form System -> Status:
    Component version: BBPCRM 4.0
    Kernel release is: 640.
    This is an unicode system, with code page 4103.
    Is the casued by too old version? And can't be fixed?
    Regards
    Piotr
    Edited by: Piotr Jakubowski on Aug 28, 2008 1:07 PM

  • How to create customized graphic editor

    hi,
    i am new to java.
    Currently i am developing an application like a graphical editor. where i can drag and drop images,icons and also want to resize and edit it.
    Can any one tell me how to do it ?

    Java 2D, Graphics, Graphics2D. You make the objects you want to use, this is a language to devlope with for general use, it is not a spacifically designed to do the task you are asking.

  • Help developing a JavaFX graphical editor

    hello,
    i need some help going about building a javafx graphical editor..
    the basic working should be for the app to be able to drag and drop simple javafx elements(circle,rect,buttons etc)..and finally,a file with the corresponding code should be generated?
    i would like to know HOW to go about building this? and any tools,are helpful for building this?
    any help appreciated..thanks.. :-)

    public Point getCursorPosition() {
    Display display = Display.getDefault();
    Point point = getGraphicalViewer().getControl().toControl(display.getCursorLocation());
    FigureCanvas figureCanvas = (FigureCanvas)getGraphicalViewer().getControl();
    org.eclipse.draw2d.geometry.Point location = figureCanvas.getViewport().getViewLocation();
    point = new Point(point.x + location.x, point.y + location.y);
    return point;

  • Problem with graphical editor SE51

    Hi Friends,
    I need to design a screen in the graphical editor but when I am pressing the button layout in the T.code se51 I am getting the alphanumeric screen instead of graphical editor, I also checked with the settings and checked the graphical editor.
    Even though I am not getting graphical editor, pls let me know how to get it.
    Regards,
    Line

    hi line,
       This problem is due to the fault or corrupted gui. Try to reinstall that one.
    contact the basis team to reinstall the gui. It will definitely sort out ur problem.
    Regards....
    Arun.
    Reward points if useful.

  • Make the  transport router graphical editor show up

    On STMS, once I click the transport router button, I should see the the transport router graphical editor directly.
    However now I see a list of items.  I have to select "go to-> graphical editor" in order to see it.
    Could you tell me how to make it default? My TMS configuration is free of error.
    Thanks a lot!

    Hi,
    For you solution is
    Go to STMS >Extra>Setting-->Transaport routes
    Here select Graphical editor.
    Revert once done!
    Regards,
    Gagan Deep Kaushal

  • Cyrillic characters become garbage in SapScript Graphical Editor

    Hello Everyone,
    Cyrillic characters become garbage when switching from standard SapScript PC Editor, to SapScript Grahical Editor.
    What could be the reason for that?
    The logon language is EN, installed code page 1500 for Cyrillic.
    Best regards
    Max

    Cross posts:
    /thread/1209675 [original link is broken]
    Cyrillic characters become garbage in SapScript Graphical Editor

  • Link between referenced graphics and graphics editor

    FM 10 on Windows 7 …  If I right-click on a referenced .eps graphic, the context menu helpfully offers me Edit with RoboScreen Capture. Illustrator, my obvious preference for preparing and adjusting .eps graphics, is greyed out. So is Photoshop, even when I right-click on a .jpg  How do I convince FM I already have CS5.5 on this PC and would appreciate the click-to-open I'm used to from earlier installations elsewhere?  Thanks in advance.

    FM looks to what is enabled as the default application for a file format at the system level. So if you have .eps associated with Illustrator, double-clicking on the graphic within FM will open a referenced graphic file in that associated application. If it isn't working for you, then from Explorer you can change the default app by using the "Open with" option and specifying which app is to be the default.

  • Keynote as Graphics editor

    I have created a web site for my home based business using RapidWeaver. I made a post on the RW Forum in an effort to find a simple graphics software product to use for editing images to put on my site. I have been using ImageWell mostly for simple image crops but wanted a few more capabilities not in that product. One of the advanced web designers answered that he uses Keynote to create the graphics he wants.
    I have plans to use Keynote to make presentations for my site at a later date so I started playing around with it as a way to create image content for my site.
    I masked a picture to get just the 700 X 90 px portion of the image I wanted. I added a text box to get some company information I wanted on it. I grouped the two pieces to make a whole. I also added a 3px stroke/border. The result is a complete sized image on a Keynote slide.
    My problem is, I can not figure out how to get just the footer image I created out of Keynote. I can export a jpeg but I get the whole slide (the entire page with the image on it). All I want is the nice 700 x 90 px image I made. Is there a way to remove just the things I place on Keynote slides or maybe to size the "slide"....?

    If I'm understanding correctly, all you have to do is copy what you've created, open Preview, do a Command-N, then Export as the file type you'd like. And it's so versatile, you can use it for just about everything. Here, I describe how you can do the same thing for icons.
    http://www.makentosh.com/tipsfromtheiceberg/Blog/Entries/2006/11/9Ucan_do_Icons,too.html

  • Graphical editor of business process

    Hi All,
    I am going to specify the properties to the integration process step in properties window. there i need give message type from the F4 popup, but its in disable mode.
    how to activate this popup.
    Thanks & Regards,
    Nagarjuna.

    Hi,
    Insert teh 1st step in IP and then try it out.
    Also verify if the Abstract Message inetrface are available then only you could use those message types.
    Thanks
    Swarup

  • Graphics Editor

    Hey, all of you know how Windows boasts their easy to use paint program.. what program can i get for free that is closest to windows pain? Thanks,
    RILEy

    Seashore is pretty good and feels a lot lot the basic Paint program that is included with Windows.
    If you want something more heavy duty, you can get Gimp; there is a pointer to Gimp from the Apple OSX Software web page. Gimp is more of a Photo Shop - like program and has a bit of a learning curve. Gimp is very good. I've had people that use Photo Shop to earn a living criticize Gimp for not being not productive enough. For somebody like myself that works with family photos as an occasional hobby, Gimp seems great. The price is right too - free.
    Bill

  • SAPGUI 710 Graphical Layout Editor not available in LAN

    Hi,
    I recently installed sneakpreview NW04s for ABAP at home and the SAPGUI 710 software. The graphical layout editor doesn't work. I have checked all requirements such as, required dll and exe files. They are all available. The problem occurs only when I try to start the graphical editor from another pc in my LAN. If I start it on the application server where I have installed NW04s and the SAPGUI, it works fine. Only when I access to the application server from other pc in my home network, it fails to start the graphical editor. I've read that there must be a problem with firewall / port somewhere. I don't know where I can check whether this is the cause. I am using D-Link wireless for my home network.
    Can anybody help me with this?
    Thanks in advance,
    Shahram

    I tried SM59 and ran a connection test for EU_SCRP_WN32. It started gnetx.exe, the window appeared shortly. But, the connection failed with the following error message:
    ERROR                timeout during allocate                        
    LOCATION             SAP-Gateway on host OFFICE / sapgw00           
    DETAIL               no connect of TP gnetx.exe from host %%SAPGUI%%
    COMPONENT            SAP-Gateway                                    
    COUNTER              5824                                           
    MODULE               gwr3cpic.c ;                                    
    It seems that my laptop cannot establish an RFC connection to the application server. the service file on my laptop has the right entry for the application server.
    Any ideas?

Maybe you are looking for

  • When I import files (copy from jpeg or copy as DNG from raw, where is the full size original stored?

    I have the photos go here file, does LR5 put the untouched original there? Do I need my own file for originals and if so, how does LR5 know where to find the full size original? I have everything working but don't understand where my untouched origin

  • How to install the OS using a Toshiba Recovery DVD

    Hi I want to clear my laptop and start from scratch and I have a toshiba product recovery DVD When i put it into the D drive i just keep getting a window that asks if i want to copy pice, play cd etc I thought the DVD would wipe everything off the ha

  • Itunes fraudlent charges

    Today, I found two $20 charges for iTunes purchases on my credit card. I disputed both of those with my card company; however, I have a greater concern. I do not have a credit card associated with my iTunes account. I checked my purchases and all sho

  • Business One Customer Checkout (POS)

    Hi guys, I can't seem to find much information on SAP Business One Customer Checkout. Does anyone have any links? thanks, Costas

  • Clarification - CRM

    Hi I have the below requirement : System is Stand alone CRM (Assume) Like in CS (R/3) - Service Order , We have Service Order in CRM also . My doubt is like in CS we put the components that are required in the components tab in service order and also