Java Code Examples for java.awt.BorderLayout#getConstraints()
The following examples show how to use
java.awt.BorderLayout#getConstraints() .
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
Source File: NimbusLookAndFeel.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Package private method which returns either BorderLayout.NORTH, * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending * on the location of the toolbar in its parent. The toolbar might be * in PAGE_START, PAGE_END, CENTER, or some other position, but will be * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar * actually IS, with CENTER being NORTH. * * This code is used to determine where the border line should be drawn * by the custom toolbar states, and also used by NimbusIcon to determine * whether the handle icon needs to be shifted to look correct. * * Toollbars are unfortunately odd in the way these things are handled, * and so this code exists to unify the logic related to toolbars so it can * be shared among the static files such as NimbusIcon and generated files * such as the ToolBar state classes. */ static Object resolveToolbarConstraint(JToolBar toolbar) { //NOTE: we don't worry about component orientation or PAGE_END etc //because the BasicToolBarUI always uses an absolute position of //NORTH/SOUTH/EAST/WEST. if (toolbar != null) { Container parent = toolbar.getParent(); if (parent != null) { LayoutManager m = parent.getLayout(); if (m instanceof BorderLayout) { BorderLayout b = (BorderLayout)m; Object con = b.getConstraints(toolbar); if (con == SOUTH || con == EAST || con == WEST) { return con; } return NORTH; } } } return NORTH; }
Example 2
Source File: NimbusLookAndFeel.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Package private method which returns either BorderLayout.NORTH, * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending * on the location of the toolbar in its parent. The toolbar might be * in PAGE_START, PAGE_END, CENTER, or some other position, but will be * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar * actually IS, with CENTER being NORTH. * * This code is used to determine where the border line should be drawn * by the custom toolbar states, and also used by NimbusIcon to determine * whether the handle icon needs to be shifted to look correct. * * Toollbars are unfortunately odd in the way these things are handled, * and so this code exists to unify the logic related to toolbars so it can * be shared among the static files such as NimbusIcon and generated files * such as the ToolBar state classes. */ static Object resolveToolbarConstraint(JToolBar toolbar) { //NOTE: we don't worry about component orientation or PAGE_END etc //because the BasicToolBarUI always uses an absolute position of //NORTH/SOUTH/EAST/WEST. if (toolbar != null) { Container parent = toolbar.getParent(); if (parent != null) { LayoutManager m = parent.getLayout(); if (m instanceof BorderLayout) { BorderLayout b = (BorderLayout)m; Object con = b.getConstraints(toolbar); if (con == SOUTH || con == EAST || con == WEST) { return con; } return NORTH; } } } return NORTH; }
Example 3
Source File: NimbusLookAndFeel.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Package private method which returns either BorderLayout.NORTH, * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending * on the location of the toolbar in its parent. The toolbar might be * in PAGE_START, PAGE_END, CENTER, or some other position, but will be * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar * actually IS, with CENTER being NORTH. * * This code is used to determine where the border line should be drawn * by the custom toolbar states, and also used by NimbusIcon to determine * whether the handle icon needs to be shifted to look correct. * * Toollbars are unfortunately odd in the way these things are handled, * and so this code exists to unify the logic related to toolbars so it can * be shared among the static files such as NimbusIcon and generated files * such as the ToolBar state classes. */ static Object resolveToolbarConstraint(JToolBar toolbar) { //NOTE: we don't worry about component orientation or PAGE_END etc //because the BasicToolBarUI always uses an absolute position of //NORTH/SOUTH/EAST/WEST. if (toolbar != null) { Container parent = toolbar.getParent(); if (parent != null) { LayoutManager m = parent.getLayout(); if (m instanceof BorderLayout) { BorderLayout b = (BorderLayout)m; Object con = b.getConstraints(toolbar); if (con == SOUTH || con == EAST || con == WEST) { return con; } return NORTH; } } } return NORTH; }
Example 4
Source File: NimbusLookAndFeel.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Package private method which returns either BorderLayout.NORTH, * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending * on the location of the toolbar in its parent. The toolbar might be * in PAGE_START, PAGE_END, CENTER, or some other position, but will be * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar * actually IS, with CENTER being NORTH. * * This code is used to determine where the border line should be drawn * by the custom toolbar states, and also used by NimbusIcon to determine * whether the handle icon needs to be shifted to look correct. * * Toollbars are unfortunately odd in the way these things are handled, * and so this code exists to unify the logic related to toolbars so it can * be shared among the static files such as NimbusIcon and generated files * such as the ToolBar state classes. */ static Object resolveToolbarConstraint(JToolBar toolbar) { //NOTE: we don't worry about component orientation or PAGE_END etc //because the BasicToolBarUI always uses an absolute position of //NORTH/SOUTH/EAST/WEST. if (toolbar != null) { Container parent = toolbar.getParent(); if (parent != null) { LayoutManager m = parent.getLayout(); if (m instanceof BorderLayout) { BorderLayout b = (BorderLayout)m; Object con = b.getConstraints(toolbar); if (con == SOUTH || con == EAST || con == WEST) { return con; } return NORTH; } } } return NORTH; }
Example 5
Source File: NimbusLookAndFeel.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Package private method which returns either BorderLayout.NORTH, * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending * on the location of the toolbar in its parent. The toolbar might be * in PAGE_START, PAGE_END, CENTER, or some other position, but will be * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar * actually IS, with CENTER being NORTH. * * This code is used to determine where the border line should be drawn * by the custom toolbar states, and also used by NimbusIcon to determine * whether the handle icon needs to be shifted to look correct. * * Toollbars are unfortunately odd in the way these things are handled, * and so this code exists to unify the logic related to toolbars so it can * be shared among the static files such as NimbusIcon and generated files * such as the ToolBar state classes. */ static Object resolveToolbarConstraint(JToolBar toolbar) { //NOTE: we don't worry about component orientation or PAGE_END etc //because the BasicToolBarUI always uses an absolute position of //NORTH/SOUTH/EAST/WEST. if (toolbar != null) { Container parent = toolbar.getParent(); if (parent != null) { LayoutManager m = parent.getLayout(); if (m instanceof BorderLayout) { BorderLayout b = (BorderLayout)m; Object con = b.getConstraints(toolbar); if (con == SOUTH || con == EAST || con == WEST) { return con; } return NORTH; } } } return NORTH; }
Example 6
Source File: NimbusLookAndFeel.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Package private method which returns either BorderLayout.NORTH, * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending * on the location of the toolbar in its parent. The toolbar might be * in PAGE_START, PAGE_END, CENTER, or some other position, but will be * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar * actually IS, with CENTER being NORTH. * * This code is used to determine where the border line should be drawn * by the custom toolbar states, and also used by NimbusIcon to determine * whether the handle icon needs to be shifted to look correct. * * Toollbars are unfortunately odd in the way these things are handled, * and so this code exists to unify the logic related to toolbars so it can * be shared among the static files such as NimbusIcon and generated files * such as the ToolBar state classes. */ static Object resolveToolbarConstraint(JToolBar toolbar) { //NOTE: we don't worry about component orientation or PAGE_END etc //because the BasicToolBarUI always uses an absolute position of //NORTH/SOUTH/EAST/WEST. if (toolbar != null) { Container parent = toolbar.getParent(); if (parent != null) { LayoutManager m = parent.getLayout(); if (m instanceof BorderLayout) { BorderLayout b = (BorderLayout)m; Object con = b.getConstraints(toolbar); if (con == SOUTH || con == EAST || con == WEST) { return con; } return NORTH; } } } return NORTH; }
Example 7
Source File: NimbusLookAndFeel.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Package private method which returns either BorderLayout.NORTH, * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending * on the location of the toolbar in its parent. The toolbar might be * in PAGE_START, PAGE_END, CENTER, or some other position, but will be * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar * actually IS, with CENTER being NORTH. * * This code is used to determine where the border line should be drawn * by the custom toolbar states, and also used by NimbusIcon to determine * whether the handle icon needs to be shifted to look correct. * * Toollbars are unfortunately odd in the way these things are handled, * and so this code exists to unify the logic related to toolbars so it can * be shared among the static files such as NimbusIcon and generated files * such as the ToolBar state classes. */ static Object resolveToolbarConstraint(JToolBar toolbar) { //NOTE: we don't worry about component orientation or PAGE_END etc //because the BasicToolBarUI always uses an absolute position of //NORTH/SOUTH/EAST/WEST. if (toolbar != null) { Container parent = toolbar.getParent(); if (parent != null) { LayoutManager m = parent.getLayout(); if (m instanceof BorderLayout) { BorderLayout b = (BorderLayout)m; Object con = b.getConstraints(toolbar); if (con == SOUTH || con == EAST || con == WEST) { return con; } return NORTH; } } } return NORTH; }
Example 8
Source File: NimbusLookAndFeel.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Package private method which returns either BorderLayout.NORTH, * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending * on the location of the toolbar in its parent. The toolbar might be * in PAGE_START, PAGE_END, CENTER, or some other position, but will be * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar * actually IS, with CENTER being NORTH. * * This code is used to determine where the border line should be drawn * by the custom toolbar states, and also used by NimbusIcon to determine * whether the handle icon needs to be shifted to look correct. * * Toollbars are unfortunately odd in the way these things are handled, * and so this code exists to unify the logic related to toolbars so it can * be shared among the static files such as NimbusIcon and generated files * such as the ToolBar state classes. */ static Object resolveToolbarConstraint(JToolBar toolbar) { //NOTE: we don't worry about component orientation or PAGE_END etc //because the BasicToolBarUI always uses an absolute position of //NORTH/SOUTH/EAST/WEST. if (toolbar != null) { Container parent = toolbar.getParent(); if (parent != null) { LayoutManager m = parent.getLayout(); if (m instanceof BorderLayout) { BorderLayout b = (BorderLayout)m; Object con = b.getConstraints(toolbar); if (con == SOUTH || con == EAST || con == WEST) { return con; } return NORTH; } } } return NORTH; }
Example 9
Source File: MetaData.java From Bytecoder with Apache License 2.0 | 5 votes |
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 10
Source File: MetaData.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
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 11
Source File: MetaData.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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 12
Source File: Test6437265.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 13
Source File: MetaData.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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 14
Source File: Test6437265.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 15
Source File: Test6437265.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 16
Source File: Test6437265.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 17
Source File: Test6437265.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 18
Source File: MetaData.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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 19
Source File: Test6437265.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 20
Source File: SeaGlassLookAndFeel.java From seaglass with Apache License 2.0 | 5 votes |
/** * Package private method which returns either BorderLayout.NORTH, * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending on * the location of the toolbar in its parent. The toolbar might be in * PAGE_START, PAGE_END, CENTER, or some other position, but will be * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar * actually IS, with CENTER being NORTH. * * <p/>This code is used to determine where the border line should be drawn * by the custom toolbar states, and also used by SeaGlassIcon to determine * whether the handle icon needs to be shifted to look correct.</p> * * <p>Toollbars are unfortunately odd in the way these things are handled, * and so this code exists to unify the logic related to toolbars so it can * be shared among the static files such as SeaGlassIcon and generated files * such as the ToolBar state classes.</p> * * @param toolbar a toolbar in the Swing hierarchy. * * @return the {@code BorderLayout} orientation of the toolbar, or * {@code BorderLayout.NORTH} if none can be determined. */ public static Object resolveToolbarConstraint(JToolBar toolbar) { /* * NOTE: we don't worry about component orientation or PAGE_END etc * because the BasicToolBarUI always uses an absolute position of * NORTH/SOUTH/EAST/WEST. */ if (toolbar != null) { Container parent = toolbar.getParent(); if (parent != null) { LayoutManager m = parent.getLayout(); if (m instanceof BorderLayout) { BorderLayout b = (BorderLayout) m; Object con = b.getConstraints(toolbar); if (con == SOUTH || con == EAST || con == WEST) { return con; } return NORTH; } } } return NORTH; }