/** * Remove all trees from the display */ public void clearMatches() { JPanel spaceholder = new JPanel(); spaceholder.setBackground(Color.white); scroller.setViewportView(spaceholder); scroller.validate(); scroller.repaint(); matchedPartCoordinates = null; matchedPartCoordinateIdx = -1; }
/** * Remove all trees from the display */ public void clearMatches() { JPanel spaceholder = new JPanel(); spaceholder.setBackground(Color.white); scroller.setViewportView(spaceholder); scroller.validate(); scroller.repaint(); matchedPartCoordinates = null; matchedPartCoordinateIdx = -1; }
public void run() { tree.validate(); targetScroll.validate(); } });
public void run() { tree.validate(); targetScroll.validate(); } });
private void scrollDown() { scroll.validate(); scroll.getVerticalScrollBar().setValue(scroll.getVerticalScrollBar().getMaximum()); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { scroll.getVerticalScrollBar().setValue(scroll.getVerticalScrollBar().getMaximum()); } }); }
public void actionPerformed(ActionEvent ev) { String result = JOptionPane.showInputDialog(ListerFrame.this, getAddMessage()); if(result != null){ StringTokenizer st = new StringTokenizer(result); String[] tokens = new String[st.countTokens()]; for(int i = 0; i < tokens.length; i++) tokens[i] = st.nextToken().trim(); addItems(tokens); resetListModel(); scrollPane.validate(); } } }));
private void updateDynamicComponents() { LOGGER.debug("update " + unitPanelMap.values().size() + " components."); synchronized (unitPanelMapLock) { contentPanel.removeAll(); for (JComponent component : unitPanelMap.values()) { contentPanel.add(component); } LayoutGenerator.generateHorizontalLayout(contentPanel, unitPanelMap.values()); } contentPanel.validate(); contentPanel.revalidate(); contentScrollPane.validate(); contentScrollPane.revalidate(); this.validate(); this.revalidate(); }
@Override public void valueChanged(ListSelectionEvent e) { int idx = listBox.getSelectedIndex(); boolean activeSelection = (idx != -1); if(!activeSelection) imgComponent.setImage(null); else { PlottedGraph pg = graphs.get(idx); imgComponent.setImage(pg.getImage()); } saveDotAction.setEnabled(activeSelection); savePngAction.setEnabled(activeSelection); renameAction.setEnabled(activeSelection); scrollPane.validate(); } });
public void actionPerformed(ActionEvent ev) { Object[] selected = listBox.getSelectedValues(); if(selected == null || selected.length == 0){ // no items are selected JOptionPane.showMessageDialog(ListerFrame.this, "No items are selected", "Warning", JOptionPane.WARNING_MESSAGE); return; } int result = JOptionPane.showConfirmDialog(ListerFrame.this, getRemoveMessage(selected), "Query", JOptionPane.YES_NO_OPTION); if(result == JOptionPane.YES_OPTION){ removeItems(selected); resetListModel(); scrollPane.validate(); } } }));
private void moveMouseWithDrag(Point p){ Rectangle visibleHeight=container.getViewport().getViewRect(); DefaultMutableTreeNode dmtn=this.findNode(p); if (visibleHeight.height-p.y<40){ container.validate(); container.getVerticalScrollBar().setValue(container.getVerticalScrollBar().getValue()+10); } if ((p.y-visibleHeight.y<40) && (container.getVerticalScrollBar().getValue()>10)){ container.validate(); container.getVerticalScrollBar().setValue(container.getVerticalScrollBar().getValue()-10); } // this.getLocation() if (dmtn!=null){ this.setSelectionPath(new TreePath(dmtn.getPath())); } else { } }
/** * Redo the layout. */ public void relayout () { mMainPanel.invalidate (); mMainScroller.invalidate (); mMainScroller.validate (); mMainScroller.repaint (); }
public EntryTreePanel(boolean isControllable) { this.isControllable = isControllable; // Init this panel setLayout(new BorderLayout()); // Init tree node and model (attribute tree nodes) root = new ObjectNode(isControllable); //initTree(); model = new DefaultTreeModel(root); // Init tree view tree = new JTree(model); //tree.addMouseListener(new DoubleClicker(this)); tree.setRootVisible(false); ObjectNodeRenderer renderer = new ObjectNodeRenderer(); tree.setCellRenderer(renderer); tree.setRowHeight(0); // let the renderer handle it scrollPane = new JScrollPane(tree); add(scrollPane, "Center"); tree.validate(); scrollPane.validate(); }
/** * Removes a ContactGroup from the group model and ContactList. * * @param contactGroup the ContactGroup to remove. */ private void removeContactGroup(ContactGroup contactGroup) { contactGroup.removeContactGroupListener(this); groupList.remove(contactGroup); mainPanel.remove(contactGroup); ContactGroup parent = getParentGroup(contactGroup.getGroupName()); if (parent != null) { parent.removeContactGroup(contactGroup); } contactListScrollPane.validate(); mainPanel.invalidate(); mainPanel.repaint(); fireContactGroupRemoved(contactGroup); }
public void repaint() { //TODO FIX: NPE when playing with window cloning m_imageContainer.setTryPaint(); m_animatorView.invalidate(); m_topComponent.validate(); m_animatorView.repaint(); m_topComponent.repaint(); }
public void refreshPanel() { // reconstruct nodes root.removeAllChildren(); initTree(); model.nodeStructureChanged(root); tree.validate(); scrollPane.validate(); }
public void setNormalSize() { JScrollPane scrollPane = getScrollPane(); Insets scrollInsets = getScrollPaneInsets(); if (scrollPane != null) { Dimension d = scrollPane.getVisibleRect().getSize(); if (scrollPane.getBorder() != null) { d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right, d.getHeight() - scrollInsets.top - scrollInsets.bottom); } d.setSize(d.getWidth() - 20, d.getHeight() - 20); desktop.setAllSize(d); scrollPane.invalidate(); scrollPane.validate(); } }
public void setNormalSize() { JScrollPane scrollPane = getScrollPane(); Insets scrollInsets = getScrollPaneInsets(); if (scrollPane != null) { Dimension d = scrollPane.getVisibleRect().getSize(); if (scrollPane.getBorder() != null) { d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right, d.getHeight() - scrollInsets.top - scrollInsets.bottom); } d.setSize(d.getWidth() - 20, d.getHeight() - 20); desktop.setAllSize(d); scrollPane.invalidate(); scrollPane.validate(); } }
public void setNormalSize() { JScrollPane scrollPane = getScrollPane(); Insets scrollInsets = getScrollPaneInsets(); if (scrollPane != null) { Dimension d = scrollPane.getVisibleRect().getSize(); if (scrollPane.getBorder() != null) { d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right, d.getHeight() - scrollInsets.top - scrollInsets.bottom); } d.setSize(d.getWidth() - 20, d.getHeight() - 20); desktop.setAllSize(d); scrollPane.invalidate(); scrollPane.validate(); } }
public void setNormalSize() { JScrollPane scrollPane = getScrollPane(); int x = 0; int y = 0; Insets scrollInsets = getScrollPaneInsets(); if (scrollPane != null) { Dimension d = scrollPane.getVisibleRect().getSize(); if (scrollPane.getBorder() != null) { d .setSize(d.getWidth() - scrollInsets.left - scrollInsets.right, d.getHeight() - scrollInsets.top - scrollInsets.bottom); } d.setSize(d.getWidth() - 20, d.getHeight() - 20); desktop.setAllSize(x, y); scrollPane.invalidate(); scrollPane.validate(); } }
public void setDocument(Document newDocument) { // clean up any previous documents if (document != null) { document.dispose(); document = null; } document = newDocument; // clean up old document model and create a new one if (documentViewModel != null) { documentViewModel.dispose(); documentViewModel = null; } documentViewModel = createDocumentViewMode(document, documentViewScrollPane); // setup view type setViewType(); // remove re-size listener. documentViewScrollPane.addComponentListener(this); documentViewScrollPane.validate(); }