Search in sources :

Example 26 with JComboBox

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);
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) Calendar(java.util.Calendar) JLabel(javax.swing.JLabel)

Example 27 with JComboBox

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) {
        }
    });
}
Also used : JPanel(javax.swing.JPanel) JComboBox(javax.swing.JComboBox) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) WindowListener(java.awt.event.WindowListener) WindowEvent(java.awt.event.WindowEvent)

Example 28 with JComboBox

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));
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) GridBagLayout(java.awt.GridBagLayout) JComboBox(javax.swing.JComboBox) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper)

Example 29 with JComboBox

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");
}
Also used : JScrollPane(javax.swing.JScrollPane) FlowLayout(java.awt.FlowLayout) JComboBox(javax.swing.JComboBox) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) ListSelectionModel(javax.swing.ListSelectionModel) TableColumnModel(javax.swing.table.TableColumnModel) Dimension(java.awt.Dimension) TableColumn(javax.swing.table.TableColumn) Container(java.awt.Container) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable)

Example 30 with JComboBox

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;
}
Also used : JCheckBox(javax.swing.JCheckBox) Arrays(java.util.Arrays) Inject(com.google.inject.Inject) AfterInjection(org.baderlab.csplugins.enrichmentmap.AfterInjection) HeatMapTableModel(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.HeatMapTableModel) Operator(org.baderlab.csplugins.enrichmentmap.view.heatmap.HeatMapParams.Operator) JTableHeader(javax.swing.table.JTableHeader) TableCellRenderer(javax.swing.table.TableCellRenderer) IconManager(org.cytoscape.util.swing.IconManager) Assisted(com.google.inject.assistedinject.Assisted) ComboItem(org.baderlab.csplugins.enrichmentmap.view.util.ComboItem) Map(java.util.Map) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) DEFAULT_SIZE(javax.swing.GroupLayout.DEFAULT_SIZE) Set(java.util.Set) ColorAndValueRenderer(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.ColorAndValueRenderer) Distance(org.baderlab.csplugins.enrichmentmap.view.heatmap.HeatMapParams.Distance) Component(java.awt.Component) Collectors(java.util.stream.Collectors) TableRowSorter(javax.swing.table.TableRowSorter) Sets(com.google.common.collect.Sets) PREFERRED_SIZE(javax.swing.GroupLayout.PREFERRED_SIZE) List(java.util.List) Alignment(javax.swing.GroupLayout.Alignment) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) LookAndFeelUtil(org.cytoscape.util.swing.LookAndFeelUtil) SwingUtil(org.baderlab.csplugins.enrichmentmap.view.util.SwingUtil) ColumnHeaderRankOptionRenderer(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.ColumnHeaderRankOptionRenderer) JCheckBox(javax.swing.JCheckBox) Optional(java.util.Optional) JTable(javax.swing.JTable) ColumnHeaderVerticalRenderer(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.ColumnHeaderVerticalRenderer) RankValue(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.RankValue) JPanel(javax.swing.JPanel) ListSelectionModel(javax.swing.ListSelectionModel) ActionListener(java.awt.event.ActionListener) TableColumnModel(javax.swing.table.TableColumnModel) SortKey(javax.swing.RowSorter.SortKey) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) CompletableFuture(java.util.concurrent.CompletableFuture) GradientLegendPanel(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.GradientLegendPanel) ArrayList(java.util.ArrayList) SwingUtilities(javax.swing.SwingUtilities) EMStyleBuilder(org.baderlab.csplugins.enrichmentmap.style.EMStyleBuilder) JButton(javax.swing.JButton) Transform(org.baderlab.csplugins.enrichmentmap.view.heatmap.HeatMapParams.Transform) TableColumn(javax.swing.table.TableColumn) JPopupMenu(javax.swing.JPopupMenu) ActionEvent(java.awt.event.ActionEvent) RankOptionErrorHeader(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.RankOptionErrorHeader) RankValueRenderer(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.RankValueRenderer) JScrollPane(javax.swing.JScrollPane) JLabel(javax.swing.JLabel) GroupLayout(javax.swing.GroupLayout) ColorRenderer(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.ColorRenderer) Comparator(java.util.Comparator) JPanel(javax.swing.JPanel) GradientLegendPanel(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.GradientLegendPanel) JButton(javax.swing.JButton) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel)

Aggregations

JComboBox (javax.swing.JComboBox)150 JLabel (javax.swing.JLabel)66 JPanel (javax.swing.JPanel)57 ActionEvent (java.awt.event.ActionEvent)51 ActionListener (java.awt.event.ActionListener)48 JButton (javax.swing.JButton)47 JScrollPane (javax.swing.JScrollPane)28 JTextField (javax.swing.JTextField)27 BoxLayout (javax.swing.BoxLayout)26 Dimension (java.awt.Dimension)25 JCheckBox (javax.swing.JCheckBox)23 JTable (javax.swing.JTable)22 BorderLayout (java.awt.BorderLayout)21 GridBagLayout (java.awt.GridBagLayout)20 Insets (java.awt.Insets)20 GridBagConstraints (java.awt.GridBagConstraints)19 FlowLayout (java.awt.FlowLayout)18 DefaultCellEditor (javax.swing.DefaultCellEditor)17 TableColumn (javax.swing.table.TableColumn)14 ItemEvent (java.awt.event.ItemEvent)11