use of java.awt.event.KeyEvent in project MtgDesktopCompanion by nicho92.
the class ConstructPanel method initGUI.
private void initGUI() {
JPanel panneauHaut = new JPanel();
JButton btnSearch;
JButton btnUpdate;
HandPanel thumbnail;
JPanel panelBottom;
JTextField txtSearch;
JComboBox<String> cboAttributs;
JScrollPane scrollResult;
JTabbedPane tabbedPane;
ButtonGroup groupsFilterResult;
lblExport.setIcon(MTGConstants.ICON_LOADING);
lblExport.setVisible(false);
setLayout(new BorderLayout(0, 0));
deckmodel = new DeckModel(DeckModel.TYPE.DECK);
deckSidemodel = new DeckModel(DeckModel.TYPE.SIDE);
deckDetailsPanel = new DeckDetailsPanel();
panelBottom = new JPanel();
thumbnail = new HandPanel();
thumbnail.setThumbnailSize(new Dimension(223, 311));
thumbnail.enableDragging(false);
thumbnail.setMaxCardsRow(4);
FlowLayout flowLayout = (FlowLayout) panneauHaut.getLayout();
flowLayout.setAlignment(FlowLayout.LEFT);
add(panneauHaut, BorderLayout.NORTH);
cboAttributs = new JComboBox<>(new DefaultComboBoxModel<String>(MTGControler.getInstance().getEnabledProviders().getQueryableAttributs()));
panneauHaut.add(cboAttributs);
txtSearch = new JTextField();
panneauHaut.add(txtSearch);
txtSearch.setColumns(25);
btnSearch = new JButton(MTGConstants.ICON_SEARCH);
panneauHaut.add(btnSearch);
final JLabel lblCards = new JLabel();
panneauHaut.add(lblCards);
JButton btnNewDeck = new JButton(MTGConstants.ICON_NEW);
btnNewDeck.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("CREATE_NEW_DECK"));
panneauHaut.add(btnNewDeck);
btnNewDeck.addActionListener(newDeckEvent -> {
MagicDeck newDeck = new MagicDeck();
setDeck(newDeck);
deckmodel.init(newDeck);
deckSidemodel.init(newDeck);
});
JButton btnOpen = new JButton(MTGConstants.ICON_OPEN);
btnOpen.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("OPEN_DECK"));
panneauHaut.add(btnOpen);
btnOpen.addActionListener(openEvent -> {
try {
JDeckChooserDialog choose = new JDeckChooserDialog();
choose.setVisible(true);
deck = choose.getSelectedDeck();
if (deck != null) {
deckDetailsPanel.setMagicDeck(deck);
deckmodel.init(deck);
deckSidemodel.init(deck);
setDeck(deck);
updatePanels();
}
} catch (Exception ex) {
logger.error(ex);
JOptionPane.showMessageDialog(null, ex, MTGControler.getInstance().getLangService().getError(), JOptionPane.ERROR_MESSAGE);
}
});
btnUpdate = new JButton();
btnUpdate.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("UPDATE_DECK"));
btnUpdate.addActionListener(updateEvent -> ThreadManager.getInstance().execute(() -> {
Map<MagicCard, Integer> updateM = new HashMap<>();
Map<MagicCard, Integer> updateS = new HashMap<>();
btnUpdate.setEnabled(false);
lblExport.setVisible(true);
for (MagicCard mc : deck.getMap().keySet()) {
try {
updateM.put(MTGControler.getInstance().getEnabledProviders().getCardById(mc.getId()), deck.getMap().get(mc));
} catch (Exception e) {
logger.error(e);
btnUpdate.setEnabled(true);
lblExport.setVisible(false);
}
}
for (MagicCard mc : deck.getMapSideBoard().keySet()) {
try {
updateS.put(MTGControler.getInstance().getEnabledProviders().getCardById(mc.getId()), deck.getMapSideBoard().get(mc));
} catch (Exception e) {
btnUpdate.setEnabled(true);
lblExport.setVisible(false);
}
}
deck.getMap().clear();
deck.setMapDeck(updateM);
deck.getMapSideBoard().clear();
deck.setMapSideBoard(updateS);
updatePanels();
btnUpdate.setEnabled(true);
lblExport.setVisible(false);
JOptionPane.showMessageDialog(null, MTGControler.getInstance().getLangService().getCapitalize("UPDATED_DECK"), MTGControler.getInstance().getLangService().getCapitalize("FINISHED"), JOptionPane.INFORMATION_MESSAGE);
}, "Update Deck"));
btnUpdate.setIcon(MTGConstants.ICON_REFRESH);
panneauHaut.add(btnUpdate);
JButton btnSave = new JButton(MTGConstants.ICON_SAVE);
btnSave.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("SAVE_DECK"));
panneauHaut.add(btnSave);
btnSave.addActionListener(e -> {
try {
String name = JOptionPane.showInputDialog(MTGControler.getInstance().getLangService().getCapitalize("DECK_NAME") + " ?", deck.getName());
deck.setName(name);
MTGControler.getInstance().saveDeck(deck);
} catch (Exception ex) {
logger.error("error saving", ex);
JOptionPane.showMessageDialog(null, ex, MTGControler.getInstance().getLangService().getError(), JOptionPane.ERROR_MESSAGE);
}
});
JButton btnImport = new JButton(MTGConstants.ICON_IMPORT);
btnImport.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("DECK_IMPORT_AS"));
btnImport.addActionListener(ae -> {
JPopupMenu menu = new JPopupMenu();
for (final MTGCardsExport exp : MTGControler.getInstance().getEnabledDeckExports()) {
if (exp.getMods() == MODS.BOTH || exp.getMods() == MODS.IMPORT) {
JMenuItem it = new JMenuItem();
it.setIcon(exp.getIcon());
it.setText(exp.getName());
it.addActionListener(itEvent -> {
JFileChooser jf = new JFileChooser(".");
jf.setFileFilter(new FileFilter() {
@Override
public String getDescription() {
return exp.getName();
}
@Override
public boolean accept(File f) {
return (f.isDirectory() || f.getName().endsWith(exp.getFileExtension()));
}
});
int res = -1;
f = new File("");
if (!exp.needDialogGUI()) {
res = jf.showOpenDialog(null);
f = jf.getSelectedFile();
} else {
res = JFileChooser.APPROVE_OPTION;
}
if (res == JFileChooser.APPROVE_OPTION)
ThreadManager.getInstance().execute(() -> {
try {
loading(true, MTGControler.getInstance().getLangService().get("LOADING_FILE", f.getName(), exp));
deck = exp.importDeck(f);
JOptionPane.showMessageDialog(null, MTGControler.getInstance().getLangService().getCapitalize("FINISHED"), exp.getName() + " " + MTGControler.getInstance().getLangService().get("FINISHED"), JOptionPane.INFORMATION_MESSAGE);
setDeck(deck);
loading(false, "");
deckmodel.init(deck);
deckSidemodel.init(deck);
setDeck(deck);
updatePanels();
} catch (Exception e) {
logger.error("error import", e);
MTGLogger.printStackTrace(e);
loading(false, "");
JOptionPane.showMessageDialog(null, e, MTGControler.getInstance().getLangService().getError(), JOptionPane.ERROR_MESSAGE);
}
}, "import " + exp);
});
menu.add(it);
}
}
Component b = (Component) ae.getSource();
Point point = b.getLocationOnScreen();
menu.show(b, 0, 0);
menu.setLocation(point.x, point.y + b.getHeight());
});
panneauHaut.add(btnImport);
btnExports = new JButton();
btnExports.setEnabled(false);
btnExports.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("EXPORT_AS"));
btnExports.setIcon(MTGConstants.ICON_EXPORT);
btnExports.addActionListener(exportsAction -> {
JPopupMenu menu = new JPopupMenu();
for (final MTGCardsExport exp : MTGControler.getInstance().getEnabledDeckExports()) {
if (exp.getMods() == MODS.BOTH || exp.getMods() == MODS.EXPORT) {
JMenuItem it = new JMenuItem();
it.setIcon(exp.getIcon());
it.setText(exp.getName());
it.addActionListener(pluginExportEvent -> {
JFileChooser jf = new JFileChooser(".");
jf.setSelectedFile(new File(deck.getName() + exp.getFileExtension()));
jf.showSaveDialog(null);
exportedFile = jf.getSelectedFile();
ThreadManager.getInstance().execute(() -> {
try {
loading(true, MTGControler.getInstance().getLangService().get("EXPORT_TO", deck, exp));
exp.export(deck, exportedFile);
JOptionPane.showMessageDialog(null, MTGControler.getInstance().getLangService().combine("EXPORT", "FINISHED"), exp.getName() + " " + MTGControler.getInstance().getLangService().getCapitalize("FINISHED"), JOptionPane.INFORMATION_MESSAGE);
loading(false, "");
} catch (Exception e) {
logger.error(e);
loading(false, "");
JOptionPane.showMessageDialog(null, e, MTGControler.getInstance().getLangService().getError(), JOptionPane.ERROR_MESSAGE);
}
}, "Export " + deck + " to " + exp.getName());
});
menu.add(it);
}
}
Component b = (Component) exportsAction.getSource();
Point point = b.getLocationOnScreen();
menu.show(b, 0, 0);
menu.setLocation(point.x, point.y + b.getHeight());
});
panneauHaut.add(btnExports);
panneauHaut.add(lblExport);
JPanel panneauBas = new JPanel();
add(panneauBas, BorderLayout.SOUTH);
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
add(tabbedPane, BorderLayout.CENTER);
JSplitPane panneauDeck = new JSplitPane();
panneauDeck.setOrientation(JSplitPane.VERTICAL_SPLIT);
tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("DECK"), null, panneauDeck, null);
DefaultRowSorter sorterCards = new TableRowSorter<DefaultTableModel>(deckmodel);
magicCardDetailPanel = new MagicCardDetailPanel();
magicCardDetailPanel.setPreferredSize(new Dimension(0, 0));
magicCardDetailPanel.enableThumbnail(true);
panelBottom.setLayout(new BorderLayout(0, 0));
panelBottom.add(magicCardDetailPanel);
panneauDeck.setRightComponent(panelBottom);
cardDrawProbaPanel = new DrawProbabilityPanel();
panelBottom.add(cardDrawProbaPanel, BorderLayout.EAST);
final JTabbedPane tabbedDeckSide = new JTabbedPane(JTabbedPane.BOTTOM);
panneauDeck.setLeftComponent(tabbedDeckSide);
JScrollPane scrollDeck = new JScrollPane();
tabbedDeckSide.addTab("Main", null, scrollDeck, null);
tableDeck = new JTable();
scrollDeck.setViewportView(tableDeck);
tableDeck.setModel(deckmodel);
tableDeck.getColumnModel().getColumn(2).setCellRenderer(new ManaCellRenderer());
tableDeck.setRowHeight(MTGConstants.TABLE_ROW_HEIGHT);
tableDeck.setRowSorter(sorterCards);
tableDeck.getColumnModel().getColumn(4).setCellEditor(new IntegerCellEditor());
tableDeck.getColumnModel().getColumn(3).setCellRenderer(new MagicEditionRenderer());
tableDeck.getColumnModel().getColumn(3).setCellEditor(new MagicEditionListEditor());
JScrollPane scrollSideboard = new JScrollPane();
tabbedDeckSide.addTab("SideBoard", null, scrollSideboard, null);
tableSide = new JTable();
tableSide.setModel(deckSidemodel);
tableSide.setRowHeight(MTGConstants.TABLE_ROW_HEIGHT);
tableSide.getColumnModel().getColumn(2).setCellRenderer(new ManaCellRenderer());
tableSide.getColumnModel().getColumn(4).setCellEditor(new IntegerCellEditor());
tableSide.getColumnModel().getColumn(3).setCellRenderer(new MagicEditionRenderer());
tableSide.getColumnModel().getColumn(3).setCellEditor(new MagicEditionListEditor());
tableSide.getColumnModel().getColumn(4).setCellEditor(new IntegerCellEditor());
scrollSideboard.setViewportView(tableSide);
tableDeck.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent ev) {
MagicCard mc = (MagicCard) tableDeck.getValueAt(tableDeck.getSelectedRow(), 0);
magicCardDetailPanel.setMagicCard(mc);
cardDrawProbaPanel.init(deck, mc);
}
});
tableSide.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent ev) {
MagicCard mc = (MagicCard) tableSide.getValueAt(tableSide.getSelectedRow(), 0);
magicCardDetailPanel.setMagicCard(mc);
}
});
tableDeck.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
MagicCard mc = (MagicCard) tableDeck.getValueAt(tableDeck.getSelectedRow(), 0);
if (e.getKeyCode() == 0) {
deck.getMap().remove(mc);
deckmodel.init(deck);
}
}
});
tableSide.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
MagicCard mc = (MagicCard) tableSide.getValueAt(tableSide.getSelectedRow(), 0);
if (e.getKeyCode() == 0) {
deck.getMapSideBoard().remove(mc);
deckmodel.init(deck);
}
}
});
tableDeck.getModel().addTableModelListener(e -> updatePanels());
tableSide.getModel().addTableModelListener(e -> updatePanels());
tableDeck.getDefaultEditor(String.class).addCellEditorListener(new CellEditorListener() {
@Override
public void editingStopped(ChangeEvent e) {
updatePanels();
}
@Override
public void editingCanceled(ChangeEvent e) {
updatePanels();
}
});
tableSide.getDefaultEditor(String.class).addCellEditorListener(new CellEditorListener() {
@Override
public void editingStopped(ChangeEvent e) {
updatePanels();
}
@Override
public void editingCanceled(ChangeEvent e) {
updatePanels();
}
});
JPanel panelInfoDeck = new JPanel();
tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("INFORMATIONS"), null, panelInfoDeck, null);
panelInfoDeck.setLayout(new BorderLayout(0, 0));
panelInfoDeck.add(deckDetailsPanel, BorderLayout.NORTH);
deckDetailsPanel.setMagicDeck(deck);
cmcChartPanel = new CmcChartPanel();
manaRepartitionPanel = new ManaRepartitionPanel();
typeRepartitionPanel = new TypeRepartitionPanel();
rarityRepartitionPanel = new RarityRepartitionPanel();
drawProbabilityPanel = new DrawProbabilityPanel();
JPanel randomHandPanel = new JPanel();
JPanel statPanel = new JPanel();
randomHandPanel.setLayout(new BorderLayout(0, 0));
randomHandPanel.add(thumbnail, BorderLayout.CENTER);
statPanel.setLayout(new GridLayout(3, 2, 0, 0));
statPanel.add(manaRepartitionPanel);
statPanel.add(typeRepartitionPanel);
statPanel.add(rarityRepartitionPanel);
statPanel.add(cmcChartPanel);
statPanel.add(drawProbabilityPanel);
tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("STATS"), null, statPanel, null);
deckPricePanel = new DeckPricePanel();
statPanel.add(deckPricePanel);
tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("SAMPLE_HAND"), null, randomHandPanel, null);
JPanel panel = new JPanel();
randomHandPanel.add(panel, BorderLayout.NORTH);
JButton btnDrawAHand = new JButton(MTGControler.getInstance().getLangService().getCapitalize("DRAW_HAND"));
btnDrawAHand.addActionListener(ae -> {
thumbnail.removeAll();
p.mixHandAndLibrary();
p.shuffleLibrary();
p.drawCard(7);
thumbnail.initThumbnails(p.getHand(), false, false);
});
panel.add(btnDrawAHand);
JPanel panneauGauche = new JPanel();
add(panneauGauche, BorderLayout.WEST);
panneauGauche.setLayout(new BorderLayout(0, 0));
scrollResult = new JScrollPane();
panneauGauche.add(scrollResult);
listResult = new JList<>(new DefaultListModel<MagicCard>());
listResult.setCellRenderer(new MagicCardListRenderer());
listResult.setMinimumSize(new Dimension(100, 0));
listResult.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
scrollResult.setViewportView(listResult);
JPanel panneauResultFilter = new JPanel();
panneauGauche.add(panneauResultFilter, BorderLayout.NORTH);
groupsFilterResult = new ButtonGroup() {
@Override
public void setSelected(ButtonModel model, boolean selected) {
if (selected) {
super.setSelected(model, selected);
} else {
clearSelection();
}
}
};
JToggleButton tglbtnStd = new JToggleButton("STD");
tglbtnStd.setActionCommand("Standard");
panneauResultFilter.add(tglbtnStd);
JToggleButton tglbtnMdn = new JToggleButton("MDN");
tglbtnMdn.setActionCommand("Modern");
panneauResultFilter.add(tglbtnMdn);
JToggleButton tglbtnLeg = new JToggleButton("LEG");
tglbtnLeg.setActionCommand("Legacy");
panneauResultFilter.add(tglbtnLeg);
JToggleButton tglbtnVin = new JToggleButton("VIN");
tglbtnVin.setActionCommand("Vintage");
panneauResultFilter.add(tglbtnVin);
groupsFilterResult.add(tglbtnStd);
groupsFilterResult.add(tglbtnMdn);
groupsFilterResult.add(tglbtnLeg);
groupsFilterResult.add(tglbtnVin);
listResult.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent ev) {
if (ev.getClickCount() == 1 && !ev.isConsumed()) {
ev.consume();
MagicCard mc = listResult.getSelectedValue();
magicCardDetailPanel.setMagicCard(mc);
}
if (ev.getClickCount() == 2 && !ev.isConsumed()) {
ev.consume();
MagicCard mc = listResult.getSelectedValue();
if (getSelectedMap().get(mc) != null) {
getSelectedMap().put(mc, deck.getMap().get(mc) + 1);
} else {
getSelectedMap().put(mc, 1);
}
deckmodel.init(deck);
deckSidemodel.init(deck);
}
}
});
txtSearch.addActionListener(e -> btnSearch.doClick());
tabbedDeckSide.addChangeListener(e -> selectedIndex = tabbedDeckSide.getSelectedIndex());
btnSearch.addActionListener(aeSearch -> {
if (txtSearch.getText().equals(""))
return;
resultListModel.removeAllElements();
ThreadManager.getInstance().execute(() -> {
try {
String searchName = txtSearch.getText();
List<MagicCard> cards = MTGControler.getInstance().getEnabledProviders().searchCardByCriteria(cboAttributs.getSelectedItem().toString(), searchName, null, false);
MagicFormat form = new MagicFormat();
for (MagicCard m : cards) {
if (groupsFilterResult.getSelection() != null) {
form.setFormat(groupsFilterResult.getSelection().getActionCommand());
if (m.getLegalities().contains(form))
resultListModel.addElement(m);
} else {
resultListModel.addElement(m);
}
}
lblCards.setText(resultListModel.size() + " " + MTGControler.getInstance().getLangService().get("RESULTS"));
listResult.setModel(resultListModel);
listResult.updateUI();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage(), MTGControler.getInstance().getLangService().getError(), JOptionPane.ERROR_MESSAGE);
}
}, "search deck");
});
}
use of java.awt.event.KeyEvent in project sic by belluccifranco.
the class PedidosGUI method cargarRenglonesDelPedidoSeleccionadoEnTabla.
private void cargarRenglonesDelPedidoSeleccionadoEnTabla(KeyEvent evt) {
int row = Utilidades.getSelectedRowModelIndice(tbl_Pedidos);
if (evt != null) {
if ((evt.getKeyCode() == KeyEvent.VK_UP) && row > 0) {
row--;
}
if ((evt.getKeyCode() == KeyEvent.VK_DOWN) && (row + 1) < tbl_Pedidos.getRowCount()) {
row++;
}
}
this.limpiarTablaRenglones();
this.setColumnasRenglonesPedido();
try {
List<RenglonPedido> renglones = Arrays.asList(RestClient.getRestTemplate().getForObject("/pedidos/" + pedidosTotal.get(row).getId_Pedido() + "/renglones", RenglonPedido[].class));
renglones.stream().map(r -> {
Object[] fila = new Object[6];
fila[0] = r.getProducto().getCodigo();
fila[1] = r.getProducto().getDescripcion();
fila[2] = r.getCantidad();
fila[3] = r.getProducto().getPrecioLista();
fila[4] = r.getDescuento_porcentaje();
fila[5] = r.getSubTotal();
return fila;
}).forEach(fila -> {
modeloTablaRenglones.addRow(fila);
});
tbl_RenglonesPedido.setModel(modeloTablaRenglones);
} catch (RestClientResponseException ex) {
JOptionPane.showMessageDialog(this, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
} catch (ResourceAccessException ex) {
LOGGER.error(ex.getMessage());
JOptionPane.showMessageDialog(this, ResourceBundle.getBundle("Mensajes").getString("mensaje_error_conexion"), "Error", JOptionPane.ERROR_MESSAGE);
}
}
use of java.awt.event.KeyEvent in project UniversalMediaServer by UniversalMediaServer.
the class FFmpegDVRMSRemux method config.
@Override
public JComponent config() {
FormLayout layout = new FormLayout("left:pref, 3dlu, p, 3dlu, 0:grow", "p, 3dlu, p, 3dlu, 0:grow");
PanelBuilder builder = new PanelBuilder(layout);
builder.border(Borders.EMPTY);
builder.opaque(false);
CellConstraints cc = new CellConstraints();
JComponent cmp = builder.addSeparator(Messages.getString("NetworkTab.5"), cc.xyw(1, 1, 5));
cmp = (JComponent) cmp.getComponent(0);
cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));
builder.addLabel(Messages.getString("FFmpegDVRMSRemux.0"), cc.xy(1, 3));
altffpath = new JTextField(configuration.getFfmpegAlternativePath());
altffpath.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
configuration.setFfmpegAlternativePath(altffpath.getText());
}
});
builder.add(altffpath, cc.xyw(3, 3, 3));
return builder.getPanel();
}
use of java.awt.event.KeyEvent in project SeqMonk by s-andrews.
the class SmoothingSubtractionQuantitation method getOptionsPanel.
/* (non-Javadoc)
* @see uk.ac.babraham.SeqMonk.Quantitation.Quantitation#getOptionsPanel(uk.ac.babraham.SeqMonk.SeqMonkApplication)
*/
public JPanel getOptionsPanel() {
if (optionPanel != null) {
// We've done this already
return optionPanel;
}
optionPanel = new JPanel();
optionPanel.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 1;
gbc.weightx = 0.5;
gbc.weighty = 0.1;
gbc.fill = GridBagConstraints.HORIZONTAL;
optionPanel.add(new JLabel("Smoothing method"), gbc);
gbc.gridx = 2;
correctionActions = new JComboBox(new String[] { "Adjacent Probes", "Window Size" });
optionPanel.add(correctionActions, gbc);
gbc.gridx = 1;
gbc.gridy++;
optionPanel.add(new JLabel("Size"), gbc);
distanceField = new JTextField("" + distance);
distanceField.addKeyListener(new NumberKeyListener(false, false));
distanceField.addKeyListener(new KeyListener() {
public void keyTyped(KeyEvent arg0) {
}
public void keyReleased(KeyEvent arg0) {
optionsChanged();
}
public void keyPressed(KeyEvent arg0) {
}
});
gbc.gridx++;
optionPanel.add(distanceField, gbc);
return optionPanel;
}
use of java.awt.event.KeyEvent in project SeqMonk by s-andrews.
the class LogTransformQuantitation method getOptionsPanel.
/* (non-Javadoc)
* @see uk.ac.babraham.SeqMonk.Quantitation.Quantitation#getOptionsPanel(uk.ac.babraham.SeqMonk.SeqMonkApplication)
*/
public JPanel getOptionsPanel() {
if (optionPanel != null) {
// We've done this already
return optionPanel;
}
optionPanel = new JPanel();
optionPanel.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 1;
gbc.weightx = 0.5;
gbc.weighty = 0.1;
gbc.fill = GridBagConstraints.HORIZONTAL;
optionPanel.add(new JLabel("Log Base "), gbc);
gbc.gridx = 2;
logBaseField = new JTextField("" + logBase);
logBaseField.addKeyListener(new NumberKeyListener(true, false));
logBaseField.addKeyListener(new KeyListener() {
public void keyTyped(KeyEvent arg0) {
}
public void keyReleased(KeyEvent arg0) {
optionsChanged();
}
public void keyPressed(KeyEvent arg0) {
}
});
optionPanel.add(logBaseField, gbc);
gbc.gridx = 1;
gbc.gridy++;
optionPanel.add(new JLabel("Threshold "), gbc);
thresholdField = new JTextField("" + threshold);
thresholdField.addKeyListener(new NumberKeyListener(true, false));
thresholdField.addKeyListener(new KeyListener() {
public void keyTyped(KeyEvent arg0) {
}
public void keyReleased(KeyEvent arg0) {
optionsChanged();
}
public void keyPressed(KeyEvent arg0) {
}
});
gbc.gridx++;
optionPanel.add(thresholdField, gbc);
return optionPanel;
}
Aggregations