Example usage for javax.swing SwingConstants LEFT

List of usage examples for javax.swing SwingConstants LEFT

Introduction

In this page you can find the example usage for javax.swing SwingConstants LEFT.

Prototype

int LEFT

To view the source code for javax.swing SwingConstants LEFT.

Click Source Link

Document

Box-orientation constant used to specify the left side of a box.

Usage

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.filtering.MultipleCutOffFilteringController.java

/**
 * Private methods and classes/* www.j av  a 2  s.  c  o m*/
 */
// initialize the main view
private void initMainView() {
    // make a new view
    multipleCutOffPanel = new MultipleCutOffPanel();
    // make a new radio button group for the radio buttons
    ButtonGroup radioButtonGroup = new ButtonGroup();
    radioButtonGroup.add(multipleCutOffPanel.getPixelRadioButton());
    radioButtonGroup.add(multipleCutOffPanel.getMicroMeterRadioButton());

    // pixels or m?
    multipleCutOffPanel.getPixelRadioButton().addActionListener((ActionEvent e) -> {
        multipleCutOffPanel.getConversionFactorTextField().setEnabled(true);
    });

    multipleCutOffPanel.getMicroMeterRadioButton().addActionListener((ActionEvent e) -> {
        // m: we do not need a conversion factor
        multipleCutOffPanel.getConversionFactorTextField().setEnabled(false);
    });

    // set default to micrometer
    multipleCutOffPanel.getMicroMeterRadioButton().setSelected(true);
    // and therefore no need for the conversion factor
    multipleCutOffPanel.getConversionFactorTextField().setEnabled(false);
    // set some default values for the top and bottom translocaton limits
    multipleCutOffPanel.getBottomLimTextField().setText("0.4");
    multipleCutOffPanel.getTopLimTextField().setText("2.8");
    multipleCutOffPanel.getTranslocationStepTextField().setText("0.8");
    multipleCutOffPanel.getPercentageMotileStepsTextField().setText("30");
    percentageMotile = 33;

    // actually do the filtering
    multipleCutOffPanel.getFilterButton().addActionListener((ActionEvent e) -> {

        // try to read the user-inserted values for up and down limit
        // check for number format exception
        try {
            if (multipleCutOffPanel.getPixelRadioButton().isSelected()) {
                double conversionFactor = Double
                        .parseDouble(multipleCutOffPanel.getConversionFactorTextField().getText());
                multipleCutOffPanel.getBottomLimTextField()
                        .setText("" + AnalysisUtils.roundTwoDecimals(
                                Double.parseDouble(multipleCutOffPanel.getBottomLimTextField().getText())
                                        / conversionFactor));
                multipleCutOffPanel.getTopLimTextField()
                        .setText("" + AnalysisUtils.roundTwoDecimals(
                                Double.parseDouble(multipleCutOffPanel.getTopLimTextField().getText())
                                        / conversionFactor));
            }

            int topLimit = (int) (Double.parseDouble(multipleCutOffPanel.getTopLimTextField().getText()) * 10);
            int bottomLimit = (int) (Double.parseDouble(multipleCutOffPanel.getBottomLimTextField().getText())
                    * 10);
            double step = Double.parseDouble(multipleCutOffPanel.getTranslocationStepTextField().getText());
            percentageMotile = Double
                    .parseDouble(multipleCutOffPanel.getPercentageMotileStepsTextField().getText());

            int numberSteps = (int) ((topLimit - bottomLimit) / (10 * step)) + 1;
            motileSteps = new ArrayList<>();

            for (int i = 0; i < numberSteps; i++) {
                motileSteps.add(((double) bottomLimit / 10) + (step * i));
            }
            FilterSwingWorker filterSwingWorker = new FilterSwingWorker();
            filterSwingWorker.execute();

        } catch (NumberFormatException ex) {
            // warn the user and log the error for info
            filteringController.showMessage("Please insert valid numbers!" + "\n " + ex.getMessage(),
                    "number format exception", JOptionPane.ERROR_MESSAGE);
            LOG.error(ex.getMessage());
        }

    });

    // apply a specific cut-off value to all the conditions at once
    multipleCutOffPanel.getApplyCutOffToConditionsButton().addActionListener((ActionEvent e) -> {
        // get the cut-off from the list (sure this is a Double)
        Double value = (Double) multipleCutOffPanel.getCutOffValuesComboBox().getSelectedItem();
        FilterConditionSwingWorker filterConditionSwingWorker = new FilterConditionSwingWorker(value);
        filterConditionSwingWorker.execute();
    });

    // select cut-off for a condition
    multipleCutOffPanel.getSelectCutOffForConditionButton().addActionListener((ActionEvent e) -> {
        if (multipleCutOffPanel.getCutOffValuesComboBox().getSelectedItem() != null) {
            SelectCutOffConditionSwingWorker selectCutOffConditionSwingWorker = new SelectCutOffConditionSwingWorker();
            selectCutOffConditionSwingWorker.execute();
        } else {
            filteringController.showMessage("Please select a cut-off!", "info", JOptionPane.WARNING_MESSAGE);
        }

    });

    AlignedTableRenderer alignedTableRenderer = new AlignedTableRenderer(SwingConstants.LEFT);
    for (int i = 0; i < multipleCutOffPanel.getFilterTrackTable().getColumnModel().getColumnCount(); i++) {
        multipleCutOffPanel.getFilterTrackTable().getColumnModel().getColumn(i)
                .setCellRenderer(alignedTableRenderer);
        multipleCutOffPanel.getSummaryTable().getColumnModel().getColumn(i)
                .setCellRenderer(alignedTableRenderer);
    }
    multipleCutOffPanel.getFilterTrackTable().getTableHeader()
            .setDefaultRenderer(new TableHeaderRenderer(SwingConstants.LEFT));
    multipleCutOffPanel.getSummaryTable().getTableHeader()
            .setDefaultRenderer(new TableHeaderRenderer(SwingConstants.LEFT));

    // add view to parent component
    filteringController.getFilteringPanel().getMultipleCutOffParentPanel().add(multipleCutOffPanel,
            gridBagConstraints);
}

From source file:com.vgi.mafscaling.ClosedLoop.java

private JTable createAfrDataTable(JPanel panel, String tableName, int gridy) {
    final JTable afrTable = new JTable() {
        private static final long serialVersionUID = 6526901361175099297L;

        public boolean isCellEditable(int row, int column) {
            return false;
        };/*from  ww  w  . jav a 2s  .  c  om*/
    };
    DefaultTableColumnModel afrModel = new DefaultTableColumnModel();
    final TableColumn afrColumn = new TableColumn(0, 250);
    afrColumn.setHeaderValue(tableName);
    afrModel.addColumn(afrColumn);
    JTableHeader lblAfrTableName = afrTable.getTableHeader();
    lblAfrTableName.setColumnModel(afrModel);
    lblAfrTableName.setReorderingAllowed(false);
    DefaultTableCellRenderer headerRenderer = (DefaultTableCellRenderer) lblAfrTableName.getDefaultRenderer();
    headerRenderer.setHorizontalAlignment(SwingConstants.LEFT);

    GridBagConstraints gbc_lblAfrTableName = new GridBagConstraints();
    gbc_lblAfrTableName.insets = new Insets((gridy == 0 ? 0 : 5), 0, 0, 0);
    gbc_lblAfrTableName.anchor = GridBagConstraints.PAGE_START;
    gbc_lblAfrTableName.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblAfrTableName.gridx = 0;
    gbc_lblAfrTableName.gridy = gridy;
    panel.add(lblAfrTableName, gbc_lblAfrTableName);

    afrTable.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            afrColumn.setWidth(afrTable.getWidth());
        }
    });
    afrTable.getTableHeader().setReorderingAllowed(false);
    afrTable.setColumnSelectionAllowed(true);
    afrTable.setCellSelectionEnabled(true);
    afrTable.setBorder(new LineBorder(new Color(0, 0, 0)));
    afrTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    afrTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    afrTable.setModel(new DefaultTableModel(AfrTableRowCount, AfrTableColumnCount));
    Utils.initializeTable(afrTable, ColumnWidth);

    if (tableName.equals(Afr1TableName)) {
        Format[][] formatMatrix = { { new DecimalFormat("#"), new DecimalFormat("0.00") } };
        NumberFormatRenderer renderer = (NumberFormatRenderer) afrTable.getDefaultRenderer(Object.class);
        renderer.setFormats(formatMatrix);
    } else if (tableName.equals(Afr2TableName)) {
        Format[][] formatMatrix = { { new DecimalFormat("#"), new DecimalFormat("0.00") },
                { new DecimalFormat("#"), new DecimalFormat("#") } };
        NumberFormatRenderer renderer = (NumberFormatRenderer) afrTable.getDefaultRenderer(Object.class);
        renderer.setFormats(formatMatrix);
    }

    GridBagConstraints gbc_afrTable = new GridBagConstraints();
    gbc_afrTable.insets = new Insets(0, 0, 0, 0);
    gbc_afrTable.anchor = GridBagConstraints.PAGE_START;
    gbc_afrTable.gridx = 0;
    gbc_afrTable.gridy = gridy + 1;
    panel.add(afrTable, gbc_afrTable);

    excelAdapter.addTable(afrTable, true, false);

    return afrTable;
}

From source file:com.digitalgeneralists.assurance.ui.components.ScanDefinitionPanel.java

@Override
protected void initializeComponent() {
    if (!this.initialized) {
        if (this.definition == null) {
            mode = AssuranceDialogMode.ADD;
            this.dialogTitle = "Add New Scan Definition";
            this.definition = new ScanDefinition();
        } else {/*w w w.java2s  .com*/
            mode = AssuranceDialogMode.EDIT;
            this.dialogTitle = "Edit Scan Definition";
        }

        GridBagLayout gridbag = new GridBagLayout();
        this.setLayout(gridbag);

        final JPanel optionsPanel = new JPanel();
        optionsPanel.setLayout(new GridBagLayout());

        Border optionsBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        optionsBorder = BorderFactory.createTitledBorder(optionsBorder, "Merge Options", TitledBorder.CENTER,
                TitledBorder.TOP);

        GridBagConstraints nameTextFieldConstraints = new GridBagConstraints();
        nameTextFieldConstraints.anchor = GridBagConstraints.NORTH;
        nameTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL;
        nameTextFieldConstraints.gridx = 0;
        nameTextFieldConstraints.gridy = 0;
        nameTextFieldConstraints.weightx = 1.0;
        nameTextFieldConstraints.weighty = 1.0;
        nameTextFieldConstraints.gridheight = 1;
        nameTextFieldConstraints.gridwidth = 2;
        nameTextFieldConstraints.insets = new Insets(10, 5, 0, 5);

        this.nameTextField.setText(this.definition.getName());
        this.nameTextField.getDocument().addDocumentListener(this.textPropertyValidationListener);
        this.add(this.nameTextField, nameTextFieldConstraints);

        Border existingScanMappingsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        existingScanMappingsPanelBorder = BorderFactory.createTitledBorder(existingScanMappingsPanelBorder,
                "Paths", TitledBorder.CENTER, TitledBorder.TOP);

        GridBagConstraints existingScanMappingsPanelConstraints = new GridBagConstraints();
        existingScanMappingsPanelConstraints.anchor = GridBagConstraints.WEST;
        existingScanMappingsPanelConstraints.fill = GridBagConstraints.BOTH;
        existingScanMappingsPanelConstraints.gridx = 0;
        existingScanMappingsPanelConstraints.gridy = 1;
        existingScanMappingsPanelConstraints.weightx = 1.0;
        existingScanMappingsPanelConstraints.weighty = 1.0;
        existingScanMappingsPanelConstraints.gridheight = 1;
        existingScanMappingsPanelConstraints.gridwidth = 2;
        existingScanMappingsPanelConstraints.insets = new Insets(5, 5, 0, 5);

        JPanel existingScanMappingsPanel = new JPanel();
        GridBagLayout panelGridbag = new GridBagLayout();
        existingScanMappingsPanel.setLayout(panelGridbag);
        existingScanMappingsPanel.setBorder(existingScanMappingsPanelBorder);
        this.add(existingScanMappingsPanel, existingScanMappingsPanelConstraints);

        GridBagConstraints existingScanMappingsListConstraints = new GridBagConstraints();
        existingScanMappingsListConstraints.anchor = GridBagConstraints.WEST;
        existingScanMappingsListConstraints.fill = GridBagConstraints.BOTH;
        existingScanMappingsListConstraints.gridx = 0;
        existingScanMappingsListConstraints.gridy = 0;
        existingScanMappingsListConstraints.weightx = 1.0;
        existingScanMappingsListConstraints.weighty = 0.9;
        existingScanMappingsListConstraints.gridheight = 1;
        existingScanMappingsListConstraints.gridwidth = 2;
        existingScanMappingsListConstraints.insets = new Insets(5, 5, 5, 5);

        this.definition = (ScanDefinition) ModelUtils.initializeEntity(this.definition,
                ScanDefinition.SCAN_MAPPING_PROPERTY);
        this.scanMappingsList = new ListInputPanel<ScanMappingDefinition>(this.definition, this);
        existingScanMappingsPanel.add(this.scanMappingsList, existingScanMappingsListConstraints);

        GridBagConstraints optionsPanelConstraints = new GridBagConstraints();
        optionsPanelConstraints.anchor = GridBagConstraints.SOUTH;
        optionsPanelConstraints.fill = GridBagConstraints.HORIZONTAL;
        optionsPanelConstraints.gridx = 0;
        optionsPanelConstraints.gridy = 3;
        optionsPanelConstraints.weightx = 1.0;
        optionsPanelConstraints.weighty = 1.0;
        optionsPanelConstraints.gridheight = 1;
        optionsPanelConstraints.gridwidth = 2;
        optionsPanelConstraints.insets = new Insets(5, 5, 5, 5);

        optionsPanel.setBorder(optionsBorder);
        this.add(optionsPanel, optionsPanelConstraints);

        GridBagConstraints strategyLabelConstraints = new GridBagConstraints();
        strategyLabelConstraints.anchor = GridBagConstraints.WEST;
        strategyLabelConstraints.fill = GridBagConstraints.BOTH;
        strategyLabelConstraints.gridx = 0;
        strategyLabelConstraints.gridy = 0;
        strategyLabelConstraints.weightx = 1.0;
        strategyLabelConstraints.weighty = 1.0;
        strategyLabelConstraints.gridheight = 1;
        strategyLabelConstraints.gridwidth = 1;
        strategyLabelConstraints.insets = new Insets(5, 5, 0, 5);

        final JLabel strategyLabel = new JLabel("Strategy", SwingConstants.RIGHT);
        optionsPanel.add(strategyLabel, strategyLabelConstraints);

        GridBagConstraints strategyComboBoxConstraints = new GridBagConstraints();
        strategyComboBoxConstraints.anchor = GridBagConstraints.WEST;
        strategyComboBoxConstraints.fill = GridBagConstraints.VERTICAL;
        strategyComboBoxConstraints.gridx = 1;
        strategyComboBoxConstraints.gridy = 0;
        strategyComboBoxConstraints.weightx = 1.0;
        strategyComboBoxConstraints.weighty = 1.0;
        strategyComboBoxConstraints.gridheight = 1;
        strategyComboBoxConstraints.gridwidth = 1;
        strategyComboBoxConstraints.insets = new Insets(5, 5, 0, 5);

        String[] strategyLabels = { "Source", "Target", "Both" };
        this.strategyComboBox = new JComboBox<String>(strategyLabels);
        // NOTE: We should have better validation of the data state for these controls.
        // We could run into problems as the application versions over time.
        this.strategyComboBox.setSelectedIndex(this.definition.getMergeStrategy().ordinal());
        this.strategyComboBox.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                validateFormState();
            }
        });
        optionsPanel.add(this.strategyComboBox, strategyComboBoxConstraints);

        GridBagConstraints autoMergeCheckBoxConstraints = new GridBagConstraints();
        autoMergeCheckBoxConstraints.gridx = 0;
        autoMergeCheckBoxConstraints.gridy = 1;
        autoMergeCheckBoxConstraints.weightx = 1.0;
        autoMergeCheckBoxConstraints.weighty = 1.0;
        autoMergeCheckBoxConstraints.gridheight = 1;
        autoMergeCheckBoxConstraints.gridwidth = 2;
        autoMergeCheckBoxConstraints.insets = new Insets(2, 5, 5, 5);

        this.autoMergeCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
        this.autoMergeCheckBox.setSelected(this.definition.getAutoResolveConflicts());
        this.autoMergeCheckBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                validateFormState();
            }
        });
        optionsPanel.add(this.autoMergeCheckBox, autoMergeCheckBoxConstraints);

        GridBagConstraints includeNonCreationTimestampsCheckBoxConstraints = new GridBagConstraints();
        includeNonCreationTimestampsCheckBoxConstraints.gridx = 0;
        includeNonCreationTimestampsCheckBoxConstraints.gridy = 2;
        includeNonCreationTimestampsCheckBoxConstraints.weightx = 1.0;
        includeNonCreationTimestampsCheckBoxConstraints.weighty = 1.0;
        includeNonCreationTimestampsCheckBoxConstraints.gridheight = 1;
        includeNonCreationTimestampsCheckBoxConstraints.gridwidth = 2;
        includeNonCreationTimestampsCheckBoxConstraints.insets = new Insets(2, 5, 5, 5);

        this.includeNonCreationTimestampCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
        this.includeNonCreationTimestampCheckBox.setSelected(this.definition.getIncludeNonCreationTimestamps());
        this.includeNonCreationTimestampCheckBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                validateFormState();
            }
        });
        optionsPanel.add(this.includeNonCreationTimestampCheckBox,
                includeNonCreationTimestampsCheckBoxConstraints);

        GridBagConstraints advancedAttributesCheckBoxConstraints = new GridBagConstraints();
        advancedAttributesCheckBoxConstraints.gridx = 0;
        advancedAttributesCheckBoxConstraints.gridy = 3;
        advancedAttributesCheckBoxConstraints.weightx = 1.0;
        advancedAttributesCheckBoxConstraints.weighty = 1.0;
        advancedAttributesCheckBoxConstraints.gridheight = 1;
        advancedAttributesCheckBoxConstraints.gridwidth = 2;
        advancedAttributesCheckBoxConstraints.insets = new Insets(2, 5, 5, 5);

        this.includeAdvancedAttributesCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
        this.includeAdvancedAttributesCheckBox.setSelected(this.definition.getAutoResolveConflicts());
        this.includeAdvancedAttributesCheckBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                validateFormState();
            }
        });
        optionsPanel.add(this.includeAdvancedAttributesCheckBox, advancedAttributesCheckBoxConstraints);

        this.scanMappingsList.loadData();

        if (this.getMode() == AssuranceDialogMode.EDIT) {
            this.validateFormState();
        }

        this.initialized = true;
    }
}

From source file:burp.BurpExtender.java

private void createSettingsLabel(String label, Container cont) {
    JLabel labelField = new JLabel(label);
    labelField.setHorizontalAlignment(SwingConstants.LEFT);
    callbacks.customizeUiComponent(labelField);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = 1;/*from   ww  w . j a va 2 s.c  om*/
    gbc.gridx = 0;
    gbc.insets = new Insets(0, 12, 0, 0);
    gbc.anchor = GridBagConstraints.WEST;
    cont.add(labelField, gbc);
}

From source file:com.sec.ose.osi.ui.frm.main.identification.codematch.table.JTableInfoForCMFile.java

synchronized public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
        boolean hasFocus, int row, int column) {

    JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row,
            column);/* w w w .j a va  2s .c o m*/
    if (value == null) {
        comp.setToolTipText(null);
        return comp;
    }

    comp.setToolTipText(String.valueOf(value));

    if (row >= table.getRowCount()) {
        log.debug("row > table.getRowCount()");
        return comp;
    }

    switch (column) {
    case TableModelForCMFile.COL_COMPONENT_NAME:
    case TableModelForCMFile.COL_LICENSE_NAME:
        setHorizontalAlignment(SwingConstants.LEFT);
        break;

    case TableModelForCMFile.COL_VERSION_NAME:
    case TableModelForCMFile.COL_USAGE:
    case TableModelForCMFile.COL_STATUS:
    case TableModelForCMFile.COL_PERCENTAGE:
    case TableModelForCMFile.COL_MATCHED_FILE:
        setHorizontalAlignment(SwingConstants.CENTER);
        break;
    }

    if (table.getValueAt(row, TableModelForCMFile.COL_STATUS) == null)
        return comp;
    String status = table.getValueAt(row, TableModelForCMFile.COL_STATUS).toString();
    String licenseName = table.getValueAt(row, TableModelForCMFile.COL_LICENSE_NAME).toString();

    if (status.equals(AbstractMatchInfo.IDENTIFIED)) {

        comp.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 12));
        comp.setForeground(NORMAL_COLOR);

    } else if ((status.equals(AbstractMatchInfo.REJECTED)) || (status.equals(AbstractMatchInfo.DECLARED))) {

        comp.setForeground(new Color(150, 150, 150));

    } else if (status.equals(AbstractMatchInfo.PENDING)) {

        if (identifiedStringSearchLicense != null && !identifiedStringSearchLicense.equals("")) {
            String currentRowLicense = "" + licenseName;
            if (identifiedStringSearchLicense.equals(currentRowLicense)) {
                comp.setForeground(NORMAL_COLOR);
            } else {
                comp.setForeground(GRAY_COLOR);
            }
        } else {
            comp.setForeground(NORMAL_COLOR);
        }
    }

    return comp;
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.area.AreaDoseResponseController.java

/**
 * Initialize main view/*ww w .  jav  a2 s  . co m*/
 */
@Override
protected void initMainView() {
    dRPanel = new DRPanel();
    //create a ButtonGroup for the radioButtons used for analysis
    ButtonGroup mainDRRadioButtonGroup = new ButtonGroup();
    //adding buttons to a ButtonGroup automatically deselect one when another one gets selected
    mainDRRadioButtonGroup.add(dRPanel.getInputDRButton());
    mainDRRadioButtonGroup.add(dRPanel.getInitialPlotDRButton());
    mainDRRadioButtonGroup.add(dRPanel.getNormalizedPlotDRButton());
    mainDRRadioButtonGroup.add(dRPanel.getResultsDRButton());
    //select as default first button
    dRPanel.getInputDRButton().setSelected(true);
    //init dataTable
    dataTable = new JTable();
    JScrollPane scrollPane = new JScrollPane(dataTable);
    //the table will take all the viewport height available
    dataTable.setFillsViewportHeight(true);
    scrollPane.getViewport().setBackground(Color.white);
    dataTable.getTableHeader().setReorderingAllowed(false);
    //row and column selection must be false
    //dataTable.setColumnSelectionAllowed(false);
    //dataTable.setRowSelectionAllowed(false);
    dRPanel.getDatatableDRPanel().add(scrollPane, BorderLayout.CENTER);

    /**
     * When button is selected, switch view to corresponding subview
     */
    dRPanel.getInputDRButton().addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            //switch shared table view
            updateModelInTable(dRInputController.getTableModel());
            updateTableInfoMessage("This table contains all conditions and their respective slopes");
            /**
             * for (int columnIndex = 0; columnIndex <
             * dataTable.getColumnCount(); columnIndex++) {
             * GuiUtils.packColumn(dataTable, columnIndex); }
             */
            dataTable.getTableHeader().setDefaultRenderer(new TableHeaderRenderer(SwingConstants.LEFT));
            //remove other panels
            dRInitialController.getInitialChartPanel().setChart(null);
            dRNormalizedController.getNormalizedChartPanel().setChart(null);
            dRResultsController.getDupeInitialChartPanel().setChart(null);
            dRResultsController.getDupeNormalizedChartPanel().setChart(null);
            dRPanel.getGraphicsDRParentPanel().removeAll();
            dRPanel.getGraphicsDRParentPanel().revalidate();
            dRPanel.getGraphicsDRParentPanel().repaint();
            //add panel to view
            dRPanel.getGraphicsDRParentPanel().add(dRInputController.getdRInputPanel(), gridBagConstraints);
        }
    });

    dRPanel.getInitialPlotDRButton().addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (dRAnalysisGroup != null) {
                if (isFirstFitting()) {
                    initFirstFitting();
                    setFirstFitting(false);
                }
                //switch shared table view
                updateModelInTable(dRInitialController.getTableModel());
                updateTableInfoMessage(
                        "Concentrations of conditions selected previously have been log-transformed, slopes have not been changed");
                /**
                 * for (int columnIndex = 0; columnIndex <
                 * dataTable.getColumnCount(); columnIndex++) {
                 * GuiUtils.packColumn(dataTable, columnIndex); }
                 */
                dataTable.getTableHeader().setDefaultRenderer(new TableHeaderRenderer(SwingConstants.LEFT));
                //remove other panels
                dRNormalizedController.getNormalizedChartPanel().setChart(null);
                dRResultsController.getDupeInitialChartPanel().setChart(null);
                dRResultsController.getDupeNormalizedChartPanel().setChart(null);
                dRPanel.getGraphicsDRParentPanel().removeAll();
                dRPanel.getGraphicsDRParentPanel().revalidate();
                dRPanel.getGraphicsDRParentPanel().repaint();
                dRPanel.getGraphicsDRParentPanel().add(dRInitialController.getDRInitialPlotPanel(),
                        gridBagConstraints);
                //Plot fitted data in dose-response curve, along with R annotation
                plotDoseResponse(dRInitialController.getInitialChartPanel(),
                        dRInitialController.getDRInitialPlotPanel().getDoseResponseChartParentPanel(),
                        getDataToFit(false), getdRAnalysisGroup(), false);
            }
        }
    });

    dRPanel.getNormalizedPlotDRButton().addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (dRAnalysisGroup != null) {
                //in case user skips "initial" subview and goes straight to normalization
                if (isFirstFitting()) {
                    initFirstFitting();
                    setFirstFitting(false);
                }
                //switch shared table view
                updateModelInTable(dRNormalizedController.getTableModel());
                updateTableInfoMessage(
                        "Log-transformed concentrations with their normalized responses per replicate");
                /**
                 * for (int columnIndex = 0; columnIndex <
                 * dataTable.getColumnCount(); columnIndex++) {
                 * GuiUtils.packColumn(dataTable, columnIndex); }
                 */
                dataTable.getTableHeader().setDefaultRenderer(new TableHeaderRenderer(SwingConstants.LEFT));
                //remove other panels
                dRInitialController.getInitialChartPanel().setChart(null);
                dRResultsController.getDupeInitialChartPanel().setChart(null);
                dRResultsController.getDupeNormalizedChartPanel().setChart(null);
                dRPanel.getGraphicsDRParentPanel().removeAll();
                dRPanel.getGraphicsDRParentPanel().revalidate();
                dRPanel.getGraphicsDRParentPanel().repaint();
                dRPanel.getGraphicsDRParentPanel().add(dRNormalizedController.getDRNormalizedPlotPanel(),
                        gridBagConstraints);
                //Plot fitted data in dose-response curve, along with R annotation
                plotDoseResponse(dRNormalizedController.getNormalizedChartPanel(),
                        dRNormalizedController.getDRNormalizedPlotPanel().getDoseResponseChartParentPanel(),
                        getDataToFit(true), getdRAnalysisGroup(), true);
            }
        }
    });

    dRPanel.getResultsDRButton().addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (dRAnalysisGroup != null) {
                //switch shared table view: create and set new table model with most recent statistical values
                // (these values get recalculated after each new fitting)
                dRResultsController.setTableModel(dRResultsController.reCreateTableModel(dRAnalysisGroup));
                updateModelInTable(dRResultsController.getTableModel());
                updateTableInfoMessage(
                        "Statistical values from the curve fit of the initial and normalized data.");

                //remove other panels
                dRInitialController.getInitialChartPanel().setChart(null);
                dRNormalizedController.getNormalizedChartPanel().setChart(null);
                dRPanel.getGraphicsDRParentPanel().removeAll();
                dRPanel.getGraphicsDRParentPanel().revalidate();
                dRPanel.getGraphicsDRParentPanel().repaint();
                dRPanel.getGraphicsDRParentPanel().add(dRResultsController.getdRResultsPanel(),
                        gridBagConstraints);
                //plot curves
                dRResultsController.plotCharts();
            }
        }
    });

    //add view to parent panel
    areaMainController.getAreaAnalysisPanel().getDoseResponseParentPanel().add(dRPanel, gridBagConstraints);
}

From source file:MainProgram.MainProgram.java

private void initComponents() throws InterruptedException {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    welcomeMessage = new JLabel();
    welcomeMessage2 = new JLabel();
    pennIDLabel = new JLabel();
    pennIDTextField = new JTextField();
    pennPassLabel = new JLabel();
    pennPassField = new JPasswordField();
    emailLabel = new JLabel();
    emailTextField = new JTextField();
    emailDomainLabel = new JLabel();
    emailPassLabel = new JLabel();
    emailPassField = new JPasswordField();
    semesterLabel = new JLabel();
    semesterComboBox = new JComboBox(semestersString);
    credentials = new JLabel();
    dropLabel = new JLabel();
    dropCheckBox = new JCheckBox();
    button = new JButton();
    stopWatchLabel = new JLabel();
    checkMail = false;//from   w w  w  .  jav  a  2 s .  c  o  m
    testConnection = false;

    mailCheckTimeInitializer();
    StopWatchInitializer();
    try {
        setUIFont(new javax.swing.plaf.FontUIResource("Segoe UI", Font.ROMAN_BASELINE, 12));
    } catch (Exception e) {
        e.printStackTrace(MainProgram.errorLog);
    }

    String lcOSName = System.getProperty("os.name").toLowerCase();
    boolean IS_MAC = lcOSName.startsWith("mac os x");
    //======== this ========
    setLayout(new GridBagLayout());
    ((GridBagLayout) getLayout()).columnWidths = new int[] { 81, 5, 119, 5, 0, 0 };
    if (!IS_MAC) {
        ((GridBagLayout) getLayout()).rowHeights = new int[] { 17, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 0, 0,
                0 };
    }
    ((GridBagLayout) getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 };
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;

    //---- welcomeMessage ----
    welcomeMessage.setText("Course Registration");
    welcomeMessage.setHorizontalAlignment(SwingConstants.CENTER);
    add(welcomeMessage, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- welcomeMessage2 ----
    welcomeMessage2.setText("for Penn State (BETA)");
    welcomeMessage2.setHorizontalAlignment(SwingConstants.CENTER);
    add(welcomeMessage2, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- pennIDLabel ----
    pennIDLabel.setText("Penn State ID: ");
    pennIDLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    add(pennIDLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- pennIDTextField ----
    pennIDTextField.setText("xxx123");
    add(pennIDTextField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- pennPassLabel ----
    pennPassLabel.setText("Penn State Password: ");
    pennPassLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    add(pennPassLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    add(pennPassField, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- emailLabel ----
    emailLabel.setText("Email: ");
    emailLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    add(emailLabel, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- emailTextField ----
    emailTextField.setText("myEmail");
    add(emailTextField, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- emailDomainLabel ----
    emailDomainLabel.setText("@mail.com");
    add(emailDomainLabel, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- emailPassLabel ----
    emailPassLabel.setText("Email Password: ");
    emailPassLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    add(emailPassLabel, new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    add(emailPassField, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    //---- Semester label ----
    semesterLabel.setText("Semester/Drop Option: ");
    semesterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    add(semesterLabel, new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    //---- Semester ComboBox ----
    add(semesterComboBox, new GridBagConstraints(1, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    //---- Drop CheckBox ----
    add(dropCheckBox, new GridBagConstraints(2, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    //---- button ----
    button.setText("Start");
    add(button, new GridBagConstraints(1, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    //---- stopWatchLabel ----
    stopWatchLabel.setText("  " + stopWatchSplitting[0]);
    stopWatchLabel.setHorizontalAlignment(SwingConstants.LEFT);
    add(stopWatchLabel, new GridBagConstraints(2, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    //---- label11 ----
    credentials.setText(" Created by Daniyar Yeralin");
    credentials.setForeground(Color.gray);
    credentials.setHorizontalAlignment(SwingConstants.RIGHT);
    credentials.setFont(new Font("Cambria", Font.ITALIC, 12));
    add(credentials, new GridBagConstraints(2, 17, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    /*button.registerKeyboardAction(button.getActionForKeyStroke(
     KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, false)),
     KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false),
     JComponent.WHEN_FOCUSED);
            
     button.registerKeyboardAction(button.getActionForKeyStroke(
     KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, true)),
     KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true),
     JComponent.WHEN_FOCUSED);*/
    StartButtonHandler buttonListener = new StartButtonHandler();
    button.addActionListener(buttonListener);

}

From source file:it.cnr.icar.eric.client.ui.swing.RegistryObjectsTable.java

public TableCellRenderer getCellRenderer(int row, int column) {
    if (cachedTableCellRenderers[column] != null) {
        return cachedTableCellRenderers[column];
    }//www .j a  va  2 s.c o  m
    TableCellRenderer renderer = null;
    Class<?> clazz = null;

    try {
        clazz = tableModel.getColumnClass(column);
        renderer = super.getCellRenderer(row, column);

        if (renderer == null) {
            Object[] unsupportedColumnClassArgs = { tableModel.getColumnName(column), clazz };
            MessageFormat form = new MessageFormat(resourceBundle.getString("error.unsupportedColumnClass"));
            RegistryBrowser.displayError(form.format(unsupportedColumnClassArgs));
        }
    } catch (Exception e) {
        Object[] unsupportedColumnClassArgs = { tableModel.getColumnName(column), clazz };
        MessageFormat form = new MessageFormat(resourceBundle.getString("error.unsupportedColumnClass"));
        RegistryBrowser.displayError(form.format(unsupportedColumnClassArgs), e);
    }

    if (renderer instanceof JLabel) {
        ((JLabel) renderer).setHorizontalAlignment(SwingConstants.LEFT);
    }
    cachedTableCellRenderers[column] = renderer;
    return renderer;
}

From source file:de.ailis.xadrian.frames.MainFrame.java

/**
 * Creates the content.//from  w  w w.j  a  v a2 s. c om
 */
private void createContent() {
    this.tabs = new JTabbedPane();
    this.tabs.setPreferredSize(new Dimension(640, 480));
    this.tabs.addChangeListener(this);
    this.tabs.setTransferHandler(this.transferHandler);

    final JPanel welcomePanel = this.welcomePanel = new JPanel();
    welcomePanel.setTransferHandler(this.transferHandler);

    welcomePanel.setLayout(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();

    welcomePanel.setPreferredSize(new Dimension(640, 480));
    final JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridBagLayout());
    c.anchor = GridBagConstraints.CENTER;
    welcomePanel.add(buttonPanel, c);

    final JButton newButton = new JButton(this.newAction);
    newButton.setHorizontalAlignment(SwingConstants.LEFT);
    newButton.setIconTextGap(10);
    newButton.setText("<html><body><strong>" + newButton.getText() + "</strong><br />"
            + newButton.getToolTipText() + "</body></html>");
    newButton.setToolTipText(null);
    newButton.setMargin(new Insets(5, 10, 5, 10));
    c.gridy = 0;
    c.fill = GridBagConstraints.BOTH;
    c.insets.set(5, 5, 5, 5);
    buttonPanel.add(newButton, c);

    final JButton openButton = new JButton(this.openAction);
    openButton.setHorizontalAlignment(SwingConstants.LEFT);
    openButton.setIconTextGap(10);
    openButton.setText("<html><body><strong>" + openButton.getText() + "</strong><br />"
            + openButton.getToolTipText() + "</body></html>");
    openButton.setToolTipText(null);
    openButton.setMargin(new Insets(5, 10, 5, 10));
    c.gridy++;
    buttonPanel.add(openButton, c);

    final JPanel separator = new JPanel();
    separator.setPreferredSize(new Dimension(20, 20));
    c.gridy++;
    buttonPanel.add(separator, c);

    final JButton donateButton = new JButton(this.donateAction);
    donateButton.setHorizontalAlignment(SwingConstants.LEFT);
    donateButton.setIconTextGap(10);
    donateButton.setText("<html><body><strong>" + donateButton.getText() + "</strong><br />"
            + donateButton.getToolTipText() + "</body></html>");
    donateButton.setToolTipText(null);
    donateButton.setMargin(new Insets(5, 10, 5, 10));
    c.gridy++;
    buttonPanel.add(donateButton, c);

    final SocialPane socialPane = new SocialPane();
    c.insets.top = 50;
    c.gridy++;
    buttonPanel.add(socialPane, c);
    installStatusHandler(buttonPanel);

    add(welcomePanel, BorderLayout.CENTER);
}

From source file:me.philnate.textmanager.windows.MainWindow.java

/**
 * Initialize the contents of the frame.
 *///  w  w w.  j  av a2  s.co  m
private void initialize() {
    changeListener = new ChangeListener();

    frame = new JFrame();
    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            Starter.shutdown();
        }
    });
    frame.setBounds(100, 100, 1197, 500);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new MigLayout("", "[grow]", "[][grow][::16px]"));

    customers = new CustomerComboBox();
    customers.addItemListener(changeListener);

    frame.getContentPane().add(customers, "flowx,cell 0 0,growx");

    jScrollPane = new JScrollPane();
    billLines = new BillingItemTable(frame, true);

    jScrollPane.setViewportView(billLines);
    frame.getContentPane().add(jScrollPane, "cell 0 1,grow");

    // for each file added through drag&drop create a new lineItem
    new FileDrop(jScrollPane, new FileDrop.Listener() {

        @Override
        public void filesDropped(File[] files) {
            for (File file : files) {
                addNewBillingItem(Document.loadAndSave(file));
            }
        }
    });

    monthChooser = new JMonthChooser();
    monthChooser.addPropertyChangeListener(changeListener);
    frame.getContentPane().add(monthChooser, "cell 0 0");

    yearChooser = new JYearChooser();
    yearChooser.addPropertyChangeListener(changeListener);
    frame.getContentPane().add(yearChooser, "cell 0 0");

    JButton btnAddLine = new JButton();
    btnAddLine.setIcon(ImageRegistry.getImage("load.gif"));
    btnAddLine.setToolTipText(getCaption("mw.tooltip.add"));
    btnAddLine.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            addNewBillingItem();
        }
    });

    frame.getContentPane().add(btnAddLine, "cell 0 0");

    JButton btnMassAdd = new JButton();
    btnMassAdd.setIcon(ImageRegistry.getImage("load_all.gif"));
    btnMassAdd.setToolTipText(getCaption("mw.tooltip.massAdd"));
    btnMassAdd.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            JFileChooser file = new DocXFileChooser();
            switch (file.showOpenDialog(frame)) {
            case JFileChooser.APPROVE_OPTION:
                File[] files = file.getSelectedFiles();
                if (null != files) {
                    for (File fl : files) {
                        addNewBillingItem(Document.loadAndSave(fl));
                    }
                }
                break;
            default:
                return;
            }
        }
    });

    frame.getContentPane().add(btnMassAdd, "cell 0 0");

    billNo = new JTextField();
    // enable/disable build button based upon text in billNo
    billNo.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void removeUpdate(DocumentEvent arg0) {
            setButtonStates();
        }

        @Override
        public void insertUpdate(DocumentEvent arg0) {
            setButtonStates();
        }

        @Override
        public void changedUpdate(DocumentEvent arg0) {
            setButtonStates();
        }

        private void setButtonStates() {
            boolean notBlank = StringUtils.isNotBlank(billNo.getText());
            build.setEnabled(notBlank);
            view.setEnabled(pdf.find(billNo.getText() + ".pdf").size() == 1);
        }
    });
    frame.getContentPane().add(billNo, "cell 0 0");
    billNo.setColumns(10);

    build = new JButton();
    build.setEnabled(false);// disable build Button until there's some
    // billNo entered
    build.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (runningThread == null) {
                try {
                    // check that billNo isn't empty or already used within
                    // another Bill
                    if (billNo.getText().trim().equals("")) {
                        JOptionPane.showMessageDialog(frame, getCaption("mw.dialog.error.billNoBlank.msg"),
                                getCaption("mw.dialog.error.billNoBlank.title"), JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                    try {
                        bill.setBillNo(billNo.getText()).save();
                    } catch (DuplicateKey e) {
                        // unset the internal value as this is already used
                        bill.setBillNo("");
                        JOptionPane.showMessageDialog(frame,
                                format(getCaption("mw.error.billNoUsed.msg"), billNo.getText()),
                                getCaption("mw.dialog.error.billNoBlank.title"), JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                    PDFCreator pdf = new PDFCreator(bill);
                    pdf.addListener(new ThreadCompleteListener() {

                        @Override
                        public void threadCompleted(NotifyingThread notifyingThread) {
                            build.setToolTipText(getCaption("mw.tooltip.build"));
                            build.setIcon(ImageRegistry.getImage("build.png"));
                            runningThread = null;
                            view.setEnabled(DB.pdf.find(billNo.getText() + ".pdf").size() == 1);
                        }
                    });
                    runningThread = new Thread(pdf);
                    runningThread.start();
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                build.setToolTipText(getCaption("mw.tooltip.build.cancel"));
                build.setIcon(ImageRegistry.getImage("cancel.gif"));
            } else {
                runningThread.interrupt();
                runningThread = null;
                build.setToolTipText(getCaption("mw.tooltip.build"));
                build.setIcon(ImageRegistry.getImage("build.png"));

            }
        }
    });
    build.setToolTipText(getCaption("mw.tooltip.build"));
    build.setIcon(ImageRegistry.getImage("build.png"));
    frame.getContentPane().add(build, "cell 0 0");

    view = new JButton();
    view.setToolTipText(getCaption("mw.tooltip.view"));
    view.setIcon(ImageRegistry.getImage("view.gif"));
    view.setEnabled(false);
    view.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            File file = new File(System.getProperty("user.dir"),
                    format("template/%s.tmp.pdf", billNo.getText()));
            try {
                pdf.findOne(billNo.getText() + ".pdf").writeTo(file);
                new ProcessBuilder(Setting.find("pdfViewer").getValue(), file.getAbsolutePath()).start()
                        .waitFor();
                file.delete();
            } catch (IOException | InterruptedException e1) {
                // TODO Auto-generated catch block
                LOG.warn("Error while building PDF", e1);
            }
        }
    });
    frame.getContentPane().add(view, "cell 0 0");

    statusBar = new JPanel();
    statusBar.setBorder(new BevelBorder(BevelBorder.LOWERED));
    statusBar.setLayout(new BoxLayout(statusBar, BoxLayout.X_AXIS));
    GitRepositoryState state = DB.state;
    JLabel statusLabel = new JLabel(String.format("textManager Version v%s build %s",
            state.getCommitIdDescribe(), state.getBuildTime()));
    statusLabel.setHorizontalAlignment(SwingConstants.LEFT);
    statusBar.add(statusLabel);
    frame.add(statusBar, "cell 0 2,growx");

    JMenuBar menuBar = new JMenuBar();
    frame.setJMenuBar(menuBar);

    JMenu menu = new JMenu(getCaption("mw.menu.edit"));
    JMenuItem itemCust = new JMenuItem(getCaption("mw.menu.edit.customer"));
    itemCust.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            new CustomerWindow(customers);
        }
    });
    menu.add(itemCust);

    JMenuItem itemSetting = new JMenuItem(getCaption("mw.menu.edit.settings"));
    itemSetting.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            new SettingWindow();
        }
    });
    menu.add(itemSetting);

    JMenuItem itemImport = new JMenuItem(getCaption("mw.menu.edit.import"));
    itemImport.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            new ImportWindow(new ImportListener() {

                @Override
                public void entriesImported(List<BillingItem> items) {
                    for (BillingItem item : items) {
                        item.setCustomerId(customers.getSelectedCustomer().getId())
                                .setMonth(monthChooser.getMonth()).setYear(yearChooser.getYear());
                        item.save();
                        billLines.addRow(item);
                    }
                }
            }, frame);
        }
    });
    menu.add(itemImport);

    menuBar.add(menu);

    customers.loadCustomer();
    fillTableModel();
}