protected JScrollPane embeddInScrollPane(JTable table) {
   JScrollPane pane = new JScrollPane(table);
   pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   adjustmentSynchronizer.participateInSynchronizedScrolling(pane.getVerticalScrollBar());
   return pane;
 }
示例#2
0
文件: ListMerger.java 项目: kuny/josm
  protected void build() {
    setLayout(new GridBagLayout());
    GridBagConstraints gc = new GridBagConstraints();

    // ------------------
    gc.gridx = 0;
    gc.gridy = 0;
    gc.gridwidth = 1;
    gc.gridheight = 1;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.CENTER;
    gc.weightx = 0.0;
    gc.weighty = 0.0;
    gc.insets = new Insets(10, 0, 0, 0);
    lblMyVersion = new JLabel(tr("My version"));
    lblMyVersion.setToolTipText(tr("List of elements in my dataset, i.e. the local dataset"));
    add(lblMyVersion, gc);

    gc.gridx = 2;
    gc.gridy = 0;
    lblMergedVersion = new JLabel(tr("Merged version"));
    lblMergedVersion.setToolTipText(
        tr(
            "List of merged elements. They will replace the list of my elements when the merge decisions are applied."));
    add(lblMergedVersion, gc);

    gc.gridx = 4;
    gc.gridy = 0;
    lblTheirVersion = new JLabel(tr("Their version"));
    lblTheirVersion.setToolTipText(
        tr("List of elements in their dataset, i.e. the server dataset"));
    add(lblTheirVersion, gc);

    // ------------------------------
    gc.gridx = 0;
    gc.gridy = 1;
    gc.gridwidth = 1;
    gc.gridheight = 1;
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.anchor = GridBagConstraints.FIRST_LINE_START;
    gc.weightx = 0.33;
    gc.weighty = 0.0;
    gc.insets = new Insets(0, 0, 0, 0);
    JCheckBox cbLockMyScrolling = new JCheckBox();
    cbLockMyScrolling.setName("checkbox.lockmyscrolling");
    add(buildAdjustmentLockControlPanel(cbLockMyScrolling), gc);

    gc.gridx = 2;
    gc.gridy = 1;
    JCheckBox cbLockMergedScrolling = new JCheckBox();
    cbLockMergedScrolling.setName("checkbox.lockmergedscrolling");
    add(buildAdjustmentLockControlPanel(cbLockMergedScrolling), gc);

    gc.gridx = 4;
    gc.gridy = 1;
    JCheckBox cbLockTheirScrolling = new JCheckBox();
    cbLockTheirScrolling.setName("checkbox.locktheirscrolling");
    add(buildAdjustmentLockControlPanel(cbLockTheirScrolling), gc);

    // --------------------------------
    gc.gridx = 0;
    gc.gridy = 2;
    gc.gridwidth = 1;
    gc.gridheight = 1;
    gc.fill = GridBagConstraints.BOTH;
    gc.anchor = GridBagConstraints.FIRST_LINE_START;
    gc.weightx = 0.33;
    gc.weighty = 1.0;
    gc.insets = new Insets(0, 0, 0, 0);
    JScrollPane pane = buildMyElementsTable();
    adjustmentSynchronizer.adapt(cbLockMyScrolling, pane.getVerticalScrollBar());
    add(pane, gc);

    gc.gridx = 1;
    gc.gridy = 2;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.CENTER;
    gc.weightx = 0.0;
    gc.weighty = 0.0;
    add(buildLeftButtonPanel(), gc);

    gc.gridx = 2;
    gc.gridy = 2;
    gc.fill = GridBagConstraints.BOTH;
    gc.anchor = GridBagConstraints.FIRST_LINE_START;
    gc.weightx = 0.33;
    gc.weighty = 0.0;
    pane = buildMergedElementsTable();
    adjustmentSynchronizer.adapt(cbLockMergedScrolling, pane.getVerticalScrollBar());
    add(pane, gc);

    gc.gridx = 3;
    gc.gridy = 2;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.CENTER;
    gc.weightx = 0.0;
    gc.weighty = 0.0;
    add(buildRightButtonPanel(), gc);

    gc.gridx = 4;
    gc.gridy = 2;
    gc.fill = GridBagConstraints.BOTH;
    gc.anchor = GridBagConstraints.FIRST_LINE_START;
    gc.weightx = 0.33;
    gc.weighty = 0.0;
    pane = buildTheirElementsTable();
    adjustmentSynchronizer.adapt(cbLockTheirScrolling, pane.getVerticalScrollBar());
    add(pane, gc);

    // ----------------------------------
    gc.gridx = 2;
    gc.gridy = 3;
    gc.gridwidth = 1;
    gc.gridheight = 1;
    gc.fill = GridBagConstraints.BOTH;
    gc.anchor = GridBagConstraints.CENTER;
    gc.weightx = 0.0;
    gc.weighty = 0.0;
    add(buildMergedListControlButtons(), gc);

    // -----------------------------------
    gc.gridx = 0;
    gc.gridy = 4;
    gc.gridwidth = 2;
    gc.gridheight = 1;
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.anchor = GridBagConstraints.LINE_START;
    gc.weightx = 0.0;
    gc.weighty = 0.0;
    add(buildComparePairSelectionPanel(), gc);

    gc.gridx = 2;
    gc.gridy = 4;
    gc.gridwidth = 3;
    gc.gridheight = 1;
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.anchor = GridBagConstraints.LINE_START;
    gc.weightx = 0.0;
    gc.weighty = 0.0;
    add(buildFrozeStateControlPanel(), gc);

    wireActionsToSelectionModels();
  }