Example usage for javax.swing JProgressBar setMaximumSize

List of usage examples for javax.swing JProgressBar setMaximumSize

Introduction

In this page you can find the example usage for javax.swing JProgressBar setMaximumSize.

Prototype

@BeanProperty(description = "The maximum size of the component.")
public void setMaximumSize(Dimension maximumSize) 

Source Link

Document

Sets the maximum size of this component to a constant value.

Usage

From source file:net.pandoragames.far.ui.swing.FileListPanel.java

private void init(SwingConfig config, ComponentRepository componentRepository) {

    this.setLayout(new BorderLayout());

    this.setBorder(
            BorderFactory.createEmptyBorder(0, SwingConfig.PADDING, SwingConfig.PADDING, SwingConfig.PADDING));

    tableModel = componentRepository.getTableModel();
    componentRepository.getResetDispatcher().addResetable(tableModel);
    componentRepository.getSearchBaseListener().addResetable(tableModel);
    componentRepository.getUndoListener().setTableModel(tableModel);

    JTable fileListTable = componentRepository.getFileSetTable();
    int totalWidth = fileListTable.getPreferredSize().width;
    fileListTable.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    fileListTable.setColumnSelectionAllowed(true);
    fileListTable.getTableHeader().addMouseListener(new TableHeaderMouseListener());
    fileListTable.getTableHeader().getColumnModel().getColumn(0)
            .setHeaderRenderer(new TableHeaderCheckBoxColumnRenderer());
    fileListPopupMenu = new FileListPopupMenu(fileListTable, tableModel, componentRepository, config);
    fileListTable.setComponentPopupMenu(fileListPopupMenu);
    fileListTable.addMouseListener(new FileViewOpener(fileListTable, componentRepository.getRootWindow(),
            config, componentRepository));
    fileListTable.getColumnModel().getColumn(0).setPreferredWidth(20);
    fileListTable.getColumnModel().getColumn(0).setMaxWidth(20);
    fileListTable.getColumnModel().getColumn(1).setCellRenderer(new TargetFileListTableCellRenderer());
    fileListTable.getColumnModel().getColumn(1).setPreferredWidth(2 * totalWidth / 5);
    fileListTable.getColumnModel().getColumn(2).setCellRenderer(new PathColumnRenderer());
    fileListTable.getColumnModel().getColumn(3).setCellRenderer(new InfoColumnRenderer(config));
    JScrollPane scrollPane = new JScrollPane(fileListTable);
    this.add(scrollPane, BorderLayout.CENTER);

    SelectCounter fileCounter = new SelectCounter();
    fileCounter.setBorder(BorderFactory.createEmptyBorder(1, SwingConfig.PADDING, 2, SwingConfig.PADDING));
    fileCounter.setForeground(Color.GRAY);
    ErrorCounter errorCounter = new ErrorCounter();
    errorCounter.setBorder(BorderFactory.createEmptyBorder(1, SwingConfig.PADDING, 2, SwingConfig.PADDING));
    JPanel counterLine = new JPanel();
    counterLine.setLayout(new BorderLayout());
    counterLine.add(fileCounter, BorderLayout.WEST);
    counterLine.add(errorCounter, BorderLayout.EAST);

    JProgressBar progressBar = new JProgressBar();
    progressBar.setEnabled(false);//from   w ww.  j a va  2  s.  c o  m
    progressBar.setMaximumSize(new Dimension(100, 20));
    progressBar.setBorder(BorderFactory.createEmptyBorder(1, SwingConfig.PADDING, 2, SwingConfig.PADDING));
    componentRepository.getProgressBarUpdater().setProgressBar(progressBar);
    JPanel progressBarPanel = new JPanel();
    progressBarPanel.add(progressBar);
    counterLine.add(progressBarPanel, BorderLayout.CENTER);

    counterLine.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    this.add(counterLine, BorderLayout.SOUTH);

    tableModel.addTableModelListener(new ColumnCountListener(fileCounter));
    tableModel.addTableModelListener(errorCounter);
    componentRepository.getResetDispatcher().addResetable(fileCounter);
    componentRepository.getSearchBaseListener().addResetable(fileCounter);
    componentRepository.getOperationCallBackListener().addComponentStartReseted(fileCounter,
            OperationType.FIND);
    componentRepository.getResetDispatcher().addResetable(errorCounter);
    componentRepository.getSearchBaseListener().addResetable(errorCounter);

    viewAction = new ActionView(componentRepository, config);
}