drag'n'drop with jdk 1.2-pre1?
I'm trying to do drag'n'drop with Swing in JDK 1.2 pre1. However, all the examples I've managed to find (well, all two of them, from MiningCo and JavaWorld) give me this when I try to drag something: java.awt.dnd.InvalidDnDOperationException: The operation requested cannot be performed by the DnD system since it is not in the appropriate state Is pre1 broken or am I doing something wrong? -- >> juri pakaste >> noitatieto oy -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
I/O to HTTP url
Hello, I'm not a Java newbie, but I am not too familiar with the networking classes of our dear "write once, run anywhere" language. The problem is the following, I need to let an applet write a file to a specified http address in order for it to work correctly. How do I acomplish this? If I am correct, the java.io.* only works for local files. Any help would be appreciated. -Michael -- Michael Holst Schlager [EMAIL PROTECTED] Instituto Tecnologico de Costa Rica TEC Linux -- Linux & MacOS Addict -- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
NullPointerException
Help, I keep getting a NullPointerException when trying to load the following aplpet. Can someone please help - it's 1 of 6 programs I'm writting for my final in an intro to java class and I haven't been able to track down the problem. Below is the output of the java console and the applet and html code. Any help would be greatly appreciated - --- - Netscape Communications Corporation -- Java 1.1.5 java.lang.NullPointerException: trying to call getProperty(Ljava/lang/String;Ljava/awt/image/Im at javax.swing.ImageIcon.(ImageIcon.java:124) at VTour.initComponents(VTour.java:40) at VTour.init(VTour.java:7) * at netscape.applet.DerivedAppletFrame$InitAppletEvent.dispatch(DerivedAppletFrame.java:553) at java.awt.EventDispatchThread$EventPump.dispatchEvents(EventDispatchThread.java:81) at java.awt.EventDispatchThread.run(EventDispatchThread.java:135) at netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(DerivedAppletFrame.java:911) --- import javax.swing.*; public class VTour extends java.applet.Applet { /** Initializes the Form */ public void init () { initComponents (); } private void initComponents () { setLayout (new java.awt.BorderLayout ()); //NORTH jTitlePanel = new JPanel (); jTitlePanel.setLayout (new java.awt.FlowLayout ()); jTitleLabel = new JLabel (); jTitleLabel.setText ("Java Jive University Virtual Tour"); jTitlePanel.add (jTitleLabel); add (jTitlePanel, "North"); //END NORTH //CENTER jSlidePanel = new JPanel (); jSlidePanel.setBorder (new javax.swing.border.SoftBevelBorder (0)); jSlidePanel.setLayout (new java.awt.CardLayout ()); jPanel1 = new JPanel (); jPanel1.setLayout (new java.awt.FlowLayout ()); jSlidePanel.add (jPanel1, "card2"); add (jSlidePanel, "Center"); //END CENTER //WEST jPrevButton = new JButton (); jPrevButton.setPressedIcon (new ImageIcon (this.getImage(this.getDocumentBase(),this.getParameter("Prev-active"; jPrevButton.setIcon (new ImageIcon (this.getImage(this.getDocumentBase(),this.getParameter("Prev-passive"; jPrevButton.setRolloverEnabled (true); jPrevButton.setBackground (java.awt.Color.lightGray); jPrevButton.setDisabledIcon (new ImageIcon (this.getImage(this.getDocumentBase(),this.getParameter("Prev-disable"; jPrevButton.setBorder (new javax.swing.border.SoftBevelBorder (0)); jPrevButton.setDebugGraphicsOptions ( DebugGraphics.BUFFERED_OPTION); jPrevButton.setToolTipText ("Next Image"); jPrevButton.setDoubleBuffered (true); jPrevButton.setDisabledSelectedIcon (new ImageIcon (this.getImage(this.getDocumentBase(),this.getParameter("Prev-disable"; jPrevButton.setRolloverIcon (new ImageIcon (this.getImage(this.getDocumentBase(),this.getParameter("Prev-active"; jPrevButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { jPrevButtonActionPerformed (evt); } } ); add (jPrevButton, "West"); //END WEST //EAST jNextButton = new JButton (); jNextButton.setPressedIcon (new ImageIcon ("NbuttonImage3.gif")); jNextButton.setIcon (new ImageIcon ("NbuttonImage2.gif")); jNextButton.setRolloverEnabled (true); jNextButton.setBackground (java.awt.Color.lightGray); jNextButton.setDisabledIcon (new ImageIcon ("NbuttonImage4.gif")); jNextButton.setBorder (new javax.swing.border.SoftBevelBorder (0)); jNextButton.setDebugGraphicsOptions ( DebugGraphics.BUFFERED_OPTION); jNextButton.setToolTipText ("Next Image"); jNextButton.setDoubleBuffered (true); jNextButton.setRolloverIcon (new ImageIcon ("NbuttonImage3.gif")); jNextButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { jNextButtonActionPerformed (evt); } } ); add (jNextButton, "East"); //END EAST //SOUTH jCaptionTextArea = new JTextArea (); jCaptionTextArea.setText ("Captions for the slide show go here !"); jCaptionTextArea.setSelectedTextColor (java.awt.Color.white); jCaptionTextArea.setForeground (java.awt.Color.white); jCaptionTextArea.setBackground (java.awt.Color.black); jCaptionTextArea.setFont (new java.awt.Font ("SansSerif", 0, 14)); jCaptionTextArea.setBorder (new javax.
Re: I/O to HTTP url
You would need to have the Java code call a cgi script or servlet that resides on the remote host. The cgi or servlet could then write to its local machine. You are correct about the java.io.*. You would need to use the java.net.* api. to run the script. Michael Holst wrote: > Hello, > > I'm not a Java newbie, but I am not too familiar with the networking > classes of our dear "write once, run anywhere" language. > The problem is the following, I need to let an applet write a file to a > specified http address in order for it to work correctly. How do I > acomplish this? If I am correct, the java.io.* only works for local > files. > > Any help would be appreciated. > -Michael > -- > Michael Holst Schlager > [EMAIL PROTECTED] > > Instituto Tecnologico de Costa Rica > TEC Linux > > -- Linux & MacOS Addict -- > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: drag'n'drop with jdk 1.2-pre1?
[EMAIL PROTECTED] said: > I'm trying to do drag'n'drop with Swing in JDK 1.2 pre1. However, all > the examples I've managed to find (well, all two of them, from > MiningCo and JavaWorld) give me this when I try to drag something: > > java.awt.dnd.InvalidDnDOperationException: The operation requested cannot be >performed by the DnD system since it is not in the appropriate state > > Is pre1 broken or am I doing something wrong? Check the archives: http://www.mail-archive.com/java-linux@java.blackdown.org/msg06579.html Lightweight components seem not to have the XEvent data required by the underlying Motif library to do drag-n-drop. I have a native method fix to this, but it's not pretty. If you find a solaris jdk1.2 and it successfully runs my test code using Swing components, we'll know if it's linux or java who is to blame. -- Pete -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: drag'n'drop with jdk 1.2-pre1?
> Pete Wyckoff writes: Pete> [EMAIL PROTECTED] said: >> I'm trying to do drag'n'drop with Swing in JDK 1.2 pre1. However, all >> the examples I've managed to find (well, all two of them, from >> MiningCo and JavaWorld) give me this when I try to drag something: >> >> java.awt.dnd.InvalidDnDOperationException: The operation requested cannot be performed by the DnD system since it is not in the appropriate state >> >> Is pre1 broken or am I doing something wrong? Pete> Check the archives: Pete> http://www.mail-archive.com/java-linux@java.blackdown.org/msg06579.html Pete> Lightweight components seem not to have the XEvent data Pete> required by the underlying Motif library to do drag-n-drop. Pete> I have a native method fix to this, but it's not pretty. Pete> If you find a solaris jdk1.2 and it successfully runs my Pete> test code using Swing components, we'll know if it's linux Pete> or java who is to blame. It's a linux problem and it will be fixed in the next release. Juergen -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
File IO exception from the security manager
I'm trying to set up jButtons with different images like such - h t m l --- . - h t m l the images are read in like thus - j a v a - ... protected Image pImage1 ... pImage1 = this.getImage(this.getDocumentBase(), this.getParameter( "Prev-passive" )); ... jPrevButton.setIcon (new ImageIcon (pImage1)); ... --- when the applet tries to read the files it gets a FileIO exception from the security manager like such java console - netscape.security.AppletSecurityException: security.checkread: Read of 'NbuttonImage3.gif' not permitted at netscape.security.AppletSecurity.checkRead(AppletSecurity.java:608) at netscape.security.AppletSecurity.checkRead(AppletSecurity.java:493) at java.lang.SecurityManager.checkRead(SecurityManager.java:545) at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:110) at sun.awt.SunToolkit.getImage(SunToolkit.java:124) at javax.swing.ImageIcon.(ImageIcon.java:64) at javax.swing.ImageIcon.(ImageIcon.java:83) at VTour.init(VTour.java:99) * at netscape.applet.DerivedAppletFrame$InitAppletEvent.dispatch(DerivedAppletFrame.java:553) at java.awt.EventDispatchThread$EventPump.dispatchEvents(EventDispatchThread.java:81) at java.awt.EventDispatchThread.run(EventDispatchThread.java:135) Can someone please give me some ideas the ful code is available at www.digital-babylon.com/strangedos/java thanks, Joel McCrty -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]