本文整理了Java中javax.swing.JPanel.getVisibleRect()
方法的一些代码示例,展示了JPanel.getVisibleRect()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.getVisibleRect()
方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:getVisibleRect
暂无
代码示例来源:origin: jasperreports/jasperreports
protected float getPageCanvasWidth()
{
return (float) pnlInScroll.getVisibleRect().getWidth() - 20f;
}
代码示例来源:origin: jasperreports/jasperreports
protected float getPageCanvasHeight()
{
return (float) pnlInScroll.getVisibleRect().getHeight() - 20f;
}
代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui
/**
* Gets an random position of for a new node. This method is called when a new node is added to the graph.
*
* @return The position
*/
private Point getRandomPosition() {
Rectangle area = this.panel.getVisibleRect();
int x = (int) (area.x + (area.width - NodeGUI.MINIMUM_WIDTH) * Math.random());
int y = (int) (area.y + (area.height - NodeGUI.MINIMUM_HEIGHT) * Math.random());
return new Point(x, y);
}
代码示例来源:origin: jasperreports/jasperreports
/**
*
*/
private void fitPage(){
float heightRatio = ((float)pnlInScroll.getVisibleRect().getHeight() - 20f) / jasperPrint.getPageHeight();
float widthRatio = ((float)pnlInScroll.getVisibleRect().getWidth() - 20f) / jasperPrint.getPageWidth();
setRealZoomRatio(heightRatio < widthRatio ? heightRatio : widthRatio);
}
代码示例来源:origin: jasperreports/jasperreports
void btnFitWidthActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFitWidthActionPerformed
// Add your handling code here:
if (btnFitWidth.isSelected())
{
btnActualSize.setSelected(false);
btnFitPage.setSelected(false);
cmbZoom.setSelectedIndex(-1);
setRealZoomRatio(((float)pnlInScroll.getVisibleRect().getWidth() - 20f) / jasperPrint.getPageWidth());
btnFitWidth.setSelected(true);
}
}//GEN-LAST:event_btnFitWidthActionPerformed
代码示例来源:origin: jasperreports/jasperreports
/**
*
*/
public void setFitWidthZoomRatio()
{
setRealZoomRatio(((float)pnlInScroll.getVisibleRect().getWidth() - 20f) / jasperPrint.getPageWidth());
}
代码示例来源: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: jasperreports/jasperreports
public void setFitPageZoomRatio()
{
setRealZoomRatio(((float)pnlInScroll.getVisibleRect().getHeight() - 20f) / jasperPrint.getPageHeight());
}
代码示例来源:origin: jawi/ols
/**
* Returns the dimensions of the visible view, taking care of viewports (such
* as used in {@link JScrollPane}).
*
* @return a visible view size, as {@link Dimension}, never <code>null</code>.
*/
@Override
public Rectangle getVisibleRect()
{
final JScrollPane scrollPane = getAncestorOfClass( JScrollPane.class, this );
final Rectangle rect;
if ( scrollPane != null )
{
rect = scrollPane.getViewport().getViewRect();
}
else
{
rect = super.getVisibleRect();
}
return rect;
}
代码示例来源: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: jasperreports/jasperreports
void pnlMainComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_pnlMainComponentResized
// Add your handling code here:
if (btnFitPage.isSelected())
{
fitPage();
btnFitPage.setSelected(true);
}
else if (btnFitWidth.isSelected())
{
setRealZoomRatio(((float)pnlInScroll.getVisibleRect().getWidth() - 20f) / jasperPrint.getPageWidth());
btnFitWidth.setSelected(true);
}
}//GEN-LAST:event_pnlMainComponentResized
代码示例来源:origin: approvals/ApprovalTests.Java
/**************************************************************************/
public void setState(String label, int progress)
{
progressLabel.setText(label);
progressBar.setValue(progress);
if (forcePainting)
{
panel.paintImmediately(panel.getVisibleRect());
}
else
{
repaint();
}
if (progress == maxSteps)
{
this.dispose();
}
}
/**************************************************************************/
代码示例来源:origin: viglucci/app-jcef-example
return;
Rectangle clipping = ((JPanel)component_).getVisibleRect();
代码示例来源:origin: montoyo/mcef
return;
Rectangle clipping = ((JPanel)component_).getVisibleRect();
内容来源于网络,如有侵权,请联系作者删除!