Swing in JDK 1.2

1998-08-07 Thread Robert Fitzsimons

Hi everybody

I'm just pointing out to everybody that JavaWorld (www.javaworld.com) are
doing a poll, on whether it is right for Sun to put Swing under the package
name com.sun.java.swing.

This is very important for us in the open source community to try and
change Sun's minds.  As we may in the future want to write a open source
version of Swing, and I don't think it is right for us to put our code
under com.sun.java.swing.

The poll page is http://nigeria.wpi.com/cgi-bin/gwpoll/gwpoll/ballot.html

Thanks

Robert Fitzsimons
[EMAIL PROTECTED]



Re: jdk 1.1.x without X-windows support

1998-10-22 Thread Robert Fitzsimons

Hi Michal

> Can you point me to an appropriate place to see ?
http://www.blackdown.org/java-linux/rel/116/v5/README-1.1.6v5.html

Robert Fitzimons
[EMAIL PROTECTED]



Re: jdk 1.1.x without X-windows support

1998-10-22 Thread Robert Fitzsimons

Hi Michal

> > Can you point me to an appropriate place to see ?
> http://www.blackdown.org/java-linux/rel/116/v5/README-1.1.6v5.html
Look under the section Java Virtual Machine variations.

Robert Fitzimons
[EMAIL PROTECTED]



Re: HP wrong, Linux right... right?

1998-10-28 Thread Robert Fitzsimons

Hi Charles

The problem with your code is not a bug, it's just how thread are scheduled
by the underliying VM.

Your code running on Linux is unblocking (notifyAll) before, there is any
thing waiting (wait) on the lock.  The run method in SThread run to the
while loop, before the XThread run starts.  Maybe adding a Thread.yeild()
just after the new Socket() would work.


Below is the output with the changes I made to your code, which I ran on
Linux JDK 1.1.6v5.

Unblocking pause()
Before notifyAll
After notifyAll
Before wait

Hope this helps.

Robert Fitzsimons

> import java.net.*;
> import java.util.Date;
> 
> public class STest {
>   public static void main(String[] param) {
> if (param.length != 1) {
>   System.out.println("Usage: java STest ");
>   System.exit(1);
> }
> 
> SThread t = new SThread(param[0]);
> XThread x = new XThread(t);
> try {
>   t.start();
>   x.start();
>   x.join();
>   System.out.println("XThread completed.  Socket should be closed");
> } catch(Exception e) {
>   e.printStackTrace();
> }
>   }
> }
> 
> class XThread extends Thread {
>   private SThread st;
> 
>   public XThread(SThread st) { this.st = st; }
> 
>   public void run() {
> try {
>   st.pause();
>   System.out.println("XThread sleeping for a little bit.\t" + 
>  new Date());
>   sleep(5000);
>   System.out.println("XThread awake.\t\t\t" + new Date());
>   st.s.close();
> } catch(Exception e) {
>   e.printStackTrace();
> }
>   }
> }
> 
> class SThread extends Thread {
>   private String host;
>   public Socket s;
>   public SThread(String host) { this.host = host; }
> 
>   public void run() {
> try {
>   // Open a telnet socket to the host passed on the command line
>   s = new Socket(host, 23);
> 
>   System.out.println("Unblocking pause()");

System.out.println("Before notifyAll");

>   synchronized(this) { notifyAll(); }

System.out.println("After notifyAll");

> 
>   while(true) {
>   s.getInputStream().read();
>   }
> } catch(Exception e) {
>   e.printStackTrace();
> }
>   }
> 
>   public synchronized void pause() {

  System.out.println("Before wait");

> try { wait(); } catch(Exception e) { e.printStackTrace(); }

  System.out.println("After wait");

>   }
> }



Re: More problems extending an inner class

1998-06-17 Thread Robert Fitzsimons

Daniele

Here is some code I put together showing the three forms of inner
classes, this may help you understand what is going wrong.  I also
think your code didn't work because the was a logical error, with
the events somewhere.

Robert Fitzsimons
[EMAIL PROTECTED]

// Test.java

import java.awt.*;
import java.awt.event.*;

public class Test extends Frame {
private Checkbox cb;

public Test() {
Button b;
this.setLayout(new FlowLayout());
this.setSize(200, 200);
// Anonymous innerclass
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
// Local innerclass
class ActionAdapter implements ActionListener {
public void actionPerformed(ActionEvent e) {
TestDialog td;
if(!Test.this.cb.getState()) {
td = new TestDialog(Test.this,
e.getActionCommand());
} else {
td = new ExTestDialog(Test.this,
e.getActionCommand());
}
td.setVisible(true);
}
}
ActionAdapter aa = new ActionAdapter();
for(int i = 1; i < 6; i++) {
this.add(b = new Button("Test " + i));
b.addActionListener(aa);
}
this.add(cb = new Checkbox("Modal"));
this.setVisible(true);
}

public static void main(String[] args) {
new Test();
}

// Innerclass
protected class TestDialog extends Dialog {
public TestDialog(Frame frame, String title) {
super(frame, title);
this.setSize(100, 100);
// Anonymous innerclass
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
TestDialog.this.dispose();
}
});
}
}

// Extended innerclass
protected class ExTestDialog extends TestDialog {
public ExTestDialog(Frame frame, String title) {
super(frame, title);
this.setModal(true);
}
}
}




Re: More problems extending an inner class

1998-06-17 Thread Robert Fitzsimons

Daniele

Here is some code I put together showing the three forms of inner
classes, this may help you understand what is going wrong.  I also
think your code didn't work because the was a logical error, with
the events somewhere.

Robert Fitzsimons
[EMAIL PROTECTED]

// Test.java

import java.awt.*;
import java.awt.event.*;

public class Test extends Frame {
private Checkbox cb;

public Test() {
Button b;
this.setLayout(new FlowLayout());
this.setSize(200, 200);
// Anonymous innerclass
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
// Local innerclass
class ActionAdapter implements ActionListener {
public void actionPerformed(ActionEvent e) {
TestDialog td;
if(!Test.this.cb.getState()) {
td = new TestDialog(Test.this,
e.getActionCommand());
} else {
td = new ExTestDialog(Test.this,
e.getActionCommand());
}
td.setVisible(true);
}
}
ActionAdapter aa = new ActionAdapter();
for(int i = 1; i < 6; i++) {
this.add(b = new Button("Test " + i));
b.addActionListener(aa);
}
this.add(cb = new Checkbox("Modal"));
this.setVisible(true);
}

public static void main(String[] args) {
new Test();
}

// Innerclass
protected class TestDialog extends Dialog {
public TestDialog(Frame frame, String title) {
super(frame, title);
this.setSize(100, 100);
// Anonymous innerclass
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
TestDialog.this.dispose();
}
});
}
}

// Extended innerclass
protected class ExTestDialog extends TestDialog {
public ExTestDialog(Frame frame, String title) {
super(frame, title);
this.setModal(true);
}
}
}