Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #3452 > unrolled thread

DND using XML

Started by"steve" <steve@THRWHITE.remove-dii-this>
First post2011-04-27 15:44 +0000
Last post2011-04-27 15:45 +0000
Articles 7 — 5 participants

Back to article view | Back to comp.lang.java.gui


Contents

  DND using XML "steve" <steve@THRWHITE.remove-dii-this> - 2011-04-27 15:44 +0000
    Re: DND using XML "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this> - 2011-04-27 15:44 +0000
      Re: DND using XML "steve" <steve@THRWHITE.remove-dii-this> - 2011-04-27 15:44 +0000
        Re: DND using XML "Mark Thornton" <mark.thornton@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000
        Re: DND using XML "=?ISO-8859-1?Q?Roger_Lind" <=?iso-8859-1?q?roger_lind@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000
        Re: DND using XML "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000
        Re: DND using XML "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000

#3452 — DND using XML

From"steve" <steve@THRWHITE.remove-dii-this>
Date2011-04-27 15:44 +0000
SubjectDND using XML
Message-ID<fvhepi019v4@news1.newsguy.com>
  To: comp.lang.java.gui
	Hi,

I want to transfer a block of XML between 2 DND objects in java

What's the best way to do this?

steve

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#3453

From"Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this>
Date2011-04-27 15:44 +0000
Message-ID<k7YSj.3$YZ4.1@newsfe05.lga>
In reply to#3452
  To: comp.lang.java.gui

steve wrote:
> Hi,
>
> I want to transfer a block of XML between 2 DND objects in java
>
> What's the best way to do this?
>

<http://java.sun.com/docs/books/tutorial/uiswing/dnd/index.html>

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3458

From"steve" <steve@THRWHITE.remove-dii-this>
Date2011-04-27 15:44 +0000
Message-ID<fvjnv80upo@news4.newsguy.com>
In reply to#3453
  To: comp.lang.java.gui
On Sat, 3 May 2008 19:33:49 +0800, Jeff Higgins wrote
(in article <k7YSj.3$YZ4.1@newsfe05.lga>):

> http://java.sun.com/docs/books/tutorial/uiswing/dnd/index.html

gosh, did you figure that out all by yourself.


"This section has been updated to reflect features and conventions of the 
latest release, JDK 6.0, but it is not yet final. We've published this 
preliminary version so you can get the most current information now, and so 
you can tell us (please!) about errors, omissions, or improvements we can 
make to this tutorial."


so you think the best way forward is to implement code that is not finalised 
yet?



moron!

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3459

From"Mark Thornton" <mark.thornton@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
Message-ID<qDeTj.8366$b4.2358@newsfe1-gui.ntli.net>
In reply to#3458
  To: comp.lang.java.gui
steve wrote:
> On Sat, 3 May 2008 19:33:49 +0800, Jeff Higgins wrote
> (in article <k7YSj.3$YZ4.1@newsfe05.lga>):
> 
>> http://java.sun.com/docs/books/tutorial/uiswing/dnd/index.html
> 
> gosh, did you figure that out all by yourself.
> 
> 
> "This section has been updated to reflect features and conventions of the 
> latest release, JDK 6.0, but it is not yet final. We've published this 
> preliminary version so you can get the most current information now, and so 
> you can tell us (please!) about errors, omissions, or improvements we can 
> make to this tutorial."
> 
> 
> so you think the best way forward is to implement code that is not finalised 
> yet?
> 
> 
> 
> moron!
> 

It is the tutorial/lesson that isn't final, not the code.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3460

From"=?ISO-8859-1?Q?Roger_Lind" <=?iso-8859-1?q?roger_lind@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
Message-ID<fvk0bi$niv$1@blue.telenor.se>
In reply to#3458
  To: comp.lang.java.gui
steve wrote:
> On Sat, 3 May 2008 19:33:49 +0800, Jeff Higgins wrote
> (in article <k7YSj.3$YZ4.1@newsfe05.lga>):
> 
>> http://java.sun.com/docs/books/tutorial/uiswing/dnd/index.html
> 
> gosh, did you figure that out all by yourself.

He probably googled on it since you gave no indication that you had 
tried that.

> "This section has been updated to reflect features and conventions of the 
> latest release, JDK 6.0, but it is not yet final. We've published this 
> preliminary version so you can get the most current information now, and so 
> you can tell us (please!) about errors, omissions, or improvements we can 
> make to this tutorial."

As far as I can see this refers to the tutorial.

> so you think the best way forward is to implement code that is not finalised 
> yet?

The tutorial is not completed (is it ever?), but the Java 6 API should 
be since it is released.

> moron!

Creative an probably an excellent way of getting further help.

-- 
Roger Lindsj%

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3461

From"Lew" <lew@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
Message-ID<9eudnTBvSOJtD4DVnZ2dnUVZ_tqtnZ2d@comcast.com>
In reply to#3458
  To: comp.lang.java.gui
steve wrote:
> moron!

Gee, Jeff gives you information that's directly relevant to the question you 
ask, and you resort to name calling and highly inappropriate hostility.  How 
very machoowah.  Not to mention shockingly ungrateful, rude and contemptible.

Nice way to win friends and influence people, Dale Carnegie.

-- 
Lew

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3463

From"Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
Message-ID<IcoTj.104$4J1.56@newsfe05.lga>
In reply to#3458
  To: comp.lang.java.gui

steve wrote:
> On Sat, 3 May 2008 19:33:49 +0800, Jeff Higgins wrote
> (in article <k7YSj.3$YZ4.1@newsfe05.lga>):
>
>> http://java.sun.com/docs/books/tutorial/uiswing/dnd/index.html
>
> gosh, did you figure that out all by yourself.
>

Pretty good tutorial, don't chathink?

>
> "This section has been updated to reflect features and conventions of the
> latest release, JDK 6.0, but it is not yet final. We've published this
> preliminary version so you can get the most current information now, and 
> so
> you can tell us (please!) about errors, omissions, or improvements we can
> make to this tutorial."
>
>
> so you think the best way forward is to implement code...

Yep.

> that is not finalised yet?

So what's holding you up?  Oh, ignorance!

>
>
>
> moron!

He, he!







import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.Action;
import javax.swing.JFrame;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.text.DefaultEditorKit;
import org.apache.batik.util.gui.xmleditor.XMLTextEditor;

public class Launcher {

  public static void main(String[] args) {

    EventQueue.invokeLater(new Runnable() {
      public void run() {
        new GUI();
      }
    });
  }

  public static class GUI {

    JPopupMenu contextMenu;

    public GUI() {

      XMLTextEditor leftEditorPane =
        new XMLTextEditor();
      leftEditorPane.setPreferredSize
      (new Dimension(400, 400));

      XMLTextEditor rightEditorPane =
        new XMLTextEditor();
      rightEditorPane.setPreferredSize
      (new Dimension(400, 400));

      JScrollPane leftScrollPane =
        new JScrollPane(leftEditorPane);
      JScrollPane rightScrollPane =
        new JScrollPane(rightEditorPane);

      JSplitPane splitPane = new JSplitPane();

      splitPane.setRightComponent(rightScrollPane);
      splitPane.setLeftComponent(leftScrollPane);

      JFrame frame = new JFrame("XML DND");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setLocationByPlatform(true);

      frame.add(splitPane);

      View leftView = new View(leftEditorPane);
      @SuppressWarnings("unused")
      View rightView = new View(rightEditorPane);
      leftView.setText(
          "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
          "<jackass>\n" +
            "\t<moron>So easy any moron can do it.</moron>\n" +
            "\t<moron>Well, except maybe you; har har.</moron>\n" +
          "</jackass>");
      frame.pack();
      frame.setVisible(true);
    }
  }

  public static class View{

    XMLTextEditor editorPane;
    JPopupMenu contextMenu;

    public View(XMLTextEditor editorPane) {
      this.editorPane = editorPane;
      createMenu();
      ContextMenuMouseListener contextMenuMouseListener =
        new ContextMenuMouseListener();
      editorPane.addMouseListener(contextMenuMouseListener);
      editorPane.setDragEnabled(true);
    }

    public void setText(String text) {
      editorPane.setText(text);
    }

    private void createMenu() {
      Action a;
      a = editorPane.getActionMap()
      .get(DefaultEditorKit.cutAction);
      a.putValue(Action.NAME, "Cut");

      a = editorPane.getActionMap()
      .get(DefaultEditorKit.copyAction);
      a.putValue(Action.NAME, "Copy");

      a = editorPane.getActionMap()
      .get(DefaultEditorKit.pasteAction);
      a.putValue(Action.NAME, "Paste");

      a = editorPane.getActionMap()
      .get(DefaultEditorKit.selectAllAction);
      a.putValue(Action.NAME, "Select All");

      contextMenu = new JPopupMenu();
      contextMenu.add(editorPane.getActionMap()
          .get(DefaultEditorKit.cutAction));
      contextMenu.add(editorPane.getActionMap()
          .get(DefaultEditorKit.copyAction));
      contextMenu.add(editorPane.getActionMap()
          .get(DefaultEditorKit.pasteAction));
      contextMenu.add(editorPane.getActionMap()
          .get(DefaultEditorKit.selectAllAction));
    }

    class ContextMenuMouseListener
    extends MouseAdapter {
      public void mousePressed(MouseEvent e) {
        if (e.isPopupTrigger()) {
          contextMenu.show(e.getComponent(),
              e.getX(), e.getY());
        }
      }
      public void mouseReleased(MouseEvent e) {
        if (e.isPopupTrigger()) {
          contextMenu.show(e.getComponent(),
              e.getX(), e.getY());
        }
      }
    }
  }
}

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web