-
Bug
-
Resolution: Fixed
-
P4
-
1.1.8
-
beta
-
x86
-
windows_nt
-
Not verified
Name: vi73552 Date: 05/13/99
the example code can be used to demonstrate the following
problems
Bug 3
-----
Resize an internal frame by dragging the cursor into the top
of the screen (JEditorpane). Note this frames title bar is nolonger
accessable.
The Code
--------
package swingtest;
import java.awt.*;
import java.io.IOException;
import java.io.FileInputStream;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.*;
public class AdminFrame extends JFrame
{JEditorPane branding_strip;
JPanel backdrop;
JDesktopPane win_mgr;
String fruits[] = {"apples","oranges","plumes","melons"};
String animals[] = {"cats","dogs","elephants","cows"};
public AdminFrame()
{super("Jacobs Rimell");
Insets insets = new Insets(0,0,0,0);
branding_strip = new JEditorPane();
branding_strip.setEditable(false);
branding_strip.setBorder(new javax.swing.border.EmptyBorder(insets));
/////////////////////////////////////////////////
// Now the Back Drop
/////////////////////////////////////////////////
backdrop = new JPanel();
win_mgr = new JDesktopPane();
backdrop.setLayout(new BorderLayout());
backdrop.add(win_mgr,BorderLayout.CENTER);
branding_strip.setPreferredSize(new Dimension(800,100));
backdrop.setPreferredSize(new Dimension(800,500));
setSize(800,600);
///////////////////////////////////////////////////
Container container = getContentPane();
container.setLayout(new BorderLayout());
container.add(BorderLayout.NORTH,branding_strip);
container.add(BorderLayout.CENTER,backdrop);
}
public void loadBranding(String html_page)
{try{URL url;
// This is in the jar
if (html_page.indexOf(":") == -1)
url = ClassLoader.getSystemResource(html_page);
else
url = new URL(html_page);
branding_strip.setPage(url);
}
catch (MalformedURLException e )
{System.out.println("Admin: Unable to load URL: " + html_page);
}
catch (IOException e)
{System.out.println("Admin: Unable to load URL: " + html_page);
}
}
public void openSubWindow(String name,String data[])
{try{InfraBrowse i_frame = new InfraBrowse(name);
i_frame.load(data);
i_frame.setBounds(0,0,400,300);
win_mgr.add(i_frame,javax.swing.JLayeredPane.PALETTE_LAYER);
i_frame.setSelected(true);
}
catch (java.beans.PropertyVetoException exe)
{
}
}
public static void main (String args[])
{AdminFrame mainFrame = null;
URL look_file = null;
mainFrame = new AdminFrame();
mainFrame.loadBranding("swingtest/jr.html");
mainFrame.setVisible(true);
mainFrame.openSubWindow("Fruits",mainFrame.fruits);
mainFrame.openSubWindow("Animals",mainFrame.animals);
}
}
package swingtest;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class InfraBrowse extends JInternalFrame
{JList list1;
final static int CATEGORY_LIST = 0,INSTANCE_LIST = 1;
public InfraBrowse(String my_name)
{super(my_name,true,true,true,true);
list1 = new JList();
list1.addMouseListener(new ListClickListener());
registerKeyboardAction(new HelpListener(this),
"HELP!",
KeyStroke.getKeyStroke(KeyEvent.VK_F1,0),
JComponent.WHEN_IN_FOCUSED_WINDOW);
getContentPane().add(list1);
getContentPane().setLayout(new GridLayout(1,1));
}
public boolean load(Object seed)
{
String arr[] = (String[]) seed;
list1.setListData(arr);
return true;
}
public class HelpListener implements ActionListener
{JInternalFrame parent;
public HelpListener(JInternalFrame parent)
{this.parent = parent;
}
public void actionPerformed(ActionEvent e)
{System.out.println(getTitle() + " help key press.");
}
}
}
package swingtest;
import java.awt.event.MouseEvent;
import java.awt.event.MouseAdapter;
public class ListClickListener extends MouseAdapter
{int click = 0;
public void mouseClicked(MouseEvent e)
{Object src = e.getSource();
System.out.println("ListClickListener: I have a click. " + ++click);
}
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>JR Branding</title>
</head>
<body topmargin="0" leftmargin="0" bgcolor="#8DBFC3">
<p align="center"><img src="full_strip.gif" width="760" height="78"
alt="full_strip.gif (21083 bytes)" align="center"></p>
</body>
</html>
Bug 1
none reproducible V.I.
-----
KeyEvents are not sent to the JInternalFrame with focus.
Run example code select a frame and press F1, you will get
the message "<win name> help key press". Selected the
other frame and press F1 again. Notice other frame still
has keyboard focus.
Bug 2
testsuite needed V.I.
-----
JList/JInternalFrame mouse event loss.
description : Take one JInternalFrame, add one JList and fill with
items, attach a mouseListener to the JList and print out when a
a message as click event occur.
(Review ID: 63132)
======================================================================