Java Code Examples for java.awt.BorderLayout.getLayoutComponent()

The following are Jave code examples for showing how to use getLayoutComponent() of the java.awt.BorderLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: OpenJSharp   File: MetaData.java   Source Code and License Vote up 6 votes
@Override
protected void initialize(Class<?> type, Object oldInstance,
                          Object newInstance, Encoder out) {
    super.initialize(type, oldInstance, newInstance, out);
    BorderLayout oldLayout = (BorderLayout) oldInstance;
    BorderLayout newLayout = (BorderLayout) newInstance;
    for (String constraints : CONSTRAINTS) {
        Object oldC = oldLayout.getLayoutComponent(constraints);
        Object newC = newLayout.getLayoutComponent(constraints);
        // Pending, assume any existing elements are OK.
        if (oldC != null && newC == null) {
            invokeStatement(oldInstance, "addLayoutComponent",
                            new Object[] { oldC, constraints }, out);
        }
    }
}
 
Example 2
Project: jdk8u-jdk   File: MetaData.java   Source Code and License Vote up 6 votes
@Override
protected void initialize(Class<?> type, Object oldInstance,
                          Object newInstance, Encoder out) {
    super.initialize(type, oldInstance, newInstance, out);
    BorderLayout oldLayout = (BorderLayout) oldInstance;
    BorderLayout newLayout = (BorderLayout) newInstance;
    for (String constraints : CONSTRAINTS) {
        Object oldC = oldLayout.getLayoutComponent(constraints);
        Object newC = newLayout.getLayoutComponent(constraints);
        // Pending, assume any existing elements are OK.
        if (oldC != null && newC == null) {
            invokeStatement(oldInstance, "addLayoutComponent",
                            new Object[] { oldC, constraints }, out);
        }
    }
}
 
Example 3
Project: openjdk-jdk10   File: MetaData.java   Source Code and License Vote up 6 votes
@Override
protected void initialize(Class<?> type, Object oldInstance,
                          Object newInstance, Encoder out) {
    super.initialize(type, oldInstance, newInstance, out);
    BorderLayout oldLayout = (BorderLayout) oldInstance;
    BorderLayout newLayout = (BorderLayout) newInstance;
    for (String constraints : CONSTRAINTS) {
        Object oldC = oldLayout.getLayoutComponent(constraints);
        Object newC = newLayout.getLayoutComponent(constraints);
        // Pending, assume any existing elements are OK.
        if (oldC != null && newC == null) {
            invokeStatement(oldInstance, "addLayoutComponent",
                            new Object[] { oldC, constraints }, out);
        }
    }
}
 
Example 4
Project: incubator-netbeans   File: TracerView.java   Source Code and License Vote up 5 votes
private void addContents(JComponent container, JComponent contents) {
    BorderLayout layout = (BorderLayout)container.getLayout();
    Component oldContents = layout.getLayoutComponent(BorderLayout.CENTER);
    if (oldContents != contents) {
        if (oldContents != null) container.remove(oldContents);
        container.add(contents, BorderLayout.CENTER);
        contents.requestFocusInWindow();
        container.revalidate();
        container.repaint();
    }
}