コード例 #1
0
  public AncestralStatesPanel(BeautiFrame parent) {

    super();

    this.frame = parent;

    partitionTableModel = new PartitionTableModel();
    partitionTable = new JTable(partitionTableModel);

    partitionTable.getTableHeader().setReorderingAllowed(false);
    partitionTable.getTableHeader().setResizingAllowed(false);
    //        modelTable.getTableHeader().setDefaultRenderer(
    //                new HeaderRenderer(SwingConstants.LEFT, new Insets(0, 4, 0, 4)));

    final TableColumnModel model = partitionTable.getColumnModel();
    final TableColumn tableColumn0 = model.getColumn(0);

    TableEditorStopper.ensureEditingStopWhenTableLosesFocus(partitionTable);

    partitionTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    partitionTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent evt) {
                selectionChanged();
              }
            });

    JScrollPane scrollPane =
        new JScrollPane(
            partitionTable,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setOpaque(false);

    JPanel panel = new JPanel(new BorderLayout(0, 0));
    panel.setOpaque(false);
    panel.add(scrollPane, BorderLayout.CENTER);
    panel.setMinimumSize(new Dimension(MINIMUM_TABLE_WIDTH, 0));

    optionsPanelParent = new JPanel(new FlowLayout(FlowLayout.CENTER));
    optionsPanelParent.setOpaque(false);
    optionsBorder = new TitledBorder("Ancestral state options:");
    optionsPanelParent.setBorder(optionsBorder);

    setCurrentPartition(null);

    JScrollPane scrollPane2 =
        new JScrollPane(
            optionsPanelParent,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane2.setOpaque(false);
    scrollPane2.setBorder(null);
    scrollPane2.getViewport().setOpaque(false);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel, scrollPane2);
    splitPane.setDividerLocation(MINIMUM_TABLE_WIDTH);
    splitPane.setContinuousLayout(true);
    splitPane.setBorder(BorderFactory.createEmptyBorder());
    splitPane.setOpaque(false);

    setOpaque(false);
    setBorder(new BorderUIResource.EmptyBorderUIResource(new Insets(12, 12, 12, 12)));
    setLayout(new BorderLayout(0, 0));
    add(splitPane, BorderLayout.CENTER);
  }
コード例 #2
0
  public ListSelectionDemo() {
    super(new BorderLayout());

    String[] listData = {"one", "two", "three", "four", "five", "six", "seven"};
    String[] columnNames = {"French", "Spanish", "Italian"};
    list = new JList(listData);

    listSelectionModel = list.getSelectionModel();
    listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
    JScrollPane listPane = new JScrollPane(list);

    JPanel controlPane = new JPanel();
    String[] modes = {
      "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION"
    };

    final JComboBox comboBox = new JComboBox(modes);
    comboBox.setSelectedIndex(2);
    comboBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String newMode = (String) comboBox.getSelectedItem();
            if (newMode.equals("SINGLE_SELECTION")) {
              listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) {
              listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
            } else {
              listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
            }
            output.append("----------" + "Mode: " + newMode + "----------" + newline);
          }
        });
    controlPane.add(new JLabel("Selection mode:"));
    controlPane.add(comboBox);

    // Build output area.
    output = new JTextArea(1, 10);
    output.setEditable(false);
    JScrollPane outputPane =
        new JScrollPane(
            output,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    // Do the layout.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    add(splitPane, BorderLayout.CENTER);

    JPanel topHalf = new JPanel();
    topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.LINE_AXIS));
    JPanel listContainer = new JPanel(new GridLayout(1, 1));
    listContainer.setBorder(BorderFactory.createTitledBorder("List"));
    listContainer.add(listPane);

    topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
    topHalf.add(listContainer);
    // topHalf.add(tableContainer);

    topHalf.setMinimumSize(new Dimension(100, 50));
    topHalf.setPreferredSize(new Dimension(100, 110));
    splitPane.add(topHalf);

    JPanel bottomHalf = new JPanel(new BorderLayout());
    bottomHalf.add(controlPane, BorderLayout.PAGE_START);
    bottomHalf.add(outputPane, BorderLayout.CENTER);
    // XXX: next line needed if bottomHalf is a scroll pane:
    // bottomHalf.setMinimumSize(new Dimension(400, 50));
    bottomHalf.setPreferredSize(new Dimension(450, 135));
    splitPane.add(bottomHalf);
  }
コード例 #3
0
  /** the JbInit method */
  public void jbInit() throws Exception {
    // Layout definition for this panel
    dataPanel.setLayout(panelLayout);
    dataPanel.setMinimumSize(new Dimension(100, 100));
    this.setLayout(borderLayout);
    this.setSize(new Dimension(862, 514));
    this.setPreferredSize(new Dimension(479, 306));
    this.setMinimumSize(new Dimension(479, 306));
    this.setMaximumSize(new Dimension(479, 306));
    mIdtraslo.setDocument((Document) panelBinding.bindUIControl("Idtraslo", mIdtraslo));
    mIdtraslo.setEditable(false);
    mDescrip.setFocusable(false);
    mDescrip.setEditable(false);
    mEstadotraslotxt.setFocusable(false);
    mEstadopasillotxt.setFocusable(false);
    mEstadoprocesotraslotxt.setFocusable(false);
    mDescripvisualEntrada.setFocusable(false);
    mDescripvisualSalida.setFocusable(false);
    mPasilloactual.setFocusable(false);
    mPasillodestino.setFocusable(true);
    mPosplc.setFocusable(false);
    jCheckBoxTrasbordoEntrada.setText("Trasbord Entradas");
    jCheckBoxTrasbordoEntrada.setToolTipText(
        "Realitzar trasbord per ubicar containers en entrada de passadis");
    dataPanel.add(
        labelIdtraslo,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mIdtraslo,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelIdtraslo.setLabelFor(mIdtraslo);
    mIdtraslo.setColumns(5);
    labelIdtraslo.setText(panelBinding.findCtrlValueBinding("Idtraslo").getLabel());
    mIdtraslo.setToolTipText(panelBinding.findCtrlValueBinding("Idtraslo").getTooltip());
    mDescrip.setDocument((Document) panelBinding.bindUIControl("Descrip", mDescrip));
    dataPanel.add(
        labelDescrip,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mDescrip,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelDescrip.setLabelFor(mDescrip);
    mDescrip.setColumns(15);
    labelDescrip.setText(panelBinding.findCtrlValueBinding("Descrip").getLabel());
    mDescrip.setToolTipText(panelBinding.findCtrlValueBinding("Descrip").getTooltip());
    mEstadotraslotxt.setDocument(
        (Document) panelBinding.bindUIControl("Estadotraslotxt", mEstadotraslotxt));
    dataPanel.add(
        labelEstadotraslotxt,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mEstadotraslotxt,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelEstadotraslotxt.setLabelFor(mEstadotraslotxt);
    mEstadotraslotxt.setColumns(20);
    labelEstadotraslotxt.setText(panelBinding.findCtrlValueBinding("Estadotraslotxt").getLabel());
    mEstadotraslotxt.setToolTipText(
        panelBinding.findCtrlValueBinding("Estadotraslotxt").getTooltip());
    mEstadopasillotxt.setDocument(
        (Document) panelBinding.bindUIControl("Estadopasillotxt", mEstadopasillotxt));
    dataPanel.add(
        labelEstadopasillotxt,
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mEstadopasillotxt,
        new GridBagConstraints(
            1,
            3,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelEstadopasillotxt.setLabelFor(mEstadopasillotxt);
    mEstadopasillotxt.setColumns(20);
    labelEstadopasillotxt.setText(panelBinding.findCtrlValueBinding("Estadopasillotxt").getLabel());
    mEstadopasillotxt.setToolTipText(
        panelBinding.findCtrlValueBinding("Estadopasillotxt").getTooltip());
    mEstadoprocesotraslotxt.setDocument(
        (Document) panelBinding.bindUIControl("Estadoprocesotraslotxt", mEstadoprocesotraslotxt));
    dataPanel.add(
        labelEstadoprocesotraslotxt,
        new GridBagConstraints(
            0,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mEstadoprocesotraslotxt,
        new GridBagConstraints(
            1,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelEstadoprocesotraslotxt.setLabelFor(mEstadoprocesotraslotxt);
    mEstadoprocesotraslotxt.setColumns(20);
    labelEstadoprocesotraslotxt.setText(
        panelBinding.findCtrlValueBinding("Estadoprocesotraslotxt").getLabel());
    mEstadoprocesotraslotxt.setToolTipText(
        panelBinding.findCtrlValueBinding("Estadoprocesotraslotxt").getTooltip());
    mDescripvisualEntrada.setDocument(
        (Document) panelBinding.bindUIControl("DescripvisualEntrada", mDescripvisualEntrada));
    dataPanel.add(
        labelDescripvisualEntrada,
        new GridBagConstraints(
            0,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mDescripvisualEntrada,
        new GridBagConstraints(
            1,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelDescripvisualEntrada.setLabelFor(mDescripvisualEntrada);
    mDescripvisualEntrada.setColumns(20);
    labelDescripvisualEntrada.setText(
        panelBinding.findCtrlValueBinding("DescripvisualEntrada").getLabel());
    mDescripvisualEntrada.setToolTipText(
        panelBinding.findCtrlValueBinding("DescripvisualEntrada").getTooltip());
    mDescripvisualSalida.setDocument(
        (Document) panelBinding.bindUIControl("DescripvisualSalida", mDescripvisualSalida));
    dataPanel.add(
        labelDescripvisualSalida,
        new GridBagConstraints(
            0,
            6,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mDescripvisualSalida,
        new GridBagConstraints(
            1,
            6,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelDescripvisualSalida.setLabelFor(mDescripvisualSalida);
    mDescripvisualSalida.setColumns(20);
    labelDescripvisualSalida.setText(
        panelBinding.findCtrlValueBinding("DescripvisualSalida").getLabel());
    mDescripvisualSalida.setToolTipText(
        panelBinding.findCtrlValueBinding("DescripvisualSalida").getTooltip());
    mPasilloactual.setDocument(
        (Document) panelBinding.bindUIControl("Pasilloactual", mPasilloactual));
    dataPanel.add(
        labelPasilloactual,
        new GridBagConstraints(
            0,
            7,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mPasilloactual,
        new GridBagConstraints(
            1,
            7,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelPasilloactual.setLabelFor(mPasilloactual);
    mPasilloactual.setColumns(3);
    labelPasilloactual.setText(panelBinding.findCtrlValueBinding("Pasilloactual").getLabel());
    mPasilloactual.setToolTipText(panelBinding.findCtrlValueBinding("Pasilloactual").getTooltip());
    mPasillodestino.setDocument(
        (Document) panelBinding.bindUIControl("Pasillodestino", mPasillodestino));
    dataPanel.add(
        labelPasillodestino,
        new GridBagConstraints(
            0,
            8,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mPasillodestino,
        new GridBagConstraints(
            1,
            8,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelPasillodestino.setLabelFor(mPasillodestino);
    mPasillodestino.setColumns(3);
    labelPasillodestino.setText(panelBinding.findCtrlValueBinding("Pasillodestino").getLabel());
    mPasillodestino.setToolTipText(
        panelBinding.findCtrlValueBinding("Pasillodestino").getTooltip());
    mPosplc.setDocument((Document) panelBinding.bindUIControl("Posplc", mPosplc));
    dataPanel.add(
        labelPosplc,
        new GridBagConstraints(
            0,
            9,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mPosplc,
        new GridBagConstraints(
            1,
            9,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    // dataPanel.add(buttonArrancar, new GridBagConstraints(0, 10, 3, 2, 0.0, 0.0,
    // GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 22, 63), -98, -13));
    dataPanel.add(
        buttonArrancar,
        new GridBagConstraints(
            0,
            10,
            3,
            2,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 5, 5),
            0,
            0));
    // dataPanel.add(jCheckBoxTrasbordoEntrada, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0,
    // GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    labelPosplc.setLabelFor(mPosplc);
    mPosplc.setColumns(5);
    labelPosplc.setText(panelBinding.findCtrlValueBinding("Posplc").getLabel());

    // Layout the datapanel and the navigation bar
    mPosplc.setToolTipText(panelBinding.findCtrlValueBinding("Posplc").getTooltip());
    add(dataPanel, BorderLayout.CENTER);

    navBar.setModel(
        JUNavigationBar.createViewBinding(
            panelBinding, navBar, "SgavtrasloEntSalView1", null, "SgavtrasloEntSal1Iter"));
    statusBar.setModel(JUStatusBar.createPanelBinding(panelBinding, statusBar));
    add(navBar, BorderLayout.NORTH);
    add(statusBar, BorderLayout.SOUTH);

    // Quitar botones de add / remove
    navBar.remove(navBar.getButton(JUNavigationBar.BUTTON_DELETE));
    navBar.remove(navBar.getButton(JUNavigationBar.BUTTON_INSERT));
    jCheckBoxTrasbordoEntrada.setModel(
        (ButtonModel) panelBinding.bindUIControl("Trasbordoentrada", jCheckBoxTrasbordoEntrada));
    if (getIdTraslo() == 0) jCheckBoxTrasbordoEntrada.setEnabled(false);
  }