-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.1
-
x86, sparc
-
solaris_2.5.1, windows_nt
The application given below brings up a scrollpane that has no child.
On Windows NT, this scrollpane has scrollbars.
On Solaris OpenWindows, it doesn't.
/*
ScrollpaneNochild.java
This application displays a scrollpane with no child
*/
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class ScrollpaneNochild extends Frame {
public ScrollpaneNochild () {
setLayout(new BorderLayout());
setFont(new Font("Helvetica", Font.PLAIN, 14));
}
public static void main(String args[]) {
ScrollpaneNochild window = new ScrollpaneNochild();
// Panel for the scrollpane
Panel scrollpanePanel = new Panel();
// Scrollpane
ScrollPane scrollpane= new ScrollPane();
// Set size of scrollpane
scrollpane.setSize(150, 300);
// Add scrollpane to scrollpane panel
scrollpanePanel.setLayout(new GridLayout(0, 1));
scrollpanePanel.add(scrollpane);
// Add scrollpane panel to window
window.add("North", scrollpanePanel);
// Display window
window.setTitle("ScrollpaneNochild Application");
window.addWindowListener(new EventAdapter());
window.pack();
window.show();
}
}
// ******************************* EventAdapter ***************************
class EventAdapter implements WindowListener {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
public void windowOpened(WindowEvent e) {}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowActivated(WindowEvent e) {}
public void windowDeactivated(WindowEvent e) {}
}
ronan.mandel@Eng 1997-10-23
Here is another example:
import java.awt.*;
import java.awt.event.*;
class ScrollHandle extends ScrollPane implements AdjustmentListener {
int count;
ScrollHandle() {
setSize(400, 600);
getVAdjustable().addAdjustmentListener(this);
getHAdjustable().addAdjustmentListener(this);
count = 0;
}
public void adjustmentValueChanged(AdjustmentEvent e) {
System.out.println("value" + e.getValue());
System.out.println(e);
count++;
System.out.println("count " + count);
}
public static final void main(String[] args) {
Frame f = new Frame();
f.setSize(200, 200);
ScrollHandle sh = new ScrollHandle();
f.add(sh);
f.show();
}
}
On Windows NT, this scrollpane has scrollbars.
On Solaris OpenWindows, it doesn't.
/*
ScrollpaneNochild.java
This application displays a scrollpane with no child
*/
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class ScrollpaneNochild extends Frame {
public ScrollpaneNochild () {
setLayout(new BorderLayout());
setFont(new Font("Helvetica", Font.PLAIN, 14));
}
public static void main(String args[]) {
ScrollpaneNochild window = new ScrollpaneNochild();
// Panel for the scrollpane
Panel scrollpanePanel = new Panel();
// Scrollpane
ScrollPane scrollpane= new ScrollPane();
// Set size of scrollpane
scrollpane.setSize(150, 300);
// Add scrollpane to scrollpane panel
scrollpanePanel.setLayout(new GridLayout(0, 1));
scrollpanePanel.add(scrollpane);
// Add scrollpane panel to window
window.add("North", scrollpanePanel);
// Display window
window.setTitle("ScrollpaneNochild Application");
window.addWindowListener(new EventAdapter());
window.pack();
window.show();
}
}
// ******************************* EventAdapter ***************************
class EventAdapter implements WindowListener {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
public void windowOpened(WindowEvent e) {}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowActivated(WindowEvent e) {}
public void windowDeactivated(WindowEvent e) {}
}
ronan.mandel@Eng 1997-10-23
Here is another example:
import java.awt.*;
import java.awt.event.*;
class ScrollHandle extends ScrollPane implements AdjustmentListener {
int count;
ScrollHandle() {
setSize(400, 600);
getVAdjustable().addAdjustmentListener(this);
getHAdjustable().addAdjustmentListener(this);
count = 0;
}
public void adjustmentValueChanged(AdjustmentEvent e) {
System.out.println("value" + e.getValue());
System.out.println(e);
count++;
System.out.println("count " + count);
}
public static final void main(String[] args) {
Frame f = new Frame();
f.setSize(200, 200);
ScrollHandle sh = new ScrollHandle();
f.add(sh);
f.show();
}
}
- duplicates
-
JDK-4029090 Solaris:SCROLLBARS_ALWAYS on scrollpane doesn't ensure scrollbars always visible
-
- Closed
-