Example usage for java.awt FlowLayout CENTER

List of usage examples for java.awt FlowLayout CENTER

Introduction

In this page you can find the example usage for java.awt FlowLayout CENTER.

Prototype

int CENTER

To view the source code for java.awt FlowLayout CENTER.

Click Source Link

Document

This value indicates that each row of components should be centered.

Usage

From source file:fedroot.dacs.swingdemo.DacsSingleFrameApplication.java

private JPanel createControlPanel() {
    JPanel settingsPanel = new JPanel(new BorderLayout());
    // TODO ad the infoPanel as a listener to the loadFederation action

    JPanel federationPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10));
    JLabel federationUriLabel = new JLabel("Federation URI:");
    federationPanel.add(federationUriLabel);

    federationURLTextField = new TextField(40);
    federationURLTextField.setEditable(true);

    JButton loadFederationButton = new JButton(actionMap().get("loadFederation"));

    federationPanel.add(federationURLTextField);
    federationPanel.add(loadFederationButton);

    JPanel jurisdictionsPanel = new JPanel(new FlowLayout());
    JLabel jurisdictionsLabel = new JLabel("Jurisdictions");
    jurisdictionsPanel.add(jurisdictionsLabel);

    JPanel modifiersPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10));
    checkOnlyCheckBox = new JCheckBox(actionMap().get("toggleCheckOnly"));
    enableEventHandlingCheckBox = new JCheckBox(actionMap().get("toggleEnableEventHandling"));
    modifiersPanel.add(checkOnlyCheckBox);
    modifiersPanel.add(enableEventHandlingCheckBox);

    settingsPanel.add(federationPanel, BorderLayout.NORTH);
    settingsPanel.add(jurisdictionsPanel, BorderLayout.CENTER);
    settingsPanel.add(modifiersPanel, BorderLayout.SOUTH);

    return settingsPanel;
}

From source file:edu.harvard.mcz.imagecapture.VerbatimCaptureDialog.java

protected void init() {
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setTitle("Transcribe Verbatim Data");
    setMinimumSize(new Dimension(1020, 640));
    setBounds(100, 100, 1020, 640);/* w w w  .ja va  2  s .c o m*/
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    {
        JPanel panel = new JPanel();
        contentPanel.add(panel, BorderLayout.NORTH);
        panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

        JLabel lblVerbatimDataFor = new JLabel("Verbatim Data for:");
        panel.add(lblVerbatimDataFor);
        lblBarcode = new JLabel("Barcode");
        panel.add(lblBarcode);
        lblCurrentid = new JLabel("CurrentID");
        panel.add(lblCurrentid);
    }
    {
        JPanel panel = new JPanel();
        contentPanel.add(panel, BorderLayout.WEST);
        GridBagLayout gbl_panel = new GridBagLayout();
        gbl_panel.columnWidths = new int[] { 0, 0, 0, 0 };
        gbl_panel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        gbl_panel.columnWeights = new double[] { 0.0, 1.0, 1.0, Double.MIN_VALUE };
        gbl_panel.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, 1.0,
                Double.MIN_VALUE };
        panel.setLayout(gbl_panel);

        JLabel lblNewLabel = new JLabel("Locality");
        GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
        gbc_lblNewLabel.anchor = GridBagConstraints.NORTHEAST;
        gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel.gridx = 0;
        gbc_lblNewLabel.gridy = 0;
        panel.add(lblNewLabel, gbc_lblNewLabel);

        textFieldVerbLocality = new JTextArea();
        textFieldVerbLocality.setRows(3);
        GridBagConstraints gbc_textFieldVerbLocality = new GridBagConstraints();
        gbc_textFieldVerbLocality.gridheight = 2;
        gbc_textFieldVerbLocality.gridwidth = 2;
        gbc_textFieldVerbLocality.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbLocality.fill = GridBagConstraints.BOTH;
        gbc_textFieldVerbLocality.gridx = 1;
        gbc_textFieldVerbLocality.gridy = 0;
        panel.add(textFieldVerbLocality, gbc_textFieldVerbLocality);
        textFieldVerbLocality.setColumns(10);

        JLabel lblVerbatimDate = new JLabel("Date");
        GridBagConstraints gbc_lblVerbatimDate = new GridBagConstraints();
        gbc_lblVerbatimDate.anchor = GridBagConstraints.EAST;
        gbc_lblVerbatimDate.insets = new Insets(0, 0, 5, 5);
        gbc_lblVerbatimDate.gridx = 0;
        gbc_lblVerbatimDate.gridy = 2;
        panel.add(lblVerbatimDate, gbc_lblVerbatimDate);

        textFieldVerbDate = new JTextField();
        GridBagConstraints gbc_textFieldVerbDate = new GridBagConstraints();
        gbc_textFieldVerbDate.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbDate.gridwidth = 2;
        gbc_textFieldVerbDate.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldVerbDate.gridx = 1;
        gbc_textFieldVerbDate.gridy = 2;
        panel.add(textFieldVerbDate, gbc_textFieldVerbDate);
        textFieldVerbDate.setColumns(10);

        JLabel lblCollector = new JLabel("Collector");
        GridBagConstraints gbc_lblCollector = new GridBagConstraints();
        gbc_lblCollector.anchor = GridBagConstraints.EAST;
        gbc_lblCollector.insets = new Insets(0, 0, 5, 5);
        gbc_lblCollector.gridx = 0;
        gbc_lblCollector.gridy = 3;
        panel.add(lblCollector, gbc_lblCollector);

        textFieldVerbCollector = new JTextField();
        GridBagConstraints gbc_textFieldVerbCollector = new GridBagConstraints();
        gbc_textFieldVerbCollector.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbCollector.gridwidth = 2;
        gbc_textFieldVerbCollector.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldVerbCollector.gridx = 1;
        gbc_textFieldVerbCollector.gridy = 3;
        panel.add(textFieldVerbCollector, gbc_textFieldVerbCollector);
        textFieldVerbCollector.setColumns(10);

        JLabel lblNewLabel_1 = new JLabel("Collection");
        GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
        gbc_lblNewLabel_1.anchor = GridBagConstraints.EAST;
        gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel_1.gridx = 0;
        gbc_lblNewLabel_1.gridy = 4;
        panel.add(lblNewLabel_1, gbc_lblNewLabel_1);

        textFieldVerbCollection = new JTextField();
        GridBagConstraints gbc_textFieldVerbCollection = new GridBagConstraints();
        gbc_textFieldVerbCollection.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbCollection.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldVerbCollection.gridx = 2;
        gbc_textFieldVerbCollection.gridy = 4;
        panel.add(textFieldVerbCollection, gbc_textFieldVerbCollection);
        textFieldVerbCollection.setColumns(10);

        JLabel lblNumbers = new JLabel("Numbers");
        GridBagConstraints gbc_lblNumbers = new GridBagConstraints();
        gbc_lblNumbers.anchor = GridBagConstraints.EAST;
        gbc_lblNumbers.insets = new Insets(0, 0, 5, 5);
        gbc_lblNumbers.gridx = 0;
        gbc_lblNumbers.gridy = 5;
        panel.add(lblNumbers, gbc_lblNumbers);

        textFieldVerbNumbers = new JTextField();
        GridBagConstraints gbc_textFieldVerbNumbers = new GridBagConstraints();
        gbc_textFieldVerbNumbers.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbNumbers.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldVerbNumbers.gridx = 2;
        gbc_textFieldVerbNumbers.gridy = 5;
        panel.add(textFieldVerbNumbers, gbc_textFieldVerbNumbers);
        textFieldVerbNumbers.setColumns(10);

        JLabel lblNewLabel_2 = new JLabel("Other Text");
        GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints();
        gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST;
        gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel_2.gridx = 0;
        gbc_lblNewLabel_2.gridy = 6;
        panel.add(lblNewLabel_2, gbc_lblNewLabel_2);

        textFieldVerbUnclassifiedText = new JTextArea();
        textFieldVerbUnclassifiedText.setRows(3);
        GridBagConstraints gbc_textFieldVerbUnclassifiedText = new GridBagConstraints();
        gbc_textFieldVerbUnclassifiedText.gridheight = 2;
        gbc_textFieldVerbUnclassifiedText.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbUnclassifiedText.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldVerbUnclassifiedText.gridx = 2;
        gbc_textFieldVerbUnclassifiedText.gridy = 6;
        panel.add(textFieldVerbUnclassifiedText, gbc_textFieldVerbUnclassifiedText);
        textFieldVerbUnclassifiedText.setColumns(10);

        JLabel lblQuestions = new JLabel("Questions");
        GridBagConstraints gbc_lblQuestions = new GridBagConstraints();
        gbc_lblQuestions.anchor = GridBagConstraints.EAST;
        gbc_lblQuestions.insets = new Insets(0, 0, 5, 5);
        gbc_lblQuestions.gridx = 0;
        gbc_lblQuestions.gridy = 8;
        panel.add(lblQuestions, gbc_lblQuestions);

        textFieldQuestions = new JTextField();
        GridBagConstraints gbc_textFieldQuestions = new GridBagConstraints();
        gbc_textFieldQuestions.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldQuestions.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldQuestions.gridx = 2;
        gbc_textFieldQuestions.gridy = 8;
        panel.add(textFieldQuestions, gbc_textFieldQuestions);
        textFieldQuestions.setColumns(30);

        JLabel lblWorkflowStatus = new JLabel("Workflow Status");
        GridBagConstraints gbc_lblWorkflowStatus = new GridBagConstraints();
        gbc_lblWorkflowStatus.anchor = GridBagConstraints.EAST;
        gbc_lblWorkflowStatus.insets = new Insets(0, 0, 5, 5);
        gbc_lblWorkflowStatus.gridx = 0;
        gbc_lblWorkflowStatus.gridy = 9;
        panel.add(lblWorkflowStatus, gbc_lblWorkflowStatus);

        comboBoxWorkflowStatus = new JComboBox<String>(WorkFlowStatus.getVerbatimWorkFlowStatusValues());
        GridBagConstraints gbc_comboBoxWorkflowStatus = new GridBagConstraints();
        gbc_comboBoxWorkflowStatus.insets = new Insets(0, 0, 5, 0);
        gbc_comboBoxWorkflowStatus.gridwidth = 2;
        gbc_comboBoxWorkflowStatus.fill = GridBagConstraints.HORIZONTAL;
        gbc_comboBoxWorkflowStatus.gridx = 2;
        gbc_comboBoxWorkflowStatus.gridy = 9;
        panel.add(comboBoxWorkflowStatus, gbc_comboBoxWorkflowStatus);

        JPanel panel_1 = new JPanel();
        GridBagConstraints gbc_panel_1 = new GridBagConstraints();
        gbc_panel_1.gridwidth = 2;
        gbc_panel_1.insets = new Insets(0, 0, 0, 5);
        gbc_panel_1.fill = GridBagConstraints.BOTH;
        gbc_panel_1.gridx = 2;
        gbc_panel_1.gridy = 11;
        panel.add(panel_1, gbc_panel_1);
        GridBagLayout gbl_panel_1 = new GridBagLayout();
        gbl_panel_1.columnWidths = new int[] { 150, 143, 0 };
        gbl_panel_1.rowHeights = new int[] { 25, 0, 0, 0, 0 };
        gbl_panel_1.columnWeights = new double[] { 0.0, 0.0, 0.0 };
        gbl_panel_1.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
        panel_1.setLayout(gbl_panel_1);

        JButton btnPartiallyIllegible = new JButton("Partially Illegible");
        btnPartiallyIllegible.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                appendToQuestions(Verbatim.PARTLY_ILLEGIBLE);

            }
        });
        GridBagConstraints gbc_btnPartiallyIllegible = new GridBagConstraints();
        gbc_btnPartiallyIllegible.fill = GridBagConstraints.HORIZONTAL;
        gbc_btnPartiallyIllegible.anchor = GridBagConstraints.NORTH;
        gbc_btnPartiallyIllegible.insets = new Insets(0, 0, 5, 5);
        gbc_btnPartiallyIllegible.gridx = 0;
        gbc_btnPartiallyIllegible.gridy = 0;
        panel_1.add(btnPartiallyIllegible, gbc_btnPartiallyIllegible);

        JButton btnNewButton = new JButton("No Locality Data");
        btnNewButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                textFieldVerbLocality.setText(Verbatim.NO_LOCALITY_DATA);
            }
        });
        GridBagConstraints gbc_btnNewButton = new GridBagConstraints();
        gbc_btnNewButton.anchor = GridBagConstraints.NORTHWEST;
        gbc_btnNewButton.insets = new Insets(0, 0, 5, 5);
        gbc_btnNewButton.gridx = 1;
        gbc_btnNewButton.gridy = 0;
        panel_1.add(btnNewButton, gbc_btnNewButton);
        btnNewButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            }
        });

        JButton btnNewButton_1 = new JButton("Entirely Illegible");
        btnNewButton_1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                appendToQuestions(Verbatim.ENTIRELY_ILLEGIBLE);
            }
        });
        GridBagConstraints gbc_btnNewButton_1 = new GridBagConstraints();
        gbc_btnNewButton_1.fill = GridBagConstraints.HORIZONTAL;
        gbc_btnNewButton_1.anchor = GridBagConstraints.NORTH;
        gbc_btnNewButton_1.insets = new Insets(0, 0, 5, 5);
        gbc_btnNewButton_1.gridx = 0;
        gbc_btnNewButton_1.gridy = 1;
        panel_1.add(btnNewButton_1, gbc_btnNewButton_1);

        JButton btnNoDateData = new JButton("No Date Data");
        btnNoDateData.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                textFieldVerbDate.setText("[No date data]");
            }
        });
        GridBagConstraints gbc_btnNoDateData = new GridBagConstraints();
        gbc_btnNoDateData.fill = GridBagConstraints.HORIZONTAL;
        gbc_btnNoDateData.insets = new Insets(0, 0, 5, 5);
        gbc_btnNoDateData.gridx = 1;
        gbc_btnNoDateData.gridy = 1;
        panel_1.add(btnNoDateData, gbc_btnNoDateData);

        JButton btnLabelTruncatedIn = new JButton("Label Truncated in Image");
        btnLabelTruncatedIn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                appendToQuestions(Verbatim.TRUNCATED_BY_IMAGE);
            }
        });
        GridBagConstraints gbc_btnLabelTruncatedIn = new GridBagConstraints();
        gbc_btnLabelTruncatedIn.insets = new Insets(0, 0, 5, 5);
        gbc_btnLabelTruncatedIn.anchor = GridBagConstraints.NORTHWEST;
        gbc_btnLabelTruncatedIn.gridx = 0;
        gbc_btnLabelTruncatedIn.gridy = 2;
        panel_1.add(btnLabelTruncatedIn, gbc_btnLabelTruncatedIn);

        JButton btnNoCollectorData = new JButton("No Collector Data");
        btnNoCollectorData.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                textFieldVerbCollector.setText("[No collector data]");
            }
        });
        GridBagConstraints gbc_btnNoCollectorData = new GridBagConstraints();
        gbc_btnNoCollectorData.insets = new Insets(0, 0, 5, 5);
        gbc_btnNoCollectorData.gridx = 1;
        gbc_btnNoCollectorData.gridy = 2;
        panel_1.add(btnNoCollectorData, gbc_btnNoCollectorData);

        JButton btnNoPinLabels = new JButton("No Pin Labels");
        btnNoPinLabels.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                appendToQuestions(Verbatim.NO_PIN_LABELS);
            }
        });
        GridBagConstraints gbc_btnNoPinLabels = new GridBagConstraints();
        gbc_btnNoPinLabels.insets = new Insets(0, 0, 0, 5);
        gbc_btnNoPinLabels.gridx = 0;
        gbc_btnNoPinLabels.gridy = 3;
        panel_1.add(btnNoPinLabels, gbc_btnNoPinLabels);
    }
    {
        JPanel panel = new JPanel();
        contentPanel.add(panel, BorderLayout.CENTER);
        panel.setLayout(new BorderLayout(0, 0));

        panel.add(getImagePanePinLabels());
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);

        btnPrevious = new JButton("Previous");
        btnPrevious.setEnabled(false);
        if (specimenControler != null && specimenControler.isInTable()) {
            btnPrevious.setEnabled(true);
        }
        btnPrevious.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                save();
                if (specimenControler.previousSpecimenInTable()) {
                    specimen = specimenControler.getSpecimen();
                    setValues();
                }
            }
        });
        buttonPane.add(btnPrevious);

        btnNext = new JButton("Next");
        btnNext.setEnabled(false);
        if (specimenControler != null && specimenControler.isInTable()) {
            btnNext.setEnabled(true);
        }
        btnNext.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                save();
                if (specimenControler.nextSpecimenInTable()) {
                    specimen = specimenControler.getSpecimen();
                    setValues();
                }
            }
        });
        buttonPane.add(btnNext);
        {
            JButton okButton = new JButton("OK");
            okButton.setActionCommand("OK");
            okButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    if (save()) {
                        setVisible(false);
                    }
                }

            });
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.setActionCommand("Cancel");
            cancelButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    setVisible(false);
                }

            });
            buttonPane.add(cancelButton);
        }
    }
}

From source file:org.nuclos.client.main.mainframe.workspace.WorkspaceEditor.java

public WorkspaceEditor(WorkspaceVO wovo) {
    final SpringLocaleDelegate localeDelegate = SpringLocaleDelegate.getInstance();
    this.wovo = wovo;
    this.backup = new WorkspaceVO();
    this.backup.importHeader(wovo.getWoDesc());

    boolean showAlwaysReset = wovo.isAssigned()
            && SecurityCache.getInstance().isActionAllowed(Actions.ACTION_WORKSPACE_ASSIGN);

    contentPanel = new JPanel();
    initJPanel(contentPanel,/*from   ww  w.ja v  a2s  .c  o  m*/
            new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
                    TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL },
            new double[] { 20, 20, 20, 20, showAlwaysReset ? 20 : 0, 10, 20, TableLayout.FILL,
                    TableLayout.PREFERRED });
    contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    JLabel lbName = new JLabel(localeDelegate.getMessage("WorkspaceEditor.2", "Name"), JLabel.TRAILING);
    contentPanel.add(lbName, "0, 0");
    tfName = new JTextField(15);
    lbName.setLabelFor(tfName);
    contentPanel.add(tfName, "1, 0");
    chckHideName = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.3", "Name ausblenden"));
    contentPanel.add(chckHideName, "2, 0, 3, 0");
    chckHide = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.8", "Auswahl Button ausblenden"));
    if (wovo.isAssigned() && SecurityCache.getInstance().isActionAllowed(Actions.ACTION_WORKSPACE_ASSIGN)) {
        contentPanel.add(chckHide, "4, 0");
    }
    chckAlwaysOpenAtLogin = new JCheckBox(
            localeDelegate.getMessage("WorkspaceEditor.11", "Immer bei Anmeldung ffnen"));
    contentPanel.add(chckAlwaysOpenAtLogin, "1, 1");

    JLabel lbMainFrame = new JLabel(localeDelegate.getMessage("WorkspaceEditor.9", "Hauptfenster"),
            JLabel.TRAILING);
    contentPanel.add(lbMainFrame, "0, 2");
    chckHideMenuBar = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.10", "Nur Standard Menuleiste"));
    contentPanel.add(chckHideMenuBar, "1, 2");
    chckUseLastFrameSettings = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.12",
            "Letzte Fenster Einstellungen bernehmen (Gre und Position)"));
    contentPanel.add(chckUseLastFrameSettings, "1, 3, 5, 3");
    chckAlwaysReset = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.alwaysreset",
            "Zuletzt geffnete Tabs immer zurcksetzen"));
    if (showAlwaysReset) {
        contentPanel.add(chckAlwaysReset, "1, 4, 5, 4");
    }

    JTabbedPane tbbdPane = new JTabbedPane();
    nuclosIconChooser = new ResourceIconChooser(WorkspaceChooserController.ICON_SIZE,
            NuclosResourceCategory.ENTITY_ICON);
    nuclosIconChooser.removeBorder();
    tbbdPane.addTab(localeDelegate.getMessage("WorkspaceEditor.4", "Icon"), nuclosIconChooser);
    JPanel parameterPanel = new JPanel(new BorderLayout());
    parameterModel = new ParameterModel();
    jtbParameter = new JTable(parameterModel);
    JScrollPane parameterScroller = new JScrollPane(jtbParameter);
    jtbParameter.setFillsViewportHeight(true);
    jtbParameter.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    jtbParameter.getColumnModel().getColumn(0).setPreferredWidth(100);
    jtbParameter.getColumnModel().getColumn(1).setPreferredWidth(400);
    parameterPanel.add(parameterScroller, BorderLayout.CENTER);
    JToolBar parameterTools = UIUtils.createNonFloatableToolBar(JToolBar.VERTICAL);
    parameterTools.add(new ParameterAddButton());
    btRemoveParameter = new ParameterRemoveButton();
    btRemoveParameter.setEnabled(false);
    parameterTools.add(btRemoveParameter);
    parameterPanel.add(parameterTools, BorderLayout.WEST);
    tbbdPane.addTab(localeDelegate.getMessage("WorkspaceEditor.13", "Parameter"), parameterPanel);
    contentPanel.add(tbbdPane, "1, 6, 5, 7");

    JPanel actionsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 2));
    btSave = new JButton(localeDelegate.getMessage("WorkspaceEditor.5", "Speichern"));
    btCancel = new JButton(localeDelegate.getMessage("WorkspaceEditor.6", "Abbrechen"));
    actionsPanel.add(btSave);
    actionsPanel.add(btCancel);
    contentPanel.add(actionsPanel, "0, 8, 5, 8");

    tfName.setText(wovo.getWoDesc().getName());
    chckHide.setSelected(wovo.getWoDesc().isHide());
    chckHideName.setSelected(wovo.getWoDesc().isHideName());
    chckHideMenuBar.setSelected(wovo.getWoDesc().isHideMenuBar());
    chckAlwaysOpenAtLogin.setSelected(wovo.getWoDesc().isAlwaysOpenAtLogin());
    chckUseLastFrameSettings.setSelected(wovo.getWoDesc().isUseLastFrameSettings());
    chckAlwaysReset.setSelected(wovo.getWoDesc().isAlwaysReset());
    nuclosIconChooser.setSelected(wovo.getWoDesc().getNuclosResource());
    parameterModel.setParamters(wovo.getWoDesc().getParameters());

    dialog = new JDialog(Main.getInstance().getMainFrame(),
            localeDelegate.getMessage("WorkspaceEditor.1", "Arbeitsumgebung Eigenschaften"), true);
    dialog.setContentPane(contentPanel);
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.getRootPane().setDefaultButton(btSave);
    Rectangle mfBounds = Main.getInstance().getMainFrame().getBounds();
    dialog.setBounds(mfBounds.x + (mfBounds.width / 2) - 300, mfBounds.y + (mfBounds.height / 2) - 200, 600,
            400);
    dialog.setResizable(false);

    initListener();
    dialog.setVisible(true);
}

From source file:org.interreg.docexplore.ServerConfigPanel.java

public ServerConfigPanel(final File config, final File serverDir) throws Exception {
    super(new LooseGridLayout(0, 1, 5, 5, true, false, SwingConstants.LEFT, SwingConstants.TOP, true, false));

    this.serverDir = serverDir;
    this.books = new Vector<Book>();
    this.bookList = new JList(new DefaultListModel());

    JPanel listPanel = new JPanel(new BorderLayout());
    listPanel.setBorder(BorderFactory.createTitledBorder(XMLResourceBundle.getBundledString("cfgBooksLabel")));
    bookList.setOpaque(false);//from  www  . j  a  v  a  2  s .  co  m
    bookList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    bookList.setCellRenderer(new ListCellRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            Book book = (Book) value;
            JLabel label = new JLabel("<html><b>" + book.name + "</b> - " + book.nPages + " pages</html>");
            label.setOpaque(true);
            if (isSelected) {
                label.setBackground(TextToolbar.styleHighLightedBackground);
                label.setForeground(Color.white);
            }
            if (book.deleted)
                label.setForeground(Color.red);
            else if (!book.used)
                label.setForeground(Color.gray);
            return label;
        }
    });
    bookList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting())
                return;
            setFields((Book) bookList.getSelectedValue());
        }
    });
    JScrollPane scrollPane = new JScrollPane(bookList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setPreferredSize(new Dimension(500, 300));
    scrollPane.getVerticalScrollBar().setUnitIncrement(10);
    listPanel.add(scrollPane, BorderLayout.CENTER);

    JPanel importPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    importPanel.add(new JButton(new AbstractAction(XMLResourceBundle.getBundledString("cfgImportLabel")) {
        public void actionPerformed(ActionEvent e) {
            final File inFile = DocExploreTool.getFileDialogs().openFile(DocExploreTool.getIBookCategory());
            if (inFile == null)
                return;

            try {
                final File tmpDir = new File(serverDir, "tmp");
                tmpDir.mkdir();

                GuiUtils.blockUntilComplete(new ProgressRunnable() {
                    float[] progress = { 0 };

                    public void run() {
                        try {
                            ZipUtils.unzip(inFile, tmpDir, progress);
                        } catch (Exception ex) {
                            ErrorHandler.defaultHandler.submit(ex);
                        }
                    }

                    public float getProgress() {
                        return (float) progress[0];
                    }
                }, ServerConfigPanel.this);

                File tmpFile = new File(tmpDir, "index.tmp");
                ObjectInputStream input = new ObjectInputStream(new FileInputStream(tmpFile));
                String bookFile = input.readUTF();
                String bookName = input.readUTF();
                String bookDesc = input.readUTF();
                input.close();

                new PresentationImporter().doImport(ServerConfigPanel.this, bookName, bookDesc,
                        new File(tmpDir, bookFile));
                FileUtils.cleanDirectory(tmpDir);
                FileUtils.deleteDirectory(tmpDir);
                updateBooks();
            } catch (Exception ex) {
                ErrorHandler.defaultHandler.submit(ex);
            }
        }
    }));
    listPanel.add(importPanel, BorderLayout.SOUTH);
    add(listPanel);

    JPanel setupPanel = new JPanel(
            new LooseGridLayout(0, 1, 5, 5, true, false, SwingConstants.LEFT, SwingConstants.TOP, true, false));
    setupPanel.setBorder(
            BorderFactory.createTitledBorder(XMLResourceBundle.getBundledString("cfgBookInfoLabel")));
    usedBox = new JCheckBox(XMLResourceBundle.getBundledString("cfgUseLabel"));
    usedBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Book book = (Book) bookList.getSelectedValue();
            if (book != null) {
                book.used = usedBox.isSelected();
                bookList.repaint();
            }
        }
    });
    setupPanel.add(usedBox);

    JPanel fieldPanel = new JPanel(new LooseGridLayout(0, 2, 5, 5, false, false, SwingConstants.LEFT,
            SwingConstants.TOP, true, false));
    fieldPanel.add(new JLabel(XMLResourceBundle.getBundledString("cfgTitleLabel")));
    nameField = new JTextField(50);
    nameField.getDocument().addDocumentListener(new DocumentListener() {
        public void removeUpdate(DocumentEvent e) {
            changedUpdate(e);
        }

        public void insertUpdate(DocumentEvent e) {
            changedUpdate(e);
        }

        public void changedUpdate(DocumentEvent e) {
            Book book = (Book) bookList.getSelectedValue();
            if (book == null)
                return;
            book.name = nameField.getText();
            bookList.repaint();
        }
    });
    fieldPanel.add(nameField);

    fieldPanel.add(new JLabel(XMLResourceBundle.getBundledString("cfgDescriptionLabel")));
    descField = new JTextPane();
    //descField.setWrapStyleWord(true);
    descField.getDocument().addDocumentListener(new DocumentListener() {
        public void removeUpdate(DocumentEvent e) {
            changedUpdate(e);
        }

        public void insertUpdate(DocumentEvent e) {
            changedUpdate(e);
        }

        public void changedUpdate(DocumentEvent e) {
            Book book = (Book) bookList.getSelectedValue();
            if (book == null)
                return;
            book.desc = descField.getText();
        }
    });
    scrollPane = new JScrollPane(descField, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setPreferredSize(new Dimension(420, 50));
    scrollPane.getVerticalScrollBar().setUnitIncrement(10);
    fieldPanel.add(scrollPane);

    setupPanel.add(fieldPanel);

    exportButton = new JButton(new AbstractAction(XMLResourceBundle.getBundledString("cfgExportLabel")) {
        public void actionPerformed(ActionEvent e) {
            File file = DocExploreTool.getFileDialogs().saveFile(DocExploreTool.getIBookCategory());
            if (file == null)
                return;
            final Book book = (Book) bookList.getSelectedValue();
            final File indexFile = new File(serverDir, "index.tmp");
            try {
                final File outFile = file;
                ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(indexFile));
                out.writeUTF(book.bookFile.getName());
                out.writeUTF(book.name);
                out.writeUTF(book.desc);
                out.close();

                GuiUtils.blockUntilComplete(new ProgressRunnable() {
                    float[] progress = { 0 };

                    public void run() {
                        try {
                            ZipUtils.zip(serverDir, new File[] { indexFile, book.bookFile, book.bookDir },
                                    outFile, progress, 0, 1, 9);
                        } catch (Exception ex) {
                            ErrorHandler.defaultHandler.submit(ex);
                        }
                    }

                    public float getProgress() {
                        return (float) progress[0];
                    }
                }, ServerConfigPanel.this);
            } catch (Exception ex) {
                ErrorHandler.defaultHandler.submit(ex);
            }
            if (indexFile.exists())
                indexFile.delete();
        }
    });
    deleteButton = new JButton(new AbstractAction(XMLResourceBundle.getBundledString("cfgDeleteRestoreLabel")) {
        public void actionPerformed(ActionEvent e) {
            Book book = (Book) bookList.getSelectedValue();
            if (book == null)
                return;
            book.deleted = !book.deleted;
            bookList.repaint();
        }
    });

    JPanel actionsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    actionsPanel.add(exportButton);
    actionsPanel.add(deleteButton);
    setupPanel.add(actionsPanel);

    add(setupPanel);

    JPanel optionsPanel = new JPanel(new LooseGridLayout(0, 2, 5, 5, false, false, SwingConstants.LEFT,
            SwingConstants.TOP, true, false));
    optionsPanel
            .setBorder(BorderFactory.createTitledBorder(XMLResourceBundle.getBundledString("cfgOptionsLabel")));
    JPanel timeoutPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    timeoutField = new JTextField(5);
    timeoutPanel.add(timeoutField);
    timeoutPanel.add(new JLabel(XMLResourceBundle.getBundledString("cfgTimeoutLabel")));
    optionsPanel.add(timeoutPanel);
    add(optionsPanel);

    updateBooks();
    setFields(null);

    final String xml = config.exists() ? StringUtils.readFile(config) : "<config></config>";
    String idle = StringUtils.getTagContent(xml, "idle");
    if (idle != null)
        try {
            timeoutField.setText("" + Integer.parseInt(idle));
        } catch (Throwable e) {
        }
}

From source file:DisplayModeModel.java

private void initComponents(Container c) {
    setContentPane(c);//from w  ww  .j  a v  a2 s .c  o m
    c.setLayout(new BorderLayout());
    // Current DM
    JPanel currentPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    c.add(currentPanel, BorderLayout.NORTH);
    JLabel current = new JLabel("Current Display Mode : ");
    currentPanel.add(current);
    currentPanel.add(currentDM);
    // Display Modes
    JPanel modesPanel = new JPanel(new GridLayout(1, 2));
    c.add(modesPanel, BorderLayout.CENTER);
    // List of display modes
    for (int i = 0; i < COLUMN_WIDTHS.length; i++) {
        TableColumn col = new TableColumn(i, COLUMN_WIDTHS[i]);
        col.setIdentifier(COLUMN_NAMES[i]);
        col.setHeaderValue(COLUMN_NAMES[i]);
        dmList.addColumn(col);
    }
    dmList.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dmList.getSelectionModel().addListSelectionListener(this);
    modesPanel.add(dmPane);
    // Controls
    JPanel controlsPanelA = new JPanel(new BorderLayout());
    modesPanel.add(controlsPanelA);
    JPanel controlsPanelB = new JPanel(new GridLayout(2, 1));
    controlsPanelA.add(controlsPanelB, BorderLayout.NORTH);
    // Exit
    JPanel exitPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    controlsPanelB.add(exitPanel);
    exitPanel.add(exit);
    // Change DM
    JPanel changeDMPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    controlsPanelB.add(changeDMPanel);
    changeDMPanel.add(changeDM);
    controlsPanelA.add(new JPanel(), BorderLayout.CENTER);
}

From source file:com.haskins.cloudtrailviewer.feature.MetricsFeature.java

private void buildUI() {

    // toolbar//from   w  w  w  . ja va2 s .  c  o m
    toolbar.setLayout(new WrapLayout(FlowLayout.CENTER, 1, 1));
    toolbar.setFloatable(false);
    toolbar.setBackground(Color.white);
    toolbar.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, Color.black));

    eventTable.setVisible(false);

    jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, chartCards, eventTable);
    jsp.setDividerSize(0);
    jsp.setResizeWeight(1);
    jsp.setDividerLocation(jsp.getSize().height - jsp.getInsets().bottom - jsp.getDividerSize());
    jsp.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0));

    this.setLayout(new BorderLayout());
    this.add(toolbar, BorderLayout.PAGE_START);
    this.add(jsp, BorderLayout.CENTER);
}

From source file:com.emental.mindraider.ui.dialogs.AttachmentJDialog.java

/**
 * Concetructor.//w w  w .  j a  va 2  s .c o m
 * 
 * @param noteResource
 *            The concept resource.
 * @param dragAndDropReference
 *            The drag'n'drop reference.
 */
public AttachmentJDialog(ConceptResource conceptResource, DragAndDropReference dragAndDropReference) {

    super(Messages.getString("AttachmentJDialog.title"));
    this.conceptResource = conceptResource;
    getContentPane().setLayout(new BorderLayout());
    JPanel p, pp;

    p = new JPanel();
    p.setLayout(new BorderLayout());
    JLabel intro = new JLabel("<html>&nbsp;&nbsp;" + Messages.getString("AttachmentJDialog.introduction")
            + "&nbsp;&nbsp;<br><br></html>");
    p.add(intro, BorderLayout.NORTH);
    p.add(new JLabel("<html>&nbsp;&nbsp;" + Messages.getString("AttachmentJDialog.description") + "</html>"),
            BorderLayout.CENTER);
    description = new JTextField(38);
    pp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    pp.add(description);
    p.add(pp, BorderLayout.SOUTH);
    getContentPane().add(p, BorderLayout.NORTH);

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    mainPanel.setBorder(new TitledBorder(Messages.getString("AttachmentJDialog.resource")));

    ButtonGroup attachType = new ButtonGroup();

    JPanel webPanel = new JPanel();
    webPanel.setLayout(new BorderLayout());
    webType = new JRadioButton(Messages.getString("AttachmentJDialog.web"));
    webType.setActionCommand(WEB);
    webType.addActionListener(this);
    webType.setSelected(true);
    attachType.add(webType);
    webPanel.add(webType, BorderLayout.NORTH);
    urlTextField = new JTextField("http://", 35);
    urlTextField.selectAll();
    urlTextField.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent keyEvent) {
            if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) {
                attach();
            }
        }

        public void keyReleased(KeyEvent keyEvent) {
        }

        public void keyTyped(KeyEvent keyEvent) {
        }
    });
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.LEFT));
    p.add(new JLabel("   "));
    p.add(urlTextField);
    webPanel.add(p, BorderLayout.SOUTH);
    mainPanel.add(webPanel, BorderLayout.NORTH);

    JPanel localPanel = new JPanel();
    localPanel.setLayout(new BorderLayout());
    JRadioButton localType = new JRadioButton(Messages.getString("AttachmentJDialog.local"));
    localType.setActionCommand(LOCAL);
    localType.addActionListener(this);
    localPanel.add(localType, BorderLayout.NORTH);
    pathTextField = new JTextField(35);
    pathTextField.setEnabled(false);
    browseButton = new JButton(Messages.getString("AttachmentJDialog.browse"));
    browseButton.setToolTipText(Messages.getString("AttachmentJDialog.browseTip"));
    browseButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = new JFileChooser();
            fc.setApproveButtonText(Messages.getString("AttachmentJDialog.attach"));
            fc.setControlButtonsAreShown(true);
            fc.setDialogTitle(Messages.getString("AttachmentJDialog.chooseAttachment"));
            fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
            int returnVal = fc.showOpenDialog(AttachmentJDialog.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                pathTextField.setText(file.toString());
            }
        }
    });
    browseButton.setEnabled(false);
    pp = new JPanel();
    pp.setLayout(new BorderLayout());
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.LEFT));
    p.add(new JLabel("   "));
    pp.add(p, BorderLayout.NORTH);
    p.add(pathTextField);
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.RIGHT));
    p.add(browseButton);
    pp.add(p, BorderLayout.SOUTH);
    localPanel.add(pp, BorderLayout.SOUTH);
    attachType.add(localType);
    mainPanel.add(localPanel, BorderLayout.SOUTH);

    getContentPane().add(mainPanel, BorderLayout.CENTER);

    // buttons
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.CENTER));
    JButton addButton = new JButton(Messages.getString("AttachmentJDialog.attach"));

    p.add(addButton);
    addButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            attach();
        }
    });
    JButton cancelButton = new JButton(Messages.getString("AttachmentJDialog.cancel"));
    p.add(cancelButton);
    cancelButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            AttachmentJDialog.this.dispose();
        }
    });
    getContentPane().add(p, BorderLayout.SOUTH);

    /*
     * drag and drop initialization
     */
    if (dragAndDropReference != null) {
        if (dragAndDropReference.getType() == DragAndDropReference.BROWSER_LINK) {
            urlTextField.setText(dragAndDropReference.getReference());
            localType.setSelected(false);
            webType.setSelected(true);
            enableWebTypeButtons();
        } else {
            pathTextField.setText(dragAndDropReference.getReference());
            localType.setSelected(true);
            webType.setSelected(false);
            enableLocalTypeButtons();
        }
        description.setText(dragAndDropReference.getTitle());
    }

    pack();
    Gfx.centerAndShowWindow(this);
}

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

private DCTable getDatabaseDriverTable() {
    final List<DatabaseDriverDescriptor> databaseDrivers = _databaseDriverCatalog.getDatabaseDrivers();
    final TableModel tableModel = new DefaultTableModel(
            new String[] { "", "Database", "Driver class", "Installed?", "Used?" }, databaseDrivers.size());

    final DCTable table = new DCTable(tableModel);

    final Icon validIcon = imageManager.getImageIcon(IconUtils.STATUS_VALID, IconUtils.ICON_SIZE_SMALL);
    final Icon invalidIcon = imageManager.getImageIcon(IconUtils.STATUS_ERROR, IconUtils.ICON_SIZE_SMALL);

    final int installedCol = 3;
    final int usedCol = 4;
    int row = 0;/*w w  w  .  j  av a 2  s.c  o  m*/
    for (final DatabaseDriverDescriptor dd : databaseDrivers) {
        final String driverClassName = dd.getDriverClassName();
        final String displayName = dd.getDisplayName();

        final Icon driverIcon = imageManager.getImageIcon(DatabaseDriverCatalog.getIconImagePath(dd),
                IconUtils.ICON_SIZE_SMALL);

        tableModel.setValueAt(driverIcon, row, 0);
        tableModel.setValueAt(displayName, row, 1);
        tableModel.setValueAt(driverClassName, row, 2);
        tableModel.setValueAt("", row, 3);
        tableModel.setValueAt("", row, 4);

        final DatabaseDriverState state = _databaseDriverCatalog.getState(dd);
        if (state == DatabaseDriverState.INSTALLED_WORKING) {
            tableModel.setValueAt(validIcon, row, installedCol);
        } else if (state == DatabaseDriverState.INSTALLED_NOT_WORKING) {
            tableModel.setValueAt(invalidIcon, row, installedCol);
        } else if (state == DatabaseDriverState.NOT_INSTALLED) {
            final String[] downloadUrls = dd.getDownloadUrls();
            if (downloadUrls != null) {
                final DCPanel buttonPanel = new DCPanel();
                buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 0));

                final JButton downloadButton = WidgetFactory.createSmallButton("images/actions/download.png");
                downloadButton.setToolTipText("Download and install the driver for " + dd.getDisplayName());

                downloadButton.addActionListener(createDownloadActionListener(dd));
                buttonPanel.add(downloadButton);

                tableModel.setValueAt(buttonPanel, row, installedCol);
            }
        }

        if (isUsed(driverClassName)) {
            tableModel.setValueAt(validIcon, row, usedCol);
        }

        row++;
    }

    table.setAlignment(installedCol, Alignment.CENTER);
    table.setAlignment(usedCol, Alignment.CENTER);

    table.setRowHeight(IconUtils.ICON_SIZE_SMALL + 4);
    table.getColumn(0).setMaxWidth(IconUtils.ICON_SIZE_SMALL + 4);
    table.getColumn(installedCol).setMaxWidth(84);
    table.getColumn(usedCol).setMaxWidth(70);
    table.setColumnControlVisible(false);
    return table;
}

From source file:org.datacleaner.panels.DatabaseDriversPanel.java

private DCTable getDatabaseDriverTable() {
    final List<DatabaseDriverDescriptor> databaseDrivers = _databaseDriverCatalog.getDatabaseDrivers();
    final List<UserDatabaseDriver> userPreferencesDatabaseDrivers = _userPreferences.getDatabaseDrivers();
    final List<UserDatabaseDriver> unknownManuallyInstalledDrivers = getUnknownManuallyInstalledDrivers(
            userPreferencesDatabaseDrivers, databaseDrivers);
    final TableModel tableModel = new DefaultTableModel(
            new String[] { "", "Database", "Driver class", "Installed?", "Used?" },
            databaseDrivers.size() + unknownManuallyInstalledDrivers.size());

    final DCTable table = new DCTable(tableModel);

    final Icon validIcon = imageManager.getImageIcon(IconUtils.STATUS_VALID, IconUtils.ICON_SIZE_SMALL);
    final Icon invalidIcon = imageManager.getImageIcon(IconUtils.STATUS_ERROR, IconUtils.ICON_SIZE_SMALL);

    final int installedCol = 3;
    final int usedCol = 4;
    int row = 0;//from  www .  jav a2s.c  om
    for (final DatabaseDriverDescriptor dd : databaseDrivers) {
        final String driverClassName = dd.getDriverClassName();
        final String displayName = dd.getDisplayName();

        final Icon driverIcon = imageManager.getImageIcon(DatabaseDriverCatalog.getIconImagePath(dd),
                IconUtils.ICON_SIZE_SMALL);

        tableModel.setValueAt(driverIcon, row, 0);
        tableModel.setValueAt(displayName, row, 1);
        tableModel.setValueAt(driverClassName, row, 2);
        tableModel.setValueAt("", row, 3);
        tableModel.setValueAt("", row, 4);

        final DatabaseDriverState state = _databaseDriverCatalog.getState(dd);
        if (state == DatabaseDriverState.INSTALLED_WORKING) {
            tableModel.setValueAt(validIcon, row, installedCol);
        } else if (state == DatabaseDriverState.INSTALLED_NOT_WORKING) {
            tableModel.setValueAt(invalidIcon, row, installedCol);
        } else if (state == DatabaseDriverState.NOT_INSTALLED) {
            final String[] downloadUrls = dd.getDownloadUrls();
            if (downloadUrls != null) {
                final DCPanel buttonPanel = new DCPanel();
                buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 0));

                final JButton downloadButton = WidgetFactory.createSmallButton(IconUtils.ACTION_DOWNLOAD);
                downloadButton.setToolTipText("Download and install the driver for " + dd.getDisplayName());

                downloadButton.addActionListener(createDownloadActionListener(dd));
                buttonPanel.add(downloadButton);

                tableModel.setValueAt(buttonPanel, row, installedCol);
            }
        }

        if (isUsed(driverClassName)) {
            tableModel.setValueAt(validIcon, row, usedCol);
        }

        row++;
    }

    for (UserDatabaseDriver driver : unknownManuallyInstalledDrivers) {
        final String driverClassName = driver.getDriverClassName();
        final Icon driverIcon = imageManager.getImageIcon(IconUtils.GENERIC_DATASTORE_IMAGEPATH,
                IconUtils.ICON_SIZE_SMALL);
        tableModel.setValueAt(driverIcon, row, 0);
        tableModel.setValueAt("", row, 1);
        tableModel.setValueAt(driverClassName, row, 2);
        final DatabaseDriverState state = driver.getState();
        if (state == DatabaseDriverState.INSTALLED_WORKING) {
            tableModel.setValueAt(validIcon, row, installedCol);
        } else if (state == DatabaseDriverState.INSTALLED_NOT_WORKING) {
            tableModel.setValueAt(invalidIcon, row, installedCol);
        } else if (state == DatabaseDriverState.NOT_INSTALLED) {
            final Icon icon = imageManager.getImageIcon(IconUtils.STATUS_WARNING, IconUtils.ICON_SIZE_SMALL);
            tableModel.setValueAt(icon, row, installedCol);

        }
        if (isUsed(driverClassName)) {
            tableModel.setValueAt(validIcon, row, usedCol);
        }
        row++;
    }

    table.setAlignment(installedCol, Alignment.CENTER);
    table.setAlignment(usedCol, Alignment.CENTER);

    table.setRowHeight(IconUtils.ICON_SIZE_SMALL + 4);
    table.getColumn(0).setMaxWidth(IconUtils.ICON_SIZE_SMALL + 4);
    table.getColumn(installedCol).setMaxWidth(84);
    table.getColumn(usedCol).setMaxWidth(70);
    table.setColumnControlVisible(false);
    return table;
}