下面列出了怎么用javax.swing.JLayeredPane的API类实例代码及写法,或者点击链接到github查看源代码。
private Constructor dataModelViewConstructorFactory(String dataModelViewClassName) {
Constructor<?> dataModelViewConstructor = null;
try {
Class<?> dataModelViewClass = Class.forName(dataModelViewClassName);
Class<?>[] partypes = new Class[5];
partypes[0] = JLayeredPane.class;
partypes[1] = TripoliFraction.class;
partypes[2] = DataModelInterface.class;
partypes[3] = Rectangle.class;
partypes[4] = boolean.class;
dataModelViewConstructor = dataModelViewClass.getConstructor(partypes);
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException classNotFoundException) {
}
return dataModelViewConstructor;
}
/**
*
* @param sampleSessionDataView
* @param rawRatioDataModel
* @param targetDataModelView
* @param bounds
* @param forStandards
* @param meanOnly the value of meanOnly
*/
public InterceptFitFunctionsPresentationView( //
JLayeredPane sampleSessionDataView, //
DataModelInterface rawRatioDataModel, //
FitFunctionDataInterface targetDataModelView, //
Rectangle bounds, //
boolean forStandards, //
boolean meanOnly) {
super(targetDataModelView, bounds);
setCursor(Cursor.getDefaultCursor());
this.sampleSessionDataView = sampleSessionDataView;
this.rawRatioDataModel = rawRatioDataModel;
this.forStandards = forStandards;
this.meanOnly = meanOnly;
}
/**
*
* @param sampleSessionDataView
* @param tripoliFraction
* @param rawRatioDataModel
* @param bounds
* @param invokeMouseListener
*/
public FitFunctionsOnDownHoleRatioDataView(//
JLayeredPane sampleSessionDataView, //
TripoliFraction tripoliFraction,//
DataModelInterface rawRatioDataModel,//
Rectangle bounds,//
boolean invokeMouseListener) {
super(sampleSessionDataView, tripoliFraction, bounds, invokeMouseListener, true);
this.rawRatioDataModel = rawRatioDataModel;
this.fittedFunctionValues = null;
this.showFittedFunction = false;
this.standardValue = rawRatioDataModel.getStandardValue();
this.dataPresentationMode = DataPresentationModeEnum.LOGRATIO;
}
/** 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.
*/
@SuppressWarnings ("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLayeredPane1 = new javax.swing.JLayeredPane();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLayeredPane1.setBackground(new java.awt.Color(255, 255, 255));
jLayeredPane1.setOpaque(true);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLayeredPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1171, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLayeredPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
);
pack();
}
/**
* Sets the window title pane -- the JComponent used to provide a plaf a
* way to override the native operating system's window title pane with
* one whose look and feel are controlled by the plaf. The plaf creates
* and sets this value; the default is null, implying a native operating
* system window title pane.
*
* @param root the root
* @param titlePane the title pane
*/
private void setTitlePane(JRootPane root, JComponent titlePane)
{
JLayeredPane layeredPane = root.getLayeredPane();
JComponent oldTitlePane = getTitlePane();
if (oldTitlePane != null)
{
oldTitlePane.setVisible(false);
layeredPane.remove(oldTitlePane);
}
if (titlePane != null)
{
layeredPane.add(titlePane, JLayeredPane.FRAME_CONTENT_LAYER);
titlePane.setVisible(true);
}
this.titlePane = titlePane;
}
private void performOperation(JLayeredPane pane, Integer layer) {
// XXX - TBD
switch (type) {
case SLIDE_IN:
component.setBounds(finishBounds);
pane.add(component, layer);
if( isHeavyWeightShowing() ) {
repaintLayeredPane();
}
break;
case SLIDE_OUT:
pane.remove(component);
break;
case SLIDE_RESIZE:
component.setBounds(finishBounds);
((JComponent)component).revalidate();
if( isHeavyWeightShowing() ) {
repaintLayeredPane();
}
break;
}
}
/**
*
*
* @param tripoliFractionRawDataModelViews
* @param sampleSessionDataView
* @param dataPresentationMode the value of dataPresentationMode
* @param bounds
*/
public DataViewsOverlay(//
AbstractRawDataView[] tripoliFractionRawDataModelViews, //
JLayeredPane sampleSessionDataView, //
DataPresentationModeEnum dataPresentationMode,//
Rectangle bounds) {
super(bounds);
this.tripoliFractionRawDataModelViews = tripoliFractionRawDataModelViews;
this.sampleSessionDataView = sampleSessionDataView;
this.downholeFractionationDataModel = null;
this.myFittedAverages = null;
this.dataPresentationMode = dataPresentationMode;
this.standardValue = tripoliFractionRawDataModelViews[0].getStandardValue();
addMeAsMouseListener();
}
public void close() {
Preconditions.checkState(SwingUtilities.isEventDispatchThread(), "Must be on the EDT");
JLayeredPane layeredPane = Panels.getApplication().getLayeredPane();
Component[] components = layeredPane.getComponents();
if (components.length == 4 || components.length == 6) {
layeredPane.remove(0);
}
if (components.length > 2 && components.length < 7) {
layeredPane.remove(1);
layeredPane.remove(0);
}
Panels.getApplication().validate();
Panels.getApplication().repaint();
}
/**
*
*
* @param sampleSessionDataView
* @param tripoliFraction
* @param bounds
* @param invokeMouseListener
* @param forStandards the value of forStandards
*/
public AbstractRawDataView(//
JLayeredPane sampleSessionDataView, //
TripoliFraction tripoliFraction, //
Rectangle bounds, //
boolean invokeMouseListener,//
boolean forStandards) {
this(bounds);
this.sampleSessionDataView = sampleSessionDataView;
this.tripoliFraction = tripoliFraction;
this.forStandards = forStandards;
if (tripoliFraction != null) {
if (!tripoliFraction.isStandard()) {
setBackground(ReduxConstants.LightBlueForUnknowns);
}
}
if (invokeMouseListener) {
addMeAsMouseListener();
}
}
private int[] computeVisibleSpan() {
Component parent = pane.getParent();
if (parent instanceof JLayeredPane) {
parent = parent.getParent();
}
if (parent instanceof JViewport) {
JViewport vp = (JViewport) parent;
Point start = vp.getViewPosition();
Dimension size = vp.getExtentSize();
Point end = new Point((int) (start.getX() + size.getWidth()), (int) (start.getY() + size.getHeight()));
int startPosition = pane.viewToModel(start);
int endPosition = pane.viewToModel(end);
if (parentWithListener != vp) {
vp.addChangeListener(WeakListeners.change(this, vp));
parentWithListener = vp;
}
return new int[] {startPosition, endPosition};
}
return new int[] {0, pane.getDocument().getLength()};
}
@Override
public Component add(Component comp) {
setsize(comp.getPreferredSize());
Component[] comps = getComponents();
if (comps.length > 0) {
oldComponent = comps[0];
}
if (comp.equals(oldComponent)) {
return super.add(comp);
}
if (oldComponent != null) {
putLayer((JComponent) oldComponent, JLayeredPane.DEFAULT_LAYER);
}
Component returnResult = super.add(comp);
putLayer((JComponent) comp, JLayeredPane.DRAG_LAYER);
comp.setSize(getPreferredSize());
comp.setVisible(true);
comp.setLocation(0, 0 - getPreferredSize().height);
slideFromTop(comp, oldComponent);
return returnResult;
}
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
super.initialize(type, oldInstance, newInstance, out);
// Ignore the children of a JScrollPane.
// Pending(milne) find a better way to do this.
if (oldInstance instanceof javax.swing.JScrollPane) {
return;
}
java.awt.Container oldC = (java.awt.Container)oldInstance;
java.awt.Component[] oldChildren = oldC.getComponents();
java.awt.Container newC = (java.awt.Container)newInstance;
java.awt.Component[] newChildren = (newC == null) ? new java.awt.Component[0] : newC.getComponents();
BorderLayout layout = ( oldC.getLayout() instanceof BorderLayout )
? ( BorderLayout )oldC.getLayout()
: null;
JLayeredPane oldLayeredPane = (oldInstance instanceof JLayeredPane)
? (JLayeredPane) oldInstance
: null;
// Pending. Assume all the new children are unaltered.
for(int i = newChildren.length; i < oldChildren.length; i++) {
Object[] args = ( layout != null )
? new Object[] {oldChildren[i], layout.getConstraints( oldChildren[i] )}
: (oldLayeredPane != null)
? new Object[] {oldChildren[i], oldLayeredPane.getLayer(oldChildren[i]), Integer.valueOf(-1)}
: new Object[] {oldChildren[i]};
invokeStatement(oldInstance, "add", args, out);
}
}
/**
*
* @param sampleSessionDataView
* @param downholeFractionationDataModel
* @param targetDataModelView
* @param bounds
*/
public DownholeFitFunctionsPresentationView( //
JLayeredPane sampleSessionDataView, //
DataModelFitFunctionInterface downholeFractionationDataModel,//
FitFunctionDataInterface targetDataModelView,
Rectangle bounds) {
super(targetDataModelView, bounds);
setCursor(Cursor.getDefaultCursor());
this.sampleSessionDataView = sampleSessionDataView;
this.downholeFractionationDataModel = downholeFractionationDataModel;
}
@Override
public void focusGained(FocusEvent event) {
if (mFloater == null) {
Point where = new Point(0, mFilterField.getHeight() + 1);
mFloater = new SearchDropDown(mTarget.getSearchRenderer(), mFilterField, mTarget);
JLayeredPane layeredPane = getRootPane().getLayeredPane();
UIUtilities.convertPoint(where, mFilterField, layeredPane);
layeredPane.add(mFloater, JLayeredPane.POPUP_LAYER);
mFloater.repaint();
adjustHits();
}
}
/**
*
*
* @param rawDataModelViews
* @param sampleSessionDataView
* @param backgroundColor
* @param minY
* @param maxY
* @param bounds
* @param floating
* @param forStandards the value of forStandards
*/
public YAxisView(//
AbstractRawDataView[] rawDataModelViews, //
JLayeredPane sampleSessionDataView, //
Color backgroundColor, //
double minY, //
double maxY, //
Rectangle bounds, //
boolean floating, //
boolean forStandards) {
super(bounds);
this.rawDataModelViews = rawDataModelViews;
this.dataViewsOverlay = null;
this.sampleSessionDataView = sampleSessionDataView;
this.backgroundColor = backgroundColor;
this.yOnMousePress = 0;
this.minY = minY;
this.maxY = maxY;
this.floating = floating;
this.forStandards = forStandards;
// horizontal layout arbitrarily fixed
this.minX = 0;
this.maxX = bounds.getWidth();//100;
setOpaque(true);
setBackground(Color.white);
setBounds(bounds);
graphWidth = bounds.width - leftMargin;
graphHeight = bounds.height - topMargin;
addMeAsMouseListener();
addMeAsMouseMotionListener();
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
private JLayeredPane shadeFactory(JLayeredPane sampleSessionDataView) {
AbstractRawDataView maskingShadeControl = //
new MaskingShadeControl(new Rectangle(15, 88, 170, 20), myOnPeakNormalizedAquireTimes, sampleSessionDataView);
maskingShadeControl.preparePanel(true, false);
return maskingShadeControl;
}
/**
*
* @param enableThPa
*/
public void SetupDateCorrectionCheckBoxes ( boolean enableThPa ) {
ActionListener dateCorrectionChkBoxActionListener = new ActionListener() {
public void actionPerformed ( ActionEvent e ) {
AbstractButton abstractButton =
(AbstractButton) e.getSource();
String choice = abstractButton.getActionCommand();
CalculateDateCorrectionMode( choice );
}
};
correctTh = new JCheckBox( "Th" );
correctTh.setActionCommand( "Th" );
correctTh.setOpaque( false );
correctTh.setForeground( new java.awt.Color( 204, 0, 0 ) );
correctTh.setFont( new Font( "SansSerif", Font.BOLD, 9 ) );
correctTh.setBounds( 125, 20, 45, 15 );
correctTh.setEnabled( enableThPa );
correctTh.addActionListener( dateCorrectionChkBoxActionListener );
add( correctTh, javax.swing.JLayeredPane.DEFAULT_LAYER );
correctPa = new JCheckBox( "Pa" );
correctPa.setActionCommand( "Pa" );
correctPa.setOpaque( false );
correctPa.setForeground( new java.awt.Color( 204, 0, 0 ) );
correctPa.setFont( new Font( "SansSerif", Font.BOLD, 9 ) );
correctPa.setBounds( 125, 40, 45, 15 );
correctPa.setEnabled( enableThPa );
correctPa.addActionListener( dateCorrectionChkBoxActionListener );
add( correctPa, javax.swing.JLayeredPane.DEFAULT_LAYER );
}
private static void createAndShowGUI() {
final JFrame frame = new JFrame("Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLayeredPane layeredPane = new JLayeredPane();
layeredPane.setPreferredSize(new Dimension(400, 400));
JPanel enabledPanel = createPanel(new Point(10, 10), true);
JPanel disabledPanel = createPanel(new Point(100, 100), false);
layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);
frame.getContentPane().add(layeredPane);
frame.pack();
frame.setVisible(true);
}
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
super.initialize(type, oldInstance, newInstance, out);
// Ignore the children of a JScrollPane.
// Pending(milne) find a better way to do this.
if (oldInstance instanceof javax.swing.JScrollPane) {
return;
}
java.awt.Container oldC = (java.awt.Container)oldInstance;
java.awt.Component[] oldChildren = oldC.getComponents();
java.awt.Container newC = (java.awt.Container)newInstance;
java.awt.Component[] newChildren = (newC == null) ? new java.awt.Component[0] : newC.getComponents();
BorderLayout layout = ( oldC.getLayout() instanceof BorderLayout )
? ( BorderLayout )oldC.getLayout()
: null;
JLayeredPane oldLayeredPane = (oldInstance instanceof JLayeredPane)
? (JLayeredPane) oldInstance
: null;
// Pending. Assume all the new children are unaltered.
for(int i = newChildren.length; i < oldChildren.length; i++) {
Object[] args = ( layout != null )
? new Object[] {oldChildren[i], layout.getConstraints( oldChildren[i] )}
: (oldLayeredPane != null)
? new Object[] {oldChildren[i], oldLayeredPane.getLayer(oldChildren[i]), Integer.valueOf(-1)}
: new Object[] {oldChildren[i]};
invokeStatement(oldInstance, "add", args, out);
}
}
public XDMFrame() {
setUndecorated(true);
// getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
// setDefaultLookAndFeelDecorated(true);
//
createCursors();
contentPane = new JPanel(new BorderLayout());
modalPane = new LayeredPanel(150);
modalPane.setVisible(false);
dialogPane = new LayeredPanel(40);
dialogPane.setVisible(false);
createResizeGrip();
panTitle = new TitlePanel(new BorderLayout(), this);
panTitle.setBackground(ColorResource.getTitleColor());
panTitle.setBorder(new EmptyBorder(XDMUtils.getScaledInt(5), XDMUtils.getScaledInt(5), XDMUtils.getScaledInt(0),
XDMUtils.getScaledInt(5)));
panTitle.setOpaque(true);
panClient = new JPanel(new BorderLayout());
panClient.setBackground(Color.WHITE);
JPanel panContent = new JPanel(new BorderLayout());
panContent.add(panTitle, BorderLayout.NORTH);
panContent.add(panClient);
contentPane.add(panContent);
layeredPane = new JLayeredPane();
layeredPane.add(contentPane, Integer.valueOf(DEFAULT_LAYER));
layeredPane.add(modalPane, Integer.valueOf(MODAL_LAYER));
layeredPane.add(dialogPane, Integer.valueOf(DIALOG_LAYER));
super.add(layeredPane);
super.addComponentListener(this);
}
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
super.initialize(type, oldInstance, newInstance, out);
// Ignore the children of a JScrollPane.
// Pending(milne) find a better way to do this.
if (oldInstance instanceof javax.swing.JScrollPane) {
return;
}
java.awt.Container oldC = (java.awt.Container)oldInstance;
java.awt.Component[] oldChildren = oldC.getComponents();
java.awt.Container newC = (java.awt.Container)newInstance;
java.awt.Component[] newChildren = (newC == null) ? new java.awt.Component[0] : newC.getComponents();
BorderLayout layout = ( oldC.getLayout() instanceof BorderLayout )
? ( BorderLayout )oldC.getLayout()
: null;
JLayeredPane oldLayeredPane = (oldInstance instanceof JLayeredPane)
? (JLayeredPane) oldInstance
: null;
// Pending. Assume all the new children are unaltered.
for(int i = newChildren.length; i < oldChildren.length; i++) {
Object[] args = ( layout != null )
? new Object[] {oldChildren[i], layout.getConstraints( oldChildren[i] )}
: (oldLayeredPane != null)
? new Object[] {oldChildren[i], oldLayeredPane.getLayer(oldChildren[i]), Integer.valueOf(-1)}
: new Object[] {oldChildren[i]};
invokeStatement(oldInstance, "add", args, out);
}
}
/**
* Creates a content pane.
*
* @return a content pane.
*/
private static JLayeredPane createContentPane() {
JLayeredPane contentPane = new JLayeredPane();
contentPane.setBounds(100, 100, 1000, 700);
contentPane.setLayout(new BorderLayout(0, 0));
contentPane.setVisible(true);
return contentPane;
}
/**
* Adds a component to this Canvas updating the menus.
*
* Make sure the status panel is not present unless the component
* *is* the status panel.
*
* @param comp The {@code Component} to add to this canvas.
* @param i The layer to add the component to (see JLayeredPane).
*/
private void addToCanvas(Component comp, Integer i) {
if (statusPanel.isVisible()) {
if (comp == statusPanel) return;
if (!(comp instanceof JMenuItem)) removeFromCanvas(statusPanel);
}
if (i == null) i = JLayeredPane.DEFAULT_LAYER;
try {
super.add(comp, i);
} catch (Exception e) {
logger.log(Level.WARNING, "addToCanvas(" + comp + ", " + i
+ ") failed.", e);
}
}
private static void init(JLayeredPane pane, int layer, int x, int y, int w, int h, Color color) {
JPanel panel = new JPanel();
panel.setBackground(color);
panel.setLocation(x, y);
panel.setSize(w, h);
pane.add(panel, new Integer(layer));
}
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
super.initialize(type, oldInstance, newInstance, out);
// Ignore the children of a JScrollPane.
// Pending(milne) find a better way to do this.
if (oldInstance instanceof javax.swing.JScrollPane) {
return;
}
java.awt.Container oldC = (java.awt.Container)oldInstance;
java.awt.Component[] oldChildren = oldC.getComponents();
java.awt.Container newC = (java.awt.Container)newInstance;
java.awt.Component[] newChildren = (newC == null) ? new java.awt.Component[0] : newC.getComponents();
BorderLayout layout = ( oldC.getLayout() instanceof BorderLayout )
? ( BorderLayout )oldC.getLayout()
: null;
JLayeredPane oldLayeredPane = (oldInstance instanceof JLayeredPane)
? (JLayeredPane) oldInstance
: null;
// Pending. Assume all the new children are unaltered.
for(int i = newChildren.length; i < oldChildren.length; i++) {
Object[] args = ( layout != null )
? new Object[] {oldChildren[i], layout.getConstraints( oldChildren[i] )}
: (oldLayeredPane != null)
? new Object[] {oldChildren[i], oldLayeredPane.getLayer(oldChildren[i]), Integer.valueOf(-1)}
: new Object[] {oldChildren[i]};
invokeStatement(oldInstance, "add", args, out);
}
}
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
super.initialize(type, oldInstance, newInstance, out);
// Ignore the children of a JScrollPane.
// Pending(milne) find a better way to do this.
if (oldInstance instanceof javax.swing.JScrollPane) {
return;
}
java.awt.Container oldC = (java.awt.Container)oldInstance;
java.awt.Component[] oldChildren = oldC.getComponents();
java.awt.Container newC = (java.awt.Container)newInstance;
java.awt.Component[] newChildren = (newC == null) ? new java.awt.Component[0] : newC.getComponents();
BorderLayout layout = ( oldC.getLayout() instanceof BorderLayout )
? ( BorderLayout )oldC.getLayout()
: null;
JLayeredPane oldLayeredPane = (oldInstance instanceof JLayeredPane)
? (JLayeredPane) oldInstance
: null;
// Pending. Assume all the new children are unaltered.
for(int i = newChildren.length; i < oldChildren.length; i++) {
Object[] args = ( layout != null )
? new Object[] {oldChildren[i], layout.getConstraints( oldChildren[i] )}
: (oldLayeredPane != null)
? new Object[] {oldChildren[i], oldLayeredPane.getLayer(oldChildren[i]), Integer.valueOf(-1)}
: new Object[] {oldChildren[i]};
invokeStatement(oldInstance, "add", args, out);
}
}
private static void init(JLayeredPane pane, int layer, int x, int y, int w, int h, Color color) {
JPanel panel = new JPanel();
panel.setBackground(color);
panel.setLocation(x, y);
panel.setSize(w, h);
pane.add(panel, new Integer(layer));
}
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
super.initialize(type, oldInstance, newInstance, out);
// Ignore the children of a JScrollPane.
// Pending(milne) find a better way to do this.
if (oldInstance instanceof javax.swing.JScrollPane) {
return;
}
java.awt.Container oldC = (java.awt.Container)oldInstance;
java.awt.Component[] oldChildren = oldC.getComponents();
java.awt.Container newC = (java.awt.Container)newInstance;
java.awt.Component[] newChildren = (newC == null) ? new java.awt.Component[0] : newC.getComponents();
BorderLayout layout = ( oldC.getLayout() instanceof BorderLayout )
? ( BorderLayout )oldC.getLayout()
: null;
JLayeredPane oldLayeredPane = (oldInstance instanceof JLayeredPane)
? (JLayeredPane) oldInstance
: null;
// Pending. Assume all the new children are unaltered.
for(int i = newChildren.length; i < oldChildren.length; i++) {
Object[] args = ( layout != null )
? new Object[] {oldChildren[i], layout.getConstraints( oldChildren[i] )}
: (oldLayeredPane != null)
? new Object[] {oldChildren[i], oldLayeredPane.getLayer(oldChildren[i]), Integer.valueOf(-1)}
: new Object[] {oldChildren[i]};
invokeStatement(oldInstance, "add", args, out);
}
}
/**
* Constructor of the PeriodicTablePanel object
*/
public PeriodicTablePanel() {
super();
setLayout(new BorderLayout());
layeredPane = new JLayeredPane();
layeredPane.setPreferredSize(new Dimension(581, 435));
JPanel tp = PTPanel();
tp.setBounds(8, 85, 570, 340);
panel = CreateLabelProperties(null);
layeredPane.add(tp, new Integer(0));
layeredPane.add(panel, new Integer(1));
add(layeredPane);
}
/**
*
* @param preferredDatePanel
*/
public void setPreferredDatePanel(JLayeredPane preferredDatePanel) {
this.preferredDatePanel = preferredDatePanel;
if (preferredDatePanel != null) {
initPreferredDatePanel();
}
}