-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2fcs
-
generic
-
generic
-
Verified
Run the attached program.
- LineWrap status set to true.
- Select text and LineWrap status set to false.
From on to off, scrollbar disappered. However, off to on, scrollbar does not appeared until resizing window.
program :
-------------------
import com.sun.java.swing.JFrame;
import com.sun.java.swing.JTextArea;
import com.sun.java.swing.JScrollPane;
import com.sun.java.swing.JMenuBar;
import com.sun.java.swing.JMenu;
import com.sun.java.swing.JMenuItem;
import com.sun.java.swing.JCheckBoxMenuItem;
import com.sun.java.swing.event.ChangeListener;
import com.sun.java.swing.event.ChangeEvent;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class LineWrapTest extends JFrame {
private JTextArea editor;
public LineWrapTest() {
super("LineWrap Test");
WindowListener wl = new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
};
this.addWindowListener(wl);
editor = createEditor();
this.setJMenuBar(createMenuBar());
JScrollPane scrollPane = new JScrollPane(editor);
this.getContentPane().add(scrollPane, BorderLayout.CENTER);
}
private JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu menu;
JMenuItem menuItem;
menu = new JMenu("FILE");
menuBar.add(menu);
menuItem = menu.add(new JMenuItem("EXIT"));
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}});
menu = new JMenu("TEST");
menuBar.add(menu);
menuItem = menu.add(new JCheckBoxMenuItem("LineWrap",editor.getLineWrap()));
menuItem.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
editor.setLineWrap(((JCheckBoxMenuItem)e.getSource()).isSelected());
}});
return menuBar;
}
private JTextArea createEditor() {
return new JTextArea("This is a sample program for LineWrap status change");
}
public static void main(String args[]) {
LineWrapTest lw = new LineWrapTest();
lw.setSize(300,200);
lw.show();
}
}
-------------------
- LineWrap status set to true.
- Select text and LineWrap status set to false.
From on to off, scrollbar disappered. However, off to on, scrollbar does not appeared until resizing window.
program :
-------------------
import com.sun.java.swing.JFrame;
import com.sun.java.swing.JTextArea;
import com.sun.java.swing.JScrollPane;
import com.sun.java.swing.JMenuBar;
import com.sun.java.swing.JMenu;
import com.sun.java.swing.JMenuItem;
import com.sun.java.swing.JCheckBoxMenuItem;
import com.sun.java.swing.event.ChangeListener;
import com.sun.java.swing.event.ChangeEvent;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class LineWrapTest extends JFrame {
private JTextArea editor;
public LineWrapTest() {
super("LineWrap Test");
WindowListener wl = new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
};
this.addWindowListener(wl);
editor = createEditor();
this.setJMenuBar(createMenuBar());
JScrollPane scrollPane = new JScrollPane(editor);
this.getContentPane().add(scrollPane, BorderLayout.CENTER);
}
private JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu menu;
JMenuItem menuItem;
menu = new JMenu("FILE");
menuBar.add(menu);
menuItem = menu.add(new JMenuItem("EXIT"));
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}});
menu = new JMenu("TEST");
menuBar.add(menu);
menuItem = menu.add(new JCheckBoxMenuItem("LineWrap",editor.getLineWrap()));
menuItem.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
editor.setLineWrap(((JCheckBoxMenuItem)e.getSource()).isSelected());
}});
return menuBar;
}
private JTextArea createEditor() {
return new JTextArea("This is a sample program for LineWrap status change");
}
public static void main(String args[]) {
LineWrapTest lw = new LineWrapTest();
lw.setSize(300,200);
lw.show();
}
}
-------------------