for (final String option : options) {
comboBox.addItem(option);
}
searchWidget.getContentPane().add(comboBox);
searchTable = new JTable();
searchTable.setName("search");
searchTable.setBackground(new Color(35, 35, 35));
searchTable.setForeground(Color.GRAY);
searchTable.setOpaque(true);
final JTableHeader header = searchTable.getTableHeader();
header.setOpaque(false);
header.setBorder(BorderFactory.createRaisedSoftBevelBorder());
header.setForeground(Color.GRAY);
header.setAutoscrolls(true);
header.setFont(new Font("Calibri", Font.PLAIN, 14));
header.setBorder(BorderFactory.createEmptyBorder());
searchTable.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(final KeyEvent e) {
final int c = e.getKeyCode();
e.getSource();
if (c == KeyEvent.VK_DELETE) {
} else if (c == KeyEvent.VK_ADD) {
} else if (c == KeyEvent.VK_LEFT) {
} else if (c == KeyEvent.VK_RIGHT) {
} else if (c == KeyEvent.VK_ENTER) {
}
}
});
searchTable.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
if (e.getClickCount() == 2) {
final JTable target = (JTable) e.getSource();
target.getSelectedRow();
MediaUtils.switchMedia(target);
}
}
@Override
public void mouseReleased(final MouseEvent e) {
if (e.isPopupTrigger()) {
final JTable source = (JTable) e.getSource();
final int row = source.rowAtPoint(e.getPoint());
final int column = source.columnAtPoint(e.getPoint());
if (!source.isRowSelected(row)) {
source.changeSelection(row, column, false, false);
}
popup.show(e.getComponent(), e.getX(), e.getY());
}
}