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


Java JScrollPane.setMaximumSize方法代码示例

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


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

示例1: generateScrollPane

import javax.swing.JScrollPane; //导入方法依赖的package包/类
public JScrollPane generateScrollPane()
{	
	JScrollPane newScroll = new JScrollPane();
	JList list = new JList(listModel);
	list.setFont( new Font("monospaced", Font.PLAIN, 12) );
	newScroll.setViewportView(list);
	
	Dimension listSize = new Dimension(400, 150);
	newScroll.setSize(listSize);
	newScroll.setMaximumSize(listSize);
	newScroll.setPreferredSize(listSize);
	
	newScroll.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {  
        public void adjustmentValueChanged(AdjustmentEvent e) {  
            e.getAdjustable().setValue(e.getAdjustable().getMaximum());  
        }
    }); 
	return newScroll;
}
 
开发者ID:TeamRedFox,项目名称:PointOfSale,代码行数:20,代码来源:Cart.java

示例2: buildImage

import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
 * Builds the image component
 *
 * @return JComponent
 */
private JComponent buildImage() {
    scrollPane = new JScrollPane(new ImageContainer());
    scrollPane.setMaximumSize(VISNode.get().getMainPanel().getSize());
    return scrollPane;
}
 
开发者ID:VISNode,项目名称:VISNode,代码行数:11,代码来源:ImageViewerPanel.java

示例3: adjustScrollPaneSize

import javax.swing.JScrollPane; //导入方法依赖的package包/类
private static void adjustScrollPaneSize(JScrollPane sp, JEditorPane editorPane) {
    int height;
    //logger.fine("createSingleLineEditor(): editorPane's margin = "+editorPane.getMargin());
    //logger.fine("createSingleLineEditor(): editorPane's insets = "+editorPane.getInsets());
    Dimension prefSize = sp.getPreferredSize();
    Insets borderInsets = sp.getBorder().getBorderInsets(sp);//sp.getInsets();
    int vBorder = borderInsets.bottom + borderInsets.top;
    EditorUI eui = org.netbeans.editor.Utilities.getEditorUI(editorPane);
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("createSingleLineEditor(): editor UI = "+eui);
        if (eui != null) {
            logger.fine("createSingleLineEditor(): editor UI's line height = "+eui.getLineHeight());
            logger.fine("createSingleLineEditor(): editor UI's line ascent = "+eui.getLineAscent());
        }
    }
    if (eui != null) {
        height = eui.getLineHeight();
        if (height < eui.getLineAscent()) {
            height = (eui.getLineAscent()*4)/3; // Hack for the case when line height = 1
        }
    } else {
        java.awt.Font font = editorPane.getFont();
        java.awt.FontMetrics fontMetrics = editorPane.getFontMetrics(font);
        height = fontMetrics.getHeight();
        //logger.fine("createSingleLineEditor(): editor's font = "+font+" with metrics = "+fontMetrics+", leading = "+fontMetrics.getLeading());
        //logger.fine("createSingleLineEditor(): font's height = "+height);
    }
    height += vBorder + getLFHeightAdjustment();
    //height += 2; // 2 for border
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("createSingleLineEditor(): border vertical insets = "+borderInsets.bottom+" + "+borderInsets.top);
        logger.fine("createSingleLineEditor(): computed height = "+height+", prefSize = "+prefSize);
    }
    if (prefSize.height < height) {
        prefSize.height = height;
        sp.setPreferredSize(prefSize);
        sp.setMinimumSize(prefSize);
        sp.setMaximumSize(prefSize);
        java.awt.Container c = sp.getParent();
        logger.fine("createSingleLineEditor(): setting a new height of ScrollPane = "+height);
        if (c instanceof JComponent) {
            ((JComponent) c).revalidate();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:46,代码来源:Utilities.java


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