當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。