本文整理了Java中javax.swing.JScrollPane.setViewport()
方法的一些代码示例,展示了JScrollPane.setViewport()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JScrollPane.setViewport()
方法的具体详情如下:
包路径:javax.swing.JScrollPane
类名称:JScrollPane
方法名:setViewport
暂无
代码示例来源:origin: magefree/mage
public static void setVerticalScrollingView (JScrollPane scrollPane, final Component view) {
final JViewport viewport = new JViewport();
viewport.setLayout(new ViewportLayout() {
private static final long serialVersionUID = 7701568740313788935L;
@Override
public void layoutContainer (Container parent) {
viewport.setViewPosition(new Point(0, 0));
Dimension viewportSize = viewport.getSize();
int width = viewportSize.width;
int height = Math.max(view.getPreferredSize().height, viewportSize.height);
viewport.setViewSize(new Dimension(width, height));
}
});
viewport.setView(view);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setViewport(viewport);
}
代码示例来源:origin: stackoverflow.com
JPanel panel = new JPanel(...);
panel.setOpaque( false );
panel.add(...);
JViewport viewport = new JViewport()
{
@Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
g.drawImage(image, 0, 0, getWidth(), getHeight(), this);
}
};
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewport(viewport);
scrollPane.setViewportView( panel );
代码示例来源:origin: org.softsmithy.lib/softsmithy-lib-swing
@Override
public void setViewport(JViewport viewport) {
if (! (viewport instanceof JXViewport)){
throw new IllegalArgumentException("viewport must be an instance of JXViewport!");
}
super.setViewport(viewport);
}
代码示例来源:origin: org.softsmithy.lib/lib-core
@Override
public void setViewport(JViewport viewport) {
if (! (viewport instanceof JXViewport)){
throw new IllegalArgumentException("viewport must be an instance of JXViewport!");
}
super.setViewport(viewport);
}
代码示例来源:origin: stackoverflow.com
JScrollPane scroll = new JScrollPane();
scroll.setViewport(jp);
代码示例来源:origin: stackoverflow.com
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewport(panel);
代码示例来源:origin: stackoverflow.com
JTextArea jTextArea=new JTextArea();
JScrollPane jScrollPane=new JScrollPane();
jScrollPane.setViewport(jTextArea);
代码示例来源:origin: stackoverflow.com
JScrollPane pane = new JScrollPane();
pane.setViewport(
new JViewport(){
/**
* An empty override implementation to prevent undesired scrolling on
* size changes of the client.
*/
@Override
public void scrollRectToVisible(Rectangle rect){}
});
代码示例来源:origin: stackoverflow.com
myCustomJPanel = new MyCustonJPanel();
GrabbableViewport v = new GrabbableViewport();
v.setView(myCustomJPanel);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewport(v);
enclosingContainer.add(scrollPane);
代码示例来源:origin: nroduit/Weasis
@Override
public Component getToolComponent() {
JViewport viewPort = rootPane.getViewport();
rootPane.setViewport(Optional.ofNullable(viewPort).orElseGet(JViewport::new));
if (viewPort.getView() != this) {
viewPort.setView(this);
}
return rootPane;
}
代码示例来源:origin: stackoverflow.com
CoordinateViewport coordinate = new JCoordinateViewport(); coordinate.setBackground(Color.WHITE); //coordinate.setPreferredSize(new Dimension(10000, 10000));
JScrollPane scroll = new JScrollPane(); //scroll.setViewportView(coordinate);
scroll.setViewport(coordinate);
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
scroll.getVerticalScrollBar().setMinimum(-10000);
scroll.getVerticalScrollBar().setMaximum(+10000);
scroll.getHorizontalScrollBar().setMinimum(-10000);
scroll.getHorizontalScrollBar().setMaximum(+10000);
代码示例来源:origin: stackoverflow.com
JScrollPane scrollPane = new JScrollPane();
JViewport viewport = new JViewport();
//Component that need to be added in Scroll pane//
viewport.setView(new JPanel());
viewport.setOpaque(false);
scrollPane.setViewport(viewport);
scrollPane.getViewport().setOpaque(false);
scrollPane.setOpaque(false);
// Add Scrollpane to Jframe or JPanel//
add( scrollPane,BorderLayout.CENTER);
代码示例来源:origin: nroduit/Weasis
@Override
public Component getToolComponent() {
JViewport viewPort = rootPane.getViewport();
if (viewPort == null) {
viewPort = new JViewport();
rootPane.setViewport(viewPort);
}
if (viewPort.getView() != this) {
viewPort.setView(this);
}
return rootPane;
}
代码示例来源:origin: nroduit/Weasis
@Override
public Component getToolComponent() {
JViewport viewPort = rootPane.getViewport();
if (viewPort == null) {
viewPort = new JViewport();
rootPane.setViewport(viewPort);
}
if (viewPort.getView() != this) {
viewPort.setView(this);
}
return rootPane;
}
代码示例来源:origin: nroduit/Weasis
@Override
public Component getToolComponent() {
JViewport viewPort = rootPane.getViewport();
if (viewPort == null) {
viewPort = new JViewport();
rootPane.setViewport(viewPort);
}
if (viewPort.getView() != this) {
viewPort.setView(this);
}
return rootPane;
}
代码示例来源:origin: nroduit/Weasis
@Override
public Component getToolComponent() {
JViewport viewPort = rootPane.getViewport();
if (viewPort == null) {
viewPort = new JViewport();
rootPane.setViewport(viewPort);
}
if (viewPort.getView() != this) {
viewPort.setView(this);
}
return rootPane;
}
代码示例来源:origin: nroduit/Weasis
@Override
public Component getToolComponent() {
JViewport viewPort = rootPane.getViewport();
if (viewPort == null) {
viewPort = new JViewport();
rootPane.setViewport(viewPort);
}
if (viewPort.getView() != this) {
viewPort.setView(this);
}
return rootPane;
}
代码示例来源:origin: tinyMediaManager/tinyMediaManager
public static JScrollPane createStripedJScrollPane(JTable table) {
JScrollPane scrollPane = new JScrollPane(table);
scrollPane.setViewport(new StripedViewport(table));
scrollPane.getViewport().setView(table);
// scrollPane.setBorder(BorderFactory.createEmptyBorder());
scrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, createCornerComponent(table));
// scrollPane.setBorder(BorderFactory.createLineBorder(Color.BLACK));
return scrollPane;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
private void initComponents() {
setBorder(BorderFactory.createEmptyBorder());
extendedTableScrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
extendedTableViewport = new CustomExtendedTableViewport(extendedTable);
extendedTableScrollPane.setViewport(extendedTableViewport);
extendedTableScrollPane.addMouseWheelListener(extendedTable);
// Enable vertical scrollbar only if needed
JScrollBar vScrollbar = extendedTableScrollPane.getVerticalScrollBar();
vScrollbar.getModel().addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
updateVerticalScrollbar();
}
});
add(extendedTableScrollPane, BorderLayout.CENTER);
}
代码示例来源:origin: org.xworker/xworker_core
public static void createViewport(ActionContext actionContext){
JScrollPane parent = (JScrollPane) actionContext.get("parent");
Thing thing = World.getInstance().getThing("xworker.javax.swing.JViewport");
JViewport obj = (JViewport) thing.run("create", actionContext);
if(obj != null){
parent.setViewport(obj);
}
}
内容来源于网络,如有侵权,请联系作者删除!