当前位置: 首页>>代码示例>>Java>>正文


Java ScrollPane.setSize方法代码示例

本文整理汇总了Java中java.awt.ScrollPane.setSize方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollPane.setSize方法的具体用法?Java ScrollPane.setSize怎么用?Java ScrollPane.setSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.ScrollPane的用法示例。


在下文中一共展示了ScrollPane.setSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import java.awt.ScrollPane; //导入方法依赖的package包/类
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:ScrollPanePreferredSize.java

示例2: createVncClientMainWindow

import java.awt.ScrollPane; //导入方法依赖的package包/类
private Frame createVncClientMainWindow(final BufferedImageCanvas canvas, final String title) {
    // Create AWT windows
    final Frame frame = new Frame(title + " - VNCle");

    // Use scrolling pane to support screens, which are larger than ours
    final ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
    scroller.add(canvas);
    scroller.setSize(screen.getFramebufferWidth(), screen.getFramebufferHeight());

    frame.add(scroller);
    frame.pack();
    frame.setVisible(true);

    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(final WindowEvent evt) {
            frame.setVisible(false);
            shutdown();
        }
    });

    return frame;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:24,代码来源:VncClient.java

示例3: createVncClientMainWindow

import java.awt.ScrollPane; //导入方法依赖的package包/类
private Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title) {
    // Create AWT windows
    final Frame frame = new Frame(title + " - VNCle");

    // Use scrolling pane to support screens, which are larger than ours
    ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
    scroller.add(canvas);
    scroller.setSize(screen.getFramebufferWidth(), screen.getFramebufferHeight());

    frame.add(scroller);
    frame.pack();
    frame.setVisible(true);

    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent evt) {
            frame.setVisible(false);
            shutdown();
        }
    });

    return frame;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:24,代码来源:VncClient.java

示例4: createVncClientMainWindow

import java.awt.ScrollPane; //导入方法依赖的package包/类
protected static Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title, WindowListener windowListener) {
    // Create AWT windows
    Frame frame = new Frame(title + " - RDP");

    // Use scrolling pane to support screens, which are larger than ours
    scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
    scroller.add(canvas);
    scroller.setSize(canvas.getWidth(), canvas.getHeight());

    frame.add(scroller);
    frame.pack();
    frame.setVisible(true);

    frame.addWindowListener(windowListener);

    return frame;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:18,代码来源:Client.java

示例5: createButtons

import java.awt.ScrollPane; //导入方法依赖的package包/类
private JPanel createButtons(Plan pc, ColButton[] b, Field[] f, boolean flag) {
//        	Vector v = new Vector();
//            String[] columns = FrameColumnCalculator.getCol(pc, v);
            f = pc.getFirstLegende().field;

            int nbCol = 4;
            int maxNbRow = 5;
            JPanel p = new JPanel();
            p.setLayout(new GridLayout(0, nbCol, 0, 0));
            b = new ColButton[f.length];


            boolean needScroll = f.length > nbCol*maxNbRow;
            int maxWidth = 0;
            int tmp;
            FontMetrics fm = null;
            if( needScroll ) fm = Toolkit.getDefaultToolkit().getFontMetrics(Aladin.SPLAIN);


            for( int i=0; i<f.length; i++ ) {
                b[i] = new ColButton(aladin, f[i].name, f[i]);
                b[i].setFont(Aladin.SPLAIN);
                if( needScroll && (tmp=fm.stringWidth(f[i].name))>maxWidth )
                    maxWidth = tmp;
                p.add(b[i]);
            }

            if( flag ) {
            	col1 = b;
            	fields1 = f;
            }
            else {
            	col2 = b;
            	fields2 = f;
            }


            // ajout d'un scrollpane s'il y a trop de lignes
            if(  needScroll ) {
                ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
                sp.setSize((maxWidth+20)*nbCol+30, 140);
                sp.add(p);
                JPanel newPanel = new JPanel();
                newPanel.add(sp);
                return newPanel;
            }
            else return p;
        }
 
开发者ID:jankotek,项目名称:asterope,代码行数:49,代码来源:FrameCDSXMatch.java


注:本文中的java.awt.ScrollPane.setSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。