Refine search
Component[] components = container.getComponents(); for (Component component : components) { component.setEnabled(enable); gui.add(container, BorderLayout.CENTER); container.add(tb, BorderLayout.NORTH); for (int ii=0; ii<3; ii++) { tb.add(new JButton("Button"));
for (int col = 0; col < GRID_COLS; col++) { panelGrid[row][col] = new JPanel(new GridBagLayout()); backingPanel.add(panelGrid[row][col]); redLabel.setBackground(Color.red.brighter().brighter()); redLabel.setPreferredSize(LABEL_SIZE); panelGrid[4][3].add(redLabel); panelGrid[1][1].add(blueLabel); public void mousePressed(MouseEvent me) { clickedPanel = (JPanel) backingPanel.getComponentAt(me.getPoint()); Component[] components = clickedPanel.getComponents(); if (components.length == 0) { return;
frame.add(jsp); BufferedImage img = new BufferedImage(component.getWidth(), component.getHeight(), BufferedImage.TRANSLUCENT); CellRendererPane crp = new CellRendererPane(); crp.add(component); crp.paintComponent(img.createGraphics(), component, crp, component.getBounds()); return img; c.doLayout(); if (c instanceof Container) { for (Component child : ((Container) c).getComponents()) { layoutComponent(child);
if (useSlideButton) { final JPanel statusPanel = new JPanel(); basePanel.add(statusPanel, BorderLayout.SOUTH); statusPanel.add(new JButton("Slide Left") { private static final long serialVersionUID = 9204819004142223529L; statusPanel.add(new JButton("Slide Right") { if (w instanceof JFrame) { final JFrame j = (JFrame) w; if (j.getContentPane().getComponents().length > 0) { throw new RuntimeException("ProgramCheck: Parent already contains content."); if (j.getContentPane().getComponents().length > 0) { throw new RuntimeException("ProgramCheck: Parent already contains content."); if (j.getContentPane().getComponents().length > 0) { throw new RuntimeException("ProgramCheck: Parent already contains content."); if (j.getComponents().length > 0) { throw new RuntimeException("ProgramCheck: Parent already contains content.");
add(slideContainer, BorderLayout.CENTER); frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationByPlatform(true); Component[] comps = getComponents(); if (comps.length > 0) { oldComponent = comps[0];
GridBagLayout layout = (GridBagLayout) parent.getLayout(); for (Component otherPanel : parent.getComponents()) { parent.add(otherPanel, gbc);
public Component add(Component c) { ensurePopupMenuCreated(); popupMenu.add(c); return c; public Component add(Component c, int index) { ensurePopupMenuCreated(); popupMenu.add(c, index); return c; return (popupMenu == null) ? new Component[0] : popupMenu.getComponents();
/** CONSTRUCT PANELS, ONE FOR EACH HOST. */ protected void addHost(String hostName, Properties props) { cp.add(new RMIPanel(hostName, props)); // If asked for ncolumns, make it so. // Else If it got too tall, make it multi columns. String nc = props.getProperty("netwatch.gui.columns"); if (nc != null) { int n = Integer.parseInt(nc); cp.setLayout(new GridLayout(0, n)); } else if (cp.getComponents().length > 12) cp.setLayout(new GridLayout(0,3)); else if (cp.getComponents().length > 6) cp.setLayout(new GridLayout(0,2)); } }
/** * Restore the previous toolbar. */ public void restorePreviousToolbar () { final Container container = instance.getParent(); if(null != container) { final Component[] component = container.getComponents(); for (int i = 0; (i < component.length); i++) { if (component[i] == instance) { container.remove(instance); container.add(previousInstance, i); container.validate(); break; } } } } /* end restorePreviousToolbar */
panel.add(new JLabel("BOO")); panel.add(new JButton("BBBB")); frame.add(contentpane); newpanel.add(new JLabel("LOL")); panel.add(newpanel); System.out.println(100 * panel.getComponents().length); panel.setPreferredSize(new Dimension(0, 100 * panel.getComponents().length)); contentpane.validate();
mainPanel.add(new JLabel("I'm a Label!"), BorderLayout.NORTH); mainPanel.add(new JLabel("I'm a label, too!"), BorderLayout.CENTER); mainPanel.add(triggerButton, BorderLayout.SOUTH); public void actionPerformed(ActionEvent e) { Color c = new Color(r.nextInt(256), r.nextInt(256), r.nextInt(256)); for (Component jc : mainPanel.getComponents()) { if (jc instanceof JLabel) { JLabel label = (JLabel) jc;
panel.add(h1); panel.add(text); frame.getContentPane().add(panel); frame.setVisible(true); for (Component component : container.getComponents()) { System.out.println(indent + "component.getClass().getName(): " + component.getClass().getName());
if (window instanceof Frame) { Frame f = (Frame)window; Component[] allComp = f.getComponents(); Component c = f.getComponents()[0]; f.remove(c); f.setVisible(false); add(c); validate();
if (fileFormatLabel != null) { Container parent = fileFormatLabel.getParent(); parent.add(cb); List<T> matches = new ArrayList<>(); for (Component child : parent.getComponents()) { if (aClass.isInstance(child)) { matches.add((T) child);
JScrollBar vertical = scrollPane.getVerticalScrollBar(); vertical.setPreferredSize(new Dimension(0, 0)); add(scrollPane); pack(); setVisible(true); JViewport view = scrollPane.getViewport(); Component[] components =view.getComponents(); for (int i1 = 0; i1 < components.length; i1++) { if (components[i1] instanceof JTable) {
Component[] components = c.getComponents(); for (Component comp : components) { System.out.println(comp.getClass().getSimpleName() + gui.add(new JScrollPane(tree), BorderLayout.LINE_START); gui.add(tb, BorderLayout.PAGE_START); Action list = new AbstractAction("List") { tb.add(new JToggleButton("Toggle")); tb.add(new JCheckBox("Check"));
final Component[] components = buttonBar.getComponents(); buttonBar.add( ( buttonBar.getComponentCount() == 0 ) ? Box.createGlue() : Box.createRigidArea( new Dimension( BUTTON_BAR_GAP, 0 ) ), insertAt++ ); buttonBar.add( button, insertAt );
JTextPane pane = new JTextPane(); pane.setText("Row " + row + "; Column " + column); panel.add(pane); frame.getContentPane().add(panel); frame.getContentPane().add(new JButton( new AbstractAction("Change borders") { for (Component component : panel.getComponents()) { ((JComponent) component).setBorder( BorderFactory.createMatteBorder(
JPanel childPanel = (JPanel) contentPane.getComponents()[1]; JLayeredPane layeredPane = (JLayeredPane) childPanel.getComponents()[0]; Container desktopPanel = (Container) layeredPane.getComponent(0); for (Component c : desktopPanel.getComponents()) { if (c instanceof JPanel) { JPanel cp = (JPanel) c; southPanel.add(bottomComponent, BorderLayout.CENTER); frame.getContentPane().add(southPanel, BorderLayout.SOUTH);
gbc.insets = new Insets(2, 2, 4, 2); parent.add(fieldNameField, gbc); // file name field... parent.add(cb, gbc); // Check box parent.add(fileTypes, gbc); // File types List<T> matches = new ArrayList<>(); for (Component child : parent.getComponents()) { if (aClass.isInstance(child)) { matches.add((T)child);