Relate JInternalFrames entered by user into a JDesktopPane

1

It turns out that I'm doing a Modeler Database with tables ( JInternalFrames and within this same table) that can relate to each other, but I could not do.

To obtain the position of each InternalFrame I am taking the points by clicking on the table I am selecting.

The code that I have made is the following:

- "f" is the JInternalFrame .

    f.addMouseListener(new java.awt.event.MouseAdapter() {
    @Override
    public void mouseClicked(java.awt.event.MouseEvent e){
        if(e.getClickCount() == 1){
        super.mouseClicked(e);
        p1 = PanelDeEscritorio.getSelectedFrame().getX();
        p1_1 = PanelDeEscritorio.getSelectedFrame().getY();
        System.out.println(p1);
        System.out.println(p1_1);
        } 
        if(e.getClickCount() == 2){
        super.mouseClicked(e);
        p2 = PanelDeEscritorio.getSelectedFrame().getX();
        p2_2 = PanelDeEscritorio.getSelectedFrame().getY();
        System.out.println(p2);
        System.out.println(p2_2);
        line2d = new Line2D.Double(p1, p1_1, p2, p2_2);
        }
    }
    });

And then inside a button I add the paintComponent :

   super.paintComponents(g);
   final Graphics2D g2 = (Graphics2D) g;
   g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
   g2.setColor(Color.blue);
   g2.setStroke(new BasicStroke(2.5f));
   g2.draw(line2d);  

I do not know what I'm missing since I do not draw the line, I've tried several ways and well, I hope you can contribute to go testing, thanks for the help.

    
asked by Kevin 15.04.2016 в 05:30
source

0 answers