示例#1
0
  public JScrollBarExample() {
    jpnl = new JPanel();
    jpnl.setLayout(new FlowLayout());
    jsbR = new JScrollBar(JScrollBar.VERTICAL, 10, 0, 0, 255);
    jsbG = new JScrollBar(JScrollBar.VERTICAL, 20, 0, 0, 255);
    jsbB = new JScrollBar(JScrollBar.VERTICAL, 150, 0, 0, 255);

    Rtxt = new JLabel("R Value = " + jsbR.getValue());
    Gtxt = new JLabel("G Value = " + jsbG.getValue());
    Btxt = new JLabel("B Value = " + jsbB.getValue());

    jsbR.setPreferredSize(new Dimension(20, 200));
    jsbG.setPreferredSize(new Dimension(20, 200));
    jsbB.setPreferredSize(new Dimension(20, 200));

    jpnl.add(jsbR);
    jpnl.add(Rtxt);
    jpnl.add(jsbG);
    jpnl.add(Gtxt);
    jpnl.add(jsbB);
    jpnl.add(Btxt);

    jsbR.addAdjustmentListener(this);
    jsbG.addAdjustmentListener(this);
    jsbB.addAdjustmentListener(this);

    R = new Color(jsbR.getValue(), jsbG.getValue(), jsbB.getValue());
    jpnl.setBackground(R);

    add(jpnl);

    setSize(width, height);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
示例#2
0
  public void init() {
    if (destroyed) {
      return;
    }

    resultPanel = new ResultPanel();

    plotPanel.setLayout(new GridLayout(1, 0));
    plotButton = new JToggleButton[plotButtonName.length];
    for (int i = 0; i < plotButton.length; i++) {
      plotButton[i] = new JToggleButton(plotButtonName[i]);
      plotButton[i].addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              resultPanel.repaint();
            }
          });
      plotPanel.add(plotButton[i]);
    }
    plotButton[0].setSelected(true);
    plotButton[4].setSelected(true);

    GridBagLayout g = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    mainPanel.setLayout(g);
    c.fill = GridBagConstraints.BOTH;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0;
    c.weighty = 0.0;
    mainPanel.add(plotPanel, c);
    yField.setEditable(false);
    callsField.setEditable(false);
    JPanel panel = new JPanel(new GridLayout(1, 2));
    panel.add(yField);
    panel.add(callsField);
    mainPanel.add(panel, c);
    mainPanel.add(zoomXBar, c);
    c.gridwidth = 3;
    c.weightx = 1.0;
    c.weighty = 1.0;
    mainPanel.add(resultPanel, c);
    c.weightx = 0.0;
    mainPanel.add(zoomYBar, c);
    mainPanel.add(shiftYBar, c);

    AdjustmentListener listener =
        new AdjustmentListener() {
          public void adjustmentValueChanged(AdjustmentEvent e) {
            resultPanel.repaint();
          }
        };
    zoomXBar.addAdjustmentListener(listener);
    zoomYBar.addAdjustmentListener(listener);
    shiftYBar.addAdjustmentListener(listener);

    frame.getContentPane().add(mainPanel);

    frame.setVisible(true);
  }
  private void initListener() {
    //        MyMouseEventListener myMouseEventlistener = new MyMouseEventListener(glassPane,
    // pannelloPrincipale, this, split);
    //        glassPane.getView().addMouseListener(myMouseEventlistener);
    //        glassPane.getView().addMouseMotionListener(myMouseEventlistener);

    JScrollBar jScrollBarHorizontal = scrollSource.getHorizontalScrollBar();
    JScrollBar jScrollBarVertical = scrollSource.getVerticalScrollBar();
    ScrollPaneAdjustmentListener my =
        new ScrollPaneAdjustmentListener(
            this, sourceSchemaTree, glassPane, sourceSchemaTree, "source");
    jScrollBarHorizontal.addAdjustmentListener(my);
    jScrollBarVertical.addAdjustmentListener(my);

    JScrollBar jScrollBarHorizontalTarget = scrollTarget.getHorizontalScrollBar();
    JScrollBar jScrollBarVerticalTarget = scrollTarget.getVerticalScrollBar();
    ScrollPaneAdjustmentListener my2 =
        new ScrollPaneAdjustmentListener(
            this, targetSchemaTree, glassPane, targetSchemaTree, "target");
    jScrollBarHorizontalTarget.addAdjustmentListener(my2);
    jScrollBarVerticalTarget.addAdjustmentListener(my2);

    sourceSchemaTree
        .getSelectionModel()
        .addTreeSelectionListener(
            new TreeSelectionListener() {

              public void valueChanged(TreeSelectionEvent e) {
                moveToFront(glassPane);
              }
            });

    this.sourceSchemaTree.addTreeExpansionListener(
        new WidgetMoveExpansionListener(
            this, sourceSchemaTree, glassPane, sourceSchemaTree, "source"));
    this.targetSchemaTree.addTreeExpansionListener(
        new WidgetMoveExpansionListener(
            this, targetSchemaTree, glassPane, targetSchemaTree, "target"));

    //        this.sourceSchemaTree.addTreeSelectionListener(new
    // ConstraintColoringTreeSelectionListener(Costanti.CONNECTION_CONSTRAINT_SOURCE));
    //        this.targetSchemaTree.addTreeSelectionListener(new
    // ConstraintColoringTreeSelectionListener(Costanti.CONNECTION_CONSTRAINT_TARGET));

    initListenerSplit();
    //        creaPopUpSource();
    //        creaPopUpTarget();
  }
示例#4
0
  private void init() {
    JScrollBar o;
    JScrollBar r;

    // Synchronize the horizontal scrollbars:
    o = filePanelLeft.getScrollPane().getHorizontalScrollBar();
    r = filePanelRight.getScrollPane().getHorizontalScrollBar();
    r.addAdjustmentListener(getHorizontalAdjustmentListener());
    o.addAdjustmentListener(getHorizontalAdjustmentListener());

    // Synchronize the vertical scrollbars:
    o = filePanelLeft.getScrollPane().getVerticalScrollBar();
    r = filePanelRight.getScrollPane().getVerticalScrollBar();
    r.addAdjustmentListener(getVerticalAdjustmentListener());
    o.addAdjustmentListener(getVerticalAdjustmentListener());
  }
  public ImageIndexControlPanel(ImagePresentationModel model) {
    super(new GridBagLayout());

    if (model == null) throw new IllegalArgumentException("model cannot be null.");

    mChannelLabel = createLabel(0);
    mChannelScrollBar = createScrollBar(0);

    mZPlaneLabel = createLabel(1);
    mZPlaneScrollBar = createScrollBar(1);

    mTimePointLabel = createLabel(2);
    mTimePointScrollBar = createScrollBar(2);

    mModel = model;

    mModel.addListener(
        new Listener() {
          @Override
          public void onVisibleImageContentUpdate() {}

          @Override
          public void onImageChange() {
            refreshInfo();
          }
        });

    mChannelScrollBar.addAdjustmentListener(
        e -> {
          mModel.setCurrentChannel(e.getValue());
          refreshInfo();
        });

    mZPlaneScrollBar.addAdjustmentListener(
        e -> {
          mModel.setCurrentZPlane(e.getValue());
          refreshInfo();
        });

    mTimePointScrollBar.addAdjustmentListener(
        e -> {
          mModel.setCurrentTimePoint(e.getValue());
          refreshInfo();
        });

    setHotKeys();
  }
 public void setScrollPane(JScrollPane parent) {
   this.parent = parent;
   JScrollBar jsb = parent.getVerticalScrollBar();
   jsb.addAdjustmentListener(
       new AdjustmentListener() {
         @Override
         public void adjustmentValueChanged(AdjustmentEvent ae) {
           if (!ae.getValueIsAdjusting() && autoscroll) {
             jsb.setValue(jsb.getMaximum());
           }
         }
       });
 }
示例#7
0
  private void addControls() {
    setLayout(new BorderLayout());

    scrollBar = new JScrollBar(JScrollBar.VERTICAL);

    table = new JTable(this);
    add(
        new JScrollPane(
            table,
            JScrollPane.VERTICAL_SCROLLBAR_NEVER,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED));
    add(scrollBar, BorderLayout.EAST);

    scrollBar.addAdjustmentListener(this);
    scrollBar.setMinimum(0);
  }
    public void afterPanelsAdded() {
      myLeftScroll.setMinimum(0);
      myLeftScroll.setMaximum(myMaxColumnsLeft);
      myLeftScroll.addAdjustmentListener(
          new AdjustmentListener() {
            @Override
            public void adjustmentValueChanged(AdjustmentEvent e) {
              myInScrolling = true;

              final int scrollPosCorrected = myLeftScroll.getValue() + 1;
              if (myByLeft) {
                scrollMain(myLeftScroll.getValue(), myLeftModels);
                scrollOther(scrollPosCorrected, myMaxColumnsLeft, myMaxColumnsRight, myRightModels);
              } else {
                scrollMain(myLeftScroll.getValue(), myRightModels);
                scrollOther(scrollPosCorrected, myMaxColumnsRight, myMaxColumnsLeft, myLeftModels);
              }
              myInScrolling = false;
            }
          });
    }
示例#9
0
    public BallControlUsingThread() {
      // Group buttons in a panel
      JPanel panel = new JPanel();
      panel.add(jbtSuspend);
      panel.add(jbtResume);
      panel.add(jbtAdd);
      panel.add(jbtSubtract);

      // Add ball and buttons to the panel
      ball.setBorder(new javax.swing.border.LineBorder(Color.red));
      jsbDelay.setOrientation(JScrollBar.HORIZONTAL);
      ball.setDelay(jsbDelay.getMaximum());
      setLayout(new BorderLayout());
      add(jsbDelay, BorderLayout.NORTH);
      add(ball, BorderLayout.CENTER);
      add(panel, BorderLayout.SOUTH);

      // Register listeners
      jbtSuspend.addActionListener(this);
      jbtResume.addActionListener(this);
      jbtAdd.addActionListener(this);
      jbtSubtract.addActionListener(this);
      jsbDelay.addAdjustmentListener(this);
    }
示例#10
0
 /*
  * call in constructor only
  */
 private JScrollBar createScrollBar() {
   _frameStart = 0;
   _bar = new JScrollBar(JScrollBar.VERTICAL, _frameStart, 10, 0, _virtualSize);
   _bar.addAdjustmentListener(new MyAdjustmentListener(_bar));
   return _bar;
 }
  public MetaDataDeclarationEditor(AbstractDataReader reader, final boolean showMetaDataEditor) {
    super(new BorderLayout());

    backGroundGray = this.getBackground();

    this.reader = reader;

    metadataTable = new MetaDataTable();

    previewTable = new PreviewTable();

    ExtendedJScrollPane metadataPane = new ExtendedJScrollPane(metadataTable);

    ExtendedJScrollPane dataPane =
        new ExtendedJScrollPane(previewTable) {

          private static final long serialVersionUID = 1L;

          // Only show column header if there is no MetaDataTable
          @Override
          public void setColumnHeaderView(Component view) {
            if (!showMetaDataEditor) {
              super.setColumnHeaderView(view);
            }
          } // alternative work around: dataPane.setColumnHeader(null);
        };

    metadataColumnListener =
        new TableColumnModelListener() {

          @Override
          public void columnSelectionChanged(ListSelectionEvent e) {}

          @Override
          public void columnRemoved(TableColumnModelEvent e) {}

          @Override
          public void columnMoved(TableColumnModelEvent e) {}

          @Override
          public void columnMarginChanged(ChangeEvent e) {
            assert previewTable.getColumnCount() == metadataTable.getColumnCount();
            for (int i = 0; i < previewTable.getColumnCount(); i++) {
              int columnwidth = metadataTable.getColumnModel().getColumn(i).getWidth();
              int oldwidth = previewTable.getColumnModel().getColumn(i).getPreferredWidth();
              if (oldwidth == columnwidth) {
                continue;
              }
              previewTable.getColumnModel().getColumn(i).setPreferredWidth(columnwidth);
            }
            previewTable.doLayout();
            previewTable.repaint();
          }

          @Override
          public void columnAdded(TableColumnModelEvent e) {}
        };

    if (showMetaDataEditor) {

      metadataPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

      // synchronize the the scroll bars:
      metadataPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
      JScrollBar bar = metadataPane.getVerticalScrollBar();
      JScrollBar dummyBar =
          new JScrollBar() {

            private static final long serialVersionUID = 1L;

            @Override
            public void paint(Graphics g) {
              // Color c = getParent().getBackground();
              g.setColor(backGroundGray);
              g.fillRect(0, 0, this.getSize().width, this.getSize().height);
            }
          };

      dummyBar.setPreferredSize(bar.getPreferredSize());
      metadataPane.setVerticalScrollBar(dummyBar);

      final JScrollBar bar1 = metadataPane.getHorizontalScrollBar();
      JScrollBar bar2 = dataPane.getHorizontalScrollBar();
      bar2.addAdjustmentListener(
          new AdjustmentListener() {

            @Override
            public void adjustmentValueChanged(AdjustmentEvent e) {
              bar1.setValue(e.getValue());
            }
          });

      /*
       * Synchronize the column margins if they are changed:
       */

      // propagate metadataTable margin changes to previewTable:
      metadataTable.getColumnModel().addColumnModelListener(metadataColumnListener);

      metadataPane.setPreferredSize(new Dimension(400, 103)); // ugly
      this.add(metadataPane, BorderLayout.NORTH);
    }

    this.add(dataPane, BorderLayout.CENTER);
    this.doLayout();

    updateQueue.start();
  }
示例#12
0
  private static JSplitPane createSplitPane() {
    // Help tab is used by drawing view. Initialize it first
    // helpTab = new JScrollPane(new HelpView());

    // helpTab = new HelpView();
    recognizedTab = new JScrollPane(new RecognizedView());

    // 25-09-09
    helpDrawingView = new HelpDrawingView();
    helpSubTab = helpDrawingView.DrawingWindow();

    helpRecognizeView = new HelpRecognizeView();
    helpRecognizeTab = helpRecognizeView.constraintWindow();

    dv = new DrawingView();
    drawingTab = new JScrollPane(dv);
    drawingTab.setFocusable(true);

    // add Scrollbar adjustment listener to Drawing Window - horizontal and vertical

    final JScrollBar drawHrBar = ((JScrollPane) drawingTab).getHorizontalScrollBar();
    drawHrBar.setMaximum(100);
    AdjustmentListener hListener =
        new AdjustmentListener() {
          public void adjustmentValueChanged(AdjustmentEvent e) {
            hs.setXMoved(((Adjustable) e.getSource()).getValue());
          }
        };

    drawHrBar.addAdjustmentListener(hListener);

    final JScrollBar drawVerBar = ((JScrollPane) drawingTab).getVerticalScrollBar();
    AdjustmentListener vListener =
        new AdjustmentListener() {
          public void adjustmentValueChanged(AdjustmentEvent e) {
            vs.setYMoved(((Adjustable) e.getSource()).getValue());
          }
        };

    drawVerBar.addAdjustmentListener(vListener);

    vs = new VerticalScale();
    verticalScale = new JScrollPane(vs);
    verticalScale.setFocusable(true);

    tc = new TempClass(); // just a filler above Vertical Scale
    tempclass = new JScrollPane(tc);
    tempclass.setFocusable(true);

    hs = new HorizontalScale(); // horizontal divider
    horizontalScale = new JScrollPane(hs);
    horizontalScale.setFocusable(true);

    m_LeftSplitPane =
        createSplitPane(
            JSplitPane.VERTICAL_SPLIT, tempclass, verticalScale, TOP_HORIZONTAL_DIVIDER);

    m_hzScaleDrawView =
        createSplitPane(
            JSplitPane.VERTICAL_SPLIT, horizontalScale, drawingTab, TOP_HORIZONTAL_DIVIDER);

    m_vtScaleDraw =
        createSplitPane(
            JSplitPane.HORIZONTAL_SPLIT, m_LeftSplitPane, m_hzScaleDrawView, LEFT_VERTICAL_DIVIDER);

    // m_upperPane = createSplitPane(JSplitPane.HORIZONTAL_SPLIT, m_vtScaleDraw,helpSubTab,
    // RIGHT_VERTICAL_DIVIDER);

    m_LowerPane =
        createSplitPane(JSplitPane.VERTICAL_SPLIT, m_vtScaleDraw, recognizedTab, BOTTOM_DIVIDER);

    m_splitpane =
        createSplitPane(
            JSplitPane.HORIZONTAL_SPLIT, m_LowerPane, helpSubTab, RIGHT_VERTICAL_DIVIDER);
    // m_splitpane.setResizeWeight(0.7);

    return m_splitpane;
  }
示例#13
0
  /** Creates new form FenetreJeu */
  public FenetreJeu() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | UnsupportedLookAndFeelException ex) {
      Logger.getLogger(FenetreConnexion.class.getName()).log(Level.SEVERE, null, ex);
    }
    initComponents();
    afficheurHTML.setEditorKit(
        new HTMLEditorKit() {

          @Override
          public ViewFactory getViewFactory() {

            return new HTMLFactory() {

              @Override
              public View create(Element e) {
                View v = super.create(e);
                // if(v.getClass().getName().equals("javax.swing.text.html.InlineView")){
                /*
                   * if(v instanceof InlineView){ return new
                   * InlineView(e){ public int getBreakWeight(int axis,
                   * float pos, float len) { return GoodBreakWeight; }
                   * public View breakView(int axis, int p0, float pos,
                   * float len) { if(axis == View.X_AXIS) {
                   * checkPainter(); int p1 =
                   * getGlyphPainter().getBoundedPosition(this, p0, pos,
                   * len); if(p0 == getStartOffset() && p1 ==
                   * getEndOffset()) { return this; } return
                   * createFragment(p0, p1); } return this; } };
                }
                   */
                if (v instanceof ParagraphView) {
                  return new ParagraphView(e) {

                    @Override
                    protected SizeRequirements calculateMinorAxisRequirements(
                        int axis, SizeRequirements r) {
                      if (r == null) {
                        r = new SizeRequirements();
                      }
                      float pref = layoutPool.getPreferredSpan(axis);
                      float min = layoutPool.getMinimumSpan(axis);
                      // Don't include insets, Box.getXXXSpan will include them.
                      r.minimum = (int) min;
                      r.preferred = Math.max(r.minimum, (int) pref);
                      r.maximum = Integer.MAX_VALUE;
                      r.alignment = 0.5f;
                      return r;
                    }
                  };
                }
                return v;
              }
            };
          }
        });
    /*
     * caret = (DefaultCaret) afficheurHTML.getCaret();
     * caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
     */

    /*
     * jScrollPane1.getVerticalScrollBar().addAdjustmentListener(new
     * AdjustmentListener() {
     *
     * BoundedRangeModel brm =
     * jScrollPane1.getVerticalScrollBar().getModel(); boolean wasAtBottom =
     * true;
     *
     * @Override public void adjustmentValueChanged(AdjustmentEvent e) { if
     * (!brm.getValueIsAdjusting()) { if (wasAtBottom) {
     * System.out.println(System.currentTimeMillis());
     * brm.setValue(brm.getMaximum()); } } else { wasAtBottom =
     * ((brm.getValue() + brm.getExtent()) == brm.getMaximum());
     * System.out.println(brm.getValue() + " "+brm.getExtent() + "
     * "+brm.getMaximum()); }
     *
     * }
     * });
     */

    /*
     * final JScrollBar scroll = jScrollPane1.getVerticalScrollBar();
     * scroll.addAdjustmentListener(new AdjustmentListener() {
     *
     * @Override public void adjustmentValueChanged(AdjustmentEvent e) {
     * boolean enbas = true; if
     * (jScrollPane1.getVerticalScrollBar().getValue() <
     * jScrollPane1.getVerticalScrollBar().getMaximum()) {
     * //System.out.println(jScrollPane1.getVerticalScrollBar().getValue() +
     * jScrollPane1.getVerticalScrollBar().getVisibleAmount() + " " +
     * jScrollPane1.getVerticalScrollBar().getMaximum()); if (enbas) {
     * scroll.setValue(scroll.getMaximum()); }
     *
     *
     * if (scroll.getValue() + scroll.getVisibleAmount() ==
     * scroll.getMaximum()) { enbas = true; System.out.println("en bas"); }
     * else { enbas = false; } } else { System.out.println("en bas"); } }
     * });
     */

    final JScrollBar scroll = jScrollPane1.getVerticalScrollBar();
    scroll.addAdjustmentListener(
        new AdjustmentListener() {

          @Override
          public void adjustmentValueChanged(AdjustmentEvent e) {
            /*if (!scrollVisible) {
                scroll.setValue(scroll.getMaximum() - scroll.getVisibleAmount());
                scrollVisible = true;
                enBas=true;
            }*/

            if (scrollAuto) {
              scroll.setValue(scroll.getMaximum() - scroll.getVisibleAmount());
              scrollAuto = false;
              enBas = true;
            }
            /*if(!enBas) {
                if(scroll.getValue() + scroll.getVisibleAmount() == scrollMax) enBas=true;
            }*/
            /*
             * else if(!scrollVisible || scroll.getValue() +
             * scroll.getVisibleAmount() == scroll.getMaximum()) {
             * enBas=true; } else enBas=false;
             */
          }
        });

    barreInput.requestFocus();
  }
示例#14
0
  public ContentView(final ContentPane control) {
    super(new GridLayout(1, 1));
    this.control = control;

    data = new JTable();
    data.setModel(model = new ContentModel(getControl().getQueryModel() == null));
    data.addMouseListener(popup = new ContentPopup(this));
    data.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent key) {
            if (key.getKeyCode() == KeyEvent.VK_DOWN || key.getKeyCode() == KeyEvent.VK_PAGE_DOWN) {
              if ((ContentView.this.data.getSelectedRow()
                      == ContentView.this.data.getRowCount() - 1)
                  && !control.areAllRowsFetched()) {
                int col = ContentView.this.data.getSelectedColumn();
                int row = ContentView.this.data.getRowCount() - 1;
                ContentView.this.data.scrollRectToVisible(
                    ContentView.this.data.getCellRect(row, col, true));
                ContentView.this.data.setRowSelectionInterval(row + 1, row + 1);
                ContentView.this.data.scrollRectToVisible(
                    ContentView.this.data.getCellRect(row + 1, col, true));
                key.consume();
              }
            }
          }
        });

    JScrollPane scroll = new JScrollPane(data);
    scroll.getViewport().setBackground(UIManager.getDefaults().getColor("Table.background"));
    add(scroll);
    jsb = scroll.getVerticalScrollBar();
    jsb.addAdjustmentListener(new ListenerScrollBar());

    data.setRowSelectionAllowed(false);
    data.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    data.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    data.setDefaultRenderer(Object.class, new InternalCellRenderer());
    data.getTableHeader().addMouseListener(popup);
    data.getTableHeader().setReorderingAllowed(false);

    lines = new LineNumberView();
    lines.addMouseListener(popup);
    lines.setSelectionModel(data.getSelectionModel());
    scroll.setRowHeaderView(lines);

    JLabel cUL = new JLabel("#", JLabel.CENTER);
    cUL.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    cUL.setFont(UIManager.getFont("TableHeader.font"));
    scroll.setCorner(JScrollPane.UPPER_LEFT_CORNER, cUL);

    JLabel cLL = new JLabel();
    cLL.setBorder(new CustomLineBorder(true, false, false, false));
    scroll.setCorner(JScrollPane.LOWER_LEFT_CORNER, cLL);

    data.getColumnModel().getSelectionModel().addListSelectionListener(this);

    data.getActionMap().put("copy", ((JMenuItem) popup.getSubElementsAt(1)).getAction());
    data.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK), "copy");

    data.getActionMap().put("paste", ((JMenuItem) popup.getSubElementsAt(2)).getAction());
    data.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK), "paste");

    data.getActionMap().put("set-null", ((JMenuItem) popup.getSubElementsAt(3)).getAction());
    data.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "set-null");

    MouseAdapter ma =
        new MouseAdapter() {
          public void mousePressed(MouseEvent me) {
            ContentView.this.data.setColumnSelectionAllowed(
                me.getSource() == ContentView.this.data.getTableHeader());
            ContentView.this.data.setRowSelectionAllowed(me.getSource() == ContentView.this.lines);
          }
        };

    data.getTableHeader().addMouseListener(ma);
    data.addMouseListener(ma);
    lines.addMouseListener(ma);
  }