當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。