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


Java JScrollPane.VERTICAL_SCROLLBAR_NEVER属性代码示例

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


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

示例1: MapGeneratorOptionsDialog

/**
 * Creates a dialog to set the map generator options.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 * @param editable Whether the options may be edited.
 */
public MapGeneratorOptionsDialog(FreeColClient freeColClient, JFrame frame,
                                 boolean editable) {
    super(freeColClient, frame, editable,
          freeColClient.getGame().getMapGeneratorOptions(),
          MapGeneratorOptions.TAG,
          FreeColDirectories.MAP_GENERATOR_OPTIONS_FILE_NAME,
          MapGeneratorOptions.TAG);

    if (isEditable()) {
        loadDefaultOptions();
        // FIXME: The update should be solved by PropertyEvent.

        final List<File> mapFiles = FreeColDirectories.getMapFileList();
        JPanel mapPanel = new JPanel();
        for (File f : mapFiles) {
            JButton mapButton = makeMapButton(f);
            if (mapButton == null) continue;
            mapButton.addActionListener((ActionEvent ae) -> {
                    updateFile(f);
                });
            mapPanel.add(mapButton);
        }

        JScrollPane scrollPane = new JScrollPane(mapPanel,
            JScrollPane.VERTICAL_SCROLLBAR_NEVER,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scrollPane.getVerticalScrollBar().setUnitIncrement(16);
        scrollPane.getViewport().setOpaque(false);
        // FIXME: find out how to do this properly
        scrollPane.setMinimumSize(new Dimension(400, 110));
        panel.add(scrollPane);
    }
    initialize(frame, choices());
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:41,代码来源:MapGeneratorOptionsDialog.java

示例2: initComponents

private void initComponents() {
    JTable impl = new JTable(new DefaultTableModel(new Object[] { "" }, 0)); // NOI18N
    TableColumnModel colMod = impl.getColumnModel();
    final TableColumn col = colMod.getColumn(0);
    impl.setFocusable(false);
    header = new Header(colMod);
    impl.setTableHeader(header);
    header.setResizingAllowed(false);
    header.setReorderingAllowed(false);

    final TableCellRenderer renderer = header.getDefaultRenderer();
    header.setDefaultRenderer(new TableCellRenderer() {
        public Component getTableCellRendererComponent(
                JTable table, Object value, boolean isSelected, boolean hasFocus,
                int row, int column) {

            Component component = renderer.getTableCellRendererComponent(
                    table, getRendererValue(), isSelected(),
                    isSelected(), row, processMouseEvents() ? 0 : 1);

            setupRenderer(component);

            col.setWidth(header.getWidth());
            return component;
        }
    });

    JScrollPane scroll = new JScrollPane(impl, JScrollPane.VERTICAL_SCROLLBAR_NEVER,
                                               JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) {
        public Dimension getPreferredSize() { return header.getPreferredSize(); }
        public void reshape(int x, int y, int width, int height) {
            header.setPreferredSize(new Dimension(width, height));
            super.reshape(x, y, width, height);
        }
    };
    scroll.setBorder(BorderFactory.createEmptyBorder());
    scroll.setViewportBorder(BorderFactory.createEmptyBorder());

    setLayout(new OverlayLayout(this));
    add(scroll);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:HeaderPanel.java


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