Esempio n. 1
0
 private void init_tbl_chats() {
   tbl_chats_ALM = new ArrayListModel();
   tbl_chats_M = new TblchatsModel(tbl_chats_ALM);
   tbl_chats.setModel(tbl_chats_M);
   tbl_chats.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
   int[] tbl_widths_chats = {58, 100, 0, 0, 0};
   for (int i = 0, n = tbl_widths_chats.length; i < n; i++) {
     if (i == 1) {
       continue;
     }
     TableWidthUtilities.setColumnWidth(tbl_chats, i, tbl_widths_chats[i]);
   }
   Dimension d = tbl_chats.getTableHeader().getPreferredSize();
   d.height = 0;
   tbl_chats.getTableHeader().setPreferredSize(d);
   tbl_chats.getTableHeader().setFont(new java.awt.Font("Arial", 0, 12));
   tbl_chats.setRowHeight(65);
   tbl_chats.setFont(new java.awt.Font("Arial", 0, 12));
   tbl_chats.getColumnModel().getColumn(0).setCellRenderer(new TableRender.set2());
   tbl_chats.getColumnModel().getColumn(1).setCellRenderer(new TableRender.set3());
   tbl_chats.getTableHeader().setResizingAllowed(true);
   tbl_chats.setShowGrid(false);
   tbl_chats.setShowHorizontalLines(true);
   tbl_chats.setShowVerticalLines(false);
   tbl_chats.getColumnModel().getColumn(1).setCellRenderer(new Html());
 }
 protected void build(StatisticsTableModel model) {
   infoTable = new JTable(model, new StatisticsTableColumnModel());
   infoTable.setShowHorizontalLines(true);
   infoTable.setShowVerticalLines(false);
   infoTable.setEnabled(false);
   setLayout(new BorderLayout());
   add(infoTable, BorderLayout.CENTER);
 }
Esempio n. 3
0
  protected void addWidgets(DescriptorQueryList list, ActionMap actions, boolean captionsOnly) {
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createTitledBorder(caption));
    setBackground(AmbitColors.BrightClr);
    setForeground(AmbitColors.DarkClr);

    tableModel = new DescriptorQueryTableModel(list, captionsOnly);
    JTable table = new JTable(tableModel, createTableColumnModel(tableModel, captionsOnly));
    table.setSurrendersFocusOnKeystroke(true);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setRowSelectionAllowed(false);
    table.getTableHeader().setReorderingAllowed(false);
    table.setRowHeight(24);

    TableColumn col;

    int[] pSize = {32, 240, 32, 32, 64, 32, 32, 32};
    int[] mSize = {24, 120, 32, 32, 64, 32, 32, 32};
    for (int i = 0; i < table.getColumnCount(); i++) {
      col = table.getColumnModel().getColumn(i);
      col.setPreferredWidth(pSize[i]);
      col.setMinWidth(mSize[i]);
    }
    // table.setShowGrid(false);
    table.setShowHorizontalLines(true);
    table.setShowVerticalLines(false);

    scrollPane = new JScrollPane(table);
    scrollPane.setPreferredSize(new Dimension(420, 360));
    scrollPane.setMinimumSize(new Dimension(370, 120));
    scrollPane.setAutoscrolls(true);

    // tPane.addTab("Search descriptors",scrollPane);
    add(scrollPane, BorderLayout.CENTER);
    /*
    JToolBar t = new JToolBar();
    //t.setBackground(Color.white);
    t.setFloatable(false);
    //t.setBorder(BorderFactory.createTitledBorder("Search by descriptors and distance between atoms"));
    Object[] keys = actions.allKeys();
    if (keys != null) {
     for (int i=0; i < keys.length;i++)
     	t.add(actions.get(keys[i]));
     add(t,BorderLayout.SOUTH);
    }
    */
    if (actions != null) {
      Object[] keys = actions.allKeys();
      if (keys != null) {
        for (int i = 0; i < keys.length; i++) {
          add(
              new DescriptorSearchActionPanel(list, actions.get(keys[i]), keys[i].toString()),
              BorderLayout.SOUTH);
          break;
        }
      }
    }
  }
Esempio n. 4
0
 private void setTable() {
   table = new JTable(rows, data.size());
   table.setShowHorizontalLines(true);
   table.setShowVerticalLines(true);
   table.setGridColor(Color.BLACK);
   table.getColumnModel().setColumnSelectionAllowed(true);
   table.getTableHeader().setReorderingAllowed(false);
   table.setModel(new ALTableModel(rows, colNames, data));
 }
Esempio n. 5
0
 public static void main(String[] args) {
   /*
   构造函数有很多下面先介绍几个:
   JTable()
   JTable(int numRows, int numColumns)
   JTable(Object[][] rowData, Object[] columnNames)
   */
   JTable example1 = new JTable(); // 看不到但存在
   JTable example2 = new JTable(8, 6);
   final Object[] columnNames = {
     "姓名", "性别", "家庭地址", // 列名最好用final修饰
     "电话号码", "生日", "工作", "收入", "婚姻状况", "恋爱状况"
   };
   Object[][] rowData = {
     {"ddd", "男", "江苏南京", "1378313210", "03/24/1985", "学生", "寄生中", "未婚", "没"},
     {"eee", "女", "江苏南京", "13645181705", "xx/xx/1985", "家教", "未知", "未婚", "好象没"},
     {"fff", "男", "江苏南京", "13585331486", "12/08/1985", "汽车推销员", "不确定", "未婚", "有"},
     {"ggg", "女", "江苏南京", "81513779", "xx/xx/1986", "宾馆服务员", "确定但未知", "未婚", "有"},
     {"hhh", "男", "江苏南京", "13651545936", "xx/xx/1985", "学生", "流放中", "未婚", "无数次分手后没有"}
   };
   JTable friends = new JTable(rowData, columnNames);
   friends.setPreferredScrollableViewportSize(new Dimension(600, 100)); // 设置表格的大小
   friends.setRowHeight(30); // 设置每行的高度为20
   friends.setRowHeight(0, 20); // 设置第1行的高度为15
   friends.setRowMargin(5); // 设置相邻两行单元格的距离
   friends.setRowSelectionAllowed(true); // 设置可否被选择.默认为false
   friends.setSelectionBackground(Color.white); // 设置所选择行的背景色
   friends.setSelectionForeground(Color.red); // 设置所选择行的前景色
   friends.setGridColor(Color.black); // 设置网格线的颜色
   friends.selectAll(); // 选择所有行
   friends.setRowSelectionInterval(0, 2); // 设置初始的选择行,这里是1到3行都处于选择状态
   friends.clearSelection(); // 取消选择
   friends.setDragEnabled(false); // 不懂这个
   friends.setShowGrid(false); // 是否显示网格线
   friends.setShowHorizontalLines(false); // 是否显示水平的网格线
   friends.setShowVerticalLines(true); // 是否显示垂直的网格线
   friends.setValueAt("tt", 0, 0); // 设置某个单元格的值,这个值是一个对象
   friends.doLayout();
   friends.setBackground(Color.lightGray);
   JScrollPane pane1 = new JScrollPane(example1); // JTable最好加在JScrollPane上
   JScrollPane pane2 = new JScrollPane(example2);
   JScrollPane pane3 = new JScrollPane(friends);
   JPanel panel = new JPanel(new GridLayout(0, 1));
   panel.setPreferredSize(new Dimension(600, 400));
   panel.setBackground(Color.black);
   panel.add(pane1);
   panel.add(pane2);
   panel.add(pane3);
   JFrame frame = new JFrame("JTableDemo");
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setContentPane(panel);
   frame.pack();
   frame.show();
 }
Esempio n. 6
0
  public void createviewPanel() {

    viewPanel = new JPanel();
    viewPanel.setLayout(new BorderLayout());
    // viewPanel.setPreferredSize( new Dimension(500,500 ));
    // viewPanel.setMinimumSize( new Dimension(100,50));
    // viewPanel.add( new JLabel("Notes:"),BorderLayout.NORTH );
    //		viewPanel.add( new JTextArea(), BorderLayout.CENTER );
    viewPanel.setPreferredSize(new Dimension(200, 520));
    viewPanel.setMinimumSize(new Dimension(100, 100));
    // Create columns
    CreateColumns(colcnt);
    CreateData(rowcnt, colcnt);
    setSize(300, 200);

    table =
        new JTable(dataValues, columnNames) {

          public boolean isCellEditable(int rowIndex, int vColIndex) {
            return false;
          }
        };

    table
        .getModel()
        .addTableModelListener(
            new TableModelListener() {

              public void tableChanged(TableModelEvent e) {
                System.out.println("........" + e);
              }
            });
    // table.setValueAt("1,2",0,0);

    System.out.println("Row   :" + rowcnt);
    System.out.println("Col  :" + colcnt);

    // Configure some of JTable's paramters
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    table.setRowSelectionAllowed(false);
    table.setColumnSelectionAllowed(false);

    // Change the selection colour
    table.setSelectionForeground(Color.white);
    table.setSelectionBackground(Color.red);

    // Add the table to a scrolling pane
    scrollPaneTable = JTable.createScrollPaneForTable(table);
    viewPanel.add(scrollPaneTable, BorderLayout.CENTER);
    viewPanel.add(table, BorderLayout.CENTER);
  }
 StatisticsInfoTable(StatisticsTableModel model) {
   JTable infoTable =
       new JTable(
           model,
           new TagTableColumnModelBuilder(
                   new StatisticsInfoRenderer(), tr("Paste ..."), tr("From ..."), tr("To ..."))
               .build());
   infoTable.setShowHorizontalLines(true);
   infoTable.setShowVerticalLines(false);
   infoTable.setEnabled(false);
   setLayout(new BorderLayout());
   add(infoTable, BorderLayout.CENTER);
 }
  public AppointmentGUI() {
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setBounds(100, 100, 500, 600); // window size
    setTitle("Appointment List"); // window title
    contentPane = new JPanel();
    contentPane.setBorder(
        new EmptyBorder(3, 6, 3, 6)); // distance the plane is from the edges of the window
    setContentPane(contentPane);
    contentPane.setLayout(new BorderLayout(0, 0));
    scrollPane = new JScrollPane();
    contentPane.add(scrollPane, BorderLayout.CENTER);

    table =
        new JTable(
            new DefaultTableModel(new Object[] {"Doctor's Name", "Location", "Date", "Time"}, 60)) {
          public boolean isCellEditable(
              int row,
              int column) { // prevents user from editing cells; there apparently is not a cleaner
            // way of doing this
            return false;
          }
        };
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    table.setShowGrid(false);
    table.getTableHeader().setReorderingAllowed(false); // prevent user from swapping columns
    table.getTableHeader().setResizingAllowed(false); // prevent user from resizing columns
    table.setSelectionMode(
        ListSelectionModel
            .SINGLE_INTERVAL_SELECTION); // prevent user from selecting multiple doctors
    table.setAutoCreateColumnsFromModel(
        false); // forgot why I have this here; it's probably important

    scrollPane.setViewportView(table); // lets table be scroll able

    btnPane = new JPanel();
    btnPane.setLayout(new GridLayout(0, 2, 0, 0));
    contentPane.add(btnPane, BorderLayout.SOUTH);

    btnViewAppointment = new JButton("View Appointment");
    btnPane.add(btnViewAppointment);

    btnCancelAppointment = new JButton("Cancel Appointment");
    btnPane.add(btnCancelAppointment);

    btnUpdateAppointment = new JButton("Update Appointment");
    btnPane.add(btnUpdateAppointment);

    btnGoBack = new JButton("Go Back");
    btnPane.add(btnGoBack);
  }
Esempio n. 9
0
  protected JTable createDefaultsTable() {
    JTable table = new JTable(new UIDefaultsTableModel());
    table.setRowHeight(rowHeight);
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    table.setIntercellSpacing(new Dimension(0, 0));
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    initFilters(table);

    DefaultTableColumnModel columnModel = new DefaultTableColumnModel();

    Color rowColors[] = new Color[2];
    rowColors[0] = UIManager.getColor("Table.background");
    rowColors[1] =
        new Color(
            (int) (rowColors[0].getRed() * .90),
            (int) (rowColors[0].getGreen() * .95),
            (int) (rowColors[0].getBlue() * .95));

    int width = 0;

    TableColumn column = new TableColumn();
    column.setCellRenderer(new KeyRenderer(rowColors));
    column.setModelIndex(UIDefaultsTableModel.KEY_COLUMN);
    column.setHeaderValue("Key");
    column.setPreferredWidth(250);
    columnModel.addColumn(column);
    width += column.getPreferredWidth();

    column = new TableColumn();
    column.setCellRenderer(new RowRenderer(rowColors));
    column.setModelIndex(UIDefaultsTableModel.TYPE_COLUMN);
    column.setHeaderValue("Type");
    column.setPreferredWidth(250);
    columnModel.addColumn(column);
    width += column.getPreferredWidth();

    column = new TableColumn();
    column.setCellRenderer(new ValueRenderer(rowColors));
    column.setModelIndex(UIDefaultsTableModel.VALUE_COLUMN);
    column.setHeaderValue("Value");
    column.setPreferredWidth(300);
    columnModel.addColumn(column);
    width += column.getPreferredWidth();

    table.setColumnModel(columnModel);

    table.setPreferredScrollableViewportSize(new Dimension(width, 12 * rowHeight));

    return table;
  }
Esempio n. 10
0
  @Override
  protected void init() {
    super.init();

    final SpringLocaleDelegate localeDelegate = SpringLocaleDelegate.getInstance();

    this.labAvailableColumns.setText(
        localeDelegate.getMessage("SelectFixedColumnsController.8", "Verf\u00fcgbare Spalten"));
    this.labSelectedColumns.setText(
        localeDelegate.getMessage("SelectFixedColumnsController.1", "Ausgew\u00e4hlte Spalten"));

    this.btnLeft.setToolTipText(
        localeDelegate.getMessage(
            "SelectFixedColumnsController.5", "Markierte Spalte(n) nicht anzeigen"));
    this.btnRight.setToolTipText(
        localeDelegate.getMessage(
            "SelectFixedColumnsController.4", "Markierte Spalte(n) anzeigen"));
    this.btnUp.setToolTipText(
        localeDelegate.getMessage(
            "SelectFixedColumnsController.6", "Markierte Spalte nach oben verschieben"));
    this.btnDown.setToolTipText(
        localeDelegate.getMessage(
            "SelectFixedColumnsController.7", "Markierte Spalte nach unten verschieben"));

    this.btnUp.setVisible(true);
    this.btnDown.setVisible(true);

    tblSelectedColumn =
        new JTable() {
          @Override
          public TableCellRenderer getCellRenderer(int row, int column) {
            return new TopTableCellRendererDelegate(super.getCellRenderer(row, column));
          }
        };
    tblSelectedColumn.setShowHorizontalLines(false);
    tblSelectedColumn.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    scrlpnSelectedColumns.getViewport().add(tblSelectedColumn, null);
    scrlpnSelectedColumns.getViewport().setBackground(tblSelectedColumn.getBackground());
    scrlpnSelectedColumns.setHorizontalScrollBarPolicy(
        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  }
  private void initTable() {
    JScrollPane scrollPane2 = new JScrollPane();
    Vector<String> vColumns2 = new Vector<String>();

    vColumns2.add("出库/入库");
    vColumns2.add("快递编号");
    vColumns2.add("入库日期");
    vColumns2.add("区号");
    vColumns2.add("排号");
    vColumns2.add("位号");
    vColumns2.add("架号");

    Vector<String> vData2 = new Vector<String>();

    // //模型
    deliveryInputModel2 = new DefaultTableModel(vData2, vColumns2);
    // //表格
    JTable deliveryInputTable2 =
        new JTable(deliveryInputModel2) {
          private static final long serialVersionUID = 1L;

          public boolean isCellEditable(int row, int column) {
            return false;
          }
        };

    JTableHeader tableH2 = deliveryInputTable2.getTableHeader();

    // tableH.setBackground(XContorlUtil.OUTLOOK_CONTAINER_COLOR);
    tableH2.setForeground(XContorlUtil.DEFAULT_PAGE_TEXT_COLOR);
    tableH2.setFont(XContorlUtil.FONT_14_BOLD);
    deliveryInputTable2.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    deliveryInputTable2.setShowVerticalLines(false);
    deliveryInputTable2.setShowHorizontalLines(false);
    scrollPane2.getViewport().add(deliveryInputTable2);
    deliveryInputTable2.setFillsViewportHeight(true);
    this.add(scrollPane2);
  }
  /** Create the frame. */
  public Employee_info() {

    conn = javaconnect.ConnectrDB();
    Update_Table();

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 450, 300);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(21, 11, 389, 230);
    contentPane.add(scrollPane);

    table = new JTable();
    table.setColumnSelectionAllowed(true);
    table.setCellSelectionEnabled(true);
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    scrollPane.setViewportView(table);
    table.setModel(new DefaultTableModel(new Object[][] {}, new String[] {}));
  }
Esempio n. 13
0
  private void initializeComponent() {
    JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());
    getRootPane().setLayout(new BorderLayout());
    getRootPane().add(panel, BorderLayout.CENTER);

    JButton createButton = new JButton("New...");
    createButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            create();
          }
        });
    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(5, 5, 5, 5);
    c.anchor = GridBagConstraints.WEST;
    panel.add(createButton, c);

    contexts = new JComboBox(new DefaultComboBoxModel());
    contexts.setPreferredSize(new Dimension(80, 24));
    contexts.setSize(new Dimension(80, 24));
    c = new GridBagConstraints();
    c.weightx = 1;
    c.anchor = GridBagConstraints.EAST;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(5, 5, 5, 5);
    panel.add(contexts, c);
    contexts.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            refresh();
          }
        });

    JButton refreshButton = new JButton("Refresh");
    refreshButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            refresh();
          }
        });
    c = new GridBagConstraints();
    c.insets = new Insets(5, 5, 5, 5);
    panel.add(refreshButton, c);

    itemTable = new JTable(1, 6);
    itemTable.setRowHeight(35);
    itemTable.setShowHorizontalLines(false);
    itemTable.setShowVerticalLines(false);
    itemTable.addKeyListener(
        new KeyListener() {
          public void keyTyped(KeyEvent e) {}

          public void keyReleased(KeyEvent e) {
            ctrl = false;
          }

          public void keyPressed(KeyEvent e) {
            if (e.isControlDown()) {
              ctrl = true;
            }
          }
        });
    itemTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent e) {
                int index = e.getFirstIndex();
                if (index >= 0 && index < items.size()) {
                  ChecklistItem item = items.get(index);
                  if (item.getStatus() == Status.Created) {
                    String actorId = getActorId();
                    try {
                      checklistManager.claimTask(actorId, item.getTaskId());
                      if (ctrl) {
                        checklistManager.abortTask(actorId, item.getTaskId());
                      } else {
                        checklistManager.completeTask(actorId, item.getTaskId());
                      }
                    } catch (Throwable t) {
                      // Do nothing
                    }
                    refresh();
                  } else if (item.getStatus() == Status.Reserved) {
                    String actorId = getActorId();
                    if (item.getActors().equals(actorId)) {
                      try {
                        if (ctrl) {
                          checklistManager.abortTask(actorId, item.getTaskId());
                        } else {
                          checklistManager.completeTask(actorId, item.getTaskId());
                        }
                      } catch (Throwable t) {
                        // Do nothing
                      }
                      refresh();
                    }
                  } else if (item.getStatus() == Status.Optional) {
                    try {
                      checklistManager.selectOptionalTask(
                          item.getName(), Long.valueOf((String) contexts.getSelectedItem()));
                    } catch (Throwable t) {
                      // Do nothing
                      t.printStackTrace();
                    }
                    refresh();
                  }
                }
              }
            });
    // TODO:
    // default width of columns
    // icons for state
    // not-editable
    // no selection
    // (scratch for aborted?)
    // replace refresh, create, etc. by icon
    c = new GridBagConstraints();
    c.gridy = 1;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.BOTH;
    c.insets = new Insets(5, 5, 5, 5);
    panel.add(itemTable, c);

    JLabel nameLabel = new JLabel("Logged in as:");
    c = new GridBagConstraints();
    c.gridy = 2;
    c.insets = new Insets(5, 5, 5, 5);
    c.anchor = GridBagConstraints.WEST;
    panel.add(nameLabel, c);

    userNameTextField = new JTextField("krisv");
    userNameTextField.setPreferredSize(new Dimension(80, 20));
    userNameTextField.setSize(new Dimension(80, 20));
    c = new GridBagConstraints();
    c.gridy = 2;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.insets = new Insets(5, 5, 5, 5);
    c.anchor = GridBagConstraints.WEST;
    panel.add(userNameTextField, c);

    JButton createItemButton = new JButton("+");
    createItemButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            createNewItem();
          }
        });
    c = new GridBagConstraints();
    c.gridy = 2;
    c.insets = new Insets(5, 5, 5, 5);
    c.anchor = GridBagConstraints.EAST;
    panel.add(createItemButton, c);

    panel.doLayout();
  }
  /**
   * Create a JTable with data Model.
   *
   * @param columnsName : Titles of JTable columns.
   */
  public SwingScilabVariableBrowser(String[] columnsName, int[] aligment) {
    super(UiDataMessages.VARIABLE_BROWSER, VARBROWSERUUID);

    setAssociatedXMLIDForHelp("browsevar");

    buildMenuBar();
    addMenuBar(menuBar);

    ToolBar toolBar = ScilabToolBar.createToolBar();
    toolBar.add(RefreshAction.createButton(UiDataMessages.REFRESH));
    toolBar.addSeparator();
    toolBar.add(ModifyAction.createButton(this, UiDataMessages.MODIFY));
    toolBar.add(DeleteAction.createButton(this, UiDataMessages.DELETE));
    toolBar.addSeparator();
    toolBar.add(HelpAction.createButton(UiDataMessages.HELP));
    filteringButton = ScilabVarFilteringButtonAction.createButton("Show/hide Scilab variable");
    //        toolBar.add(filteringButton);
    addToolBar(toolBar);

    dataModel = new SwingTableModel<Object>(columnsName);

    table =
        new JTable(dataModel) {
          // Implement table cell tool tips.
          public String getToolTipText(MouseEvent e) {
            String tip = null;
            TableModel model = ((JTable) e.getSource()).getModel();
            java.awt.Point p = e.getPoint();
            int rowIndex = rowAtPoint(p);

            if (rowIndex >= 0) {
              rowIndex = convertRowIndexToModel(rowIndex);
              int colIndex = columnAtPoint(p);
              if (colIndex == BrowseVar.TYPE_DESC_COLUMN_INDEX) {
                  /* Scilab type */
                try {
                  tip =
                      Messages.gettext("Scilab type:")
                          + " "
                          + model.getValueAt(rowIndex, BrowseVar.TYPE_COLUMN_INDEX).toString();
                } catch (IllegalArgumentException exception) {
                  /* If the type is not known/managed, don't crash */
                }
              } else {

                if (colIndex == BrowseVar.SIZE_COLUMN_INDEX) {
                  /* Use the getModel() method because the
                   * column 5 has been removed from display
                   * but still exist in the model */
                  tip =
                      Messages.gettext("Bytes:")
                          + " "
                          + model.getValueAt(rowIndex, BrowseVar.BYTES_COLUMN_INDEX).toString();
                }
              }
            }
            return tip;
          }
        };

    table.setFillsViewportHeight(true);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    table.setAutoCreateRowSorter(true);

    /* Size of the icon column */
    table.getColumnModel().getColumn(0).setPreferredWidth(30);

    /* Hide the columns. But keep it in memory for the tooltip */
    TableColumn column = table.getColumnModel().getColumn(BrowseVar.NB_COLS_INDEX);
    table.removeColumn(column);

    /* The order to removing does matter since it changes the positions */

    column = table.getColumnModel().getColumn(BrowseVar.NB_ROWS_INDEX);
    table.removeColumn(column);

    column = table.getColumnModel().getColumn(BrowseVar.TYPE_COLUMN_INDEX);
    table.removeColumn(column);

    column = table.getColumnModel().getColumn(BrowseVar.FROM_SCILAB_COLUMN_INDEX);
    table.removeColumn(column);

    column = table.getColumnModel().getColumn(BrowseVar.BYTES_COLUMN_INDEX);
    table.removeColumn(column);

    table.addMouseListener(new BrowseVarMouseListener());
    // Mouse selection mode
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setCellSelectionEnabled(true);

    table.setBackground(Color.WHITE);
    if (table.getGridColor().equals(Color.WHITE)) {
      table.setGridColor(new Color(128, 128, 128));
    }
    table.setShowHorizontalLines(true);
    table.setShowVerticalLines(true);

    for (int i = 0; i < aligment.length; i++) {
      align(table, columnsName[i], aligment[i]);
    }

    // Plug the shortcuts
    ExportToCsvAction.registerAction(this, table);

    JScrollPane scrollPane = new JScrollPane(table);
    setContentPane(scrollPane);
    WindowsConfigurationManager.restorationFinished(this);
  }
  /** Constructor. Creates all of the internal UI contents. */
  public BioGeomancerResultsDisplay() {
    String rowDef =
        UIHelper.createDuplicateJGoodiesDef("p", "2px", 13)
            + ",20px,p:g"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    setLayout(new FormLayout("p,10px,400px,10px,C:p:g", rowDef)); // $NON-NLS-1$

    CellConstraints cc = new CellConstraints();

    int rowIndex = 1;
    idField =
        addRow(cc, getResourceString("BioGeomancerResultsDisplay.ID"), 1, rowIndex); // $NON-NLS-1$
    rowIndex += 2;
    countryField =
        addRow(
            cc,
            getResourceString("BioGeomancerResultsDisplay.COUNTRY"),
            1,
            rowIndex); //$NON-NLS-1$
    rowIndex += 2;
    adm1Field =
        addRow(
            cc, getResourceString("BioGeomancerResultsDisplay.ADM1"), 1, rowIndex); // $NON-NLS-1$
    rowIndex += 2;
    adm2Field =
        addRow(
            cc, getResourceString("BioGeomancerResultsDisplay.ADM2"), 1, rowIndex); // $NON-NLS-1$
    rowIndex += 2;
    localityField =
        addRow(
            cc,
            getResourceString("BioGeomancerResultsDisplay.LOCALITY"),
            1,
            rowIndex); //$NON-NLS-1$
    rowIndex += 2;

    countryBoundingBoxField =
        addRow(
            cc,
            getResourceString("BioGeomancerResultsDisplay.COUNTRY_BOUNDING_BOX"),
            1,
            rowIndex); //$NON-NLS-1$
    rowIndex += 2;
    matchedCountField =
        addRow(
            cc,
            getResourceString("BioGeomancerResultsDisplay.MATCHED_CNT"),
            1,
            rowIndex); //$NON-NLS-1$
    rowIndex += 2;
    boundingBoxField =
        addRow(
            cc,
            getResourceString("BioGeomancerResultsDisplay.BOUNDING_BOX"),
            1,
            rowIndex); //$NON-NLS-1$
    rowIndex += 2;
    boundingBoxCentroidField =
        addRow(
            cc,
            getResourceString("BioGeomancerResultsDisplay.BOUNDING_BOX_CENTROID"),
            1,
            rowIndex); //$NON-NLS-1$
    rowIndex += 2;
    centroidErrorRadiusField =
        addRow(
            cc,
            getResourceString("BioGeomancerResultsDisplay.CENTROID_ERROR_RADIUS"),
            1,
            rowIndex); //$NON-NLS-1$
    rowIndex += 2;
    centroidErrorRadiusUnitsField =
        addRow(
            cc,
            getResourceString("BioGeomancerResultsDisplay.CENTROID_ERROR_RADIUS_UNITS"),
            1,
            rowIndex); //$NON-NLS-1$
    rowIndex += 2;
    multiPointMatchField =
        addRow(
            cc,
            getResourceString("BioGeomancerResultsDisplay.MULTI_POINT_MATCH"),
            1,
            rowIndex); //$NON-NLS-1$
    rowIndex += 2;
    weightedCentroidField =
        addRow(
            cc,
            getResourceString("BioGeomancerResultsDisplay.WEIGHTED_CENTROID"),
            1,
            rowIndex); //$NON-NLS-1$
    rowIndex += 2;

    mapLabel =
        createLabel(getResourceString("BioGeomancerResultsDisplay.LOADING_MAP")); // $NON-NLS-1$
    add(mapLabel, cc.xywh(5, 1, 1, 25));

    mapLabel.setPreferredSize(new Dimension(MAP_WIDTH, MAP_HEIGHT));

    bgResultsTable = new JTable();
    bgResultsTable.setShowVerticalLines(false);
    bgResultsTable.setShowHorizontalLines(false);
    bgResultsTable.setRowSelectionAllowed(true);
    bgResultsTable.setDefaultRenderer(String.class, new BiColorTableCellRenderer(false));

    mapLabel.setText(""); // $NON-NLS-1$

    add(UIHelper.createScrollPane(bgResultsTable), cc.xywh(1, rowIndex, 5, 1));
    rowIndex += 2;
  }
  public TableViewComponent() {
    super();

    setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(12, 12, 12, 12),
            BorderFactory.createLoweredBevelBorder()));

    table = new JTable();

    table.setRowSelectionAllowed(false);
    table.setColumnSelectionAllowed(false);
    table.setCellSelectionEnabled(true);
    table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ListSelectionListener selectionListener =
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
              return;
            }

            ListSelectionModel rowSelections = table.getSelectionModel();
            ListSelectionModel columnSelections = table.getColumnModel().getSelectionModel();
            if (rowSelections.isSelectionEmpty() || columnSelections.isSelectionEmpty()) {
              // no new selection -> nothing has changed
              return;
            }

            int rowIndex = rowSelections.getLeadSelectionIndex();
            int columnIndex = columnSelections.getLeadSelectionIndex();
            int modelRowIndex = table.convertRowIndexToModel(rowIndex);
            int modelColumnIndex = table.convertColumnIndexToModel(columnIndex);

            if (selectedNode != null) {
              selectedNode.setHereTooSelected(false);
            }

            final NodeWrapper newSelection =
                (NodeWrapper) table.getModel().getValueAt(modelRowIndex, modelColumnIndex);
            newSelection.setHereTooSelected(true);

            selectedNode = newSelection;

            table.invalidate();
            SwingUtilities.invokeLater(
                new Runnable() {
                  @Override
                  public void run() {
                    table.repaint();
                  }
                });
          }
        };
    table.getSelectionModel().addListSelectionListener(selectionListener);
    table.getColumnModel().getSelectionModel().addListSelectionListener(selectionListener);

    table.setAutoCreateRowSorter(false);

    table.setFillsViewportHeight(true);

    table.setGridColor(COLOR_GRID_LINES);
    table.setShowGrid(false);
    table.setShowHorizontalLines(true);

    // 0px between cells in the same row; 1px between rows
    table.setIntercellSpacing(new Dimension(0, 1));

    FontMetrics metrics = table.getFontMetrics(table.getFont());
    int rowHeight = 2 * metrics.getMaxAscent() + 2 * metrics.getMaxDescent() + metrics.getLeading();
    table.setRowHeight(rowHeight);

    setViewportView(table);

    // context menus + double-click for chain nav
    table.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() != 2) {
              return;
            }
            NodeWrapper node = getNodeWrapperAtPoint(e);
            if (node != null) {
              fireNodeSelected(node);
            }
          }

          @Override
          public void mousePressed(MouseEvent e) {
            handlePopup(e);
          }

          @Override
          public void mouseReleased(MouseEvent e) {
            handlePopup(e);
          }

          private void handlePopup(MouseEvent e) {
            if (!e.isPopupTrigger()) {
              return;
            }
            NodeWrapper node = getNodeWrapperAtPoint(e);
            if (node != null) {
              popup.setNodeWrapper(node);
              popup.show(table, e.getX(), e.getY());
            }
          }

          private NodeWrapper getNodeWrapperAtPoint(MouseEvent e) {
            int viewColumn = table.columnAtPoint(e.getPoint());
            int viewRow = table.rowAtPoint(e.getPoint());
            if (viewColumn == -1 || viewRow == -1) {
              // this means that we have an invalid point
              return null;
            }
            NodeWrapper node = (NodeWrapper) table.getValueAt(viewRow, viewColumn);
            return node;
          }
        });
  }
  public ScoreGameTableScreen(ArrayList<Player> scoreTable, final Integer userType) {
    setTitle(LoginScreen.getTitleGame());
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            if (userType == 0) {
              AdminMenuScreen adminmenuscreen = new AdminMenuScreen();
              adminmenuscreen.setVisible(true);
            } else {
              UserMenuScreen usermenuscreen = new UserMenuScreen();
              usermenuscreen.setVisible(true);
            }
            setVisible(false);
          }
        });
    setBounds(100, 100, 352, 526);
    setLocationRelativeTo(null);
    setResizable(false);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel lblTablaDePuntuaciones = new JLabel("Tabla de puntuaciones de la partida");
    lblTablaDePuntuaciones.setFont(new Font("Verdana", Font.BOLD, 15));
    lblTablaDePuntuaciones.setBounds(21, 21, 327, 35);
    contentPane.add(lblTablaDePuntuaciones);

    table = new JTable();
    table.setShowGrid(false);
    table.setRowSelectionAllowed(false);
    table.setToolTipText("");
    table.setBackground(SystemColor.control);
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    table.setModel(
        new DefaultTableModel(
            new Object[][] {
              {null}, {null}, {null},
            },
            new String[] {"Puntuaci\u00F3n"}));
    table.setBounds(52, 110, 239, 201);

    tableModel.addColumn("Jugador");
    tableModel.addColumn("Puntuación");

    table.setRowHeight(30);
    for (int i = 0; i < scoreTable.size() && i < 10; i++) {
      if (!scoreTable.get(i).disconnectedWhilePlaying())
        tableModel.addRow(
            new String[] {scoreTable.get(i).getName(), scoreTable.get(i).getScore().toString()});
      else tableModel.addRow(new String[] {scoreTable.get(i).getName(), "Desconectado"});
    }

    table.setModel(tableModel);
    centerRenderer.setHorizontalAlignment(JLabel.CENTER);
    table.getColumnModel().getColumn(0).setCellRenderer(centerRenderer);
    table.getColumnModel().getColumn(1).setCellRenderer(centerRenderer);
    JTableHeader header = table.getTableHeader();
    header.setReorderingAllowed(false);
    header.setResizingAllowed(false);

    JPanel panel = new JPanel();
    panel.setBounds(34, 75, 264, 343);
    panel.setLayout(new BorderLayout(0, 0));
    panel.add(header, BorderLayout.NORTH);
    panel.add(table, BorderLayout.CENTER);

    contentPane.add(panel);

    JButton btnVolverAlMen = new JButton("Volver al men\u00FA principal");
    btnVolverAlMen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (userType == 0) {
              AdminMenuScreen adminmenuscreen = new AdminMenuScreen();
              adminmenuscreen.setVisible(true);
            } else {
              UserMenuScreen usermenuscreen = new UserMenuScreen();
              usermenuscreen.setVisible(true);
            }
            setVisible(false);
          }
        });
    btnVolverAlMen.setBounds(135, 453, 180, 23);
    contentPane.add(btnVolverAlMen);
  }
  @NotNull
  private JBPopup createUsagePopup(
      @NotNull final List<Usage> usages,
      @NotNull final UsageInfoToUsageConverter.TargetElementsDescriptor descriptor,
      @NotNull Set<UsageNode> visibleNodes,
      @NotNull final FindUsagesHandler handler,
      final Editor editor,
      @NotNull final RelativePoint popupPosition,
      final int maxUsages,
      @NotNull final UsageViewImpl usageView,
      @NotNull final FindUsagesOptions options,
      @NotNull final JTable table,
      @NotNull final UsageViewPresentation presentation,
      @NotNull final AsyncProcessIcon processIcon,
      boolean hadMoreSeparator) {
    table.setRowHeight(PlatformIcons.CLASS_ICON.getIconHeight() + 2);
    table.setShowGrid(false);
    table.setShowVerticalLines(false);
    table.setShowHorizontalLines(false);
    table.setTableHeader(null);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    table.setIntercellSpacing(new Dimension(0, 0));

    PopupChooserBuilder builder = new PopupChooserBuilder(table);
    final String title = presentation.getTabText();
    if (title != null) {
      String result = getFullTitle(usages, title, hadMoreSeparator, visibleNodes.size() - 1, true);
      builder.setTitle(result);
      builder.setAdText(getSecondInvocationTitle(options, handler));
    }

    builder.setMovable(true).setResizable(true);
    builder.setItemChoosenCallback(
        new Runnable() {
          @Override
          public void run() {
            int[] selected = table.getSelectedRows();
            for (int i : selected) {
              Object value = table.getValueAt(i, 0);
              if (value instanceof UsageNode) {
                Usage usage = ((UsageNode) value).getUsage();
                if (usage == MORE_USAGES_SEPARATOR) {
                  appendMoreUsages(editor, popupPosition, handler, maxUsages);
                  return;
                }
                navigateAndHint(usage, null, handler, popupPosition, maxUsages, options);
              }
            }
          }
        });
    final JBPopup[] popup = new JBPopup[1];

    KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
    if (shortcut != null) {
      new DumbAwareAction() {
        @Override
        public void actionPerformed(AnActionEvent e) {
          popup[0].cancel();
          showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
        }
      }.registerCustomShortcutSet(new CustomShortcutSet(shortcut.getFirstKeyStroke()), table);
    }
    shortcut = getShowUsagesShortcut();
    if (shortcut != null) {
      new DumbAwareAction() {
        @Override
        public void actionPerformed(AnActionEvent e) {
          popup[0].cancel();
          searchEverywhere(options, handler, editor, popupPosition, maxUsages);
        }
      }.registerCustomShortcutSet(new CustomShortcutSet(shortcut.getFirstKeyStroke()), table);
    }

    InplaceButton settingsButton =
        createSettingsButton(
            handler,
            popupPosition,
            editor,
            maxUsages,
            new Runnable() {
              @Override
              public void run() {
                popup[0].cancel();
              }
            });

    ActiveComponent spinningProgress =
        new ActiveComponent() {
          @Override
          public void setActive(boolean active) {}

          @Override
          public JComponent getComponent() {
            return processIcon;
          }
        };
    builder.setCommandButton(new CompositeActiveComponent(spinningProgress, settingsButton));

    DefaultActionGroup toolbar = new DefaultActionGroup();
    usageView.addFilteringActions(toolbar);

    toolbar.add(UsageGroupingRuleProviderImpl.createGroupByFileStructureAction(usageView));
    toolbar.add(
        new AnAction(
            "Open Find Usages Toolwindow",
            "Show all usages in a separate toolwindow",
            AllIcons.Toolwindows.ToolWindowFind) {
          {
            AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_FIND_USAGES);
            setShortcutSet(action.getShortcutSet());
          }

          @Override
          public void actionPerformed(AnActionEvent e) {
            hideHints();
            popup[0].cancel();
            FindUsagesManager findUsagesManager =
                ((FindManagerImpl) FindManager.getInstance(usageView.getProject()))
                    .getFindUsagesManager();

            findUsagesManager.findUsages(
                handler.getPrimaryElements(),
                handler.getSecondaryElements(),
                handler,
                options,
                FindSettings.getInstance().isSkipResultsWithOneUsage());
          }
        });

    ActionToolbar actionToolbar =
        ActionManager.getInstance()
            .createActionToolbar(ActionPlaces.USAGE_VIEW_TOOLBAR, toolbar, true);
    actionToolbar.setReservePlaceAutoPopupIcon(false);
    final JComponent toolBar = actionToolbar.getComponent();
    toolBar.setOpaque(false);
    builder.setSettingButton(toolBar);

    popup[0] = builder.createPopup();
    JComponent content = popup[0].getContent();

    myWidth =
        (int)
            (toolBar.getPreferredSize().getWidth()
                + new JLabel(
                        getFullTitle(
                            usages, title, hadMoreSeparator, visibleNodes.size() - 1, true))
                    .getPreferredSize()
                    .getWidth()
                + settingsButton.getPreferredSize().getWidth());
    myWidth = -1;
    for (AnAction action : toolbar.getChildren(null)) {
      action.unregisterCustomShortcutSet(usageView.getComponent());
      action.registerCustomShortcutSet(action.getShortcutSet(), content);
    }

    return popup[0];
  }
Esempio n. 19
0
  public static void llenar_orden_de_compra(JTable tabla, String estado) {
    DefaultTableModel model = null;
    /*  ConexionBD con;
    con = new ConexionBD();
    Connection cn = con.GetConnection();*/
    conexionBD con;
    con = new conexionBD();
    Connection cn = con.conexion();
    if (cn != null) {
      try {
        String[] registros = new String[9];

        String[] titulos = {
          "ido",
          "ORDEN DE COMPRA",
          "PROVEEDORES",
          "FECHA ORDEN",
          "IMPUESTO",
          "SUB_TOTAL",
          "TOTAL",
          "ESTADO",
          "ACEPTAR"
        };
        model =
            new DefaultTableModel(null, titulos) {
              @Override
              public boolean isCellEditable(int row, int column) {
                if (column == 8) {
                  return true;
                } else {
                  return false;
                }
              }
            };

        String sql =
            "SELECT id_orden_compra,codigo_orden_compra, id_provedor ,fecha_orden, impuestos , sub_total,total,estado from cmprv_orden_compra where estado = '"
                + estado
                + "' ";
        /*String sql = "SELECT id_orden_compra , id_provedor ,fecha_orden, impuestos , sub_total,total,estado from cmprv_orden_compra  WHERE estado ='" + estado
        + "'";*/
        Statement st = cn.createStatement();
        ResultSet rs = st.executeQuery(sql);
        while (rs.next()) {

          registros[0] = "" + rs.getInt("id_orden_compra");
          registros[1] = rs.getString("codigo_orden_compra");
          registros[2] = obtener_proveedor(rs.getInt("id_provedor"));
          registros[3] = rs.getString("fecha_orden");
          registros[4] = "" + rs.getDouble("impuestos");
          registros[5] = "" + rs.getDouble("sub_total");
          registros[6] = "" + rs.getDouble("total");
          registros[7] = rs.getString("estado");

          model.addRow(registros);
        }
        tabla.setModel(model);
        st.close();
        cn.close();
        st = null;
        rs = null;
        cn = null;

        tabla
            .getColumnModel()
            .getColumn(0)
            .setHeaderRenderer(
                new MyRenderer(
                    new java.awt.Color(255, 255, 255),
                    new java.awt.Color(255, 0, 0),
                    new java.awt.Font("Tahoma", Font.BOLD, 12)));
        tabla
            .getColumnModel()
            .getColumn(1)
            .setHeaderRenderer(
                new MyRenderer(
                    new java.awt.Color(255, 0, 0),
                    new java.awt.Color(255, 255, 255),
                    new java.awt.Font("Tahoma", Font.BOLD, 12)));
        tabla
            .getColumnModel()
            .getColumn(2)
            .setHeaderRenderer(
                new MyRenderer(
                    new java.awt.Color(255, 255, 255),
                    new java.awt.Color(255, 0, 0),
                    new java.awt.Font("Tahoma", Font.BOLD, 12)));
        tabla
            .getColumnModel()
            .getColumn(3)
            .setHeaderRenderer(
                new MyRenderer(
                    new java.awt.Color(255, 0, 0),
                    new java.awt.Color(255, 255, 255),
                    new java.awt.Font("Tahoma", Font.BOLD, 12)));
        tabla
            .getColumnModel()
            .getColumn(4)
            .setHeaderRenderer(
                new MyRenderer(
                    new java.awt.Color(255, 255, 255),
                    new java.awt.Color(255, 0, 0),
                    new java.awt.Font("Tahoma", Font.BOLD, 12)));
        tabla
            .getColumnModel()
            .getColumn(5)
            .setHeaderRenderer(
                new MyRenderer(
                    new java.awt.Color(255, 0, 0),
                    new java.awt.Color(255, 255, 255),
                    new java.awt.Font("Tahoma", Font.BOLD, 12)));
        tabla
            .getColumnModel()
            .getColumn(6)
            .setHeaderRenderer(
                new MyRenderer(
                    new java.awt.Color(255, 255, 255),
                    new java.awt.Color(255, 0, 0),
                    new java.awt.Font("Tahoma", Font.BOLD, 12)));
        tabla
            .getColumnModel()
            .getColumn(7)
            .setHeaderRenderer(
                new MyRenderer(
                    new java.awt.Color(255, 0, 0),
                    new java.awt.Color(255, 255, 255),
                    new java.awt.Font("Tahoma", Font.BOLD, 12)));
        tabla
            .getColumnModel()
            .getColumn(8)
            .setHeaderRenderer(
                new MyRenderer(
                    new java.awt.Color(255, 255, 255),
                    new java.awt.Color(255, 0, 0),
                    new java.awt.Font("Tahoma", Font.BOLD, 12)));

        tabla.getColumn("ido").setMaxWidth(0);
        tabla.getColumn("ido").setMinWidth(0);
        tabla.getColumn("ido").setPreferredWidth(0);
        tabla.getTableHeader().getColumnModel().getColumn(0).setMaxWidth(0);
        tabla.getColumn("PROVEEDORES").setMaxWidth(170);
        tabla.getColumn("PROVEEDORES").setMinWidth(170);
        tabla.getColumn("FECHA ORDEN").setMaxWidth(120);
        tabla.getColumn("FECHA ORDEN").setMinWidth(120);
        tabla.getColumn("IMPUESTO").setMaxWidth(100);
        tabla.getColumn("IMPUESTO").setMinWidth(100);
        tabla.getColumn("SUB_TOTAL").setMaxWidth(100);
        tabla.getColumn("SUB_TOTAL").setMinWidth(100);
        tabla.getColumn("TOTAL").setMaxWidth(100);
        tabla.getColumn("TOTAL").setMinWidth(100);
        tabla.getColumn("ESTADO").setMaxWidth(60);
        tabla.getColumn("ESTADO").setMinWidth(60);
        tabla.getColumn("ACEPTAR").setMaxWidth(80);
        tabla.getColumn("ACEPTAR").setMinWidth(80);
        tabla.getColumn("ORDEN DE COMPRA").setMaxWidth(140);
        tabla.getColumn("ORDEN DE COMPRA").setMinWidth(140);

        tabla.setShowVerticalLines(true);
        tabla.setShowHorizontalLines(true);
        tabla.getTableHeader().setReorderingAllowed(false);

        TableColumn column = tabla.getColumnModel().getColumn(8);
        column.setCellRenderer(new ButtonsRenderer());
        column.setCellEditor(new ButtonsEditor(tabla));
      } catch (SQLException ex) {
        Logger.getLogger(Aceptacion_Compra.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    JFrame frmEditdeleteAuciton = new JFrame();
    frmEditdeleteAuciton.setResizable(false);
    frmEditdeleteAuciton.setTitle("Edit/Delete Auciton");
    frmEditdeleteAuciton.setBounds(100, 100, 712, 467);
    frmEditdeleteAuciton.setLocationRelativeTo(null);
    frmEditdeleteAuciton.getContentPane().setLayout(null);
    frmEditdeleteAuciton.setLocationRelativeTo(null);
    frmEditdeleteAuciton.setVisible(true);

    JButton btnSearch = new JButton("SHOW AUCTIONS CREATED BY YOU");
    btnSearch.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            AuctionMethods.showmyauction(table);
          }
        });
    btnSearch.setFont(new Font("Tahoma", Font.PLAIN, 15));
    btnSearch.setBounds(170, 11, 346, 33);
    frmEditdeleteAuciton.getContentPane().add(btnSearch);

    textField_1 = new JTextField();
    textField_1.setColumns(10);
    textField_1.setBounds(164, 262, 166, 30);
    frmEditdeleteAuciton.getContentPane().add(textField_1);

    textField_2 = new JTextField();
    textField_2.setColumns(10);
    textField_2.setBounds(164, 302, 166, 30);
    frmEditdeleteAuciton.getContentPane().add(textField_2);

    textField_3 = new JTextField();
    textField_3.setColumns(10);
    textField_3.setBounds(164, 341, 166, 30);
    frmEditdeleteAuciton.getContentPane().add(textField_3);

    JLabel lblNewCategory = new JLabel("New Category");
    lblNewCategory.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblNewCategory.setBounds(10, 341, 144, 30);
    frmEditdeleteAuciton.getContentPane().add(lblNewCategory);

    JLabel lblNewStartingBid = new JLabel("New Starting Bid");
    lblNewStartingBid.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblNewStartingBid.setBounds(10, 302, 144, 28);
    frmEditdeleteAuciton.getContentPane().add(lblNewStartingBid);

    JLabel lblNewAuctionName = new JLabel("New Auction Name");
    lblNewAuctionName.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblNewAuctionName.setBounds(10, 262, 144, 29);
    frmEditdeleteAuciton.getContentPane().add(lblNewAuctionName);

    table = new JTable();
    table.setShowVerticalLines(false);
    table.setShowHorizontalLines(false);
    table.setShowGrid(false);
    table.setRowSelectionAllowed(false);
    table.setFont(new Font("Tahoma", Font.PLAIN, 12));
    table.setEnabled(false);
    table.setBounds(119, 76, 450, 82);
    frmEditdeleteAuciton.getContentPane().add(table);

    JTextPane txtpnAuctionName = new JTextPane();
    txtpnAuctionName.setText("Auction Name");
    txtpnAuctionName.setForeground(Color.WHITE);
    txtpnAuctionName.setFont(new Font("Tahoma", Font.PLAIN, 13));
    txtpnAuctionName.setEditable(false);
    txtpnAuctionName.setBackground(Color.DARK_GRAY);
    txtpnAuctionName.setBounds(119, 55, 150, 19);
    frmEditdeleteAuciton.getContentPane().add(txtpnAuctionName);

    JTextPane txtpnCategory = new JTextPane();
    txtpnCategory.setText("Category");
    txtpnCategory.setForeground(Color.WHITE);
    txtpnCategory.setFont(new Font("Tahoma", Font.PLAIN, 13));
    txtpnCategory.setEditable(false);
    txtpnCategory.setBackground(Color.DARK_GRAY);
    txtpnCategory.setBounds(269, 55, 150, 19);
    frmEditdeleteAuciton.getContentPane().add(txtpnCategory);

    JTextPane txtpnStaringBid = new JTextPane();
    txtpnStaringBid.setText("Staring Bid");
    txtpnStaringBid.setForeground(Color.WHITE);
    txtpnStaringBid.setFont(new Font("Tahoma", Font.PLAIN, 13));
    txtpnStaringBid.setEditable(false);
    txtpnStaringBid.setBackground(Color.DARK_GRAY);
    txtpnStaringBid.setBounds(419, 55, 150, 19);
    frmEditdeleteAuciton.getContentPane().add(txtpnStaringBid);

    JButton btnEdit = new JButton("EDIT");
    btnEdit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String name = textField.getText();
            String newname = textField_1.getText();
            String bid = textField_2.getText();
            String category = textField_3.getText();
            AuctionMethods.editauction(name, newname, bid, category);

            frmEditdeleteAuciton.dispose();
          }
        });
    btnEdit.setFont(new Font("Tahoma", Font.PLAIN, 15));
    btnEdit.setBounds(93, 382, 137, 33);
    frmEditdeleteAuciton.getContentPane().add(btnEdit);

    JSeparator separator = new JSeparator();
    separator.setOrientation(SwingConstants.VERTICAL);
    separator.setBounds(340, 262, 38, 153);
    frmEditdeleteAuciton.getContentPane().add(separator);

    JLabel lblAreYouSure = new JLabel("Are you sure you want to delete the Auction?");
    lblAreYouSure.setHorizontalAlignment(SwingConstants.CENTER);
    lblAreYouSure.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblAreYouSure.setBounds(340, 262, 346, 33);
    frmEditdeleteAuciton.getContentPane().add(lblAreYouSure);

    JLabel label = new JLabel("This option CANNOT be undone!!");
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 16));
    label.setBounds(358, 322, 328, 31);
    frmEditdeleteAuciton.getContentPane().add(label);

    JButton button = new JButton("YES");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String name = textField.getText();
            AuctionMethods.deleteauction(name);

            textField.setText(null);
          }
        });
    button.setFont(new Font("Tahoma", Font.BOLD, 20));
    button.setBounds(358, 364, 127, 51);
    frmEditdeleteAuciton.getContentPane().add(button);

    JButton button_1 = new JButton("NO");
    button_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            textField.setText(null);
          }
        });
    button_1.setFont(new Font("Tahoma", Font.BOLD, 20));
    button_1.setBounds(559, 364, 127, 51);
    frmEditdeleteAuciton.getContentPane().add(button_1);

    JSeparator separator_1 = new JSeparator();
    separator_1.setBounds(55, 169, 578, 19);
    frmEditdeleteAuciton.getContentPane().add(separator_1);

    JLabel lblEnterNameOf_1 = new JLabel("Enter name of Auction you want to edit or delete");
    lblEnterNameOf_1.setHorizontalAlignment(SwingConstants.CENTER);
    lblEnterNameOf_1.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblEnterNameOf_1.setBounds(91, 189, 328, 33);
    frmEditdeleteAuciton.getContentPane().add(lblEnterNameOf_1);

    textField = new JTextField();
    textField.setColumns(10);
    textField.setBounds(432, 189, 174, 33);
    frmEditdeleteAuciton.getContentPane().add(textField);
  }
  public JComponent createComponentImpl() {
    final DefaultTableModel tableModel = createModel();
    myTable = new JBTable(tableModel);
    myTable.setIntercellSpacing(new Dimension(0, 0));
    myTable.setDefaultRenderer(TableItem.class, new MyRenderer());
    myTable.setShowGrid(false);
    myTable.setDragEnabled(false);
    myTable.setShowHorizontalLines(false);
    myTable.setShowVerticalLines(false);
    myTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    JPanel tablePanel =
        ToolbarDecorator.createDecorator(myTable)
            .setAddAction(
                new AnActionButtonRunnable() {
                  @Override
                  public void run(AnActionButton button) {
                    FileChooserDescriptor myDescriptor =
                        FileChooserDescriptorFactory.createSingleFolderDescriptor();
                    myDescriptor.setTitle(
                        ProjectBundle.message("add.external.annotations.path.title"));
                    myDescriptor.setDescription(
                        ProjectBundle.message("add.external.annotations.path.description"));
                    VirtualFile[] files =
                        FileChooser.chooseFiles(myDescriptor, myTable, myProject, null);
                    final MyTableModel tableModel = (MyTableModel) myTable.getModel();
                    boolean changes = false;
                    for (final VirtualFile file : files) {
                      if (file != null) {
                        tableModel.addTableItem(new TableItem(file));
                        changes = true;
                      }
                    }
                    if (changes) {
                      saveData();
                      TableUtil.selectRows(myTable, new int[] {tableModel.getRowCount() - 1});
                    }
                  }
                })
            .setRemoveAction(
                new AnActionButtonRunnable() {
                  @Override
                  public void run(AnActionButton button) {
                    final List removedItems = TableUtil.removeSelectedItems(myTable);
                    if (removedItems.size() > 0) {
                      saveData();
                    }
                  }
                })
            .createPanel();

    final JPanel mainPanel = new JPanel(new BorderLayout());

    mainPanel.add(tablePanel, BorderLayout.CENTER);
    mainPanel.add(
        new JBLabel(
            ProjectBundle.message("project.roots.external.annotations.description"),
            UIUtil.ComponentStyle.SMALL,
            UIUtil.FontColor.BRIGHTER),
        BorderLayout.NORTH);
    return mainPanel;
  }
  @SuppressWarnings({"unchecked", "rawtypes"})
  public InterfaceTrans() {

    setTitle("Pantalla Principal");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    setSize(1280, 720); // Tamaño
    setLocationRelativeTo(null); // Centrar ventana

    // donde se ejecute el programa
    setResizable(true);
    setVisible(true);

    // Quito la visibilidad de los elementos del padre que no necesito
    super.contentPane.setVisible(false); // para que se vea mi Panel en vez
    // del gris heredado
    super.menu2.setVisible(false);
    super.tb1.setVisible(false);

    // Añado a la barra los elementos que si necesito

    abrir = new JMenuItem("Abrir...   Alt+B");
    abrir.setMnemonic('B');
    abrir.setIcon(new ImageIcon(InterfaceTrans.class.getResource(""))); // ""
    // para
    // colocar
    // un
    // icono
    abrir.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            try {
              InterfaceTrans.archivotrans();
            } catch (Throwable e) {
              e.printStackTrace();
            }
          }
        });
    super.menu1.add(abrir);

    // -------------- Tabla ----------------------------------------------
    // -------------------------------------------------------------------

    tabla = new JTable();

    // ARRAY QUE CAPTURA EL CONTENIDO
    contenido = new Object[Tablas.transporte.size()][6];
    int contador = 0;
    for (Entry<Integer, Transporte> entrada : Tablas.transporte.entrySet()) {
      contenido[contador][0] = entrada.getValue().getId();
      contenido[contador][1] = entrada.getValue().getIdCliente();
      contenido[contador][2] = entrada.getValue().getIdProducto();
      contenido[contador][3] = entrada.getValue().isTipoViaje();
      contenido[contador][4] = entrada.getValue().getFechaEntrega();
      contenido[contador][5] = entrada.getValue().getFechaRecogida();
      contador++;
    }

    ModeloTablaTrans =
        new DefaultTableModel(contenido, columnas) {
          private static final long serialVersionUID = 1L;

          public boolean isCellEditable(int rowIndex, int columnIndex) {
            return false;
          }
        };
    // -----

    // COJEMO EL MODELO DE LA TABLA
    tabla = new JTable(ModeloTablaTrans);
    tabla.setShowVerticalLines(true);
    tabla.setShowHorizontalLines(true);
    tabla.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // SELECCION SENCILLA
    tabla.setVisible(true);

    sp = new JScrollPane(tabla); // Necesita un Scroll para que se vean las  columnas
    sp.setBounds(608, 182, 616, 337);

    // -------A partir de aqui el tabbedPaned-------------------

    separador = new JTabbedPane();
    panel1 = new JPanel();
    panel1.setBackground(Color.LIGHT_GRAY); // asi le damos color al panel
    panel1.setLayout(null);
    lblId_Transporte = new JLabel("N\u00BA Transporte:");
    lblId_Transporte.setFont(new Font("Arial", Font.BOLD, 13));
    lblId_Cliente = new JLabel("ID Cliente:");
    lblId_Cliente.setFont(new Font("Arial", Font.BOLD, 13));
    lblId_Producto = new JLabel("ID Producto:");
    lblId_Producto.setFont(new Font("Arial", Font.BOLD, 13));
    lblTipo_Viaje = new JLabel("Tipo Viaje:");
    lblTipo_Viaje.setFont(new Font("Arial", Font.BOLD, 13));
    lblFechaEnvio = new JLabel("Fecha Envio:");
    lblFechaEnvio.setFont(new Font("Arial", Font.BOLD, 13));
    lblFechaRecepcion = new JLabel("Fecha Rcogida:");
    lblFechaRecepcion.setFont(new Font("Arial", Font.BOLD, 13));

    // ----------cajas de texto ----------------

    cajaId_Transporte = new JTextField();
    cajaId_Transporte.setEnabled(false);
    cajaId_Cliente = new JTextField();
    cajaId_Producto = new JTextField();
    cajaTipo_Viaje = new JTextField();

    // --------botones-------------------

    guardar = new JButton("Guardar");
    guardar.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {

            Transporte t = new Transporte();
            Disparador d = new Disparador("idTransporte");
            SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
            if (t.insertar(
                    d.nextValue(),
                    Integer.parseInt(cajaId_Cliente.getText()),
                    Integer.parseInt(cajaId_Producto.getText()),
                    cajaTipo_Viaje.getText(),
                    sdf.format(dateEnvio.getCalendar().getTime()),
                    sdf.format(dateRecep.getCalendar().getTime()))
                == true) {
              JOptionPane.showMessageDialog(
                  null, "El registro " + d.insert() + " se ha insertado correctamente");
            }
          }
        });

    borrar = new JButton("LIMPIAR REGISTRO");
    borrar.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) { // usado para dejar las vacías

            cajaId_Transporte.setText(null);
            cajaId_Cliente.setText(null);
            cajaId_Producto.setText(null);
            cajaTipo_Viaje.setText(null);
            dateRecep.setCalendar(null); // vaciamos la caja del calendario
            dateEnvio.setCalendar(null); // vaciamos la caja del calendario
          }
        });
    lblId_Transporte.setBounds(73, 181, 187, 28);
    lblId_Cliente.setBounds(73, 220, 187, 30);
    lblId_Producto.setBounds(73, 261, 187, 30);
    lblTipo_Viaje.setBounds(73, 302, 187, 30);
    lblFechaEnvio.setBounds(73, 343, 187, 28);
    lblFechaRecepcion.setBounds(73, 382, 187, 30);

    // ----------Cajas-------------

    cajaId_Transporte.setBounds(270, 179, 124, 30);
    cajaId_Cliente.setBounds(270, 221, 250, 30);
    cajaId_Producto.setBounds(270, 262, 250, 30);
    cajaTipo_Viaje.setBounds(270, 302, 85, 30);

    // ----------Botones-------------

    guardar.setBounds(270, 423, 85, 30);
    borrar.setBounds(384, 423, 136, 30);

    dateRecep.setBounds(270, 382, 250, 30);
    panel1.add(sp);

    panel1.add(guardar);
    panel1.add(borrar);
    panel1.add(lblId_Transporte);
    panel1.add(lblId_Cliente);
    panel1.add(lblId_Producto);
    panel1.add(lblTipo_Viaje);
    panel1.add(lblFechaEnvio);
    panel1.add(lblFechaRecepcion);

    panel1.add(cajaId_Transporte);
    panel1.add(cajaId_Cliente);
    panel1.add(cajaId_Producto);
    panel1.add(cajaTipo_Viaje);

    separador.addTab("Gestion  de Transporte", null, panel1, "Separador1"); // Añadimos
    // el
    // Panel1
    // al
    // separador

    panel1.add(dateRecep);

    dateEnvio = new JDateChooser();
    dateEnvio.setBounds(270, 343, 250, 30);
    panel1.add(dateEnvio);

    btnOk = new JButton("OK");
    btnOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cajaTipo_Viaje.setText((String) comboBox.getSelectedItem());
          }
        });
    btnOk.setBounds(473, 302, 47, 30);
    panel1.add(btnOk);

    comboBox = new JComboBox();
    comboBox.setModel(
        new DefaultComboBoxModel(new String[] {"Entrega", "Recogida", "Mixto", "Anulado"}));
    comboBox.setBounds(365, 302, 98, 30);
    panel1.add(comboBox);

    btnNewButton = new JButton("Generar N\u00BA");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cajaId_Transporte.setText(new Disparador("idTransporte").nextValue() + "");
          }
        });
    btnNewButton.setBounds(404, 182, 116, 26);
    panel1.add(btnNewButton);

    lblModuloTransporte = new JLabel("MODULO TRANSPORTE");
    lblModuloTransporte.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 30));
    lblModuloTransporte.setBounds(101, 28, 362, 37);
    panel1.add(lblModuloTransporte);

    JSeparator separatortitulo = new JSeparator();
    separatortitulo.setBackground(Color.BLACK);
    separatortitulo.setBounds(46, 68, 417, 10);
    panel1.add(separatortitulo);

    label = new JLabel("");
    label.setIcon(
        new ImageIcon(InterfaceTrans.class.getResource("/FinalLaGestionTransport/truckmini.png")));
    label.setBounds(47, 11, 62, 54);
    panel1.add(label);

    label_logo = new JLabel("");
    label_logo.setIcon(
        new ImageIcon(InterfaceTrans.class.getResource("/FinalLaGestionTransport/mini-logo.png")));
    label_logo.setBounds(1058, 11, 207, 114);
    panel1.add(label_logo);
    getContentPane().add(separador); // sin esto no se veria nada, añadimos
    // al JFrame el JTabbedPane

    // ------------------------------------------------------------------------------------------------
    // --------------------------A partir de aquí el panel 2
    // ------------------------------------------
    // ------------------------------------------------------------------------------------------------
    panel2 = new JPanel();
    panel2.setBackground(Color.LIGHT_GRAY); // asi le damos color al panel1
    panel2.setLayout(null);

    separador.addTab("Conductores", null, panel2, "Separador1");

    btnAgregarCondutores = new JButton("MODIFICAR CONDUCTORES");
    btnAgregarCondutores.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent arg0) {
            //				AddConductores verformulario2 = new AddConductores();
            //				verformulario2.setVisible(true);

            try {
              Runtime.getRuntime()
                  .exec("rundll32 url.dll,FileProtocolHandler C:\\LaGestion\\Conductores.xls");
            } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        });

    tabla2 = new JTable();
    tabla21 = new DefaultTableModel();
    tabla2.setModel(tabla21);
    tabla2.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
    tabla2.setBackground(Color.LIGHT_GRAY);
    tabla2.setBounds(601, 189, 648, 400);
    // No queremos ver las lineas verticales
    tabla2.setShowVerticalLines(true);
    // No queremos ver las lineas verticales
    tabla2.setShowHorizontalLines(true);
    panel2.add(tabla2);

    btnAgregarCondutores.setBounds(384, 216, 207, 103);
    panel2.add(btnAgregarCondutores);

    labelLogo = new JLabel("");
    labelLogo.setIcon(
        new ImageIcon(InterfaceTrans.class.getResource("/FinalLaGestionTransport/mini-logo.png")));
    labelLogo.setBounds(1042, 11, 207, 114);
    panel2.add(labelLogo);

    labelConductor = new JLabel("LISTADO CONDUCTORES");
    labelConductor.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 30));
    labelConductor.setBounds(100, 33, 402, 37);
    panel2.add(labelConductor);

    label_2 = new JLabel("");
    label_2.setIcon(
        new ImageIcon(InterfaceTrans.class.getResource("/FinalLaGestionTransport/truckmini.png")));
    label_2.setBounds(51, 16, 62, 54);
    panel2.add(label_2);

    separatorTitulo = new JSeparator();
    separatorTitulo.setBackground(Color.BLACK);
    separatorTitulo.setBounds(61, 72, 441, 10);
    panel2.add(separatorTitulo);

    // RELOJ
    hilo = new Thread(this);
    hilo.start();
    lblReloj = new JLabel("");
    lblReloj.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 22));
    lblReloj.setBounds(61, 189, 312, 201);
    panel2.add(lblReloj);

    // Label Turno
    lblTurno = new JLabel("HORARIO/TURNO");
    lblTurno.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 18));
    lblTurno.setBounds(61, 401, 186, 27);
    panel2.add(lblTurno);

    lblVerturno = new JLabel("");
    lblVerturno.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 24));
    lblVerturno.setForeground(Color.BLUE);
    lblVerturno.setBounds(61, 446, 233, 66);
    panel2.add(lblVerturno);

    btnVerConductores = new JButton("VER CONDUCTORES");
    btnVerConductores.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {

            String ruta = "C:\\LaGestion\\Conductores.xls";
            JFileChooser excel = new JFileChooser();
            excel.setSelectedFile(new File(ruta));
            File archivoexcel = null;
            archivoexcel = excel.getSelectedFile().getAbsoluteFile();

            try {

              Workbook leerEx = Workbook.getWorkbook(archivoexcel);

              for (int hoja = 0; hoja < leerEx.getNumberOfSheets(); hoja++) {

                Sheet hojap = leerEx.getSheet(hoja);
                int colum2 = hojap.getColumns();
                int filas1 = hojap.getRows();
                Object data[] = new Object[colum2];

                for (int fila = 0; fila < filas1; fila++) {
                  for (int colum1 = 0; colum1 < colum2; colum1++) {
                    if (fila == 0) {
                      tabla21.addColumn(hojap.getCell(colum1, fila).getContents());
                    }
                    //										System.out.println(hojap.getCell(colum1, fila).getContents());
                    if (fila >= 1) data[colum1] = hojap.getCell(colum1, fila).getContents();
                  }
                  tabla21.addRow(data);
                }
              }

              // opcional
              tabla21.removeRow(0);
            } catch (Exception e) {

            }
            // FIN DE LEER EXCEL

            btnVerConductores.setEnabled(false);
          }
        });
    btnVerConductores.setBounds(601, 141, 153, 37);
    panel2.add(btnVerConductores);

    // Separador
    getContentPane().add(separador); // sin esto no se veria nada, añadimos
    // al JFrame el JTabbedPane

  }
Esempio n. 23
0
  private DetailsView() {
    resultsPanel = (CytoPanelImp) Cytoscape.getDesktop().getCytoPanel(SwingConstants.EAST);
    this.kamService = KAMServiceFactory.getInstance().getKAMService();

    // build node details panel and add to results panel
    nodeDetailPanel = new JPanel();
    nodeDetailPanel.setName("KAM Node Info");

    JScrollPane tblScroll = new JScrollPane();
    JTable termTbl = new JTable();
    termTbl.setShowGrid(true);
    termTbl.setShowHorizontalLines(true);
    termTbl.setShowVerticalLines(true);

    nodeDetailPanel.setLayout(new BorderLayout());

    JLabel nodeLbl = new JLabel("Supporting BEL Terms");
    nodeDetailPanel.add(nodeLbl, BorderLayout.NORTH);

    termTableModel = new TermTableModel();
    termTbl.setModel(termTableModel);
    tblScroll.setViewportView(termTbl);

    nodeDetailPanel.add(tblScroll, BorderLayout.CENTER);
    resultsPanel.add(nodeDetailPanel);

    // build edge details panel and add to results panel
    edgeDetailPanel = new JPanel(new GridLayout(3, 1));
    edgeDetailPanel.setName("KAM Edge Info");

    TextAreaCellRenderer textRenderer = new TextAreaCellRenderer();

    // statement panel
    JPanel stmtPanel = new JPanel();
    stmtPanel.setLayout(new BorderLayout());
    JLabel edgeLbl = new JLabel("Supporting BEL Statements");
    stmtPanel.add(edgeLbl, BorderLayout.NORTH);
    JScrollPane stmtScroll = new JScrollPane();
    JTable stmtTbl = new JTable();
    stmtTbl.setShowGrid(true);
    stmtTbl.setShowHorizontalLines(true);
    stmtTbl.setShowVerticalLines(true);
    stmtTableModel = new StatementTableModel();
    stmtTbl.setModel(stmtTableModel);
    stmtTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    stmtTbl.getSelectionModel().addListSelectionListener(new StatementSelectionListener());
    stmtScroll.setViewportView(stmtTbl);
    stmtPanel.add(stmtScroll, BorderLayout.CENTER);
    edgeDetailPanel.add(stmtPanel);

    // annotation panel
    JPanel annPanel = new JPanel();
    annPanel.setLayout(new BorderLayout());
    JLabel annLbl = new JLabel("Statement Annotations");
    annPanel.add(annLbl, BorderLayout.NORTH);
    JScrollPane annScroll = new JScrollPane();
    JTable annTbl = new JTable();
    annTbl.setShowGrid(true);
    annTbl.setShowHorizontalLines(true);
    annTbl.setShowVerticalLines(true);
    annTableModel = new AnnotationTableModel();
    annTbl.setModel(annTableModel);
    annTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    annTbl.getColumnModel().getColumn(1).setCellRenderer(textRenderer);

    annScroll.setViewportView(annTbl);
    annPanel.add(annScroll, BorderLayout.CENTER);
    edgeDetailPanel.add(annPanel);

    // citation panel
    JPanel citPanel = new JPanel();
    citPanel.setLayout(new BorderLayout());
    JLabel citLbl = new JLabel("Citation");
    citPanel.add(citLbl, BorderLayout.NORTH);
    JScrollPane citScroll = new JScrollPane();
    JTable citTbl = new JTable();
    citTbl.setShowGrid(true);
    citTbl.setShowHorizontalLines(true);
    citTbl.setShowVerticalLines(true);
    citTableModel = new CitationTableModel();
    citTbl.setModel(citTableModel);
    citTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    citTbl.getColumnModel().getColumn(0).setCellRenderer(textRenderer);
    citTbl.getColumnModel().getColumn(1).setCellRenderer(textRenderer);
    citTbl.getColumnModel().getColumn(2).setCellRenderer(textRenderer);
    citTbl.getColumnModel().getColumn(3).setCellRenderer(textRenderer);
    citScroll.setViewportView(citTbl);
    citPanel.add(citScroll, BorderLayout.CENTER);
    edgeDetailPanel.add(citPanel);

    // add edge details to Results Panel (cytoscape)
    resultsPanel.add(edgeDetailPanel);

    // delay showing panels
    nodeDetailPanel.setVisible(false);
    edgeDetailPanel.setVisible(false);
  }
Esempio n. 24
0
  public JComponent createComponentImpl() {
    final JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
    mainPanel.setPreferredSize(new Dimension(-1, 200));
    final DefaultTableModel tableModel = createModel();
    myTable = new Table(tableModel);
    myTable.setIntercellSpacing(new Dimension(0, 0));
    myTable.setDefaultRenderer(TableItem.class, new MyRenderer());
    myTable.setShowGrid(false);
    myTable.setDragEnabled(false);
    myTable.setShowHorizontalLines(false);
    myTable.setShowVerticalLines(false);
    myTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    myAddPathButton = new JButton(ProjectBundle.message("module.javadoc.add.path.button"));
    myAddPathButton.addActionListener(new AddPathActionListener());

    myRemoveButton = new JButton(ProjectBundle.message("module.javadoc.remove.button"));
    myRemoveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            final List removedItems = TableUtil.removeSelectedItems(myTable);
            if (removedItems.size() > 0) {
              saveData();
            }
          }
        });

    final JPanel panel = new JPanel(new GridBagLayout());
    panel.add(
        myAddPathButton,
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.NORTH,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 6, 0, 0),
            0,
            0));
    panel.add(
        myRemoveButton,
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTH,
            GridBagConstraints.HORIZONTAL,
            new Insets(6, 6, 0, 0),
            0,
            0));

    mainPanel.add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
    mainPanel.add(panel, BorderLayout.EAST);
    final PanelWithText panelWithText =
        new PanelWithText(ProjectBundle.message("project.roots.external.annotations.description"));
    panelWithText.setBorder(null);
    mainPanel.add(panelWithText, BorderLayout.NORTH);

    myTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent e) {
                if (e.getValueIsAdjusting()) {
                  return;
                }
                final int selectedIndex = myTable.getSelectedRow();
                myRemoveButton.setEnabled(selectedIndex >= 0);
              }
            });
    if (tableModel.getRowCount() > 0) {
      TableUtil.selectRows(myTable, new int[] {0});
    } else {
      myRemoveButton.setEnabled(false);
    }
    return mainPanel;
  }