Code example for JLabel

Methods: setBordersetPreferredSize

0
 
    private JLabel createLabel(String s) {
        JComboBox box = new JComboBox();
        box.setPrototypeDisplayValue(s);
        box.getPreferredSize();
        JLabel label = new JLabel(" ", SwingConstants.CENTER);
        label.setPreferredSize(box.getPreferredSize());
        label.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 1, Color.GRAY));
        return label;
    } 
 
    /* 
     * (non-Javadoc) 
     *  
     * @see net.sourceforge.marathon.editor.IStatusBar#setCaretLocation(int, 
     * int) 
     */ 
    public void setCaretLocation(int row, int col) {
        if (row == 0 && col == 0) {
            this.rowLabel.setText("");