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


Java ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS属性代码示例

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


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

示例1: getMinimumSize

@Override
public Dimension getMinimumSize(final int rows, final int columns) {
    final Dimension size = super.getMinimumSize(rows, columns);
    synchronized (getDelegateLock()) {
        // JScrollPane insets
        final Insets pi = getDelegate().getInsets();
        size.width += pi.left + pi.right;
        size.height += pi.top + pi.bottom;
        // Take scrollbars into account.
        final int vsbPolicy = getDelegate().getVerticalScrollBarPolicy();
        if (vsbPolicy == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) {
            final JScrollBar vbar = getDelegate().getVerticalScrollBar();
            size.width += vbar != null ? vbar.getMinimumSize().width : 0;
        }
        final int hsbPolicy = getDelegate().getHorizontalScrollBarPolicy();
        if (hsbPolicy == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) {
            final JScrollBar hbar = getDelegate().getHorizontalScrollBar();
            size.height += hbar != null ? hbar.getMinimumSize().height : 0;
        }
    }
    return size;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:LWTextAreaPeer.java

示例2: ThemeReaderCrashTest

ThemeReaderCrashTest() {
    JPanel panel = new JPanel();
    JScrollPane pane =
        new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    panel.setSize(300, 200);

    panel.add(pane);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:ThemeReaderCrashTest.java

示例3: ScrollPanel

public ScrollPanel(LogFrame frame) {
	super(frame);
	this.table = new TablePanel(frame);
	JScrollPane pane = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
			ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	pane.setVerticalScrollBar(table.getVerticalScrollBar());
	setLayout(new BorderLayout());
	add(pane);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:9,代码来源:ScrollPanel.java

示例4: ExpressionTab

public ExpressionTab(AnalyzerModel model) {
	this.model = model;
	selector = new OutputSelector(model);

	model.getOutputExpressions().addOutputExpressionsListener(myListener);
	selector.addItemListener(myListener);
	clear.addActionListener(myListener);
	revert.addActionListener(myListener);
	enter.addActionListener(myListener);
	field.setLineWrap(true);
	field.setWrapStyleWord(true);
	field.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), myListener);
	field.getDocument().addDocumentListener(myListener);
	field.setFont(new Font("sans serif", Font.PLAIN, 14));

	JPanel buttons = new JPanel();
	buttons.add(clear);
	buttons.add(revert);
	buttons.add(enter);

	GridBagLayout gb = new GridBagLayout();
	GridBagConstraints gc = new GridBagConstraints();
	setLayout(gb);
	gc.weightx = 1.0;
	gc.gridx = 0;
	gc.gridy = GridBagConstraints.RELATIVE;
	gc.fill = GridBagConstraints.BOTH;

	JPanel selectorPanel = selector.createPanel();
	gb.setConstraints(selectorPanel, gc);
	add(selectorPanel);
	gb.setConstraints(prettyView, gc);
	add(prettyView);
	gc.insets = new Insets(10, 10, 0, 10);
	JScrollPane fieldPane = new JScrollPane(field, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
			ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
	gb.setConstraints(fieldPane, gc);
	add(fieldPane);
	gb.setConstraints(buttons, gc);
	add(buttons);
	gc.fill = GridBagConstraints.BOTH;
	gb.setConstraints(error, gc);
	add(error);

	myListener.insertUpdate(null);
	setError(null);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:47,代码来源:ExpressionTab.java

示例5: VariableTab

VariableTab(VariableList data) {
	this.data = data;

	list.setModel(new VariableListModel(data));
	list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	list.addListSelectionListener(myListener);
	remove.addActionListener(myListener);
	moveUp.addActionListener(myListener);
	moveDown.addActionListener(myListener);
	add.addActionListener(myListener);
	rename.addActionListener(myListener);
	field.addActionListener(myListener);
	field.getDocument().addDocumentListener(myListener);

	JScrollPane listPane = new JScrollPane(list, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
			ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
	listPane.setPreferredSize(new Dimension(100, 100));

	JPanel topPanel = new JPanel(new GridLayout(3, 1));
	topPanel.add(remove);
	topPanel.add(moveUp);
	topPanel.add(moveDown);

	JPanel fieldPanel = new JPanel();
	fieldPanel.add(rename);
	fieldPanel.add(add);

	GridBagLayout gb = new GridBagLayout();
	GridBagConstraints gc = new GridBagConstraints();
	setLayout(gb);

	gc.insets = new Insets(10, 10, 0, 10);
	gc.fill = GridBagConstraints.BOTH;
	gc.weightx = 1.0;
	gb.setConstraints(listPane, gc);
	add(listPane);

	gc.fill = GridBagConstraints.NONE;
	gc.anchor = GridBagConstraints.PAGE_START;
	gc.weightx = 0.0;
	gb.setConstraints(topPanel, gc);
	add(topPanel);

	gc.gridwidth = GridBagConstraints.REMAINDER;
	gc.gridx = 0;
	gc.gridy = GridBagConstraints.RELATIVE;
	gc.fill = GridBagConstraints.HORIZONTAL;
	gb.setConstraints(field, gc);
	field.setBorder(BorderFactory.createLineBorder(new Color(130, 135, 144)));
	add(field);

	gb.setConstraints(fieldPanel, gc);
	add(fieldPanel);

	gc.fill = GridBagConstraints.HORIZONTAL;
	gb.setConstraints(error, gc);
	add(error);

	if (!data.isEmpty())
		list.setSelectedValue(data.get(0), true);
	computeEnabled();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:62,代码来源:VariableTab.java

示例6: SelectionPanel

public SelectionPanel(LogFrame window) {
	super(window);
	selector = new ComponentSelector(getModel());
	addTool = new JButton();
	changeBase = new JButton();
	moveUp = new JButton();
	moveDown = new JButton();
	remove = new JButton();
	removeAll = new JButton();
	clearComponentLog = new JButton();
	list = new SelectionList();
	list.setSelection(getSelection());

	JPanel buttons = new JPanel(new GridLayout(7, 1));
	buttons.add(addTool);
	buttons.add(changeBase);
	buttons.add(moveUp);
	buttons.add(moveDown);
	buttons.add(remove);
	buttons.add(removeAll);
	buttons.add(clearComponentLog);

	addTool.addActionListener(listener);
	changeBase.addActionListener(listener);
	moveUp.addActionListener(listener);
	moveDown.addActionListener(listener);
	remove.addActionListener(listener);
	removeAll.addActionListener(listener);
	clearComponentLog.addActionListener(listener);
	selector.addMouseListener(listener);
	selector.addTreeSelectionListener(listener);
	list.addListSelectionListener(listener);
	listener.computeEnabled();

	GridBagLayout gridbag = new GridBagLayout();
	GridBagConstraints gbc = new GridBagConstraints();
	setLayout(gridbag);
	JScrollPane explorerPane = new JScrollPane(selector, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
			ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	JScrollPane listPane = new JScrollPane(list, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
			ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	gbc.fill = GridBagConstraints.BOTH;
	gbc.weightx = 1.0;
	gbc.weighty = 1.0;
	gridbag.setConstraints(explorerPane, gbc);
	add(explorerPane);
	gbc.fill = GridBagConstraints.NONE;
	gbc.anchor = GridBagConstraints.NORTH;
	gbc.weightx = 0.0;
	gridbag.setConstraints(buttons, gbc);
	add(buttons);
	gbc.fill = GridBagConstraints.BOTH;
	gbc.weightx = 1.0;
	gridbag.setConstraints(listPane, gbc);
	add(listPane);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:56,代码来源:SelectionPanel.java

示例7: HexFrame

public HexFrame(Project proj, HexModel model) {
	setDefaultCloseOperation(HIDE_ON_CLOSE);

	LogisimMenuBar menubar = new LogisimMenuBar(this, proj);
	setJMenuBar(menubar);

	this.model = model;
	this.editor = new HexEditor(model);

	JPanel buttonPanel = new JPanel();
	buttonPanel.add(open);
	buttonPanel.add(save);
	buttonPanel.add(close);
	open.addActionListener(myListener);
	save.addActionListener(myListener);
	close.addActionListener(myListener);

	Dimension pref = editor.getPreferredSize();
	JScrollPane scroll = new JScrollPane(editor, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
			ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
	pref.height = Math.min(pref.height, pref.width * 3 / 2);
	scroll.setPreferredSize(pref);
	scroll.getViewport().setBackground(editor.getBackground());

	Container contents = getContentPane();
	contents.add(scroll, BorderLayout.CENTER);
	contents.add(buttonPanel, BorderLayout.SOUTH);

	LocaleManager.addLocaleListener(myListener);
	myListener.localeChanged();
	pack();

	setLocationRelativeTo(null);

	Dimension size = getSize();
	Dimension screen = getToolkit().getScreenSize();
	if (size.width > screen.width || size.height > screen.height) {
		size.width = Math.min(size.width, screen.width);
		size.height = Math.min(size.height, screen.height);
		setSize(size);
	}

	editor.getCaret().addChangeListener(editListener);
	editor.getCaret().setDot(0, false);
	editListener.register(menubar);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:46,代码来源:HexFrame.java

示例8: MouseOptions

public MouseOptions(OptionsFrame window) {
	super(window, new GridLayout(1, 3));

	explorer = new ProjectExplorer(getProject());
	explorer.setListener(listener);

	// Area for adding mappings
	addArea.addMouseListener(listener);

	// Area for viewing current mappings
	model = new MappingsModel();
	mappings.setTableHeader(null);
	mappings.setModel(model);
	mappings.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	mappings.getSelectionModel().addListSelectionListener(listener);
	mappings.clearSelection();
	JScrollPane mapPane = new JScrollPane(mappings);

	// Button for removing current mapping
	JPanel removeArea = new JPanel();
	remove.addActionListener(listener);
	remove.setEnabled(false);
	removeArea.add(remove);

	// Area for viewing/changing attributes
	attrTable = new AttrTable(getOptionsFrame());

	GridBagLayout gridbag = new GridBagLayout();
	GridBagConstraints gbc = new GridBagConstraints();
	setLayout(gridbag);
	gbc.weightx = 1.0;
	gbc.weighty = 1.0;
	gbc.gridheight = 4;
	gbc.fill = GridBagConstraints.BOTH;
	JScrollPane explorerPane = new JScrollPane(explorer, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
			ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	gridbag.setConstraints(explorerPane, gbc);
	add(explorerPane);
	gbc.weightx = 0.0;
	JPanel gap = new JPanel();
	gap.setPreferredSize(new Dimension(10, 10));
	gridbag.setConstraints(gap, gbc);
	add(gap);
	gbc.weightx = 1.0;
	gbc.gridheight = 1;
	gbc.gridx = 2;
	gbc.gridy = GridBagConstraints.RELATIVE;
	gbc.weighty = 0.0;
	gridbag.setConstraints(addArea, gbc);
	add(addArea);
	gbc.weighty = 1.0;
	gridbag.setConstraints(mapPane, gbc);
	add(mapPane);
	gbc.weighty = 0.0;
	gridbag.setConstraints(removeArea, gbc);
	add(removeArea);
	gbc.weighty = 1.0;
	gridbag.setConstraints(attrTable, gbc);
	add(attrTable);

	getOptions().getMouseMappings().addMouseMappingsListener(listener);
	setCurrentTool(null);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:63,代码来源:MouseOptions.java

示例9: ToolbarOptions

public ToolbarOptions(OptionsFrame window) {
	super(window);
	explorer = new ProjectExplorer(getProject());
	addTool = new JButton();
	addSeparator = new JButton();
	moveUp = new JButton();
	moveDown = new JButton();
	remove = new JButton();

	list = new ToolbarList(getOptions().getToolbarData());

	TableLayout middleLayout = new TableLayout(1);
	JPanel middle = new JPanel(middleLayout);
	middle.add(addTool);
	middle.add(addSeparator);
	middle.add(moveUp);
	middle.add(moveDown);
	middle.add(remove);
	middleLayout.setRowWeight(4, 1.0);

	explorer.setListener(listener);
	addTool.addActionListener(listener);
	addSeparator.addActionListener(listener);
	moveUp.addActionListener(listener);
	moveDown.addActionListener(listener);
	remove.addActionListener(listener);
	list.addListSelectionListener(listener);
	listener.computeEnabled();

	GridBagLayout gridbag = new GridBagLayout();
	GridBagConstraints gbc = new GridBagConstraints();
	setLayout(gridbag);
	JScrollPane explorerPane = new JScrollPane(explorer, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
			ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	JScrollPane listPane = new JScrollPane(list, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
			ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	gbc.fill = GridBagConstraints.BOTH;
	gbc.weightx = 1.0;
	gbc.weighty = 1.0;
	gridbag.setConstraints(explorerPane, gbc);
	add(explorerPane);
	gbc.fill = GridBagConstraints.VERTICAL;
	gbc.anchor = GridBagConstraints.NORTH;
	gbc.weightx = 0.0;
	gridbag.setConstraints(middle, gbc);
	add(middle);
	gbc.fill = GridBagConstraints.BOTH;
	gbc.weightx = 1.0;
	gridbag.setConstraints(listPane, gbc);
	add(listPane);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:51,代码来源:ToolbarOptions.java


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