Example usage for javax.swing SwingConstants CENTER

List of usage examples for javax.swing SwingConstants CENTER

Introduction

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

Prototype

int CENTER

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

Click Source Link

Document

The central position in an area.

Usage

From source file:edu.ku.brc.specify.utilapps.ERDTable.java

/**
 * @param p/*from w  w  w.  j  av a 2s  .c  om*/
 * @param f
 * @param font
 * @param y
 * @param all
 */
public void build(final PanelBuilder p, final DBFieldInfo f, final Font font, final int y, boolean all) {
    String typ = StringUtils.substringAfterLast(f.getType(), ".");
    if (StringUtils.isEmpty(typ)) {
        typ = f.getType();
    }

    String lenStr = f.getLength() > 0 && f.getLength() < 65000 ? Integer.toString(f.getLength()) : "";

    CellConstraints cc = new CellConstraints();
    p.add(ERDVisualizer.mkLabel(font, f.getTitle(), SwingConstants.LEFT), cc.xy(1, y));
    p.add(ERDVisualizer.mkLabel(font, typ, SwingConstants.CENTER), cc.xy(3, y));
    p.add(ERDVisualizer.mkLabel(font, lenStr, SwingConstants.CENTER), cc.xy(5, y));

    if (all) {
        p.add(ERDVisualizer.mkLabel(font, f.isRequired() ? yesStr : "", SwingConstants.CENTER), cc.xy(7, y));
        p.add(ERDVisualizer.mkLabel(font, f.isRequired() ? yesStr : "", SwingConstants.CENTER), cc.xy(9, y));
    }

}

From source file:esmska.gui.AboutFrame.java

/** This method is called from within the constructor to
 * initialize the form.//from   ww w. j  a v  a2s.com
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jLabel1 = new JLabel();
    jLabel2 = new JLabel();
    jLabel3 = new JLabel();
    creditsButton = new JButton();
    closeButton = new JButton();
    licenseButton = new JButton();
    jLabel5 = new JLabel();
    jLabel4 = new JLabel();
    jLabel6 = new JLabel();
    jLabel7 = new JLabel();
    jLabel8 = new JLabel();
    homeHyperlink = new JXHyperlink();
    supportHyperlink = new JXHyperlink();

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    ResourceBundle bundle = ResourceBundle.getBundle("esmska/resources/l10n"); // NOI18N
    setTitle(bundle.getString("AboutFrame.title")); // NOI18N
    setLocationByPlatform(true);

    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/esmska.png"))); // NOI18N
    jLabel1.setFocusable(false);

    jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() | Font.BOLD,
            jLabel2.getFont().getSize() + 22));
    jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
    Mnemonics.setLocalizedText(jLabel2, "Esmska " + config.getLatestVersion());
    jLabel2.setFocusable(false);

    jLabel3.setHorizontalAlignment(SwingConstants.CENTER);
    Mnemonics.setLocalizedText(jLabel3, bundle.getString("AboutFrame.jLabel3.text")); // NOI18N
    jLabel3.setFocusable(false);

    creditsButton.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/about-22.png"))); // NOI18N
    Mnemonics.setLocalizedText(creditsButton, bundle.getString("AboutFrame.creditsButton.text"));
    creditsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            creditsButtonActionPerformed(evt);
        }
    });

    closeButton.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/close-22.png"))); // NOI18N
    Mnemonics.setLocalizedText(closeButton, bundle.getString("Close_"));
    closeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            closeButtonActionPerformed(evt);
        }
    });
    Mnemonics.setLocalizedText(licenseButton, bundle.getString("AboutFrame.licenseButton.text"));
    licenseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            licenseButtonActionPerformed(evt);
        }
    });

    jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getSize() - 2f));
    jLabel5.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel5.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/copyleft-12.png"))); // NOI18N
    Mnemonics.setLocalizedText(jLabel5, bundle.getString("AboutFrame.jLabel5.text")); // NOI18N
    jLabel5.setFocusable(false);

    setURI(homeHyperlink, Links.getURI(Links.HOMEPAGE));
    Mnemonics.setLocalizedText(homeHyperlink, l10n.getString("AboutFrame.homeHyperlink.text"));
    homeHyperlink.setToolTipText(l10n.getString("AboutFrame.homeHyperlink.toolTipText")); // NOI18N
    setURI(supportHyperlink, Links.getURI(Links.DONATE));
    Mnemonics.setLocalizedText(supportHyperlink, l10n.getString("AboutFrame.supportHyperlink.text"));
    supportHyperlink.setToolTipText(l10n.getString("AboutFrame.supportHyperlink.toolTipText")); // NOI18N
    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addContainerGap()
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                    .addComponent(jLabel5, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE)
                    .addComponent(homeHyperlink, Alignment.CENTER, GroupLayout.PREFERRED_SIZE,
                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(supportHyperlink, Alignment.CENTER, GroupLayout.PREFERRED_SIZE,
                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE)
                    .addComponent(jLabel2, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE)
                    .addComponent(jLabel1, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup().addComponent(creditsButton)
                            .addPreferredGap(ComponentPlacement.RELATED).addComponent(licenseButton)
                            .addPreferredGap(ComponentPlacement.RELATED, 151, Short.MAX_VALUE)
                            .addComponent(closeButton))
                    .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel4, GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE)
                            .addGap(108, 108, 108)
                            .addComponent(jLabel6, GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel8, GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE)
                            .addGap(138, 138, 138)
                            .addComponent(jLabel7, GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)))
            .addContainerGap()));

    layout.linkSize(SwingConstants.HORIZONTAL, new Component[] { closeButton, creditsButton, licenseButton });

    layout.setVerticalGroup(
            layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING,
                    layout.createSequentialGroup().addContainerGap().addComponent(jLabel1).addGap(18, 18, 18)
                            .addComponent(jLabel2).addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(jLabel3).addPreferredGap(ComponentPlacement.UNRELATED)
                            .addComponent(jLabel5).addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                                                    .addComponent(jLabel4).addComponent(jLabel6))
                                            .addPreferredGap(ComponentPlacement.RELATED)
                                            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                                                    .addComponent(jLabel7).addComponent(jLabel8)))
                                    .addComponent(homeHyperlink, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addComponent(supportHyperlink, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED, 48, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(creditsButton)
                                    .addComponent(closeButton).addComponent(licenseButton))
                            .addContainerGap()));

    layout.linkSize(SwingConstants.VERTICAL, new Component[] { jLabel4, jLabel6 });

    layout.linkSize(SwingConstants.VERTICAL, new Component[] { closeButton, creditsButton, licenseButton });

    pack();
}

From source file:edu.ku.brc.specify.ui.DBObjSearchDialog.java

/**
 * Constructs a search dialog from form infor and from search info.
 * @param viewSetName the viewset name/*  w w w  .jav  a2s.c  o  m*/
 * @param viewName the form name from the viewset
 * @param searchName the search name, this is looked up by name in the "search_config.xml" file
 * @param title the title (should be already localized before passing in)
 * @param className the name of the class to be created from the selected results
 * @param idFieldName the name of the field in the clas that is the primary key which is filled in from the search table id
 * @throws HeadlessException an exception
 */
public DBObjSearchDialog(final Dialog parent, final String viewSetName, final String viewName,
        final String searchName, final String title, final String className, final String idFieldName,
        final String helpContext) throws HeadlessException {
    super(parent, title, true, OK_BTN | CANCEL_BTN | HELP_BTN, null);

    if (StringUtils.isNotEmpty(helpContext)) {
        this.whichBtns |= HELP_BTN;
        setHelpContext(helpContext);
    }

    this.parent = parent;
    this.panel = new DBObjSearchPanel(viewSetName, viewName, searchName, className, idFieldName,
            SwingConstants.CENTER);
    if (panel == null) {
        log.error("ViewSet[" + viewSetName + "] View[" + viewName + "] searchName[" + searchName
                + "] className[" + className + "] could not be created.");
    }
}

From source file:com.anrisoftware.prefdialog.core.AbstractTitleField.java

@Override
public void setTitlePosition(TextPosition position) {
    super.setTitlePosition(position);
    switch (position) {
    case ICON_ONLY:
        titleLabel.setText(null);/*from   w  w w .  j  a  va  2  s .c  o  m*/
        break;
    case TEXT_ALONGSIDE_ICON:
        updateTitleResource();
        updateIconResource();
        titleLabel.setVerticalTextPosition(SwingConstants.CENTER);
        break;
    case TEXT_ONLY:
        updateTitleResource();
        titleLabel.setIcon(null);
        break;
    case TEXT_UNDER_ICON:
        updateIconResource();
        updateTitleResource();
        titleLabel.setVerticalTextPosition(SwingConstants.BOTTOM);
        break;
    default:
        break;
    }
}

From source file:ec.ui.view.StabilityView.java

public StabilityView() {
    super();/*ww  w. ja v  a  2 s.c  o m*/
    setLayout(new BorderLayout());

    this.graphs_ = new LinkedHashMap<>();

    meanRenderer = new XYLineAndShapeRenderer(true, false);
    meanRenderer.setAutoPopulateSeriesPaint(false);
    meanRenderer.setBasePaint(themeSupport.getLineColor(KnownColor.RED));

    pointsRenderer = new XYLineAndShapeRenderer(false, true);
    pointsRenderer.setAutoPopulateSeriesPaint(false);
    pointsRenderer.setAutoPopulateSeriesShape(false);
    pointsRenderer.setBaseShape(new Ellipse2D.Double(-2, -2, 4, 4));
    pointsRenderer.setBasePaint(themeSupport.getLineColor(KnownColor.BLUE));
    pointsRenderer.setBaseShapesFilled(false);

    smoothRenderer = new XYLineAndShapeRenderer(true, false);
    smoothRenderer.setAutoPopulateSeriesPaint(false);
    smoothRenderer.setBasePaint(themeSupport.getLineColor(KnownColor.GREEN));

    mainChart = createChart();
    detailChart = createChart();

    panel = new JChartPanel(null);

    errorPanel = new JPanel(new BorderLayout());
    errorLabel = new JLabel();
    errorLabel.setHorizontalAlignment(SwingConstants.CENTER);
    errorLabel.setFont(errorLabel.getFont().deriveFont(errorLabel.getFont().getSize2D() * 3 / 2));
    errorPanel.add(errorLabel, BorderLayout.CENTER);

    panel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            indexSelected = -1;
            if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
                double x = panel.getChartX(e.getX());
                Graphs g = null;
                for (Bornes b : graphs_.keySet()) {
                    indexSelected++;
                    if (x >= b.min_ && x <= b.max_) {
                        g = graphs_.get(b);
                        break;
                    }
                }
                if (g == null) {
                    return;
                }

                showDetail(g);
            } else if (e.getButton() == MouseEvent.BUTTON3) {
                showMain();
                indexSelected = -1;
            }
        }
    });

    StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator() {
        final DecimalFormat format = new DecimalFormat("0.0000");

        @Override
        public String generateToolTip(XYDataset dataset, int series, int item) {
            try {
                StabilityViewItem i = items.get(indexSelected == -1 ? series : indexSelected);
                int cpt = 0;
                for (Map.Entry<TsDomain, Double> e : i.data.entrySet()) {
                    if (cpt == item) {
                        TsDomain dom = e.getKey();
                        return "(" + dom.getStart().toString() + ", " + dom.getEnd().toString() + ") : "
                                + format.format(e.getValue());
                    }
                    cpt++;
                }
            } catch (IndexOutOfBoundsException e) {
            }
            return null;
        }
    };
    pointsRenderer.setBaseToolTipGenerator(generator);
    cards = new JPanel(new CardLayout());

    cards.add(MAIN_PANEL, panel);

    cards.add(ERROR_PANEL, errorPanel);

    add(cards, BorderLayout.CENTER);

    onColorSchemeChange();
}

From source file:eu.ggnet.dwoss.report.CreateViewCask.java

/** This method is called from within the constructor to
 * initialize the form./*from www. ja v a  2s.  com*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jLabel1 = new javax.swing.JLabel();
    contractorComboBox = new javax.swing.JComboBox();
    startDateChooser = new com.toedter.calendar.JDateChooser();
    endDateChooser = new com.toedter.calendar.JDateChooser();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    nameTextField = new javax.swing.JTextField();
    jLabel4 = new javax.swing.JLabel();
    unreportedCheckBox = new javax.swing.JCheckBox();
    jLabel5 = new javax.swing.JLabel();
    viewModeComboBox = new javax.swing.JComboBox();

    jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel1.setText("Lieferant:");

    contractorComboBox.setModel(
            new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
    contractorComboBox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            contractorComboBoxActionPerformed(evt);
        }
    });

    startDateChooser.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            startDateChooserMouseClicked(evt);
        }
    });

    endDateChooser.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent evt) {
            endDateChooserPropertyChange(evt);
        }
    });

    jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    jLabel2.setText("Ende:");

    jLabel3.setText("Name:");

    jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    jLabel4.setText("Begin:");

    unreportedCheckBox.setText("Noch nicht gemeldete Elemente hinzufgen");

    jLabel5.setText("ViewMode:");

    viewModeComboBox.setModel(
            new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup().addGroup(layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup().addComponent(jLabel3)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(nameTextField))
                            .addGroup(layout.createSequentialGroup().addGroup(layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 54,
                                            Short.MAX_VALUE))
                                    .addGap(11, 11, 11)
                                    .addGroup(layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(startDateChooser,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(endDateChooser, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                            .addGap(6, 6, 6))
                    .addGroup(layout.createSequentialGroup().addGap(0, 48, Short.MAX_VALUE)
                            .addComponent(unreportedCheckBox).addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                            .addGroup(layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(contractorComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            Short.MAX_VALUE)
                                    .addComponent(viewModeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            Short.MAX_VALUE))
                            .addContainerGap()))));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1).addComponent(contractorComboBox,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5).addComponent(viewModeComboBox,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 27,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(startDateChooser, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(endDateChooser, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(unreportedCheckBox)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3).addComponent(nameTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));
}

From source file:com.aw.core.format.FillerFormat.java

public static String alignCenter(String source, int length) {
    return fill(source, ' ', length, SwingConstants.CENTER);
}

From source file:com.sec.ose.osi.ui.frm.main.identification.stringmatch.table.JTableInfoForSMFile.java

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);//from   w  w w  .  j a  va 2s  .c om
    if (value != null) {
        if (table.getColumnName(column).equals("Version") || table.getColumnName(column).equals("Pending Hits")
                || table.getColumnName(column).equals("Status")
                || table.getColumnName(column).equals("Identified Hits")
                || table.getColumnName(column).equals("Files")) {
            setHorizontalAlignment(SwingConstants.CENTER);
        } else {
            setHorizontalAlignment(SwingConstants.LEFT);
        }

        comp.setToolTipText(String.valueOf(value));
        if (table.getValueAt(row, TableModelForSMFile.COL_STATUS) != null
                && table.getValueAt(row, TableModelForSMFile.COL_STATUS).toString().equals("Identified")) {

            comp.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 12));
            comp.setForeground(new Color(20, 20, 20));
        } else if (table.getValueAt(row, TableModelForSMFile.COL_STATUS).toString().equals("Declared")) {
            comp.setForeground(new Color(150, 150, 150));
        } else {
            comp.setForeground(new Color(20, 20, 20));
        }
    } else {
        comp.setToolTipText(null);
    }
    return comp;
}

From source file:com.funambol.admin.settings.panels.EditConsoleAppender.java

/**
 * Create the panel/*from   ww  w  .j a  v  a 2 s  . c o  m*/
 * @throws Exception if error occures during creation of the panel.
 */
private void init() throws Exception {

    final int h = 18;
    final int x1 = 15;
    final int x2 = 150;
    final int w1 = 100;
    final int w2 = 310;

    int y = 40;
    int dy = 25;

    setLayout(null);
    setName(Bundle.getMessage(Bundle.EDIT_CONSOLE_APPENDER_PANEL_NAME));

    panelNameLabel.setText(Bundle.getMessage(Bundle.EDIT_CONSOLE_APPENDER_PANEL_NAME));
    panelNameLabel.setBounds(new Rectangle(14, 5, 245, 28));
    panelNameLabel.setAlignmentX(SwingConstants.CENTER);
    panelNameLabel.setBorder(new TitledBorder(""));

    nameLabel.setText(Bundle.getMessage(Bundle.LABEL_APPENDER_NAME) + " :");
    nameLabel.setBounds(new Rectangle(x1, y, w1, h));
    nameLabel2.setBounds(new Rectangle(x2, y, w2, h));

    y += dy;

    conversionPatternLabel.setText(Bundle.getMessage(Bundle.LABEL_PATTERN_LAYOUT) + " :");
    conversionPatternLabel.setBounds(new Rectangle(x1, y, w1, h));
    conversionPattern.setBounds(new Rectangle(x2, y, w2, h));

    y += dy;
    y += dy;

    confirmButton.setText(Bundle.getMessage(Bundle.LABEL_BUTTON_SAVE));
    confirmButton.setBounds(new Rectangle(401, y, 60, 25));

    confirmButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                validateValues();
                getValues();
                EditConsoleAppender.this.actionPerformed(new ActionEvent(EditConsoleAppender.this,
                        ACTION_EVENT_UPDATE, event.getActionCommand()));
            } catch (Exception e) {
                notifyError(new AdminException(e.getMessage()));
            }
        }
    });

    add(panelNameLabel, null);
    add(nameLabel, null);
    add(nameLabel2, null);
    add(conversionPatternLabel, null);
    add(conversionPattern, null);
    add(confirmButton, null);

    GuiFactory.setDefaultFont(this);
    panelNameLabel.setFont(GuiFactory.titlePanelFont);

}

From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV2.ADAP3DecompositionV2SetupDialog.java

/** Creates the interface elements */
@Override//from   www .j  ava  2  s  .c  om
protected void addDialogComponents() {
    super.addDialogComponents();

    comboClustersModel = new DefaultComboBoxModel<>();

    PeakList[] peakLists = MZmineCore.getDesktop().getSelectedPeakLists();

    // -----------------------------
    // Panel with preview UI elements
    // -----------------------------

    // Preview CheckBox
    chkPreview = new JCheckBox("Show preview");
    chkPreview.addActionListener(this);
    chkPreview.setHorizontalAlignment(SwingConstants.CENTER);
    chkPreview.setEnabled(peakLists != null && peakLists.length > 0);

    // Preview panel that will contain ComboBoxes
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(new JSeparator(), BorderLayout.NORTH);
    panel.add(chkPreview, BorderLayout.CENTER);
    panel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);
    pnlUIElements = new JPanel(new BorderLayout());
    pnlUIElements.add(panel, BorderLayout.NORTH);

    // ComboBox with Clusters
    cboClusters = new JComboBox<>(comboClustersModel);
    cboClusters.setFont(COMBO_FONT);
    cboClusters.addActionListener(this);

    pnlComboBoxes = GUIUtils.makeTablePanel(1, 2, new JComponent[] { new JLabel("Clusters"), cboClusters });

    // --------------------------------------------------------------------
    // ----- Panel with plots --------------------------------------
    // --------------------------------------------------------------------

    pnlPlots = new JPanel();
    pnlPlots.setLayout(new BoxLayout(pnlPlots, BoxLayout.Y_AXIS));

    // Plot with retention-time clusters
    retTimeMZPlot = new SimpleScatterPlot("Retention time", "m/z");
    retTimeMZPlot.setMinimumSize(MIN_DIMENSIONS);

    final JPanel pnlPlotRetTimeClusters = new JPanel(new BorderLayout());
    pnlPlotRetTimeClusters.setBackground(Color.white);
    pnlPlotRetTimeClusters.add(retTimeMZPlot, BorderLayout.CENTER);
    GUIUtils.addMarginAndBorder(pnlPlotRetTimeClusters, 10);

    // Plot with chromatograms
    retTimeIntensityPlot = new EICPlot();
    retTimeIntensityPlot.setMinimumSize(MIN_DIMENSIONS);

    JPanel pnlPlotShapeClusters = new JPanel(new BorderLayout());
    pnlPlotShapeClusters.setBackground(Color.white);
    pnlPlotShapeClusters.add(retTimeIntensityPlot, BorderLayout.CENTER);
    GUIUtils.addMarginAndBorder(pnlPlotShapeClusters, 10);

    pnlPlots.add(pnlPlotRetTimeClusters);
    pnlPlots.add(pnlPlotShapeClusters);

    super.mainPanel.add(pnlUIElements, 0, super.getNumberOfParameters() + 3, 2, 1, 0, 0,
            GridBagConstraints.HORIZONTAL);
}