本文整理匯總了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}