javax.swing.JScrollPane.setMinimumSize()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(223)

本文整理了Java中javax.swing.JScrollPane.setMinimumSize()方法的一些代码示例,展示了JScrollPane.setMinimumSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JScrollPane.setMinimumSize()方法的具体详情如下:
包路径:javax.swing.JScrollPane
类名称:JScrollPane
方法名:setMinimumSize

JScrollPane.setMinimumSize介绍

暂无

代码示例

代码示例来源:origin: kiegroup/optaplanner

private JComponent createQuickOpenPanel(JList<QuickOpenAction> listPanel, String title, List<File> fileList) {
  listPanel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  listPanel.addListSelectionListener(event -> {
    if (event.getValueIsAdjusting()) {
      return;
    }
    int selectedIndex = listPanel.getSelectedIndex();
    if (selectedIndex < 0) {
      return;
    }
    QuickOpenAction action = listPanel.getModel().getElementAt(selectedIndex);
    action.actionPerformed(new ActionEvent(listPanel, -1, null));
  });
  refreshQuickOpenPanel(listPanel, fileList);
  JScrollPane scrollPane = new JScrollPane(listPanel);
  scrollPane.getVerticalScrollBar().setUnitIncrement(25);
  scrollPane.setMinimumSize(new Dimension(100, 80));
  // Size fits into screen resolution 1024*768
  scrollPane.setPreferredSize(new Dimension(180, 200));
  JPanel titlePanel = new JPanel(new BorderLayout());
  titlePanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
  JLabel titleLabel = new JLabel(title);
  titleLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
  titlePanel.add(titleLabel, BorderLayout.NORTH);
  titlePanel.add(scrollPane, BorderLayout.CENTER);
  return titlePanel;
}

代码示例来源:origin: libgdx/libgdx

fontList.setVisibleRowCount(6);
fontList.setSelectedIndex(0);
fontScroll.setMinimumSize(new Dimension(220, fontList.getPreferredScrollableViewportSize().height));
effectsList.setModel(effectsListModel);
effectsList.setVisibleRowCount(7);
effectsScroll.setMinimumSize(effectsList.getPreferredScrollableViewportSize());

代码示例来源:origin: libgdx/libgdx

fontList.setVisibleRowCount(6);
fontList.setSelectedIndex(0);
fontScroll.setMinimumSize(new Dimension(220, fontList.getPreferredScrollableViewportSize().height));
effectsList.setModel(effectsListModel);
effectsList.setVisibleRowCount(7);
effectsScroll.setMinimumSize(effectsList.getPreferredScrollableViewportSize());

代码示例来源:origin: MovingBlocks/Terasology

ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
    ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
propertyPanelScrollPane.setMinimumSize(new Dimension(350, 720));
propertyPanelScrollPane.setPreferredSize(new Dimension(350, 720));

代码示例来源:origin: 4thline/cling

@PostConstruct
public void init() {
  addWindowListener(
      new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent windowEvent) {
          dispose();
        }
      }
  );
  JScrollPane containerTreePane;
  containerTreePane = new JScrollPane(treeView.asUIComponent());
  containerTreePane.setMinimumSize(new Dimension(180, 200));
  JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  splitPane.setBorder(new EmptyBorder(10, 10, 10, 10));
  splitPane.setLeftComponent(containerTreePane);
  splitPane.setRightComponent(detailView.asUIComponent());
  splitPane.setResizeWeight(0.65);
  setLayout(new BorderLayout());
  setPreferredSize(new Dimension(700, 500));
  setMinimumSize(new Dimension(500, 250));
  add(splitPane, BorderLayout.CENTER);
  pack();
  setVisible(true);
}

代码示例来源:origin: knowm/XChart

/** Constructor */
public XChartDemo() {
 super(new GridLayout(1, 0));
 // Create the nodes.
 DefaultMutableTreeNode top = new DefaultMutableTreeNode("XChart Example Charts");
 createNodes(top);
 // Create a tree that allows one selection at a time.
 tree = new JTree(top);
 tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
 // Listen for when the selection changes.
 tree.addTreeSelectionListener(this);
 // Create the scroll pane and add the tree to it.
 JScrollPane treeView = new JScrollPane(tree);
 // Create Chart Panel
 chartPanel = new XChartPanel(new AreaChart01().getChart());
 // Add the scroll panes to a split pane.
 splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
 splitPane.setTopComponent(treeView);
 splitPane.setBottomComponent(chartPanel);
 Dimension minimumSize = new Dimension(130, 160);
 treeView.setMinimumSize(minimumSize);
 splitPane.setPreferredSize(new Dimension(700, 700));
 // Add the split pane to this panel.
 add(splitPane);
}

代码示例来源:origin: knowm/XChart

protected void init() {
 // Create the nodes.
 DefaultMutableTreeNode top = new DefaultMutableTreeNode("XChart Example Charts");
 createNodes(top);
 tree = new JTree(top);
 // Create a tree that allows one selection at a time.
 tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
 // Listen for when the selection changes.
 tree.addTreeSelectionListener(this);
 // Create the scroll pane and add the tree to it.
 JScrollPane treeView = new JScrollPane(tree);
 // Create Chart Panel
 tabbedPane = new JTabbedPane();
 for (int i = 0; i < tree.getRowCount(); i++) {
  tree.expandRow(i);
 }
 // select first leaf
 DefaultMutableTreeNode firstLeaf = top.getFirstLeaf();
 tree.setSelectionPath(new TreePath(firstLeaf.getPath()));
 // Add the scroll panes to a split pane.
 splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
 splitPane.setTopComponent(treeView);
 splitPane.setBottomComponent(tabbedPane);
 Dimension minimumSize = new Dimension(130, 160);
 treeView.setMinimumSize(minimumSize);
 splitPane.setPreferredSize(new Dimension(700, 700));
 // Add the split pane to this panel.
 add(splitPane);
}

代码示例来源:origin: nodebox/nodebox

tableScroll.setPreferredSize(new Dimension(200, 170));
tableScroll.setMaximumSize(new Dimension(200, 170));
tableScroll.setMinimumSize(new Dimension(200, 170));
tablePanel.add(tableScroll, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));

代码示例来源:origin: magefree/mage

jScrollPaneTablesFinished.setMinimumSize(new java.awt.Dimension(23, 0));

代码示例来源:origin: magefree/mage

avatarPane.setMinimumSize(new java.awt.Dimension(508, 772));
avatarPane.setPreferredSize(new java.awt.Dimension(508, 772));

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

/**
 * Create the panel where the GUI representation of the test tree is
 * displayed. The tree should already be created before calling this method.
 *
 * @return a scroll pane containing the test tree GUI
 */
private JScrollPane createTreePanel() {
  JScrollPane treeP = new JScrollPane(tree);
  treeP.setMinimumSize(new Dimension(100, 0));
  return treeP;
}

代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui

/**
 * @param width
 * @param height
 */
public void setSize(int width, int height) {
  Dimension size = new Dimension(width, height);
  this.scrollPane.setMinimumSize(size);
  this.scrollPane.setPreferredSize(size);
}

代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui

/**
 * @param width
 * @param height
 */
public void setSize(int width, int height) {
  Dimension size = new Dimension(width, height);
  this.scrollPane.setMinimumSize(size);
  this.scrollPane.setPreferredSize(size);
}

代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui

/**
 * @param width
 * @param height
 */
public void setSize(int width, int height) {
  Dimension size = new Dimension(width, height);
  this.scrollPane.setMinimumSize(size);
  this.scrollPane.setPreferredSize(size);
}

代码示例来源:origin: chatty/chatty

public final void setUserlistWidth(int width, int minWidth) {
  userlist.setPreferredSize(new Dimension(width, 10));
  userlist.setMinimumSize(new Dimension(minWidth, 0));
  userlistMinWidth = minWidth;
}

代码示例来源:origin: stackoverflow.com

JList list = controller.getCategorieList();
JScrollPane sp = new JScrollPane(list);
Dimension d = new Dimension(100, 100);
sp.setMinimumSize(d);
sp.setPreferredSize(d);
this.add(list, BorderLayout.NORTH);

代码示例来源:origin: sc.fiji/TrakEM2_

private Component wrap(Component c, String title) {
  JScrollPane s = new JScrollPane(c);
  s.setBackground(Color.white);
  s.setMinimumSize(new Dimension(400,15));
  s.setPreferredSize(new Dimension(400,200));
  s.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(0,5,0,5), title));
  return s;
}

代码示例来源:origin: io.github.dheid/fontchooser

private void addSizeScrollPane() {
  JScrollPane sizeScrollPane = new JScrollPane();
  sizeScrollPane.setMinimumSize(new Dimension(50, 50));
  sizeScrollPane.setPreferredSize(new Dimension(60, 100));
  sizeScrollPane.setViewportView(sizeList);
  GridBagConstraints gridBagConstraints = new GridBagConstraints();
  gridBagConstraints.gridy = 1;
  gridBagConstraints.fill = GridBagConstraints.VERTICAL;
  gridBagConstraints.anchor = GridBagConstraints.LINE_START;
  gridBagConstraints.weighty = 1.0;
  add(sizeScrollPane, gridBagConstraints);
}

代码示例来源:origin: kframework/k

KTreePanel() {
  super(new GridLayout(1,0));
  tree = new JTree(new DefaultMutableTreeNode("No term loaded"));
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  add(tree);
  JScrollPane treeView = new JScrollPane(tree);
  treeView.setMinimumSize(new Dimension(100,100));
  treeView.setPreferredSize(new Dimension(500,300));
  add(treeView);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

@Override
 public void componentResized(ComponentEvent cv) {
  m_js.setMinimumSize(new Dimension(MatrixPanel.this.getWidth(),
   MatrixPanel.this.getHeight() - optionsPanel.getPreferredSize().height
    - 10));
  jp.setDividerLocation(MatrixPanel.this.getHeight()
   - optionsPanel.getPreferredSize().height - 10);
 }
});

相关文章

JScrollPane类方法