Name: boT120536 Date: 01/23/2001
# not available
We are implementing a client/server application for Windows & OS/2, where the
client side is written in Java. When the user requests data from the server, the
frame is disabled. When enabling the JFrame, it repaints itself completely when
run under Windows (this is not happening in OS/2). In some cases a selection in
a JList causes a call to the server (with a very fast answer). To demonstrate
the effect, here is a small example program (use the cursor keys to navigate
through the list):
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class TestFrame extends JFrame implements ListSelectionListener
{
private JList list;
private JLabel label1;
public TestFrame()
{
super();
Object[] inhalt = {"Eintrag", "Diverses", "Produkt",
"Testfall","Sonstiges","Eintrag",
"Diverses", "Produkt",
"Testfall","Sonstiges","Eintrag", "Diverses",
"Produkt", "Testfall","Sonstiges"};
this.list = new JList(inhalt);
this.label1 = new JLabel("Input:");
this.getContentPane().setLayout(new GridLayout(0,2));
this.getContentPane().add(label1);
this.getContentPane().add(list);
this.list.addListSelectionListener(this);
this.setSize(150,400);
this.show();
}
public void valueChanged(ListSelectionEvent e)
{
this.setEnabled(false);
this.setEnabled(true);
}
public static void main(String[] args)
{
TestFrame frame = new TestFrame();
}
}
(Review ID: 115621)
======================================================================