/** * Displays a message dialog containing the error specified in parameter. * * @param error a String representing an error message to display. */ private void displayError(String error) { JOptionPane.showMessageDialog(mailsListPane.getParent(), error, String.format(i18n.get("mailslist.err.title"), Configuration.INSTANCE.get("application.name")), JOptionPane.ERROR_MESSAGE); } }
public void hierarchyChanged(HierarchyEvent e) { if (jcomp.getParent() instanceof ComboPopup) { if (scrollPaneSelector != null) { scrollPaneSelector.uninstallFromScrollPane(); scrollPaneSelector = null; } } } };
public void destroy() { Container parent = scrollPane.getParent(); adaptor.shutdown(); if (parent != null) { parent.remove(scrollPane); } }
public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { JScrollPane pane = (JScrollPane) ((Component) e.getSource()).getParent().getParent(); Component temp = pane.getParent().getParent().getParent().getParent(); if (temp instanceof JInternalFrame) { cmdToBar(pane, (JInternalFrame) temp); } else { cmdToFrame(pane); } } }
/** * Called when the number of rows is updated. By default, it will get the parent scroll pane and call revalidate. * Subclass can override it to customize the behavior when number of rows is updated. * * @param oldRow the previous row count. * @param newRow the new row count. */ protected void numberOfRowsUpdated(int oldRow, int newRow) { // look for a parent ScrollPane and revalidate its container // otherwise revalidate the text area's container JScrollPane scroll = getParentScrollPane(); if (scroll != null) { Container parent = scroll.getParent(); if (parent != null && parent instanceof JComponent) { JComponent component = (JComponent) parent; component.revalidate(); } } }
/** * Called when the number of rows is updated. By default, it will get the parent scroll pane and call revalidate. * Subclass can override it to customize the behavior when number of rows is updated. * * @param oldRow the previous row count. * @param newRow the new row count. */ protected void numberOfRowsUpdated(int oldRow, int newRow) { // look for a parent ScrollPane and revalidate its container // otherwise revalidate the text area's container JScrollPane scroll = getParentScrollPane(); if (scroll != null) { Container parent = scroll.getParent(); if (parent != null && parent instanceof JComponent) { JComponent component = (JComponent) parent; component.revalidate(); } } }
@Override public void mouseWheelMoved(MouseWheelEvent e) { JScrollPane pane = (JScrollPane)e.getSource(); int val = pane.getVerticalScrollBar().getValue(); if(myPrevVal != null && myPrevVal != val){ myPrevVal = val; myCount = 0; return; } myPrevVal = val; if(myCount++ < 3){ return; } int max = pane.getVerticalScrollBar().getMaximum(); int min = pane.getVerticalScrollBar().getMinimum(); int vis = pane.getVerticalScrollBar().getVisibleAmount(); if((val+vis == max && e.getWheelRotation() == 1) || (val == min && e.getWheelRotation() == -1)){ pane.getParent().dispatchEvent(e); } } }
@Override public void mouseWheelMoved(MouseWheelEvent e) { JScrollPane pane = (JScrollPane)e.getSource(); int val = pane.getVerticalScrollBar().getValue(); if(myPrevVal != null && myPrevVal != val){ myPrevVal = val; myCount = 0; return; } myPrevVal = val; if(myCount++ < 3){ return; } int max = pane.getVerticalScrollBar().getMaximum(); int min = pane.getVerticalScrollBar().getMinimum(); int vis = pane.getVerticalScrollBar().getVisibleAmount(); if((val+vis == max && e.getWheelRotation() == 1) || (val == min && e.getWheelRotation() == -1)){ pane.getParent().dispatchEvent(e); } } }
@Override public void actionPerformed(ActionEvent e) { Dimension d = getSize(); d.width -= 100; Dimension vd = scrollPane.getViewport().getSize(); if (d.width <= vd.width) { d.width = vd.width; decreaseWidthAction.setEnabled(false); } setPreferredSize(d); invalidate(); scrollPane.getParent().validate(); } }
@Override public void actionPerformed(ActionEvent e) { Dimension d = getSize(); d.height -= 100; Dimension vd = scrollPane.getViewport().getSize(); if (d.height <= vd.height) { d.height = vd.height; decreaseHeightAction.setEnabled(false); } setPreferredSize(d); invalidate(); scrollPane.getParent().validate(); } }
private void updateTableColumnSizes() { ETable table = notificationTable; Font font = notificationScroll.getFont(); FontMetrics fm = notificationScroll.getFontMetrics(font.deriveFont(Font.BOLD)); int maxCharWidth = fm.charWidth('A'); // NOI18N int inset = 10; TableColumnModel columnModel = table.getColumnModel(); TableColumn priorityColumn = columnModel.getColumn(0); String priorName = priorityColumn.getHeaderValue().toString(); priorityColumn.setPreferredWidth(fm.stringWidth(priorName) + inset); TableColumn dateColumn = columnModel.getColumn(2); dateColumn.setPreferredWidth(15 * maxCharWidth + inset); TableColumn categoryColumn = columnModel.getColumn(3); categoryColumn.setPreferredWidth(7 * maxCharWidth + inset); TableColumn messageColumn = columnModel.getColumn(1); Border border = notificationScroll.getBorder(); Insets insets; if (border != null) { insets = border.getBorderInsets(notificationScroll); } else { insets = new Insets(0, 0, 0, 0); } int remainingWidth = notificationScroll.getParent().getWidth() - insets.left - insets.right; remainingWidth -= 3 * columnModel.getColumnMargin(); remainingWidth -= priorityColumn.getPreferredWidth(); remainingWidth -= dateColumn.getPreferredWidth(); remainingWidth -= categoryColumn.getPreferredWidth(); messageColumn.setPreferredWidth(remainingWidth); }
@Override public void actionPerformed(ActionEvent e) { Dimension d = getSize(); d.width += 100; setPreferredSize(d); invalidate(); scrollPane.getParent().validate(); if (!decreaseWidthAction.isEnabled()) { decreaseWidthAction.setEnabled(true); } } }
@Override public void actionPerformed(ActionEvent e) { Dimension d = getSize(); d.height += 100; setPreferredSize(d); invalidate(); scrollPane.getParent().validate(); if (!decreaseHeightAction.isEnabled()) { decreaseHeightAction.setEnabled(true); } } }
@Override public void mouseWheelMoved(MouseWheelEvent e) { if (scrollPane.getVerticalScrollBar().isShowing()) { if (e.getSource() != scrollPane) { e.setSource(scrollPane); scrollPane.dispatchEvent(e); } } else { scrollPane.getParent().dispatchEvent(e); } } };
private void cmdTestQueryActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jButtonTestActionPerformed // Cleaning the existing table and releasing resources releaseResultset(); OBDAProgressMonitor progMonitor = new OBDAProgressMonitor("Executing query...", this); CountDownLatch latch = new CountDownLatch(1); ExecuteSQLQueryAction action = new ExecuteSQLQueryAction(latch); progMonitor.addProgressListener(action); progMonitor.start(); try { action.run(); latch.await(); progMonitor.stop(); ResultSet set = action.getResult(); if (set != null) { ResultSetTableModel model = new ResultSetTableModel(set); tblQueryResult.setModel(model); scrQueryResult.getParent().revalidate(); } } catch (Exception e) { log.error(e.getMessage()); } }// GEN-LAST:event_jButtonTestActionPerformed
public void stopEditing(boolean cancel) { if (editingCell != null) { scrollPane.transferFocusUpCycle(); Object cell = editingCell; editingCell = null; if (!cancel) { EventObject trig = trigger; trigger = null; graphComponent.labelChanged(cell, getCurrentValue(), trig); } else { mxCellState state = graphComponent.getGraph().getView() .getState(cell); graphComponent.redraw(state); } if (scrollPane.getParent() != null) { scrollPane.setVisible(false); scrollPane.getParent().remove(scrollPane); } graphComponent.requestFocusInWindow(); } }
public void stopEditing(boolean cancel) { if (editingCell != null) { scrollPane.transferFocusUpCycle(); Object cell = editingCell; editingCell = null; if (!cancel) { EventObject trig = trigger; trigger = null; graphComponent.labelChanged(cell, getCurrentValue(), trig); } else { mxCellState state = graphComponent.getGraph().getView() .getState(cell); graphComponent.redraw(state); } if (scrollPane.getParent() != null) { scrollPane.setVisible(false); scrollPane.getParent().remove(scrollPane); } graphComponent.requestFocusInWindow(); } }