Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4195715
Votes 0
Synopsis Common interface for JFrame/JInternalFrame needed
Category java:classes_swing
Reported Against 1.2beta4
Release Fixed
State 11-Closed, Will Not Fix, bug
Priority: 4-Low
Related Bugs
Submit Date 08-DEC-1998
Description




I have JPanels that can be embedded in JFrames or JInternalFrames--I don't know which when they are created.
But if I need to show dialogs or force the frame to be repacked as a result of a GUI event, I have to do it differently for each. 
The same goes for JApplet, I guess.
(Review ID: 39715)
======================================================================
Work Around




I have a static pack(Component comp) routine like:
	public static void pack(Component comp) {
		while (comp != null) {
			comp = comp.getParent();
			if (comp instanceof JInternalFrame) {
				((JInternalFrame) comp).pack();
				return;
			} else if (comp instanceof Window) {
				((Window) comp).pack();
				return;
			}
		}
		System.out.println("NO PARENT FOUND FOR "+comp);
	}
======================================================================
Evaluation
This does not seem like a big deal to me, and definitely not worth adding an (immutable) interface.

 xxxxx@xxxxx  2000-02-29
Comments
  
  Include a link with my name & email   

Submitted On 14-JUL-2000
wbsl
Disagree with evaluation, It would allow code to abstract 
its container:
 public interface FrameFeatures {
  setTitle(..);
  setJMenuBar(..);
  ..
 }

This would be VERY useful for projects like PJE.


Submitted On 16-NOV-2000
wbsl
Changed my mind.  Whilst it would have been better from the outset, it is now impossible as JFrames fire 
events referring to Window, and JInternalFrame has no Window as a parent class.  They are too different.

Frimble (adapter) is the solution. - PJH



PLEASE NOTE: JDK6 is formerly known as Project Mustang