java.awt.Container Java Examples

The following examples show how to use java.awt.Container. 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: OutputGeometryForm.java    From snap-desktop with GNU General Public License v3.0 8 votes vote down vote up
public static void main(String[] args) throws Exception {
    final JFrame jFrame = new JFrame("Output parameter Definition Form");
    Container contentPane = jFrame.getContentPane();
    if (args.length == 0) {
        throw new IllegalArgumentException("Missing argument to product file.");
    }
    Product sourceProduct = ProductIO.readProduct(args[0]);
    CoordinateReferenceSystem targetCrs = CRS.decode("EPSG:32632");
    OutputGeometryFormModel model = new OutputGeometryFormModel(sourceProduct, targetCrs);
    OutputGeometryForm form = new OutputGeometryForm(model);
    contentPane.add(form);

    jFrame.setSize(400, 600);
    jFrame.setLocationRelativeTo(null);
    jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            jFrame.setVisible(true);
        }
    });
}
 
Example #2
Source File: GroupLayout.java    From TencentKona-8 with GNU General Public License v2.0 7 votes vote down vote up
/**
 * Lays out the specified container.
 *
 * @param parent the container to be laid out
 * @throws IllegalStateException if any of the components added to
 *         this layout are not in both a horizontal and vertical group
 */
public void layoutContainer(Container parent) {
    // Step 1: Prepare for layout.
    prepare(SPECIFIC_SIZE);
    Insets insets = parent.getInsets();
    int width = parent.getWidth() - insets.left - insets.right;
    int height = parent.getHeight() - insets.top - insets.bottom;
    boolean ltr = isLeftToRight();
    if (getAutoCreateGaps() || getAutoCreateContainerGaps() ||
            hasPreferredPaddingSprings) {
        // Step 2: Calculate autopadding springs
        calculateAutopadding(horizontalGroup, HORIZONTAL, SPECIFIC_SIZE, 0,
                width);
        calculateAutopadding(verticalGroup, VERTICAL, SPECIFIC_SIZE, 0,
                height);
    }
    // Step 3: set the size of the groups.
    horizontalGroup.setSize(HORIZONTAL, 0, width);
    verticalGroup.setSize(VERTICAL, 0, height);
    // Step 4: apply the size to the components.
    for (ComponentInfo info : componentInfos.values()) {
        info.setBounds(insets, width, ltr);
    }
}
 
Example #3
Source File: LegacyGlueFocusTraversalPolicy.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private boolean accept(Component aComponent) {
    if (!(aComponent.isVisible() && aComponent.isDisplayable() &&
          aComponent.isFocusable() && aComponent.isEnabled())) {
        return false;
    }

    // Verify that the Component is recursively enabled. Disabling a
    // heavyweight Container disables its children, whereas disabling
    // a lightweight Container does not.
    if (!(aComponent instanceof Window)) {
        for (Container enableTest = aComponent.getParent();
             enableTest != null;
             enableTest = enableTest.getParent())
        {
            if (!(enableTest.isEnabled() || enableTest.isLightweight())) {
                return false;
            }
            if (enableTest instanceof Window) {
                break;
            }
        }
    }

    return true;
}
 
Example #4
Source File: DefaultFocusManager.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public Component getComponentAfter(Container aContainer,
                                   Component aComponent)
{
    Container root = (aContainer.isFocusCycleRoot())
        ? aContainer
        : aContainer.getFocusCycleRootAncestor();

    // Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
    // traversal policy is non-legacy, then honor it.
    if (root != null) {
        FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
        if (policy != gluePolicy) {
            return policy.getComponentAfter(root, aComponent);
        }

        comparator.setComponentOrientation(root.getComponentOrientation());
        return layoutPolicy.getComponentAfter(root, aComponent);
    }

    return null;
}
 
Example #5
Source File: ProjectsTabOperator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Gets ProjectRootNode. Wait if Opening Projects label is in main window
 * progress bar.
 *
 * @param projectName display name of project
 * @return ProjectsRootNode
 */
public ProjectRootNode getProjectRootNode(String projectName) {
    final String openingProjectsLabel = "Opening Projects";
    Object lblOpening = JLabelOperator.findJLabel(
            (Container) MainWindowOperator.getDefault().getSource(),
            openingProjectsLabel, false, false);
    if (lblOpening != null) {
        JLabelOperator lblOper = new JLabelOperator((JLabel) lblOpening);
        lblOper.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 180000);
        lblOper.waitState(new ComponentChooser() {
            @Override
            public boolean checkComponent(Component comp) {
                String text = ((JLabel) comp).getText();
                return text == null || !text.startsWith(openingProjectsLabel) || !comp.isShowing();
            }

            @Override
            public String getDescription() {
                return openingProjectsLabel + " label disappears";
            }
        });
    }
    return new ProjectRootNode(tree(), projectName);
}
 
Example #6
Source File: PoleBalancing.java    From javagame with MIT License 6 votes vote down vote up
public PoleBalancing() {
    // �^�C�g����ݒ�
    setTitle("�|���U�q������");

    Container contentPane = getContentPane();
    
    // �C���t�H���[�V�����p�l�����쐬
    InfoPanel infoPanel = new InfoPanel();
    contentPane.add(infoPanel, BorderLayout.NORTH);
    
    // ���C���p�l�����쐬
    MainPanel mainPanel = new MainPanel();
    contentPane.add(mainPanel, BorderLayout.CENTER);
    // ���C���p�l���ɃC���t�H���[�V�����p�l����n��
    mainPanel.setInfoPanel(infoPanel);
    
    // �R���g���[���p�l�����쐬
    ControlPanel controlPanel = new ControlPanel(mainPanel);
    contentPane.add(controlPanel, BorderLayout.SOUTH);

    // �p�l���T�C�Y�ɍ��킹�ăt���[���T�C�Y�������ݒ�
    pack();
}
 
Example #7
Source File: OptionsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void computeOptionsWords() {
    Set<Map.Entry<String, CategoryModel.Category>> categories = categoryModel.getCategories();
    categoryid2tabs = new HashMap<String, HashMap<Integer, TabInfo>>();
    for (Map.Entry<String, CategoryModel.Category> set : categories) {
        JComponent jcomp = set.getValue().getComponent();
        String id = set.getValue().getID();
        if(jcomp instanceof JTabbedPane) {
            categoryid2tabbedpane.put(id, (JTabbedPane)jcomp);
        } else if(jcomp instanceof AdvancedPanel) {
            categoryid2tabbedpane.put(id, (JTabbedPane)jcomp.getComponent(0));
        } else if (jcomp instanceof Container) {
            handleAllComponents((Container) jcomp, id, null, -1);
        }
    }

    FileObject keywordsFOs = FileUtil.getConfigRoot().getFileObject(CategoryModel.OD_LAYER_KEYWORDS_FOLDER_NAME);

    for(FileObject keywordsFO : keywordsFOs.getChildren()) {
        handlePanel(keywordsFO);
    }
}
 
Example #8
Source File: WPageDialog.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
@SuppressWarnings("deprecation")
public void addNotify() {
    synchronized(getTreeLock()) {
        Container parent = getParent();
        if (parent != null && parent.getPeer() == null) {
            parent.addNotify();
        }

        if (getPeer() == null) {
            ComponentPeer peer = ((WToolkit)Toolkit.getDefaultToolkit()).
                createWPageDialog(this);
            setPeer(peer);
        }
        super.addNotify();
    }
}
 
Example #9
Source File: NimbusLookAndFeel.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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 #10
Source File: Test7024235.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
    if (this.pane == null) {
        this.pane = new JTabbedPane();
        this.pane.addTab("1", new Container());
        this.pane.addTab("2", new JButton());
        this.pane.addTab("3", new JCheckBox());

        JFrame frame = new JFrame();
        frame.add(BorderLayout.WEST, this.pane);
        frame.pack();
        frame.setVisible(true);

        test("first");
    }
    else {
        test("second");
        if (this.passed || AUTO) { // do not close a frame for manual review
            SwingUtilities.getWindowAncestor(this.pane).dispose();
        }
        this.pane = null;
    }
}
 
Example #11
Source File: AdvantageModifierEnabler.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
private static Container createTop(Advantage advantage, int remaining) {
    JPanel top   = new JPanel(new ColumnLayout());
    JLabel label = new JLabel(Text.truncateIfNecessary(advantage.toString(), 80, SwingConstants.RIGHT), SwingConstants.LEFT);

    top.setBorder(new EmptyBorder(0, 0, 15, 0));
    if (remaining > 0) {
        String msg;
        msg = remaining == 1 ? I18n.Text("1 advantage remaining to be processed.") : MessageFormat.format(I18n.Text("{0} advantages remaining to be processed."), Integer.valueOf(remaining));
        top.add(new JLabel(msg, SwingConstants.CENTER));
    }
    label.setBorder(new CompoundBorder(new LineBorder(), new EmptyBorder(0, 2, 0, 2)));
    label.setOpaque(true);
    top.add(new JPanel());
    top.add(label);
    return top;
}
 
Example #12
Source File: JDesktopPane.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static Collection<JInternalFrame> getAllFrames(Container parent) {
    int i, count;
    Collection<JInternalFrame> results = new LinkedHashSet<>();
    count = parent.getComponentCount();
    for (i = 0; i < count; i++) {
        Component next = parent.getComponent(i);
        if (next instanceof JInternalFrame) {
            results.add((JInternalFrame) next);
        } else if (next instanceof JInternalFrame.JDesktopIcon) {
            JInternalFrame tmp = ((JInternalFrame.JDesktopIcon) next).getInternalFrame();
            if (tmp != null) {
                results.add(tmp);
            }
        } else if (next instanceof Container) {
            results.addAll(getAllFrames((Container) next));
        }
    }
    return results;
}
 
Example #13
Source File: Font2DTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void addLabeledComponentToGBL( String name,
                                       JComponent c,
                                       GridBagLayout gbl,
                                       GridBagConstraints gbc,
                                       Container target ) {
    LabelV2 l = new LabelV2( name );
    GridBagConstraints gbcLabel = (GridBagConstraints) gbc.clone();
    gbcLabel.insets = new Insets( 2, 2, 2, 0 );
    gbcLabel.gridwidth = 1;
    gbcLabel.weightx = 0;

    if ( c == null )
      c = new JLabel( "" );

    gbl.setConstraints( l, gbcLabel );
    target.add( l );
    gbl.setConstraints( c, gbc );
    target.add( c );
}
 
Example #14
Source File: MotifOptionPaneUI.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
protected Container createSeparator() {
    return new JPanel() {

        public Dimension getPreferredSize() {
            return new Dimension(10, 2);
        }

        public void paint(Graphics g) {
            int width = getWidth();
            g.setColor(Color.darkGray);
            g.drawLine(0, 0, width, 0);
            g.setColor(Color.white);
            g.drawLine(0, 1, width, 1);
        }
    };
}
 
Example #15
Source File: CenterLayout.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Returns the preferred size.
 *
 * @param parent
 *          the parent.
 * @return the preferred size.
 */
public Dimension preferredLayoutSize( final Container parent ) {

  synchronized ( parent.getTreeLock() ) {
    final Insets insets = parent.getInsets();
    if ( parent.getComponentCount() > 0 ) {
      final Component component = parent.getComponent( 0 );
      final Dimension d = component.getPreferredSize();
      return new Dimension( (int) d.getWidth() + insets.left + insets.right, (int) d.getHeight() + insets.top
          + insets.bottom );
    } else {
      return new Dimension( insets.left + insets.right, insets.top + insets.bottom );
    }
  }

}
 
Example #16
Source File: XComponentPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void addTree(Collection order, Set set, Container cont) {
    for (int i = 0; i < cont.getComponentCount(); i++) {
        Component comp = cont.getComponent(i);
        ComponentPeer peer = comp.getPeer();
        if (peer instanceof XComponentPeer) {
            Long window = Long.valueOf(((XComponentPeer)peer).getWindow());
            if (!set.contains(window)) {
                set.add(window);
                order.add(window);
            }
        } else if (comp instanceof Container) {
            // It is lightweight container, it might contain heavyweight components attached to this
            // peer
            addTree(order, set, (Container)comp);
        }
    }
}
 
Example #17
Source File: DefaultFocusManager.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Component getFirstComponent(Container aContainer) {
    Container root = (aContainer.isFocusCycleRoot())
        ? aContainer
        : aContainer.getFocusCycleRootAncestor();

    // Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
    // traversal policy is non-legacy, then honor it.
    if (root != null) {
        FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
        if (policy != gluePolicy) {
            return policy.getFirstComponent(root);
        }

        comparator.setComponentOrientation(root.getComponentOrientation());
        return layoutPolicy.getFirstComponent(root);
    }

    return null;
}
 
Example #18
Source File: BEUtils.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
/**
 * 设置对象集的透明性,如果该组件是Container及其子类则递归设
 * 置该组件内的所有子组件的透明性,直到组件中的任何组件都被设置完毕.
 * 
 * @param comps 对象集
 * @param opaque true表示要设置成不透明,否则表示要设置成透明
 */
public static void componentsOpaque(java.awt.Component[] comps
		, boolean opaque)
{
	if(comps == null)
		return;
	for (Component c : comps)
	{
		//递归设置它的子组件
		if(c instanceof Container)
		{
			if(c instanceof JComponent)
				((JComponent)c).setOpaque(opaque);
			componentsOpaque(((Container)c).getComponents(), opaque);
		}
		else
		{
			if(c instanceof JComponent)
				((JComponent)c).setOpaque(opaque);
		}
	}
}
 
Example #19
Source File: DefaultFocusManager.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the first component.
 * @return the first component
 * @param aContainer a container
 */
public Component getFirstComponent(Container aContainer) {
    Container root = (aContainer.isFocusCycleRoot())
        ? aContainer
        : aContainer.getFocusCycleRootAncestor();

    // Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
    // traversal policy is non-legacy, then honor it.
    if (root != null) {
        FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
        if (policy != gluePolicy) {
            return policy.getFirstComponent(root);
        }

        comparator.setComponentOrientation(root.getComponentOrientation());
        return layoutPolicy.getFirstComponent(root);
    }

    return null;
}
 
Example #20
Source File: VerticalGridLayout.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private Dimension layoutSize(Container target) {
    int cols = 1;
    int height;
    int componentCount = this.components.size();
    int itemsPerColumn = this.screenHeight / getMaxCellHeight();
    if (componentCount > itemsPerColumn) {
        cols = componentCount / itemsPerColumn;
        if (componentCount % itemsPerColumn != 0) {
            cols++;
        }
        height = itemsPerColumn * getMaxCellHeight();
    } else {
        height = getMenuItemsHeight();
    }
    return new Dimension(cols * getMaxCellWidth() + 2, height + 4);
}
 
Example #21
Source File: RitualMagicSpellEditor.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
protected Container createPointsFields() {
    boolean forCharacter = mRow.getCharacter() != null;
    boolean forTemplate  = mRow.getTemplate() != null;
    int     columns      = forTemplate ? 8 : 6;
    JPanel  panel        = new JPanel(new ColumnLayout(forCharacter ? 10 : columns));

    JLabel label = new JLabel(I18n.Text("Difficulty"), SwingConstants.RIGHT);
    label.setToolTipText(Text.wrapPlainTextForToolTip(I18n.Text("The difficulty of the spell")));
    panel.add(label);

    SkillDifficulty[] allowedDifficulties = {SkillDifficulty.A, SkillDifficulty.H};
    mDifficultyCombo = createComboBox(panel, allowedDifficulties, mRow.getDifficulty(), I18n.Text("The difficulty of the spell"));

    if (forCharacter || forTemplate) {
        mPointsField = createNumberField(panel, panel, I18n.Text("Points"), I18n.Text("The number of points spent on this spell"), mRow.getPoints(), 4);
        if (forCharacter) {
            mLevelField = createField(panel, panel, I18n.Text("Level"), getDisplayLevel(mRow.getLevel(), mRow.getRelativeLevel()), I18n.Text("The spell level and relative spell level to roll against.\n") + mRow.getLevelToolTip(), 7);
            mLevelField.setEnabled(false);
        }
    }
    return panel;
}
 
Example #22
Source File: SplitterFrame.java    From ios-image-util with MIT License 5 votes vote down vote up
/**
 * Set container enabled.
 *
 * @param parent
 * @param b
 */
protected static void setContainerEnabled(Container parent, boolean b) {
	for (Component c : parent.getComponents()) {
		if (c instanceof JTextField) {
			((JTextField)c).setEditable(b);
		} else {
			c.setEnabled(b);
		}
		if (c instanceof Container) {
			setContainerEnabled((Container)c, b);
		}
	}
}
 
Example #23
Source File: JGeneralNames.java    From keystore-explorer with GNU General Public License v3.0 5 votes vote down vote up
private void editSelectedGeneralName() {
	int selectedRow = jtGeneralNames.getSelectedRow();

	if (selectedRow != -1) {
		GeneralName generalName = (GeneralName) jtGeneralNames.getValueAt(selectedRow, 0);

		Container container = getTopLevelAncestor();

		DGeneralNameChooser dGeneralNameChooser = null;

		if (container instanceof JDialog) {
			dGeneralNameChooser = new DGeneralNameChooser((JDialog) container, title, generalName);
		} else if (container instanceof JFrame) {
			dGeneralNameChooser = new DGeneralNameChooser((JFrame) container, title, generalName);
		}
		dGeneralNameChooser.setLocationRelativeTo(container);
		dGeneralNameChooser.setVisible(true);

		GeneralName newGeneralName = dGeneralNameChooser.getGeneralName();

		if (newGeneralName == null) {
			return;
		}

		getGeneralNamesTableModel().removeRow(selectedRow);
		getGeneralNamesTableModel().addRow(newGeneralName);

		selectGeneralNameInTable(newGeneralName);
		updateButtonControls();
	}
}
 
Example #24
Source File: Megante.java    From javagame with MIT License 5 votes vote down vote up
public Megante() {
    // �^�C�g����ݒ�
    setTitle("���K���e�I");
    // �T�C�Y�ύX�s��
    setResizable(false);

    // �p�l�����쐬
    MainPanel panel = new MainPanel();
    Container contentPane = getContentPane();
    contentPane.add(panel);

    // �p�l���T�C�Y�ɍ��킹�ăt���[���T�C�Y�������ݒ�
    pack();
}
 
Example #25
Source File: ExternalProgramConfig.java    From tn5250j with GNU General Public License v2.0 5 votes vote down vote up
private static void addLabelComponent(String text,Component comp,Container container) {

	      JLabel label = new JLabel(text);
	      label.setAlignmentX(Component.LEFT_ALIGNMENT);
	      label.setHorizontalTextPosition(JLabel.LEFT);
	      container.add(label);
	      container.add(comp);

	}
 
Example #26
Source File: D3DScreenUpdateManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if the component has heavyweight children.
 *
 * @param comp component to check for hw children
 * @return true if Component has heavyweight children
 */
private static boolean hasHWChildren(Component comp) {
    if (comp instanceof Container) {
        for (Component c : ((Container)comp).getComponents()) {
            if (c.getPeer() instanceof WComponentPeer || hasHWChildren(c)) {
                return true;
            }
        }
    }
    return false;
}
 
Example #27
Source File: DefaultMenuLayout.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Dimension preferredLayoutSize(Container target) {
    if (target instanceof JPopupMenu) {
        JPopupMenu popupMenu = (JPopupMenu) target;
        sun.swing.MenuItemLayoutHelper.clearUsedClientProperties(popupMenu);
        if (popupMenu.getComponentCount() == 0) {
            return new Dimension(0, 0);
        }
    }

    // Make BoxLayout recalculate cached preferred sizes
    super.invalidateLayout(target);

    return super.preferredLayoutSize(target);
}
 
Example #28
Source File: TemplateOutlinePanel.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void layoutContainer(Container parent) {
    Insets    insets = getInsets();
    Rectangle bounds = new Rectangle(insets.left, insets.top, getWidth() - (insets.left + insets.right), getHeight() - (insets.top + insets.bottom));
    int       width  = bounds.width;
    int       height = mHeader.getPreferredSize().height;
    mHeader.setBounds(bounds.x, bounds.y, width, height);
    bounds.y += height;
    bounds.height -= height;
    mOutline.setBounds(bounds.x, bounds.y, width, bounds.height);
    ColumnUtils.pack(mOutline, width);
    mOutline.revalidateView();
}
 
Example #29
Source File: ThemeCheck.java    From neembuu-uploader with GNU General Public License v3.0 5 votes vote down vote up
private static void apply0(Component s){
    if(s==null)return;
    
    if( 
            s instanceof javax.swing.JTable && false /*disabled*/
        ){
        return; // to allow alternate cell gray background
    }else { 
        s.setBackground(Color.WHITE);
    }
    if(s instanceof JComponent){
        JComponent jc = (JComponent)s;
        if(!(jc instanceof JButton)){
            try{
                jc.setBorder(javax.swing.BorderFactory.createEmptyBorder());
            }catch(Exception a){
                //ignore
            }
        }
    }
    
    if(s instanceof Container){
        Container cc = (Container)s;
        for (Component component : cc.getComponents()) {
            apply0(component);
        }
    }
}
 
Example #30
Source File: XJTable.java    From gate-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Track parent viewport's size if it's larger than the current preferred 
 * height of the table (causes empty tables to fill in the whole area of
 * a JScrollPane). 
 * @return true if the preferred height of the table is smaller than the
 *   viewport.
 */
@Override
public boolean getScrollableTracksViewportHeight() {
  Container parent = getParent();
  Dimension dim = getPreferredSize();
  return  (parent != null && dim!= null &&
           parent instanceof JViewport && 
           parent.getHeight() > getPreferredSize().height);
}