home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Sample.bin
/
JLookAndFeelAndPackFrameComboBox.java
< prev
next >
Wrap
Text File
|
1998-09-25
|
1KB
|
42 lines
/*
A simple extension of the JLookAndFeelComboBox that pack()s the frame after swapping UIs
*/
import java.io.*;
import java.beans.*;
import java.awt.*;
import com.sun.java.swing.*;
import com.symantec.itools.swing.*;
public class JLookAndFeelAndPackFrameComboBox extends com.symantec.itools.swing.JLookAndFeelComboBox implements java.io.Serializable
{
public JLookAndFeelAndPackFrameComboBox()
{
super();
}
public void run()
{
//Find top root pane
JRootPane topRoot = SwingUtilities.getRootPane(this);
if (topRoot != null)
{
while (true)
{
Container rootParent = topRoot.getParent();
if (rootParent == null)
break;
JRootPane possibleRoot = SwingUtilities.getRootPane(rootParent);
if (possibleRoot == null || possibleRoot == topRoot)
break;
topRoot = possibleRoot;
}
SwingUtilities.updateComponentTreeUI(topRoot);
if(topRoot.getParent() instanceof Frame)
{
((Frame)topRoot.getParent()).pack();
}
}
}
}