use of javax.swing.JComboBox in project ACS by ACS-Community.
the class DateTimeSelector method initGUI.
/**
* Init the GUI
*/
private void initGUI() {
// YearCB is initialized from 2000 to the year next to this on
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
for (int t = 2000; t <= cal.get(Calendar.YEAR) + 1; t++) {
yearCB.addItem(Integer.valueOf(t));
}
// Month
for (int t = 1; t <= 12; t++) {
monthCB.addItem(Integer.valueOf(t));
}
//dayCB.setModel(new DayComboBoxModel());
for (int t = 1; t <= 31; t++) {
dayCB.addItem(Integer.valueOf(t));
}
// hour
for (int t = 0; t < 24; t++) {
hoursCB.addItem(Integer.valueOf(t));
}
// Minutes and seconds
for (int t = 0; t < 60; t++) {
secsCB.addItem(Integer.valueOf(t));
minsCB.addItem(Integer.valueOf(t));
}
// Add the date panel
JPanel datePnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
datePnl.setBorder(BorderFactory.createTitledBorder("Date"));
datePnl.add(new JLabel("Day: "));
datePnl.add(dayCB);
datePnl.add(new JLabel("Month: "));
datePnl.add(monthCB);
datePnl.add(new JLabel("Year: "));
datePnl.add(yearCB);
// Add the time panel
JPanel timePnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
timePnl.setBorder(BorderFactory.createTitledBorder("Time"));
timePnl.add(new JLabel("Hour: "));
timePnl.add(hoursCB);
timePnl.add(new JLabel("Minute: "));
timePnl.add(minsCB);
timePnl.add(new JLabel("Second: "));
timePnl.add(secsCB);
// Add the widgets to the component
setLayout(new BorderLayout());
add(datePnl, BorderLayout.NORTH);
add(timePnl, BorderLayout.SOUTH);
for (JComboBox box : comboBoxes) {
box.setEditable(false);
// Initial selection that will be updated by the next setDate
//
// Do not add the action listener before selecting a item because actionPerformed calls #ratioDayCB
// that needs to get a selected item.
box.setSelectedIndex(0);
box.addActionListener(this);
}
setDate(cal);
}
use of javax.swing.JComboBox in project ACS by ACS-Community.
the class BeanGrouper method createDelPropWindow.
private void createDelPropWindow() {
if (frame != null) {
return;
}
JLabel delLabel = new JLabel("Select the Component:Property to delete:");
jcombo = new JComboBox();
frame = new JFrame("Delete");
JPanel panel = new JPanel(new BorderLayout(5, 5));
JButton delButton = new JButton("Delete");
for (DataPrinter wp : samplers) {
jcombo.addItem(wp.component + ":" + wp.property);
}
delButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
String[] comProp = new String[2];
comProp = jcombo.getSelectedItem().toString().split(":");
removeSamp(comProp[0], comProp[1]);
jcombo.removeItemAt(jcombo.getSelectedIndex());
addToStatusList(comProp[0] + "#" + comProp[1] + "removed");
}
});
delLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.add(delLabel, BorderLayout.NORTH);
jcombo.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.add(jcombo, BorderLayout.CENTER);
delButton.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.add(delButton, BorderLayout.EAST);
//frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.add(panel);
frame.pack();
frame.setVisible(true);
frame.addWindowListener(new java.awt.event.WindowListener() {
@Override
public void windowActivated(WindowEvent e) {
}
@Override
public void windowClosed(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
}
@Override
public void windowDeactivated(WindowEvent e) {
frame = null;
}
@Override
public void windowDeiconified(WindowEvent e) {
}
@Override
public void windowIconified(WindowEvent e) {
}
@Override
public void windowOpened(WindowEvent e) {
}
});
}
use of javax.swing.JComboBox in project ACS by ACS-Community.
the class FilterTypePanel method createComponents.
/* (non-Javadoc)
* @see com.cosylab.logging.settings.FilterParameterPanel#createComponents()
*/
public void createComponents() {
// Build the renderer for the combo boxes
rendererMin = new LogTypeRenderer();
rendererMax = new LogTypeRenderer();
rendererExact = new LogTypeRenderer();
JPanel panelTop = new JPanel(new GridBagLayout());
add(panelTop, newConstraints(0, 4, 4, 4, 4));
notCheck = new JCheckBox("Discard entries matching this filter");
notCheck.setToolTipText("Keep/discard entries matching this filter");
panelTop.add(notCheck, newConstraints(0, 4, 4, 4, 4));
minimumCheck = new JCheckBox("Minimum value");
minimumCheck.addItemListener(this);
panelTop.add(minimumCheck, newConstraints(1, 4, 0, 0, 0));
LogTypeHelper[] logTypes = LogTypeHelper.values();
minimum = new JComboBox(logTypes);
minimum.setSelectedIndex(0);
minimum.setEditable(false);
minimum.setMaximumRowCount(logTypes.length);
minimum.setRenderer(rendererMin);
panelTop.add(minimum, newConstraints(2, 0, 0, 4, 0));
maximumCheck = new JCheckBox("Maximum value");
maximumCheck.addItemListener(this);
panelTop.add(maximumCheck, newConstraints(3, 4, 0, 0, 0));
maximum = new JComboBox(logTypes);
maximum.setSelectedIndex(0);
maximum.setEditable(false);
maximum.setMaximumRowCount(logTypes.length);
maximum.setRenderer(rendererMax);
panelTop.add(maximum, newConstraints(4, 0, 0, 4, 0));
JPanel panelBottom = new JPanel(new GridBagLayout());
add(panelBottom, newConstraints(1, 4, 4, 4, 4));
exactCheck = new JCheckBox("Exact value");
exactCheck.addItemListener(this);
panelBottom.add(exactCheck, newConstraints(0, 4, 0, 0, 0));
exact = new JComboBox(logTypes);
exact.setSelectedIndex(0);
exact.setEditable(false);
exact.setMaximumRowCount(logTypes.length);
exact.setRenderer(rendererExact);
panelBottom.add(exact, newConstraints(1, 0, 0, 4, 0));
}
use of javax.swing.JComboBox in project ACS by ACS-Community.
the class JDynAct method buildWindow.
/** Build the GUI
*
*/
private void buildWindow() {
Container rootCnt = getContentPane();
rootCnt.setLayout(new BorderLayout());
// The container with labels and combo boxes
Container firstCnt = new Container();
firstCnt.setLayout(new GridLayout(4, 2));
firstCnt.add(new JLabel("Name"));
nameCB = new JComboBox();
nameCB.setEditable(true);
nameCB.addItem("*");
nameCB.addItem("PIPPO");
nameCB.addItem("PLUTO");
firstCnt.add(nameCB);
firstCnt.add(new JLabel("IDL interface"));
idlCB = new JComboBox();
idlCB.addItem("*");
idlCB.addItem("IDL:alma/acsexmplLamp/Lamp:1.0");
idlCB.addItem("IDL:alma/MOUNT_ACS/Mount:1.0");
idlCB.addItem("IDL:alma/demo/HelloDemo:1.0");
idlCB.setEditable(true);
firstCnt.add(idlCB);
firstCnt.add(new JLabel("Implementation"));
implCB = new JComboBox();
implCB.addItem("*");
implCB.addItem("acsexmplLampImpl");
implCB.addItem("acsexmplMountImpl");
implCB.addItem("alma.demo.HelloDemoImpl.HelloDemoHelper");
implCB.addItem("demoImpl.HelloDemo");
implCB.addItem("acsexmplHelloWorldClient");
implCB.setEditable(true);
firstCnt.add(implCB);
firstCnt.add(new JLabel("Container"));
containerCB = new JComboBox();
containerCB.addItem("*");
containerCB.addItem("bilboContainer");
containerCB.addItem("frodoContainer");
containerCB.addItem("aragornContainer");
containerCB.setEditable(true);
firstCnt.add(containerCB);
// The container with the activate button
Container secondCnt = new Container();
secondCnt.setLayout(new FlowLayout());
JButton activateB = new JButton("Activate");
activateB.addActionListener(this);
secondCnt.add(activateB, "Center");
// The container with activated container
MyTableModel tableModel = new MyTableModel();
activatedT = new JTable(tableModel);
activatedT.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ListSelectionModel rowSM = activatedT.getSelectionModel();
JScrollPane scrollP = new JScrollPane(activatedT);
activatedT.setPreferredScrollableViewportSize(new Dimension(400, 90));
MyCellRendererr cellR = new MyCellRendererr();
TableColumnModel tcm = activatedT.getColumnModel();
TableColumn tc = tcm.getColumn(2);
tc.setCellRenderer(cellR);
MyCellEditor cellE = new MyCellEditor(this);
tc.setCellEditor(cellE);
Container thirdCnt = new Container();
thirdCnt.setLayout(new FlowLayout());
thirdCnt.add(scrollP, "North");
// Add the container to the main container
rootCnt.add(firstCnt, "North");
rootCnt.add(secondCnt, "Center");
rootCnt.add(thirdCnt, "South");
}
use of javax.swing.JComboBox in project EnrichmentMapApp by BaderLab.
the class HeatMapMainPanel method createToolbarPanel.
private JPanel createToolbarPanel() {
gradientLegendPanel = new GradientLegendPanel(table);
showValuesCheck = new JCheckBox("Show Values");
JLabel operatorLabel = new JLabel("Genes:");
operatorCombo = new JComboBox<>();
JLabel normLabel = new JLabel("Expressions:");
normCombo = new JComboBox<>();
SwingUtil.makeSmall(operatorLabel, operatorCombo, normLabel, normCombo, showValuesCheck);
operatorCombo.addItem(new ComboItem<>(Operator.UNION, "Union"));
operatorCombo.addItem(new ComboItem<>(Operator.INTERSECTION, "Intersection"));
operatorCombo.setSelectedItem(ComboItem.of(Operator.UNION));
normCombo.addItem(new ComboItem<>(Transform.AS_IS, "Expression Values"));
normCombo.addItem(new ComboItem<>(Transform.ROW_NORMALIZE, "Row Normalize"));
normCombo.addItem(new ComboItem<>(Transform.LOG_TRANSFORM, "Log Transform"));
normCombo.addItem(new ComboItem<>(Transform.COMPRESS_MEDIAN, "Compress (Median)"));
normCombo.addItem(new ComboItem<>(Transform.COMPRESS_MIN, "Compress (Min)"));
normCombo.addItem(new ComboItem<>(Transform.COMPRESS_MAX, "Compress (Max)"));
normCombo.setSelectedItem(ComboItem.of(Transform.COMPRESS_MEDIAN));
operatorCombo.addActionListener(operatorActionListener = e -> updateSetting_Operator(getOperator()));
normCombo.addActionListener(normActionListener = e -> updateSetting_Transform(getTransform()));
showValuesCheck.addActionListener(showValueActionListener = e -> updateSetting_ShowValues(isShowValues()));
JButton plusButton = SwingUtil.createIconButton(iconManager, IconManager.ICON_PLUS, "Add Rankings...");
JButton gearButton = SwingUtil.createIconButton(iconManager, IconManager.ICON_GEAR, "Settings");
JButton menuButton = SwingUtil.createIconButton(iconManager, IconManager.ICON_EXTERNAL_LINK, "Export");
LookAndFeelUtil.equalizeSize(gearButton, menuButton);
plusButton.addActionListener(e -> addRankings());
gearButton.addActionListener(e -> settingsPanel.popup(gearButton));
menuButton.addActionListener(this::showExportMenu);
JPanel panel = new JPanel();
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setAutoCreateContainerGaps(false);
layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(gradientLegendPanel, 180, 180, 180).addGap(0, 0, Short.MAX_VALUE).addComponent(operatorLabel).addComponent(operatorCombo, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGap(5).addComponent(normLabel).addComponent(normCombo, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGap(5).addComponent(showValuesCheck).addGap(5).addComponent(plusButton).addComponent(gearButton).addComponent(menuButton));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(gradientLegendPanel).addComponent(operatorLabel).addComponent(operatorCombo).addComponent(normLabel).addComponent(normCombo).addComponent(showValuesCheck).addComponent(plusButton).addComponent(gearButton).addComponent(menuButton));
panel.setOpaque(false);
return panel;
}
Aggregations