Example usage for javax.swing JPanel getComponents

List of usage examples for javax.swing JPanel getComponents

Introduction

In this page you can find the example usage for javax.swing JPanel getComponents.

Prototype

public Component[] getComponents() 

Source Link

Document

Gets all the components in this container.

Usage

From source file:com.aw.swing.mvp.view.IPView.java

public java.util.List getGridCmps(int index) {
    java.util.List components = new ArrayList();
    JPanel jPanel = getPnlTitGrid(index);
    JPanel pnlToolBarGrid = getPnlToolBarGrid(index);
    components.add(jPanel);/*w  w w  .j  av  a 2  s .c o m*/
    components.addAll(Arrays.asList(jPanel.getComponents()));
    if (pnlToolBarGrid != null) {
        components.addAll(Arrays.asList(pnlToolBarGrid.getComponents()));
    }
    JTable jTable = getTblGrid(index);
    components.add(jTable);
    JTable fixedTable = (JTable) jTable.getClientProperty(BndSJTable.CP_FIXED_TABLE);
    if (fixedTable != null) {
        components.add(fixedTable);
    }
    return components;
}

From source file:com.lottery.gui.MainLotteryForm.java

private void setPanelEnabled(JPanel panel, Boolean isEnabled) {
    panel.setEnabled(isEnabled);//  w w  w  .  ja  v a 2 s.c  om

    for (int i = 0; i < panel.getComponents().length; i++) {
        JComponent component = (JComponent) panel.getComponents()[i];
        if (component.getClass().getName() == "javax.swing.JPanel") {
            setPanelEnabled((JPanel) component, isEnabled);
        }

        component.setEnabled(isEnabled);
    }
}

From source file:com.view.TradeWindow.java

private void TraderSelectAllBlocksActionPerformed(java.awt.event.ActionEvent evt) {

    for (JPanel j : cPanelList) {
        Component[] c = j.getComponents();
        for (Component singleC : c) {
            if (singleC.getName() == null) {
                continue;
            } else if (singleC.getName().equals("splitOpt")) {
                JPanel p = (JPanel) singleC;
                if (!TraderSelectAllBlocks.isSelected()) {
                    ((JCheckBox) p.getComponent(1)).setSelected(false);
                    int n = Integer.parseInt(((JCheckBox) p.getComponent(1)).getName());
                    PopulateBlocks(n);/*from w w  w  .  ja  v a  2 s  . c  o m*/
                } else {
                    if (!((JCheckBox) p.getComponent(1)).isSelected()) {
                        ((JCheckBox) p.getComponent(1)).setSelected(true);
                        int n = Integer.parseInt(((JCheckBox) p.getComponent(1)).getName());
                        PopulateBlocks(n);
                    }
                }
            }

        }
    }
}

From source file:GUI.GUIModel.java

public void PutPoint(double key, double x, double y, JPanel GraphHerePanel) {
    Component[] a = GraphHerePanel.getComponents();
    ChartPanel chartpanel = (ChartPanel) a[0];
    JFreeChart chart = chartpanel.getChart();

    XYPlot plot = (XYPlot) chart.getPlot();
    XYSeriesCollection data = (XYSeriesCollection) plot.getDataset();
    XYSeries XYseries = data.getSeries(key);
    XYseries.add(x, y);/*from  ww  w .  ja  v a  2s .c  o  m*/
    this.revalidate();
    this.repaint();

}

From source file:edu.uara.gui.tableeditor.ChartGenerationFrame.java

/**
 * turn tab panel on or off//  ww w  . j av  a  2  s .  c o  m
 * @param enabled
 */
private void toggleTabPanel(boolean enabled) {
    for (Component comp : tab_chartProperties.getComponents()) {
        if (comp instanceof JPanel) {
            JPanel p = (JPanel) comp;
            for (Component childComp : p.getComponents())
                childComp.setEnabled(enabled);
        }
    }
}

From source file:edu.uara.gui.tableeditor.ChartGenerationFrame.java

private void switchTabPanel(Component c) {
    this.tab_chartProperties.setSelectedComponent(c);
    Component[] compCollection = tab_chartProperties.getComponents();
    for (Component comp : compCollection) {
        if (comp.equals(c)) {
            if (comp instanceof JPanel) {
                JPanel p = (JPanel) comp;
                for (Component childComp : p.getComponents())
                    childComp.setEnabled(true);
            }//from  w ww. j  a v  a2s.  co  m
        } else {
            if (comp instanceof JPanel) {
                JPanel p = (JPanel) comp;
                for (Component childComp : p.getComponents())
                    childComp.setEnabled(false);
            }
        }
    }
}

From source file:org.fhcrc.cpl.viewer.gui.MRMDialog.java

Axis findAxisOfPanel(JPanel panel, whichAxis wa) {
    for (Component c : panel.getComponents()) {
        if (c instanceof PanelWithChart) {
            PanelWithChart pwc = (PanelWithChart) c;
            JFreeChart jfc = pwc.getChart();
            XYPlot xyp = (XYPlot) jfc.getPlot();
            switch (wa) {
            case Domain:
                return xyp.getDomainAxis();
            case Range:
                return xyp.getRangeAxis();
            default:
                return null;
            }/*from www .j a  va  2  s.co  m*/
        }
    }
    return null;
}

From source file:rita.ui.component.DialogSelectEnemies.java

/** seleccionar o deseleccionar a todos los checkboxes adentro de un panel */
private void selectChecks(JPanel panelChecks, boolean b) {
    for (Component comp : panelChecks.getComponents()) {
        if (comp instanceof JPanel) {
            for (Component compInt : ((JPanel) comp).getComponents()) {
                if (compInt instanceof JCheckBox)
                    ((JCheckBox) compInt).setSelected(b);
            }/*from  w ww . ja  va2  s .c o m*/
        }
    }

}

From source file:rita.ui.component.DialogSelectEnemies.java

/**
 * el usuario selecciono los robots para competir, encontrar cuales
 * selecciono y comenzar la batalla/*from ww  w. j av a  2 s  . c o m*/
 */
private void startBattle(JPanel checks) {
    Integer roundsNumber;
    try {
        roundsNumber = (Integer) this.roundsNumberSpinner.getValue();
    } catch (NumberFormatException e) {
        roundsNumber = Batalla.NUMBER_OF_ROUNDS;
    }
    StringBuilder selectedRobots = new StringBuilder();
    // el robot del usuario siempre participa en la batalla
    selectedRobots.append(HelperEditor.currentRobotPackage + "." + HelperEditor.currentRobotName);
    selectedRobots.append("*,");
    String robotName;
    // recorrer los checkboxes de los enemigos seleccionados
    StringBuilder initialPositions = new StringBuilder("");
    // posicion de mi robot
    RobotWithPositionTemp miRobotPos = mapRobotsTemp.get(HelperEditor.currentRobotName);
    positionAsStringBuilder(initialPositions, miRobotPos);

    RobotWithPositionTemp rt = null;
    for (Component compPanel : checks.getComponents()) {
        for (Component comp : ((JPanel) compPanel).getComponents()) {
            if (comp instanceof JCheckBox && ((JCheckBox) comp).isSelected()) {
                robotName = ((JCheckBox) comp).getText();
                /*
                 * "sample" es el paquete de los que vienen con Robocode; si
                 * el robot no es de ese paquete, entonces el nombre debe
                 * estar seguido por un asterisco
                 */
                selectedRobots.append(robotName);
                if (robotName.contains("sample.")) {
                    selectedRobots.append(',');
                } else {
                    selectedRobots.append("*,");
                }
                rt = mapRobotsTemp.get(robotName);
                positionAsStringBuilder(initialPositions, rt);
            }
        }
    }
    if (initialPositions.length() > 1) {
        initialPositions.deleteCharAt(initialPositions.length() - 1); // borra
        // la
        // ultima
        // coma

    }

    HelperEditor.setEnemies(selectedRobots.toString());
    closeDialog();
    SourceCode.callBatalla(Integer.valueOf(roundsNumber), initialPositions.toString());
}

From source file:uiuc.dm.miningTools.ui.ParametersSelectionFrame.java

private static void disablePanel(final JPanel panel) {
    Component[] com = panel.getComponents();
    for (int a = 0; a < com.length; a++) {
        com[a].setEnabled(false);//www .  j  a v a2s. c  o  m
    }
}