Example usage for javax.swing JLabel setFont

List of usage examples for javax.swing JLabel setFont

Introduction

In this page you can find the example usage for javax.swing JLabel setFont.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The font for the component.")
public void setFont(Font font) 

Source Link

Document

Sets the font for this component.

Usage

From source file:org.broad.igv.track.TrackMenuUtils.java

/**
 * Return popup menu with items applicable to data tracks
 *
 * @return//from ww w  .java  2 s. c  om
 */
public static void addDataItems(JPopupMenu menu, final Collection<Track> tracks) {

    if (log.isDebugEnabled()) {
        log.debug("enter getDataPopupMenu");
    }

    final String[] labels = { "Heatmap", "Bar Chart", "Scatterplot", "Line Plot" };
    final Class[] renderers = { HeatmapRenderer.class, BarChartRenderer.class, PointsRenderer.class,
            LineplotRenderer.class };

    //JLabel popupTitle = new JLabel(LEADING_HEADING_SPACER + title, JLabel.CENTER);

    JLabel rendererHeading = new JLabel(LEADING_HEADING_SPACER + "Type of Graph", JLabel.LEFT);
    rendererHeading.setFont(UIConstants.boldFont);

    menu.add(rendererHeading);

    // Get existing selections
    Set<Class> currentRenderers = new HashSet<Class>();
    for (Track track : tracks) {
        if (track.getRenderer() != null) {
            currentRenderers.add(track.getRenderer().getClass());
        }
    }

    // Create and renderer menu items
    for (int i = 0; i < labels.length; i++) {
        JCheckBoxMenuItem item = new JCheckBoxMenuItem(labels[i]);
        final Class rendererClass = renderers[i];
        if (currentRenderers.contains(rendererClass)) {
            item.setSelected(true);
        }
        item.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                changeRenderer(tracks, rendererClass);
            }
        });
        menu.add(item);
    }
    menu.addSeparator();

    // Get union of all valid window functions for selected tracks
    Set<WindowFunction> avaibleWindowFunctions = new HashSet();
    for (Track track : tracks) {
        avaibleWindowFunctions.addAll(track.getAvailableWindowFunctions());
    }
    avaibleWindowFunctions.add(WindowFunction.none);

    // dataPopupMenu.addSeparator();
    // Collection all window functions for selected tracks
    Set<WindowFunction> currentWindowFunctions = new HashSet<WindowFunction>();
    for (Track track : tracks) {
        if (track.getWindowFunction() != null) {
            currentWindowFunctions.add(track.getWindowFunction());
        }
    }

    if (avaibleWindowFunctions.size() > 1 || currentWindowFunctions.size() > 1) {
        JLabel statisticsHeading = new JLabel(LEADING_HEADING_SPACER + "Windowing Function", JLabel.LEFT);
        statisticsHeading.setFont(UIConstants.boldFont);

        menu.add(statisticsHeading);

        for (final WindowFunction wf : ORDERED_WINDOW_FUNCTIONS) {
            JCheckBoxMenuItem item = new JCheckBoxMenuItem(wf.getDisplayName());
            if (avaibleWindowFunctions.contains(wf) || currentWindowFunctions.contains(wf)) {
                if (currentWindowFunctions.contains(wf)) {
                    item.setSelected(true);
                }
                item.addActionListener(new ActionListener() {

                    public void actionPerformed(ActionEvent evt) {
                        changeStatType(wf.toString(), tracks);
                    }
                });
                menu.add(item);
            }
        }
        menu.addSeparator();
    }

    menu.add(getDataRangeItem(tracks));
    menu.add(getHeatmapScaleItem(tracks));

    if (tracks.size() > 0) {
        menu.add(getLogScaleItem(tracks));
    }

    menu.add(getAutoscaleItem(tracks));

    menu.add(getShowDataRangeItem(tracks));

    menu.addSeparator();
    menu.add(getChangeKMPlotItem(tracks));

}

From source file:org.colombbus.tangara.update.SoftwareUpdateDialog.java

private void addCenterPane() {
    JPanel centerPane = new JPanel();
    BoxLayout layout = new BoxLayout(centerPane, BoxLayout.Y_AXIS);
    centerPane.setLayout(layout);/*from w  w  w  .j  a v  a  2s  .c o  m*/

    JTextArea descPane = new JTextArea(info.getDescription());
    descPane.setFont(font);
    descPane.setEditable(false);
    centerPane.add(descPane);

    JPanel linkPanel = new JPanel();
    linkPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    String linkTitle = bundle.getString("SoftwareUpdateDialog.linkTitle"); //$NON-NLS-1$
    JLabel linkTitleLabel = new JLabel(linkTitle);
    linkTitleLabel.setFont(font);
    linkPanel.add(linkTitleLabel);
    HyperLinkLabel linkLabel = new HyperLinkLabel(info.getLink(), info.getLink());
    linkLabel.setFont(font);
    linkPanel.add(linkLabel);
    linkPanel.setBackground(Color.white);
    linkPanel.setOpaque(true);
    centerPane.add(linkPanel);
    add(centerPane, BorderLayout.CENTER);
}

From source file:org.colombbus.tangara.update.SoftwareUpdateDialog.java

private void addIntroductionPane() {
    String introFormat = bundle.getString("SoftwareUpdateDialog.introduction"); //$NON-NLS-1$
    String introduction = MessageFormat.format(introFormat, info.getVersion());

    String labelText = String.format("<html><b>%s</b></html>", introduction); //$NON-NLS-1$
    JLabel introLabel = new JLabel(labelText);
    introLabel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    introLabel.setFont(font);
    add(introLabel, BorderLayout.NORTH);
}

From source file:org.datacleaner.widgets.OpenAnalysisJobFileChooserAccessory.java

public OpenAnalysisJobFileChooserAccessory(WindowContext windowContext, DataCleanerConfiguration configuration,
        DCFileChooser fileChooser,//w  ww. j  a  v  a2 s  . c om
        Provider<OpenAnalysisJobActionListener> openAnalysisJobActionListenerProvider) {
    super();
    _windowContext = windowContext;
    _configuration = configuration;
    _centerPanel = new DCPanel();
    _centerPanel.setLayout(new VerticalLayout(0));
    _fileChooser = fileChooser;
    _fileChooser.addPropertyChangeListener(this);
    _openJobButton = getOpenJobButton();
    _openAnalysisJobActionListenerProvider = openAnalysisJobActionListenerProvider;

    setPreferredSize(WIDTH, 10);

    setBorder(new EmptyBorder(0, 10, 0, 0));
    setLayout(new BorderLayout());
    setVisible(false);

    final JLabel iconLabel = new JLabel(ICON_APP);

    final JLabel headerLabel = new JLabel("DataCleaner analysis job:");
    headerLabel.setFont(WidgetUtils.FONT_HEADER1);

    final DCPanel northPanel = new DCPanel();
    northPanel.setLayout(new VerticalLayout(0));
    northPanel.add(iconLabel);
    northPanel.add(Box.createVerticalStrut(10));
    northPanel.add(headerLabel);
    northPanel.add(Box.createVerticalStrut(10));
    northPanel.add(_centerPanel);
    northPanel.add(Box.createVerticalStrut(10));

    final DCPanel southPanel = new DCPanel();
    southPanel.setLayout(new VerticalLayout(0));
    northPanel.add(Box.createVerticalStrut(4));
    southPanel.add(_openJobButton);
    southPanel.add(Box.createVerticalStrut(4));
    southPanel.add(getOpenAsTemplateButton());

    add(WidgetUtils.scrolleable(northPanel), BorderLayout.CENTER);
    add(southPanel, BorderLayout.SOUTH);
}

From source file:org.datacleaner.widgets.visualization.JobGraphTransformers.java

public final EdgeLabelRenderer getEdgeLabelRenderer() {
    return new EdgeLabelRenderer() {
        @Override//from w  w  w.  jav a2 s  .c om
        public void setRotateEdgeLabels(boolean state) {
        }

        @Override
        public boolean isRotateEdgeLabels() {
            return true;
        }

        @Override
        public <T> Component getEdgeLabelRendererComponent(JComponent vv, Object value, Font font,
                boolean isSelected, T edge) {
            final String labelText;
            final String iconPath;

            if (edge instanceof JobGraphLink) {
                final JobGraphLink link = (JobGraphLink) edge;
                if (link.getOutputDataStream() != null) {
                    labelText = link.getLinkLabel();
                    iconPath = IconUtils.OUTPUT_DATA_STREAM_PATH;
                } else if (isCompoundRequirementLink(link)) {
                    final HasFilterOutcomes from = (HasFilterOutcomes) link.getFrom();
                    final CompoundComponentRequirement req = (CompoundComponentRequirement) link
                            .getRequirement();
                    final Set<FilterOutcome> outcomesFrom = req.getOutcomesFrom(from);
                    labelText = new CompoundComponentRequirement(outcomesFrom).getSimpleName();
                    iconPath = IconUtils.FILTER_OUTCOME_PATH;
                } else {
                    labelText = link.getLinkLabel();
                    iconPath = IconUtils.FILTER_OUTCOME_PATH;
                }
            } else {
                labelText = value + "";
                iconPath = IconUtils.FILTER_OUTCOME_PATH;
            }

            final Icon icon = imageManager.getImageIcon(iconPath, IconUtils.ICON_SIZE_SMALL);
            final JLabel label = new JLabel(labelText, icon, JLabel.LEFT);
            label.setFont(_normalFont);
            return label;
        }
    };
}

From source file:org.eclipse.om2m.ipe.sample.gui.GUI.java

/**
 * Creates the frame.//  w  ww  .ja  v a 2  s .  co m
 */
public GUI() {
    setLocationByPlatform(true);
    setVisible(false);
    setResizable(false);
    setTitle("Sample Simulated IPE");
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((screenSize.width - 500) / 2, (screenSize.height - 570) / 2, 497, 570);

    contentPanel = new JPanel();
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPanel);
    contentPanel.setLayout(null);

    // Lamp0 Switcher0
    JPanel panel_Lamp0 = new JPanel();
    panel_Lamp0.setBounds(10, 5, 319, 260);
    contentPanel.add(panel_Lamp0);
    panel_Lamp0.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
    panel_Lamp0.setLayout(null);
    LABEL_LAMP_0.setIcon(iconLampOFF);
    LABEL_LAMP_0.setHorizontalTextPosition(SwingConstants.CENTER);
    LABEL_LAMP_0.setHorizontalAlignment(SwingConstants.CENTER);
    LABEL_LAMP_0.setBounds(10, 9, 149, 240);
    panel_Lamp0.add(LABEL_LAMP_0);

    // Lamp0 Switch Button
    JButton button_Lamp0 = new JButton();
    button_Lamp0.setOpaque(false);
    button_Lamp0.setPressedIcon(iconButtonON);
    button_Lamp0.setIcon(iconButtonOFF);
    button_Lamp0.setBounds(187, 44, 122, 155);
    panel_Lamp0.add(button_Lamp0);
    button_Lamp0.setMinimumSize(new Dimension(30, 23));
    button_Lamp0.setMaximumSize(new Dimension(30, 23));
    button_Lamp0.setPreferredSize(new Dimension(30, 23));

    JLabel labelSwitcher0 = new JLabel("Switch LAMP_0");
    labelSwitcher0.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14));
    labelSwitcher0.setFocusCycleRoot(true);
    labelSwitcher0.setBorder(null);
    labelSwitcher0.setAutoscrolls(true);
    labelSwitcher0.setBounds(187, 199, 118, 29);
    panel_Lamp0.add(labelSwitcher0);
    // Listener for Lamp0 Switch Button
    button_Lamp0.addActionListener(new java.awt.event.ActionListener() {
        // Button Clicked
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            // Change Lamp0 State
            new Thread() {
                public void run() {
                    // Send switch request to switch lamp0 state
                    SampleMonitor.switchLamp(LAMP_0);
                }
            }.start();
        }
    });

    // Lamp1 Switcher 1
    JPanel panel_Lamp1 = new JPanel();
    panel_Lamp1.setBounds(10, 271, 319, 260);
    contentPanel.add(panel_Lamp1);
    panel_Lamp1.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
    panel_Lamp1.setLayout(null);

    LABEL_LAMP_1.setIcon(iconLampOFF);
    LABEL_LAMP_1.setHorizontalTextPosition(SwingConstants.CENTER);
    LABEL_LAMP_1.setHorizontalAlignment(SwingConstants.CENTER);
    LABEL_LAMP_1.setBounds(10, 9, 154, 240);
    panel_Lamp1.add(LABEL_LAMP_1);

    // Lamp1 Switch Button
    JButton button_Lamp1 = new JButton();
    button_Lamp1.setOpaque(false);
    button_Lamp1.setPressedIcon(iconButtonON);
    button_Lamp1.setIcon(iconButtonOFF);
    button_Lamp1.setBounds(187, 44, 122, 156);
    panel_Lamp1.add(button_Lamp1);
    button_Lamp1.setMinimumSize(new Dimension(30, 23));
    button_Lamp1.setMaximumSize(new Dimension(30, 23));
    button_Lamp1.setPreferredSize(new Dimension(30, 23));

    JLabel labelSwitcher1 = new JLabel("Switch LAMP_1");
    labelSwitcher1.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14));
    labelSwitcher1.setFocusCycleRoot(true);
    labelSwitcher1.setBorder(null);
    labelSwitcher1.setAutoscrolls(true);
    labelSwitcher1.setBounds(187, 199, 118, 29);
    panel_Lamp1.add(labelSwitcher1);
    // Listener for Lamp1 Switch Button
    button_Lamp1.addActionListener(new java.awt.event.ActionListener() {
        //Switch Button clicked
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            // Change Lamp1 State
            new Thread() {
                public void run() {
                    // Send switch request to switch lamp1 state
                    SampleMonitor.switchLamp(LAMP_1);
                }
            }.start();
        }
    });

    // Switcher All lamps
    JButton buttonAllLamp = new JButton();
    buttonAllLamp.setOpaque(false);
    buttonAllLamp.setPressedIcon(iconButtonON);
    buttonAllLamp.setIcon(iconButtonOFF);
    buttonAllLamp.setBounds(339, 190, 145, 168);
    contentPanel.add(buttonAllLamp);
    buttonAllLamp.setMinimumSize(new Dimension(30, 23));
    buttonAllLamp.setMaximumSize(new Dimension(30, 23));
    buttonAllLamp.setPreferredSize(new Dimension(30, 23));

    JLabel labelSwitchAll = new JLabel("Switch All");
    labelSwitchAll.setAutoscrolls(true);
    labelSwitchAll.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14));
    labelSwitchAll.setFocusCycleRoot(true);
    labelSwitchAll.setBorder(null);
    labelSwitchAll.setBounds(371, 369, 85, 29);
    contentPanel.add(labelSwitchAll);
    // Listener of Switch all Button
    buttonAllLamp.addActionListener(new java.awt.event.ActionListener() {
        // Switch Button Clicked
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            // Change all lamps states
            new Thread() {
                public void run() {
                    // Send switch all request to create a content with the current State
                    SampleMonitor.switchAll();
                }
            }.start();
        }
    });

    lampObserver = new SampleModel.LampObserver() {

        @Override
        public void onLampStateChange(String lampId, boolean state) {
            setLabel(lampId, state);
        }
    };
    SampleModel.addObserver(lampObserver);
}

From source file:org.eclipse.om2m.ipu.sample.GUI.java

/**
 * Creates the frame.//from ww w  .j a v a 2  s  . c  o m
 */
public GUI() {
    setLocationByPlatform(true);
    setResizable(false);
    setTitle("Sample Simulated IPU");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((screenSize.width - 500) / 2, (screenSize.height - 570) / 2, 497, 570);

    contentPanel = new JPanel();
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPanel);
    contentPanel.setLayout(null);

    // Lamp0 Switcher0
    JPanel panel_Lamp0 = new JPanel();
    panel_Lamp0.setBounds(10, 5, 319, 260);
    contentPanel.add(panel_Lamp0);
    panel_Lamp0.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
    panel_Lamp0.setLayout(null);
    LABEL_LAMP_0.setIcon(iconLampOFF);
    LABEL_LAMP_0.setHorizontalTextPosition(SwingConstants.CENTER);
    LABEL_LAMP_0.setHorizontalAlignment(SwingConstants.CENTER);
    LABEL_LAMP_0.setBounds(10, 9, 149, 240);
    panel_Lamp0.add(LABEL_LAMP_0);

    // Lamp0 Switch Button
    JButton button_Lamp0 = new JButton();
    button_Lamp0.setOpaque(false);
    button_Lamp0.setPressedIcon(iconButtonON);
    button_Lamp0.setIcon(iconButtonOFF);
    button_Lamp0.setBounds(187, 44, 122, 155);
    panel_Lamp0.add(button_Lamp0);
    button_Lamp0.setMinimumSize(new Dimension(30, 23));
    button_Lamp0.setMaximumSize(new Dimension(30, 23));
    button_Lamp0.setPreferredSize(new Dimension(30, 23));

    JLabel labelSwitcher0 = new JLabel("Switch LAMP_0");
    labelSwitcher0.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14));
    labelSwitcher0.setFocusCycleRoot(true);
    labelSwitcher0.setBorder(null);
    labelSwitcher0.setAutoscrolls(true);
    labelSwitcher0.setBounds(187, 199, 118, 29);
    panel_Lamp0.add(labelSwitcher0);
    // Listener for Lamp0 Switch Button
    button_Lamp0.addActionListener(new java.awt.event.ActionListener() {
        // Button Clicked
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            // Change Lamp0 State
            new Thread() {
                public void run() {
                    // Send switch request to switch lamp0 state
                    Switchs.switchLamp(LAMP_0, !SampleMonitor.LAMPS.get(LAMP_0).getState());
                }
            }.start();
        }
    });

    // Lamp1 Switcher 1
    JPanel panel_Lamp1 = new JPanel();
    panel_Lamp1.setBounds(10, 271, 319, 260);
    contentPanel.add(panel_Lamp1);
    panel_Lamp1.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
    panel_Lamp1.setLayout(null);

    LABEL_LAMP_1.setIcon(iconLampOFF);
    LABEL_LAMP_1.setHorizontalTextPosition(SwingConstants.CENTER);
    LABEL_LAMP_1.setHorizontalAlignment(SwingConstants.CENTER);
    LABEL_LAMP_1.setBounds(10, 9, 154, 240);
    panel_Lamp1.add(LABEL_LAMP_1);

    // Lamp1 Switch Button
    JButton button_Lamp1 = new JButton();
    button_Lamp1.setOpaque(false);
    button_Lamp1.setPressedIcon(iconButtonON);
    button_Lamp1.setIcon(iconButtonOFF);
    button_Lamp1.setBounds(187, 44, 122, 156);
    panel_Lamp1.add(button_Lamp1);
    button_Lamp1.setMinimumSize(new Dimension(30, 23));
    button_Lamp1.setMaximumSize(new Dimension(30, 23));
    button_Lamp1.setPreferredSize(new Dimension(30, 23));

    JLabel labelSwitcher1 = new JLabel("Switch LAMP_1");
    labelSwitcher1.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14));
    labelSwitcher1.setFocusCycleRoot(true);
    labelSwitcher1.setBorder(null);
    labelSwitcher1.setAutoscrolls(true);
    labelSwitcher1.setBounds(187, 199, 118, 29);
    panel_Lamp1.add(labelSwitcher1);
    // Listener for Lamp1 Switch Button
    button_Lamp1.addActionListener(new java.awt.event.ActionListener() {
        //Switch Button clicked
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            // Change Lamp1 State
            new Thread() {
                public void run() {
                    // Send switch request to switch lamp1 state
                    Switchs.switchLamp(LAMP_1, !SampleMonitor.LAMPS.get(LAMP_1).getState());
                }
            }.start();
        }
    });

    // Switcher All lamps
    JButton buttonAllLamp = new JButton();
    buttonAllLamp.setOpaque(false);
    buttonAllLamp.setPressedIcon(iconButtonON);
    buttonAllLamp.setIcon(iconButtonOFF);
    buttonAllLamp.setBounds(339, 190, 145, 168);
    contentPanel.add(buttonAllLamp);
    buttonAllLamp.setMinimumSize(new Dimension(30, 23));
    buttonAllLamp.setMaximumSize(new Dimension(30, 23));
    buttonAllLamp.setPreferredSize(new Dimension(30, 23));

    JLabel labelSwitchAll = new JLabel("Switch All");
    labelSwitchAll.setAutoscrolls(true);
    labelSwitchAll.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14));
    labelSwitchAll.setFocusCycleRoot(true);
    labelSwitchAll.setBorder(null);
    labelSwitchAll.setBounds(371, 369, 85, 29);
    contentPanel.add(labelSwitchAll);
    // Listener of Switch all Button
    buttonAllLamp.addActionListener(new java.awt.event.ActionListener() {
        // Switch Button Clicked
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            // Change all lamps states
            new Thread() {
                public void run() {
                    // Send switch all request to create a content with the current State
                    Switchs.switchAll(!(SampleMonitor.LAMPS.get(LAMP_0).getState()
                            && SampleMonitor.LAMPS.get(LAMP_1).getState()));
                }
            }.start();
        }
    });
}

From source file:org.ecoinformatics.seek.ecogrid.CheckBoxTableCellRenderer.java

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    jTable = table;//from  w w  w  . jav a 2 s  .c  o  m

    JPanel cellPanel = new JPanel();
    cellPanel.setBorder(new LineBorder(Color.lightGray, 1));
    cellPanel.setBackground(Color.WHITE);
    cellPanel.setPreferredSize(
            new Dimension(ServicesDisplayPanel.CELLPREFERREDWIDTH, ServicesDisplayPanel.HEIGHT));

    SelectableDocumentType selectedDocumentType = null;
    boolean isChecked = false;
    boolean isEnable = true;
    String text = null;
    if (value != null && value instanceof SelectableObjectInterface) {
        SelectableObjectInterface selectedObj = (SelectableObjectInterface) value;
        text = selectedObj.getSelectableObjectLabel();
        isChecked = selectedObj.getIsSelected();
        isEnable = selectedObj.getEnabled();
    }

    /*
     * label = (JLabel)renderer.getTableCellRendererComponent(table, text,
     * isSelected, hasFocus, row, column);
     */
    JLabel label = new JLabel(text);
    label.setFont(new Font(FONTNAME, Font.PLAIN, FONTSIZE));
    label.setPreferredSize(new Dimension(ServicesDisplayPanel.LABELPREFERWIDTH, ServicesDisplayPanel.HEIGHT));
    // set a check box name
    String checkBoxName = "" + topRowNum + SEPERATOR + row;
    JCheckBox checkBox = new JCheckBox();
    checkBox.setName(checkBoxName);
    checkBox.setBackground(Color.WHITE);
    checkBox.setSelected(isChecked);
    CheckBoxListener listener = new CheckBoxListener();
    checkBox.addItemListener(listener);
    // checkBox.setEnabled(false);

    /*
     * if (topRowNum != DEFAUTTOPROW ) { // for sub table we need to set up
     * check box enable status checkBox.setEnabled(isEnable); }//if
     */

    // add the label and checkbox to jpanel which has a border layout
    // manager
    BorderLayout layoutManager = new BorderLayout();
    cellPanel.setLayout(layoutManager);
    cellPanel.add(label, BorderLayout.CENTER);
    cellPanel.add(checkBox, BorderLayout.WEST);
    return cellPanel;
}

From source file:org.eobjects.datacleaner.panels.OpenAnalysisJobPanel.java

public OpenAnalysisJobPanel(final FileObject file, final AnalyzerBeansConfiguration configuration,
        final OpenAnalysisJobActionListener openAnalysisJobActionListener) {
    super(WidgetUtils.BG_COLOR_LESS_BRIGHT, WidgetUtils.BG_COLOR_LESS_BRIGHT);
    _file = file;/*w  ww . j av a  2s. co m*/
    _openAnalysisJobActionListener = openAnalysisJobActionListener;

    setLayout(new BorderLayout());
    setBorder(WidgetUtils.BORDER_LIST_ITEM);

    final AnalysisJobMetadata metadata = getMetadata(configuration);
    final String jobName = metadata.getJobName();
    final String jobDescription = metadata.getJobDescription();
    final String datastoreName = metadata.getDatastoreName();

    final boolean isDemoJob = isDemoJob(metadata);

    final DCPanel labelListPanel = new DCPanel();
    labelListPanel.setLayout(new VerticalLayout(4));
    labelListPanel.setBorder(new EmptyBorder(4, 4, 4, 0));

    final String title;
    final String filename = file.getName().getBaseName();
    if (Strings.isNullOrEmpty(jobName)) {
        final String extension = FileFilters.ANALYSIS_XML.getExtension();
        if (filename.toLowerCase().endsWith(extension)) {
            title = filename.substring(0, filename.length() - extension.length());
        } else {
            title = filename;
        }
    } else {
        title = jobName;
    }

    final JButton titleButton = new JButton(title);
    titleButton.setFont(WidgetUtils.FONT_HEADER1);
    titleButton.setForeground(WidgetUtils.BG_COLOR_BLUE_MEDIUM);
    titleButton.setHorizontalAlignment(SwingConstants.LEFT);
    titleButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, WidgetUtils.BG_COLOR_MEDIUM));
    titleButton.setToolTipText("Open job");
    titleButton.setOpaque(false);
    titleButton.setMargin(new Insets(0, 0, 0, 0));
    titleButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    titleButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (isDemoDatastoreConfigured(datastoreName, configuration)) {
                _openAnalysisJobActionListener.openFile(_file);
            }
        }
    });

    final JButton executeButton = new JButton(executeIcon);
    executeButton.setOpaque(false);
    executeButton.setToolTipText("Execute job directly");
    executeButton.setMargin(new Insets(0, 0, 0, 0));
    executeButton.setBorderPainted(false);
    executeButton.setHorizontalAlignment(SwingConstants.RIGHT);
    executeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (isDemoDatastoreConfigured(datastoreName, configuration)) {
                final ImageIcon executeIconLarge = ImageManager.get().getImageIcon(IconUtils.ACTION_EXECUTE);
                final String question = "Are you sure you want to execute the job\n'" + title + "'?";
                final int choice = JOptionPane.showConfirmDialog(null, question, "Execute job?",
                        JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, executeIconLarge);
                if (choice == JOptionPane.YES_OPTION) {
                    final Injector injector = _openAnalysisJobActionListener.openAnalysisJob(_file);
                    if (injector != null) {
                        final ResultWindow resultWindow = injector.getInstance(ResultWindow.class);
                        resultWindow.open();
                        resultWindow.startAnalysis();
                    }
                }
            }
        }
    });

    final DCPanel titlePanel = new DCPanel();
    titlePanel.setLayout(new BorderLayout());
    titlePanel.add(DCPanel.around(titleButton), BorderLayout.CENTER);
    titlePanel.add(executeButton, BorderLayout.EAST);

    labelListPanel.add(titlePanel);

    if (!Strings.isNullOrEmpty(jobDescription)) {
        String desc = StringUtils.replaceWhitespaces(jobDescription, " ");
        desc = StringUtils.replaceAll(desc, "  ", " ");
        final JLabel label = new JLabel(desc);
        label.setFont(WidgetUtils.FONT_SMALL);
        labelListPanel.add(label);
    }

    final Icon icon;
    {
        if (!StringUtils.isNullOrEmpty(datastoreName)) {
            final JLabel label = new JLabel(" " + datastoreName);
            label.setFont(WidgetUtils.FONT_SMALL);
            labelListPanel.add(label);

            final Datastore datastore = configuration.getDatastoreCatalog().getDatastore(datastoreName);
            if (isDemoJob) {
                icon = demoBadgeIcon;
            } else {
                icon = IconUtils.getDatastoreSpecificAnalysisJobIcon(datastore);
            }
        } else {
            icon = ImageManager.get().getImageIcon(IconUtils.MODEL_JOB, IconUtils.ICON_SIZE_LARGE);
        }
    }

    final JLabel iconLabel = new JLabel(icon);
    iconLabel.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));

    add(iconLabel, BorderLayout.WEST);
    add(labelListPanel, BorderLayout.CENTER);
}

From source file:org.eobjects.datacleaner.widgets.OpenAnalysisJobFileChooserAccessory.java

public OpenAnalysisJobFileChooserAccessory(WindowContext windowContext,
        AnalyzerBeansConfiguration configuration, DCFileChooser fileChooser,
        Provider<OpenAnalysisJobActionListener> openAnalysisJobActionListenerProvider) {
    super();/*from   w  ww  .j av a  2s  . c  o  m*/
    _windowContext = windowContext;
    _configuration = configuration;
    _centerPanel = new DCPanel();
    _centerPanel.setLayout(new VerticalLayout(0));
    _fileChooser = fileChooser;
    _fileChooser.addPropertyChangeListener(this);
    _openJobButton = getOpenJobButton();
    _openAnalysisJobActionListenerProvider = openAnalysisJobActionListenerProvider;

    setPreferredSize(WIDTH, 10);

    setBorder(new EmptyBorder(0, 10, 0, 0));
    setLayout(new BorderLayout());
    setVisible(false);

    final JLabel iconLabel = new JLabel(ICON_APP);

    final JLabel headerLabel = new JLabel("DataCleaner analysis job:");
    headerLabel.setFont(WidgetUtils.FONT_HEADER1);

    final DCPanel northPanel = new DCPanel();
    northPanel.setLayout(new VerticalLayout(0));
    northPanel.add(iconLabel);
    northPanel.add(Box.createVerticalStrut(10));
    northPanel.add(headerLabel);
    northPanel.add(Box.createVerticalStrut(10));
    northPanel.add(_centerPanel);
    northPanel.add(Box.createVerticalStrut(10));

    final DCPanel southPanel = new DCPanel();
    southPanel.setLayout(new VerticalLayout(0));
    northPanel.add(Box.createVerticalStrut(4));
    southPanel.add(_openJobButton);
    southPanel.add(Box.createVerticalStrut(4));
    southPanel.add(getOpenAsTemplateButton());

    add(WidgetUtils.scrolleable(northPanel), BorderLayout.CENTER);
    add(southPanel, BorderLayout.SOUTH);
}