-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
None
-
1.4.0
-
x86
-
generic
Name: jbT81659 Date: 01/12/2001
JDK: jdk1.4.0-b46
OS: Win95/Win98/WinNT/Win2000
When a JOptionPane is initilized and displyed from an application. The following
warning message is displayed on the command prompt.
"JVM warning-increase BUFLEN in ostream.cpp -- output truncated"
This bug affects all windows platforms(Win95, Win98, Win NT, Win 2000) under English/Arabic/Hebrew locales.
To reproduce bug:
1- Compile and run the following code
2- From the menu choose a choice and click on it.
3- Note that a JOptionPane is displaed
4- Note that a wrning message is diplayed on the command prompt.
5- Repeat previous steps
6- Note that each time a JOptionPane is displayed, the warning message is displayed
-----------Code---------------
/* Copyright (c) Sun Microsystems 1998
$Header: /home/sun/src/JDK1.4/Linux/jDialog.java,v 1.1 2000/09/12 08:27:59 isam Exp $
*/
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.beans.*;
public class jDialog extends JApplet
{
public void init()
{
JFrame f = new jOptionPane1("\u05e9\u05dd\u0020\u0627\u0644\u0625\u0633\u0645 ");
f.setVisible(true);
f.setSize(200,300);
}
public static void main(String[] argv)
{
JFrame frame = new jOptionPane1("\u05e9\u05dd\u0020\u0627\u0644\u0625\u0633\u0645 ");
frame.setVisible(true);
frame.setSize(200,300);
frame.addWindowListener( new WindowAdapter()
{
public void windowClosing( WindowEvent e)
{
System.exit(0);
}
});
}
}
class jOptionPane1 extends JFrame
{
public jOptionPane1(final String message)
{
final int msgType = JOptionPane.QUESTION_MESSAGE;
final int optType = JOptionPane.OK_CANCEL_OPTION;
final String title = message;
setSize(350, 200);
final JDesktopPane desk = new JDesktopPane();
setContentPane(desk);
JMenuBar mb = new JMenuBar();
setJMenuBar(mb);
JMenu menu = new JMenu();
menu.setFont(new Font("Lucida Sans Regular",Font.PLAIN,15));
menu.setText("\u0645\u062d\u0627\u0643\u0627\u0629\u0020\u05d3\u05d9\u05d0\u05dc\u05d5\u05d2");
JMenu imenu = new JMenu();
imenu.setFont(new Font("Lucida Sans Regular",Font.PLAIN,15));
imenu.setText("\u062f\u0627\u062e\u0644\u064a\u0020\u05e4\u05e0\u05d9\u05de\u05d9");
mb.add(menu);
mb.add(imenu);
final JMenuItem construct = new JMenuItem();
construct.setFont(new Font("Lucida Sans Regular",Font.PLAIN,15));
construct.setText("\u0648\u0644\u062f");
final JMenuItem stat = new JMenuItem();
stat.setFont(new Font("Lucida Sans Regular",Font.PLAIN,15));
stat.setText("\u0628\u0646\u062a");
final JMenuItem iconstruct = new JMenuItem();
iconstruct.setFont(new Font("Lucida Sans Regular",Font.PLAIN,15));
iconstruct.setText("\u05d9\u05dc\u05d3\u05d4");
final JMenuItem istat = new JMenuItem();
istat.setFont(new Font("Lucida Sans Regular",Font.PLAIN,15));
istat.setText("\u05d1\u05e0\u05d5\u05ea");
menu.add(construct);
menu.add(stat);
imenu.add(iconstruct);
imenu.add(istat);
optPane = new JOptionPane(message, msgType, optType);
optPane.setWantsInput(true);
construct.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
JDialog d = optPane.createDialog(desk, title);
d.setVisible(true);
}
});
stat.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
String s = JOptionPane.showInputDialog
(desk, message, title, msgType);
//respond(s);
}
});
iconstruct.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
JInternalFrame f = optPane.createInternalFrame(desk, title);
f.setVisible(true);
f.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent ev)
{
if ((ev.getPropertyName().equals
(JInternalFrame.IS_CLOSED_PROPERTY))
&& (ev.getNewValue() == Boolean.TRUE))
{
}
}
});
}
});
istat.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
String s = JOptionPane.showInternalInputDialog
(desk, message, title, msgType);
// respond(s);
}
});
}
protected String getOptionPaneValue()
{
Object o = optPane.getInputValue();
String s = "<Unknown>";
if (o != null)
s = (String)o;
Object val = optPane.getValue(); // which button?
if (val != null)
{
if (val instanceof Integer)
{
int intVal = ((Integer)val).intValue();
if((intVal == JOptionPane.CANCEL_OPTION)
(intVal == JOptionPane.CLOSED_OPTION))
s = "<Cancel>";
}
}
optPane.setInitialValue("X");
optPane.setInitialValue("");
return s;
}
protected JOptionPane optPane;
}
-----------------------------
WorkAround:
======================================================================