本文整理了Java中javax.swing.JPanel.scrollRectToVisible()
方法的一些代码示例,展示了JPanel.scrollRectToVisible()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.scrollRectToVisible()
方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:scrollRectToVisible
暂无
代码示例来源:origin: apache/geode
@Override
public void mouseDragged(MouseEvent e) {
Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1);
((JPanel) e.getSource()).scrollRectToVisible(r);
showBox(e.getX(), e.getY());
}
代码示例来源:origin: sdedit/sdedit
public void scrollToRectangle(Rectangle rect) {
rect.x = (int) (rect.x * scale);
rect.y = (int) (rect.y * scale);
rect.width = (int) (rect.width * scale);
rect.height = (int) (rect.height * scale);
internal.scrollRectToVisible(rect);
}
代码示例来源:origin: com.jidesoft/jide-oss
@Override
public void scrollRectToVisible(Rectangle aRect) {
super.scrollRectToVisible(aRect);
}
代码示例来源:origin: io.snappydata/gemfire-hydra-tests
@Override
public void mouseDragged(MouseEvent e) {
Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1);
((JPanel)e.getSource()).scrollRectToVisible(r);
showBox(e.getX(), e.getY());
}
代码示例来源:origin: triplea-game/triplea
@Override
public void paint(final Graphics g) {
if (previousVisibleIndex != null) {
items.scrollRectToVisible(new Rectangle(0, scrollIncrementFinal * (moves.size() - previousVisibleIndex),
1, scrollIncrementFinal));
previousVisibleIndex = null;
}
super.paint(g);
}
};
代码示例来源:origin: stackoverflow.com
JPanel panel = new JPanel();
JPanel panel2 = new JPanel();
panel2.setPreferredSize(new Dimension(200, 11000));
SpringLayout layout = new SpringLayout();
panel2.setLayout(layout);
for (int i = 0; i < 100; i++) {
JLabel textField = new JLabel();
textField.setText("textfield number " + i);
textField.setPreferredSize(new Dimension(150, 100));
layout.putConstraint(SpringLayout.NORTH, textField, i * 110, SpringLayout.NORTH, panel2);
panel2.add(textField);
}
JScrollPane scrollPane = new JScrollPane(panel2, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setPreferredSize(new Dimension(200, 500));
panel2.scrollRectToVisible(new Rectangle(0, 800, 150, 100));
panel.add(scrollPane);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
@Override
public void focusGained(FocusEvent e) {
Component c = e.getComponent();
Rectangle r = c.getBounds();
contentPanel.scrollRectToVisible(r);
}
@Override
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-editor
public void focusGained(FocusEvent e) {
Component c = e.getComponent();
Rectangle r = c.getBounds();
contentPanel.scrollRectToVisible( r );
}
public void focusLost(FocusEvent arg0) {
代码示例来源:origin: aterai/java-swing-tips
protected void initPanel() {
panel.setVisible(!panel.isVisible());
label.setText(String.format("%s %s", panel.isVisible() ? "△" : "▼", title));
revalidate();
// fireExpansionEvent();
EventQueue.invokeLater(() -> panel.scrollRectToVisible(panel.getBounds()));
}
代码示例来源:origin: igniterealtime/Spark
@Override
public void run() {
//scrolls scrollPane to top
panel.scrollRectToVisible(versionField.getBounds());
// info that certificate is distrusted
if (( reason == CertificateDialogReason.ADD_CERTIFICATE
|| reason == CertificateDialogReason.ADD_ID_CERTIFICATE
|| reason == CertificateDialogReason.ADD_CERTIFICATE_FROM_CONNECTION) && !certModel.isValid()) {
JOptionPane.showMessageDialog(null, Res.getString("dialog.certificate.is.distrusted"));
}
}
});
代码示例来源:origin: sdedit/sdedit
public void setScale(double scale) {
Rectangle visible = internal.getVisibleRect();
double factor = scale / this.scale;
this.scale = Math.min(4, scale);
redraw();
visible = new Rectangle((int) (visible.x * factor),
(int) (visible.y * factor), (int) (visible.width * factor),
(int) (visible.height * factor));
internal.scrollRectToVisible(visible);
observable.setChanged();
observable.notifyObservers(this);
}
代码示例来源:origin: stackoverflow.com
private JPanel panel;
...
private void moveLeft() {
Rectangle rec = panel.getVisibleRect();
rec.setLocation((int) (rec.getX() + 1000), (int) rec.getY());
System.out.println(rec);
panel.scrollRectToVisible(rec);
System.out.println(panel.getVisibleRect());
}
代码示例来源:origin: apache/fop
/**
* Selects the given page, displays it on screen and notifies
* listeners about the change in selection.
* @param number the page number
*/
public void setPage(int number) {
int oldPage = currentPage;
if (displayMode == CONTINUOUS || displayMode == CONT_FACING) {
currentPage = number;
gridPanel.scrollRectToVisible(pagePanels[currentPage].getBounds());
} else { // single page mode
currentPage = number;
firstPage = currentPage;
}
showPage();
firePageChange(oldPage, currentPage);
}
代码示例来源:origin: nroduit/Weasis
@Override
public void focusGained(FocusEvent e) {
if (!e.isTemporary()) {
JPanel container = getScrollPane();
if (container != null) {
Rectangle bound = this.getBounds();
Point p1 = SwingUtilities.convertPoint(this, this.getX(), this.getY(), container);
bound.x = p1.x;
bound.y = p1.y;
container.scrollRectToVisible(bound);
}
SeriesImporter loader = series.getSeriesLoader();
if (loader != null) {
loader.setPriority();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!