Refine search
Rectangle r = f.getBounds(); int x = (int)r.getX(); int y = (int)r.getY(); f.add(ta); f.pack(); f.setLocationByPlatform(true); f.setVisible(true);
s.setVisible(true); Dimension size = this.getBounds().getSize(); int rectWidth = 100; int rectHeight = 130;
for (Component comp : components) { System.out.println(comp.getClass().getSimpleName() + " Bounds: " + comp.getBounds()); if (comp instanceof Container) { listComponents((Container)comp); 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"));
frame.add(tip1Null, BorderLayout.CENTER); frame.setLocation(150, 150); frame.setPreferredSize(new Dimension(310, 75)); frame.setLocationRelativeTo(null); frame.pack(); frame.setVisible(true); paintText(g, b, b.getBounds(), b.getText()); g.setColor(Color.red.brighter()); g.fillRect(0, 0, b.getSize().width, b.getSize().height);
Rectangle bounds = contentPanel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); contentPane.add(dialogPane, BorderLayout.CENTER); setLocationRelativeTo(getOwner());
jFrame1.setBounds(0, 0, 200, 200); jFrame1.setTitle("JFrame 1"); jFrame1.setVisible(true); jFrame2.setBounds(100, 100, 200, 200); jFrame2.setTitle("JFrame 2"); jFrame2.setVisible(true); jFrame3.setBounds(400, 400, 200, 200); jFrame3.setTitle("JFrame 3"); jFrame3.setVisible(true); if(i != j && jFrames.get(i).getBounds().intersects(jFrames.get(j).getBounds())) { System.out.println(jFrames.get(i).getTitle() + " overlaps!");
panel.add(new JLabel(name, JLabel.LEFT)); panel.add(jtf); list.add(jtf); internaFrame.add(sp); internaFrame.pack(); internaFrame.setVisible(true); frmtest.setVisible(true); list.get(0).requestFocusInWindow(); if (focused != null && SwingUtilities.isDescendingFrom(focused, parent)) { parent.scrollRectToVisible(focused.getBounds());
frame.setSize(new Dimension(500, 500)); frame.setLocationByPlatform(true); frame.setVisible(true); Rectangle r = getBounds();
!shape.getBounds().equals(getBounds())) { shape = new Ellipse2D.Float(0, 0, getWidth(), getHeight()); frame.getContentPane().add(button); frame.getContentPane().setLayout(new FlowLayout()); frame.setSize(150, 150); frame.setVisible(true);
repaint(); Thread.sleep(500); Rectangle r = getBounds(); g.clearRect(r.x, r.y, r.width, r.height); mf.setVisible(true);
frame.add(jsp); frame.setVisible(true); BufferedImage bi = componentToImage(imagePanel, true); try { 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;
Rectangle bounds = contentPanel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); contentPane.add(dialogPane, BorderLayout.CENTER); setSize(600, 300); setLocationRelativeTo(getOwner());
super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; Rectangle2D r1 = getBounds(); int margin = 50; Rectangle2D r2 = new Rectangle2D.Double( frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);
addRandom(); frame.add(tableaux, BorderLayout.CENTER); JButton add = new JButton("Add"); add.addActionListener(this); frame.add(add, BorderLayout.SOUTH); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(WIDTH, HEIGHT); frame.setLocationRelativeTo(null); frame.setVisible(true); tableaux.requestFocusInWindow(); Letter letter = new Letter(Character.toString((char) ('a' + random.nextInt(26)))); letter.setBounds(random.nextInt(WIDTH), random.nextInt(HEIGHT), 16, 16); tableaux.add(letter); Letter.this.setOpaque(true); setFont(font2); Rectangle bounds = getBounds(); Rectangle2D stringBounds = font2.getStringBounds(getText(), fontRenderContext2); bounds.width = (int) stringBounds.getWidth(); Letter.this.setOpaque(false); setFont(font1); Rectangle bounds = getBounds(); Rectangle2D stringBounds = font1.getStringBounds(getText(), fontRenderContext1); bounds.width = (int) stringBounds.getWidth();
/** * Enable/disable the overlay component if there is one. * * @param enable whether to enable the overlay or disable it */ public void enable(boolean enable) { requestedOverlay = enable; if (overlay != null) { if (enable) { if (!overlay.isVisible()) { Component component = getComponent(); component.getBounds(bounds); bounds.setLocation(component.getLocationOnScreen()); overlay.setBounds(bounds); Window window = getAncestorWindow(component); window.addComponentListener(overlayComponentAdapter); overlay.setVisible(true); } } else { if (overlay.isVisible()) { overlay.setVisible(false); Window window = getAncestorWindow(getComponent()); window.removeComponentListener(overlayComponentAdapter); } } } }
frame.setVisible(true); initializePanels(); frame.add(left); frame.add(middle); frame.add(right); left.setBackground(new Color(1f, 0f, 0f)); middle.setBackground(new Color(0f, 1f, 0f)); left.setBounds(left.getBounds().x - 5, left.getBounds().y, left.getBounds().width, left.getBounds().height); middle.setBounds(middle.getBounds().x - 5, middle.getBounds().y, middle.getBounds().width, middle.getBounds().height); right.setBounds(right.getBounds().x - 5, right.getBounds().y, right.getBounds().width, right.getBounds().height); try{ Thread.sleep(600);
Rectangle bounds = contentPanel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); contentPane.add(dialogPane, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner());