List of usage examples for javax.swing JComponent setBounds
public void setBounds(Rectangle r)
From source file:Main.java
public static void setBoundsForComponent(JComponent comp, String text, int xOffset, int yOffset) { Rectangle bounds = calculateBoundsForComponent(comp, text, xOffset, yOffset); comp.setBounds(bounds); }
From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java
/** Centers the image when the user maximized the viewer. */ void maximizeWindow() { JComponent c = model.getBrowser().getUI(); c.setBounds(c.getBounds()); }
From source file:org.shaman.rpg.editor.dialog.DialogVisualElement.java
public DialogVisualElement(Lookup lkp) { obj = lkp.lookup(DialogDataObject.class); assert obj != null; undoRedo = new UndoRedo.Manager(); undoRedo.addChangeListener(new ChangeListener() { @Override/* w ww .ja v a 2 s . c o m*/ public void stateChanged(ChangeEvent e) { obj.setModified(true); } }); initComponents(); contentPanel = new JPanel() { @Override public void paint(Graphics g) { super.paint(g); for (JComponent c : overlayComponents) { c.setBounds(this.getBounds()); c.paint(g); } } }; contentPanel.setLayout(new VerticalFlowLayout(GAP_Y * 2)); contentPanel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (!e.isConsumed()) { requestFocus(); callback.requestActive(); } } }); personsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { personsListSelectionEvent(); } }); removeButton.setEnabled(false); Action editNames = new EditListAction(); ListAction ls = new ListAction(personsList, editNames); personsList.getModel().addListDataListener(new ListDataListener() { @Override public void intervalAdded(ListDataEvent e) { updatePersons(); } @Override public void intervalRemoved(ListDataEvent e) { updatePersons(); } @Override public void contentsChanged(ListDataEvent e) { updatePersons(); } }); setupVisuals(); contentParent = new JPanel(); contentParent.setLayout(new BorderLayout()); // contentPanel.setBounds(contentPanel.getBounds()); // contentParent.setBounds(contentPanel.getBounds()); contentParent.add(contentPanel); scrollPane.setViewportView(contentParent); jumpListener = new JumpListener(this); dropListener = new DropListener(this); DropTarget dt = new DropTarget(contentParent, dropListener); contentParent.setDropTarget(dt); obj.getPrimaryFile().addFileChangeListener(new FileChangeAdapter() { @Override public void fileChanged(FileEvent fe) { refresh(); } }); obj.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (DataObject.PROP_MODIFIED.equals(evt.getPropertyName()) && callback != null) { if (obj.isModified()) { callback.updateTitle("<html><b>" + obj.getName() + "</b></html>"); } else { callback.updateTitle("<html>" + obj.getName() + "</html>"); } } } }); }