Java Code Examples for javax.swing.JPanel.getComponentCount()

The following are Jave code examples for showing how to use getComponentCount() of the javax.swing.JPanel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: s-store   File: RandomDistributionEditorManager.java   View Source Code Vote up 6 votes
public static void clear(JPanel paneColEdit)
{
    if (paneColEdit.getComponentCount() == 1)
    {
        paneColEdit.remove(0);
        paneColEdit.updateUI();
    }
}
 
Example 2
Project: sstore-soft   File: RandomDistributionEditorManager.java   View Source Code Vote up 5 votes
public static void clear(JPanel paneColEdit)
{
    if (paneColEdit.getComponentCount() == 1)
    {
        paneColEdit.remove(0);
        paneColEdit.updateUI();
    }
}
 
Example 3
Project: incubator-netbeans   File: DiffToRevision.java   View Source Code Vote up 4 votes
private void setEnabled (JPanel panel, boolean enabled) {
    for (int i = 0; i < panel.getComponentCount(); ++i) {
        panel.getComponent(i).setEnabled(enabled);
    }
}
 
Example 4
Project: sbc-qsystem   File: FAdvanceCalendar.java   View Source Code Vote up 4 votes
private void printDayWeek(JPanel panel, GridAndParams res, int weekDay) {
    final GregorianCalendar gc = new GregorianCalendar();
    panel.removeAll();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

    for (Date dd : res.getTimes()) {
        gc.setTime(dd);
        int ii = gc.get(GregorianCalendar.DAY_OF_WEEK) - 1;
        if (ii < 1) {
            ii = 7;
        }
        gc.setTime(this.firstWeekDay);
        gc.add(GregorianCalendar.DAY_OF_WEEK, ii - 1);

        final GregorianCalendar gc_client = new GregorianCalendar();
        final GregorianCalendar gc_now = new GregorianCalendar();
        gc_client.setTime(dd);
        gc_now.setTime(new Date());
        // проверим не отлистал ли пользователь слишком далеко, куда уже нельзя
        boolean f = true;
        int per = 0;
        if (gc_client.get(GregorianCalendar.DAY_OF_YEAR) - gc_now
            .get(GregorianCalendar.DAY_OF_YEAR)
            > 0) {
            per = gc_client.get(GregorianCalendar.DAY_OF_YEAR) - gc_now
                .get(GregorianCalendar.DAY_OF_YEAR);
        } else {
            per = gc_client.get(GregorianCalendar.DAY_OF_YEAR) + (
                gc_now.isLeapYear(gc_now.get(GregorianCalendar.YEAR)) ? 365
                    : 366 - gc_now.get(GregorianCalendar.DAY_OF_YEAR));
        }
        if (per > res.getAdvanceLimitPeriod() && res.getAdvanceLimitPeriod() != 0) {
            f = false;
        }

        if (ii == weekDay && f && gc.getTime().after(gc_now.getTime())) {
            panel.add(new QAvancePanel(new IAdviceEvent() {

                @Override
                public void eventPerformed(Date date) {
                    if (clockBack.isActive()) {
                        clockBack.stop();
                    }
                    // ставим предварительного кастомера
                    result = NetCommander
                        .standInServiceAdvance(netProperty, service.getId(), date,
                            advancedCustomer,
                            inputData, comments);
                    // закрываем диалог выбора предварительного выбора времени
                    setVisible(false);
                }
            }, dd, true));
        }
    }
    if (panel.getComponentCount() == 0) {
        panel.setLayout(new GridLayout(1, 1));
        panel.add(new JLabel(new ImageIcon(
            Uses.loadImage(this, "/ru/apertum/qsystem/client/forms/resources/noActive.png",
                null)),
            JLabel.CENTER));
    }
}