Duplicate :
|
|
Duplicate :
|
|
Relates :
|
FULL PRODUCT VERSION : /home/gat/JAVA/JDK16/jdk1.6.0_Beta2/jre1.6.0/bin/java -versionjava version "1.6.0-beta2" Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86) Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode, sharing) [gat@MyLaptop ~]$ ADDITIONAL OS VERSION INFORMATION : [gat@MyLaptop ~]$ uname -a Linux MyLaptop.gatworks.com 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 i686 i386 GNU/Linux [gat@MyLaptop ~]$ A DESCRIPTION OF THE PROBLEM : I need to create a detached window so I can simulate the java.awt.List() functionality. Once i create the detached window, one finds that when switching amongst the X work panels, the detached awt pane wont disappear when the awt frame disappears. No matter what X panel I select, the awt detached window remains. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1) /home/gat/JAVA/JDK16/jdk1.6.0_Beta2/jre1.6.0/bin/java floatingwindow/NewFrame 2) a button will appear 3) switch to different X work panels. the button will disappear on the other X work panels. 4) click on the button. a scrollbar will appear. 5) switch to different X work panels. The button will disappear. The scrollbar will not. The scrollbar will appear on all the X work panels. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - I expected the scrollbar to disappear when the X panel was switched. I looked for an event to catch, so that i may setVisible( false ), but not too sure what event would be generated. ACTUAL - The scrollbar appears on all X switched panels. REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- /* * NewFrame.java * * Created on September 13, 2006, 10:55 PM */ package floatingwindow; /** * * @author gat */ import java.awt.*; public class NewFrame extends java.awt.Frame { /** Creates new form NewFrame */ public NewFrame() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code "> private void initComponents() { panel1 = new java.awt.Panel(); button1 = new java.awt.Button(); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } }); button1.setLabel("button1"); button1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { button1MouseClicked(evt); } }); panel1.add(button1); add(panel1, java.awt.BorderLayout.CENTER); pack(); }// </editor-fold> private void button1MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: goFloatWindow(); } /** Exit the Application */ private void exitForm(java.awt.event.WindowEvent evt) { System.exit(0); } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewFrame().setVisible(true); } }); } // Variables declaration - do not modify private java.awt.Button button1; private java.awt.Panel panel1; // End of variables declaration void goFloatWindow() { java.awt.Window win = new java.awt.Window( this ); java.awt.Panel p = new java.awt.Panel(); win.add( p ); Point point = button1.getLocationOnScreen(); Rectangle r = button1.getBounds(); System.out.println("point="+point+", r="+r); win.setLocation( point.x, point.y ); Scrollbar l = new Scrollbar(); p.add( l ); win.pack(); win.setVisible( true ); } } ---------- END SOURCE ----------
|