Java Code Examples for javax.swing.JLayeredPane

The following examples show how to use javax.swing.JLayeredPane. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
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;
}
 
Example 2
/**
 *
 * @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;
}
 
Example 3
/**
 *
 * @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;
}
 
Example 4
Source Project: ET_Redux   Source File: AgePickDemo.java    License: Apache License 2.0 6 votes vote down vote up
/** 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();
}
 
Example 5
Source Project: beautyeye   Source File: BERootPaneUI.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 6
Source Project: netbeans   Source File: SlideOperationImpl.java    License: Apache License 2.0 6 votes vote down vote up
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;
    }
}
 
Example 7
Source Project: ET_Redux   Source File: DataViewsOverlay.java    License: Apache License 2.0 6 votes vote down vote up
/**
 *
 *
 * @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();

}
 
Example 8
Source Project: RipplePower   Source File: LightBoxPanel.java    License: Apache License 2.0 6 votes vote down vote up
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();

	}
 
Example 9
Source Project: ET_Redux   Source File: AbstractRawDataView.java    License: Apache License 2.0 6 votes vote down vote up
/**
 *
 *
 * @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();
    }

}
 
Example 10
Source Project: netbeans   Source File: ComponentPeer.java    License: Apache License 2.0 6 votes vote down vote up
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()};
}
 
Example 11
@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;
}
 
Example 12
Source Project: dragonwell8_jdk   Source File: MetaData.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 13
/**
 *
 * @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;
}
 
Example 14
Source Project: gcs   Source File: Search.java    License: Mozilla Public License 2.0 5 votes vote down vote up
@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();
    }
}
 
Example 15
Source Project: ET_Redux   Source File: YAxisView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *
 *
 * @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));
}
 
Example 16
Source Project: ET_Redux   Source File: DataPresentationModeChooserPanel.java    License: Apache License 2.0 5 votes vote down vote up
private JLayeredPane shadeFactory(JLayeredPane sampleSessionDataView) {
    AbstractRawDataView maskingShadeControl = //
            new MaskingShadeControl(new Rectangle(15, 88, 170, 20), myOnPeakNormalizedAquireTimes, sampleSessionDataView);

    maskingShadeControl.preparePanel(true, false);

    return maskingShadeControl;
}
 
Example 17
Source Project: ET_Redux   Source File: KwikiDateModesSelectorPanel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @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 );
}
 
Example 18
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);
}
 
Example 19
Source Project: jdk8u-jdk   Source File: MetaData.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 20
Source Project: xdm   Source File: XDMFrame.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
	}
 
Example 21
Source Project: jdk8u60   Source File: MetaData.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 22
Source Project: arcgis-runtime-demo-java   Source File: GeoJsonApp.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 23
Source Project: freecol   Source File: Canvas.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 24
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));
}
 
Example 25
Source Project: hottub   Source File: MetaData.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 26
Source Project: openjdk-jdk8u   Source File: MetaData.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 27
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));
}
 
Example 28
Source Project: Bytecoder   Source File: MetaData.java    License: Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example 29
Source Project: mzmine2   Source File: PeriodicTablePanel.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 30
Source Project: ET_Redux   Source File: ConcordiaGraphPanel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param preferredDatePanel
 */
public void setPreferredDatePanel(JLayeredPane preferredDatePanel) {
    this.preferredDatePanel = preferredDatePanel;
    if (preferredDatePanel != null) {
        initPreferredDatePanel();
    }
}