Example usage for javax.swing BorderFactory createLineBorder

List of usage examples for javax.swing BorderFactory createLineBorder

Introduction

In this page you can find the example usage for javax.swing BorderFactory createLineBorder.

Prototype

public static Border createLineBorder(Color color) 

Source Link

Document

Creates a line border with the specified color.

Usage

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.links_redundantes.PanelLinkRedundante.java

private void criaInterfaceVisualEscalavel() {
    miBtnSalvar = new JMenuItem(XHTML_Panel.BTN_SALVAR);
    painel = new JPanel();
    textAreaSourceCode = new G_TextAreaSourceCode();
    //frameSilvinha.setJMenuBar(this.criaMenuBar());         
    textAreaSourceCode.setTipoHTML();/*from w  w  w.  j a va2s .  c o  m*/
    textAreaSourceCode.setBorder(criaBorda(XHTML_Panel.COD_FONTE));
    //frameSilvinha.setTitle(XHTMLPanel.TIT_LINK_RED);

    painel.setLayout(new GridLayout(2, 1));
    setBackground(frameSilvinha.corDefault);

    Container contentPane = this;
    contentPane.setLayout(new GridLayout(1, 1));
    painel.add(textAreaSourceCode);

    JPanel panelBtnTabela = new JPanel();

    panelBtnTabela.setLayout(new BorderLayout());

    /*
     * Barra de botes
     */
    btnPanel = new JPanel();
    btnPanel.setLayout(null);
    btn_salvar = new JButton(XHTML_Panel.BTN_SALVAR);
    btn_salvar.setToolTipText(XHTML_Panel.DICA_SALVAR);
    btn_salvar.setBounds(10, 0, 150, 25);
    btnPanel.add(btn_salvar);

    btn_abrir = new JButton(XHTML_Panel.BTN_ABRIR);
    btn_abrir.setToolTipText(XHTML_Panel.DICA_ABRIR);
    btn_abrir.setBounds(165, 0, 150, 25);
    btnPanel.add(btn_abrir);

    btn_salvarComo = new JButton(XHTML_Panel.BTN_SALVAR_COMO);
    btn_salvarComo.setToolTipText(XHTML_Panel.DICA_SALVAR_COMO);
    btn_salvarComo.setBounds(320, 0, 150, 25);
    btnPanel.add(btn_salvarComo);

    btn_cancelar = new JButton(XHTML_Panel.TELA_ANTERIOR);
    btn_cancelar.setToolTipText(XHTML_Panel.DICA_TELA_ANTERIOR);
    btn_cancelar.setBounds(480, 0, 150, 25);
    btnPanel.add(btn_cancelar);

    btnPanel.setPreferredSize(new Dimension(430, 30));

    /*
     * Barra de correcao
     */
    btnAplicar = new JButton(XHTML_Panel.BTN_APLICAR);
    btnAplicar.setToolTipText(XHTML_Panel.DICA_BTN_APLICAR);
    btnAplicar.setEnabled(false);

    texto = new JTextField();

    texto.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    JPanel borda = new JPanel(new BorderLayout());
    JLabel lbl_texto = new JLabel(XHTML_Panel.ROTULO_TEXTO);
    lbl_texto.setToolTipText(XHTML_Panel.DICA_ROTULO_TEXTO);
    borda.add(lbl_texto, BorderLayout.WEST);
    borda.add(texto, BorderLayout.CENTER);
    borda.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    borda.setOpaque(false);
    panelCorretor = new JPanel(new BorderLayout());
    panelCorretor.add(borda, BorderLayout.CENTER);
    panelCorretor.add(btnAplicar, BorderLayout.EAST);
    //panelCorretor.add(btnPanel,BorderLayout.WEST);
    panelCorretor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
    panelCorretor.setOpaque(false);

    /*
     * Tabela de erros
     */
    tabelaDeErros = new TabelaErros();
    scrollPaneTabela = new JScrollPane();
    scrollPaneTabela.setViewportView(tabelaDeErros);
    panelBtnTabela.add(panelCorretor, BorderLayout.NORTH);
    panelBtnTabela.add(scrollPaneTabela, BorderLayout.CENTER);
    panelBtnTabela.add(btnPanel, BorderLayout.SOUTH);
    scrollPaneTabela.setBorder(criaBorda(XHTML_Panel.LISTA_ERROS));
    painel.add(panelBtnTabela);

    btnPanel.setBackground(frameSilvinha.corDefault);
    if (!original) {
        reverter = new JButton("Reverter");
        reverter.setText(TradPainelRelatorio.REVERTER);
        reverter.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                // TODO Auto-generated method stub
                setVisible(false);
                TxtBuffer.setContent(TxtBuffer.getContentOriginal());
                frameSilvinha.showPainelFerramentaLinksRedundantes();
                setVisible(true);
            }

        });
        //reverter.setActionCommand("Reverter");
        reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
        reverter.setBounds(640, 0, 150, 25);
        btnPanel.add(reverter);
    }

    panelBtnTabela.setBackground(frameSilvinha.corDefault);
    painel.setBackground(frameSilvinha.corDefault);
    contentPane.setBackground(frameSilvinha.corDefault);
    scrollPaneTabela.setBackground(frameSilvinha.corDefault);
    textAreaSourceCode.setBackground(frameSilvinha.corDefault);
    miBtnSalvar.setEnabled(false);
    btn_salvar.setEnabled(false);
    salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), btn_salvar,
            miBtnSalvar, frameSilvinha);
    String fil[] = { ".html", ".htm" };
    salvaAlteracoes.setFiltro(fil);
    contentPane.add(painel);
    // pack();
    this.setVisible(true);
}

From source file:com.game.ui.views.CharacterEditor.java

/**
 * This method draws up the gui on the panel.
 *///w  ww  .  j  ava 2s. c o  m
public void doGui() {
    JPanel outerPane = new JPanel();
    outerPane.setLayout(new GridBagLayout());
    //        setLayout(new GridBagLayout());
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    JLabel noteLbl = new JLabel(lblContent);
    noteLbl.setAlignmentX(0);
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.WEST;
    c.fill = GridBagConstraints.NONE;
    c.insets = new Insets(5, 5, 5, 5);
    c.gridwidth = 4;
    c.gridy = 0;
    c.gridx = 0;
    outerPane.add(noteLbl, c);
    System.out.println(c.gridy);
    c.gridy++;
    System.out.println(c.gridy);
    c.gridx = 0;
    c.gridwidth = 1;
    comboBox = new JComboBox(model);
    comboBox.setSelectedIndex(-1);
    comboBox.setMaximumSize(new Dimension(100, 30));
    comboBox.setAlignmentX(0);
    comboBox.setActionCommand("dropDown");
    comboBox.addActionListener(this);
    outerPane.add(comboBox, c);
    c.gridy++;
    JLabel nameLbl = new JLabel("Name : ");
    outerPane.add(nameLbl, c);
    c.gridx++;
    name = new JTextField();
    name.setColumns(20);
    outerPane.add(name, c);
    c.gridx = 0;
    c.gridy++;
    JLabel imageLbl = new JLabel("Image Path : ");
    outerPane.add(imageLbl, c);
    c.gridx++;
    imgPath = new JTextField();
    imgPath.setColumns(20);
    outerPane.add(imgPath, c);
    c.gridx = 0;
    c.gridy++;
    JLabel hitPtsLbl = new JLabel("Hit Points : ");
    outerPane.add(hitPtsLbl, c);
    c.gridx++;
    hitPoints = new JTextField();
    hitPoints.setColumns(20);
    outerPane.add(hitPoints, c);
    c.gridx = 0;
    c.gridy++;
    JLabel lvl = new JLabel("Level : ");
    outerPane.add(lvl, c);
    c.gridx++;
    level = new JTextField();
    level.setColumns(20);
    /*if(!isEnemy){
    level.setText("1");
    level.setEnabled(false);
    }*/
    outerPane.add(level, c);
    c.gridx = 0;
    c.gridy++;
    JLabel mlWpn = new JLabel("Melee Weapon : ");
    outerPane.add(mlWpn, c);
    c.gridx++;
    model = new DefaultComboBoxModel();
    LinkedList<String> meleeWpnList = new LinkedList<String>();
    LinkedList<String> rngdWpnList = new LinkedList<String>();
    for (Item item : GameBean.weaponDetails) {
        Weapon wpn = (Weapon) item;
        if (wpn.getWeaponType().equalsIgnoreCase(Configuration.weaponTypes[0])) {
            meleeWpnList.add(wpn.getName());
        } else {
            rngdWpnList.add(wpn.getName());
        }
        weaponMap.put(wpn.getName(), wpn);
    }
    meleeWeapon = new JComboBox(new DefaultComboBoxModel(meleeWpnList.toArray()));
    meleeWeapon.setSelectedIndex(-1);
    meleeWeapon.setMaximumSize(new Dimension(100, 30));
    outerPane.add(meleeWeapon, c);
    c.gridx++;
    JLabel rngdWpn = new JLabel("Ranged Weapon : ");
    outerPane.add(rngdWpn, c);
    c.gridx++;
    rangedWeapon = new JComboBox(new DefaultComboBoxModel(rngdWpnList.toArray()));
    rangedWeapon.setSelectedIndex(-1);
    rangedWeapon.setMaximumSize(new Dimension(100, 30));
    outerPane.add(rangedWeapon, c);
    c.gridy++;
    c.gridx = 0;
    JLabel armourLbl = new JLabel("Armour : ");
    outerPane.add(armourLbl, c);
    c.gridx++;
    LinkedList<String> armourList = new LinkedList<String>();
    LinkedList<String> shildList = new LinkedList<String>();
    for (Item item : GameBean.armourDetails) {
        Armour temp = (Armour) item;
        if (temp.getArmourType() != null) {
            if (temp.getArmourType().equalsIgnoreCase(Configuration.armourTypes[1])) {
                armourList.add(temp.getName());
            } else {
                shildList.add(temp.getName());
            }
        } else {
            armourList.add(temp.getName());
            //            else if(temp.getArmourType().equalsIgnoreCase(Configuration.armourTypes[2]))
            shildList.add(temp.getName());
        }
        armorMap.put(temp.getName(), temp);
    }
    armour = new JComboBox(new DefaultComboBoxModel(armourList.toArray()));
    armour.setSelectedIndex(-1);
    armour.setMaximumSize(new Dimension(100, 30));
    outerPane.add(armour, c);
    c.gridx++;
    JLabel shieldLbl = new JLabel("Shield : ");
    outerPane.add(shieldLbl, c);
    c.gridx++;
    shield = new JComboBox(new DefaultComboBoxModel(shildList.toArray()));
    shield.setSelectedIndex(-1);
    shield.setMaximumSize(new Dimension(100, 30));
    outerPane.add(shield, c);
    ta = new JTextArea(10, 50);
    ta.setRows(40);
    ta.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
    JScrollPane scrollPane = new JScrollPane(ta);
    scrollPane.setPreferredSize(new Dimension(600, 250));
    c.gridx = 0;
    c.gridy++;
    c.fill = GridBagConstraints.BOTH;
    c.gridwidth = 4;
    c.gridheight = 4;
    c.weightx = .5;
    c.weighty = 1;
    outerPane.add(scrollPane, c);
    c.gridy += 4;
    c.gridx = 0;
    c.weightx = 0;
    c.weighty = 0;
    c.fill = GridBagConstraints.NONE;
    c.gridheight = 1;
    c.gridwidth = 1;
    JButton generate = new JButton("Generate");
    JButton submit = new JButton("Submit");
    outerPane.add(generate, c);
    submit.addActionListener(this);
    generate.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            ta.setText("");
            HashSet<Integer> set = new HashSet<Integer>();
            int strength = getUniqueVal(set);
            int constitution = getUniqueVal(set);
            int dext = getUniqueVal(set);
            int intel = getUniqueVal(set);
            int charisma = getUniqueVal(set);
            int wisdom = getUniqueVal(set);
            if (character == null) {
                builder = new CharacterBuilder(isEnemy);
            } else {
                builder = new CharacterBuilder(character);
            }
            builder.setStrength(strength);
            builder.setConstitution(constitution);
            builder.setDexterity(dext);
            builder.setIntelligence(intel);
            builder.setCharisma(charisma);
            builder.setWisdom(wisdom);
            int strModifier = GameUtils.calculateAbilityModifier(strength);
            int conModifier = GameUtils.calculateAbilityModifier(constitution);
            int dexModifier = GameUtils.calculateAbilityModifier(dext);
            int wisModifier = GameUtils.calculateAbilityModifier(wisdom);
            int intModifier = GameUtils.calculateAbilityModifier(intel);
            int chaModifier = GameUtils.calculateAbilityModifier(charisma);
            builder.setStrengthModifier(strModifier);
            builder.setConstitutionModifier(conModifier);
            builder.setCharismaModifier(chaModifier);
            builder.setWisdomModifier(wisModifier);
            builder.setIntelligenceModifier(intModifier);
            builder.setDexterityModifier(dexModifier);
            String type = null;
            if (constitution < strength && constitution > dext) {
                type = "Bully";
                builder.setType("Bully");
            } else if (dext > constitution && constitution > strength) {
                builder.setType("Nimble");
                type = "Nimble";
            } else {
                builder.setType("Tank");
                type = "Tank";
            }
            ta.append("Strength : " + strength);
            ta.append("\nDexterity : " + dexModifier);
            ta.append("\nConstitution : " + constitution);
            ta.append("\nIntelligence : " + intel);
            ta.append("\nCharisma: " + charisma);
            ta.append("\nWisdom : " + wisdom);
            ta.append("\nType :" + type);
            ta.append("\nStrength Modifier :" + strModifier);
            ta.append("\nConstitution Modifier :" + conModifier);
            ta.append("\nDexterity Modifier :" + dexModifier);
            generated = true;
            if (character != null) {
                character = builder.build();
            }
        }
    });
    c.gridx++;
    outerPane.add(submit, c);
    validationMess = new JLabel();
    validationMess.setForeground(Color.red);
    //        validationMess.setVisible(false);
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 4;
    outerPane.add(validationMess, c);
    JScrollPane outerScrollPane = new JScrollPane(outerPane);
    setLayout(new BorderLayout());
    add(outerScrollPane, BorderLayout.CENTER);
}

From source file:org.openmicroscopy.shoola.agents.measurement.util.ui.ResultsCellRenderer.java

/**
 * @see TableCellRenderer#getTableCellRendererComponent(JTable, Object, 
 *                               boolean, boolean, int, int)
 *//*from ww  w  . j av a  2  s. c o m*/
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    Component thisComponent = new JLabel();
    JLabel label = new JLabel();
    label.setOpaque(true);

    if (value instanceof Number) {
        MeasurementTableModel tm = (MeasurementTableModel) table.getModel();
        KeyDescription key = tm.getColumnNames().get(column);
        String k = key.getKey();
        MeasurementUnits units = tm.getUnitsType();
        Number n = (Number) value;
        String s;
        if (units.isInMicrons()) {
            UnitsObject object;
            StringBuffer buffer = new StringBuffer();
            object = UIUtilities.transformSize(n.doubleValue());
            s = twoDecimalPlaces(object.getValue());
            if (StringUtils.isNotBlank(s)) {
                buffer.append(s);
                if (!(AnnotationKeys.ANGLE.getKey().equals(k) || AnnotationDescription.ZSECTION_STRING.equals(k)
                        || AnnotationDescription.ROIID_STRING.equals(k)
                        || AnnotationDescription.TIME_STRING.equals(k))) {
                    buffer.append(object.getUnits());
                }
                if (AnnotationKeys.AREA.getKey().equals(k)) {
                    buffer = new StringBuffer();
                    object = UIUtilities.transformSquareSize(n.doubleValue());
                    s = twoDecimalPlaces(object.getValue());
                    buffer.append(s);
                    buffer.append(object.getUnits());
                }
                label.setText(buffer.toString());
            }
        } else {
            s = UIUtilities.twoDecimalPlaces(n.doubleValue());
            if (StringUtils.isNotBlank(s)) {
                label.setText(s);
            }
        }
        thisComponent = label;
    } else if (value instanceof FigureType || value instanceof String) {
        thisComponent = makeShapeIcon(label, "" + value);
    } else if (value instanceof Color) {
        label.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
        label.setBackground((Color) value);
        thisComponent = label;
    } else if (value instanceof Boolean) {
        JCheckBox checkBox = new JCheckBox();
        checkBox.setSelected((Boolean) value);
        thisComponent = checkBox;
    } else if (value instanceof ArrayList) {
        thisComponent = createList(value);
        //return list;
    }
    if (!(value instanceof Color)) {
        RendererUtils.setRowColor(thisComponent, table.getSelectedRow(), row);
        if (label != null)
            label.setBackground(thisComponent.getBackground());
    }
    return thisComponent;
}

From source file:org.accretegb.modules.phenotype.PhenotypeInfoPanel.java

public void initializePanel() {
    MigLayout layout = new MigLayout("insets 10, gap 5");
    setLayout(layout);//from w  ww .  j a  v a  2s .  c  om
    populateFieldTable();
    populateParameterNames();
    setSubsetListComboBox();
    tagname = new JTextField();
    add(getSearchComponentsPanel(), "h 50%");
    add(getFieldTablePanel(), "growx, spanx, pushx, h 50%, wrap");
    add(new JLabel(""), "align label");
    add(submitButton, "tag submit, sizegroup bttn, alignx right,wrap");
    submitButton.setToolTipText("Only one of the filters [tag name, subsets, fields] can be applied");
    submitButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (getSelectedParameters().size() == 0) {
                JOptionPane.showMessageDialog(null, "Please select traits.");
            } else {
                executeTask();
            }

        }
    });

    progressBar.setAlignmentX(0f);
    add(progressBarValue, "span");
    add(progressBar, "gapleft 5, gapright 5, span, grow, wrap");
    Utils.setTableSize(tableOutput, 1.0f, 10);
    add(new JScrollPane(tableOutput), "gapleft 5, gapright 5, h 50%, span, grow, wrap");
    JPanel exportTablePanel = new JPanel();
    exportTablePanel.setLayout(new BorderLayout());
    exportTablePanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    exportTablePanel.add(exportButton, BorderLayout.EAST);
    add(exportTablePanel, "span, grow, wrap");
    setBorder(BorderFactory.createLineBorder(Color.BLACK));
    exportButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            saveTableToFile(getTableOutput(), null, "phenotype.csv");
        }
    });
}

From source file:ome.formats.importer.gui.GuiCommonElements.java

/**
 * Add a new Text Field//from  w  ww . j  a  va  2 s  .  c o m
 * 
 * @param container - parent container
 * @param name - name of text field
 * @param initialValue - initial value of text field
 * @param mnemonic - mnemonic key
 * @param tooltip - tool tip for field
 * @param suffix - suffix text for field
 * @param labelWidth - label width 
 * @param placement - TableLayout placement
 * @param debug - turn on/off red debug borders
 * @return JTextField
 */
public static JTextField addTextField(Container container, String name, String initialValue, int mnemonic,
        String tooltip, String suffix, double labelWidth, String placement, boolean debug) {

    double[][] size = null;

    JPanel panel = new JPanel();
    panel.setOpaque(false);

    if (suffix.equals(""))
        size = new double[][] { { labelWidth, TableLayout.FILL }, { 30 } };
    else
        size = new double[][] { { labelWidth, TableLayout.FILL, TableLayout.PREFERRED }, { 30 } };

    TableLayout layout = new TableLayout(size);
    panel.setLayout(layout);

    JLabel label = new JLabel(name);
    label.setDisplayedMnemonic(mnemonic);
    JTextField result = new JTextField(20);
    label.setLabelFor(result);
    label.setOpaque(false);
    result.setToolTipText(tooltip);
    if (initialValue != null)
        result.setText(initialValue);

    panel.add(label, "0, 0, r, c");
    panel.add(result, "1, 0, f, c");

    if (suffix.length() != 0) {
        JLabel suffixLabel = new JLabel(" " + suffix);
        panel.add(suffixLabel, "2,0, l, c");
    }

    if (debug == true)
        panel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.red),
                panel.getBorder()));

    container.add(panel, placement);
    return result;
}

From source file:lol.search.RankedStatsPage.java

private JPanel headerPanel() {
    //init spacers for header
    for (int i = 0; i < 10; i++) {
        JLabel label = new JLabel("--");
        label.setForeground(new Color(0, 0, 0, 0));
        spacers.add(label);/*from  w ww  .  j a  va 2 s.c  o m*/
    }
    //header -- to set this semi-transparent i had to remove setOpaque and replace with setBackground(...)
    JPanel headerPanel = new JPanel();
    headerPanel.setLayout(new BorderLayout());
    //headerPanel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
    headerPanel.setBackground(backgroundColor);
    headerPanel.setPreferredSize(headerDimension);
    //back button
    JPanel buttonHolder = new JPanel();
    ImageIcon buttonImage = new ImageIcon("assets\\other\\button.png");
    ImageIcon buttonPressedImage = new ImageIcon("assets\\other\\buttonPressed.png");
    Image tempImage = buttonImage.getImage();
    Image newTempImg = tempImage.getScaledInstance(75, 35, Image.SCALE_SMOOTH);
    buttonImage = new ImageIcon(newTempImg);
    JButton backButton = new JButton("BACK");
    backButton.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 10)); //custom font
    backButton.setForeground(Color.WHITE); //text color
    backButton.setBackground(new Color(0, 0, 0, 0));
    backButton.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    backButton.setHorizontalTextPosition(AbstractButton.CENTER);
    backButton.setPreferredSize(new Dimension(75, 35));
    //pressed button
    Image tempImage2 = buttonPressedImage.getImage();
    Image newTempImg2 = tempImage2.getScaledInstance(75, 35, Image.SCALE_SMOOTH);
    buttonPressedImage = new ImageIcon(newTempImg2);
    backButton.setIcon(buttonImage);
    backButton.setRolloverIcon(buttonPressedImage);
    backButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) { //button pressed
            System.out.println("Going back...\n");
            masterFrame.getContentPane().removeAll();
            masterFrame.revalidate();
            masterFrame.repaint();
            MainPage MAIN_PAGE = new MainPage(masterFrame, summonerName);
        }
    });
    buttonHolder.add(backButton);
    buttonHolder.setOpaque(false);
    headerPanel.add(buttonHolder, BorderLayout.LINE_START);
    //centerpanel
    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new GridLayout(1, 2));
    centerPanel.setOpaque(false);
    //centerPanel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
    //rightcenter
    JPanel rightCenter = new JPanel();
    rightCenter.setOpaque(false);
    rightCenter.setLayout(new GridLayout(2, 1));
    //top center panel
    JPanel topCenter = new JPanel();
    topCenter.setOpaque(false);
    topCenter.setLayout(new BoxLayout(topCenter, BoxLayout.X_AXIS));
    //profile icon
    JPanel proIconPanel = new JPanel();
    proIconPanel.setOpaque(false);
    proIconPanel.setLayout(new BoxLayout(proIconPanel, BoxLayout.Y_AXIS));
    JLabel profileIconLabel = new JLabel(this.profileIcon);
    //profileIconLabel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
    profileIconLabel.setAlignmentX(Component.RIGHT_ALIGNMENT);
    proIconPanel.add(profileIconLabel);
    centerPanel.add(proIconPanel);
    //empty spacer
    topCenter.add(spacers.get(0));
    //summoner name
    JLabel summonerNameLabel = new JLabel(this.summonerName);
    summonerNameLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 15)); //custom font
    summonerNameLabel.setForeground(Color.WHITE); //text color
    summonerNameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    topCenter.add(summonerNameLabel);
    //empty spacer
    topCenter.add(spacers.get(1));
    //tier
    JLabel tierLabel = new JLabel(this.tier);
    tierLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 13)); //custom font
    tierLabel.setForeground(new Color(219, 219, 219)); //text color
    tierLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    topCenter.add(tierLabel);
    //empty spacer
    topCenter.add(spacers.get(2));
    //division
    JLabel divisionLabel = new JLabel(this.division);
    divisionLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 13)); //custom font
    divisionLabel.setForeground(new Color(219, 219, 219)); //text color
    divisionLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    topCenter.add(divisionLabel);
    //bottom center panel
    JPanel bottomCenter = new JPanel();
    bottomCenter.setOpaque(false);
    bottomCenter.setLayout(new BoxLayout(bottomCenter, BoxLayout.X_AXIS));
    //empty spacer
    bottomCenter.add(spacers.get(3));
    //season
    JLabel winsLabel = new JLabel(this.season);
    winsLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 14)); //custom font
    winsLabel.setForeground(new Color(219, 219, 219)); //text color
    winsLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    bottomCenter.add(winsLabel);

    rightCenter.add(topCenter);
    rightCenter.add(bottomCenter);
    centerPanel.add(rightCenter);
    headerPanel.add(centerPanel, BorderLayout.CENTER);
    //empty panel to balance right side
    JPanel ee = new JPanel();
    ee.setOpaque(false);
    ee.setPreferredSize(new Dimension(260, 50));
    headerPanel.add(ee, BorderLayout.LINE_END);
    return headerPanel;
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.util.MIFNotificationDialog.java

/**
 * Lays out the thumbnails./*from  w w  w  .  j ava  2s .c om*/
 * 
 * @param n The number of images not listed.
 * @param thumbnails The objects to lay out.
 */
private JPanel layoutThumbnails(int n, List<ThumbnailData> thumbnails) {
    JPanel row = createRow();
    row.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
    Iterator<ThumbnailData> i = thumbnails.iterator();
    ThumbnailLabel label;
    while (i.hasNext()) {
        label = new ThumbnailLabel();
        label.setData(i.next());
        label.setToolTipText("");
        row.add(label);
    }
    if (n > 0)
        row.add(new JLabel("..."));
    return row;
}

From source file:edu.ku.brc.specify.plugins.latlon.LatLonUI.java

/**
 * Creates the UI./*  w w  w . j  a v a2 s  .c om*/
 * @param localityCEP the locality object (can be null)
 */
protected void createEditUI() {
    loadAndPushResourceBundle("specify_plugins");

    PanelBuilder builder = new PanelBuilder(new FormLayout("p", "p, 2px, p"), this);

    Color bgColor = getBackground();
    bgColor = new Color(Math.min(bgColor.getRed() + 20, 255), Math.min(bgColor.getGreen() + 20, 255),
            Math.min(bgColor.getBlue() + 20, 255));
    //System.out.println(bgColor);
    setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(bgColor),
            BorderFactory.createEmptyBorder(4, 4, 4, 4)));

    for (int i = 0; i < types.length; i++) {
        typeMapper.put(types[i], typeStrs[i]);
    }

    currentType = LatLonUIIFace.LatLonType.LLPoint;

    pointImages = new ImageIcon[pointNames.length];
    for (int i = 0; i < pointNames.length; i++) {
        pointImages[i] = IconManager.getIcon(pointNames[i], IconManager.IconSize.Std16);
    }

    String[] formatLabels = new String[formats.length];
    for (int i = 0; i < formats.length; i++) {
        formatLabels[i] = getResourceString(formats[i]);
    }
    cardPanel = new JPanel(cardLayout);
    formatSelector = createComboBox(formatLabels);
    latLonPanes = new JComponent[formatLabels.length];

    formatSelector.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            swapForm(formatSelector.getSelectedIndex(), currentType);

            cardLayout.show(cardPanel, ((JComboBox) ae.getSource()).getSelectedItem().toString());

            //stateChanged(null);
        }
    });

    Dimension preferredSize = new Dimension(0, 0);
    cardSubPanes = new JPanel[formats.length * 2];
    panels = new DDDDPanel[formats.length * 2];
    int paneInx = 0;
    for (int i = 0; i < formats.length; i++) {
        cardSubPanes[i] = new JPanel(new BorderLayout());
        try {
            String packageName = "edu.ku.brc.specify.plugins.latlon.";
            DDDDPanel latLon1 = Class.forName(packageName + formatClass[i]).asSubclass(DDDDPanel.class)
                    .newInstance();
            latLon1.setIsRequired(isRequired);
            latLon1.setViewMode(isViewMode);
            latLon1.init();
            latLon1.setChangeListener(this);

            JPanel panel1 = latLon1;
            panel1.setBorder(panelBorder);
            panels[paneInx++] = latLon1;
            latLonPanes[i] = panel1;

            DDDDPanel latlon2 = Class.forName(packageName + formatClass[i]).asSubclass(DDDDPanel.class)
                    .newInstance();
            latlon2.setIsRequired(isRequired);
            latlon2.setViewMode(isViewMode);
            latlon2.init();
            latlon2.setChangeListener(this);

            panels[paneInx++] = latlon2;

            JTabbedPane tabbedPane = new JTabbedPane(
                    UIHelper.getOSType() == UIHelper.OSTYPE.MacOSX ? SwingConstants.BOTTOM
                            : SwingConstants.RIGHT);
            tabbedPane.addTab(null, pointImages[0], panels[paneInx - 2]);
            tabbedPane.addTab(null, pointImages[0], panels[paneInx - 1]);
            latLonPanes[i] = tabbedPane;

            Dimension size = tabbedPane.getPreferredSize();
            preferredSize.width = Math.max(preferredSize.width, size.width);
            preferredSize.height = Math.max(preferredSize.height, size.height);

            tabbedPane.removeAll();
            cardSubPanes[i].add(panel1, BorderLayout.CENTER);
            cardPanel.add(formatLabels[i], cardSubPanes[i]);

            /*if (locality != null)
            {
            latLon1.set(locality.getLatitude1(), locality.getLongitude1(), locality.getLat1text(), locality.getLong1text());
            latlon2.set(locality.getLatitude2(), locality.getLongitude2(), locality.getLat2text(), locality.getLong2text());
            }*/

        } catch (Exception e) {
            e.printStackTrace();
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(LatLonUI.class, e);
        }
    }

    // Makes they are all the same size
    for (int i = 0; i < formats.length; i++) {
        cardSubPanes[i].setPreferredSize(preferredSize);
    }

    //final LatLonPanel thisPanel = this;

    PanelBuilder botBtnBar = new PanelBuilder(new FormLayout("p:g,p,10px,p,10px,p,p:g", "p"));

    ButtonGroup btnGroup = new ButtonGroup();
    botBtns = new JToggleButton[typeNames.length];

    if (UIHelper.isMacOS()) {
        /*for (int i=0;i<botBtns.length;i++)
        {
        ImageIcon selIcon   = IconManager.getIcon(typeNames[i]+"Sel", IconManager.IconSize.Std16);
        ImageIcon unselIcon = IconManager.getIcon(typeNames[i], IconManager.IconSize.Std16);
                
        MacIconRadioButton rb = new MacIconRadioButton(selIcon, unselIcon);
        botBtns[i] = rb;
        rb.setBorder(new MacBtnBorder());
                
        Dimension size = rb.getPreferredSize();
        int max = Math.max(size.width, size.height);
        size.setSize(max, max);
        rb.setPreferredSize(size);
        }*/

        BorderedRadioButton.setSelectedBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
        BorderedRadioButton.setUnselectedBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
        for (int i = 0; i < botBtns.length; i++) {
            BorderedRadioButton rb = new BorderedRadioButton(
                    IconManager.getIcon(typeNames[i], IconManager.IconSize.Std16));
            botBtns[i] = rb;
            rb.makeSquare();
            rb.setBorder(new MacBtnBorder());
        }
    } else {
        BorderedRadioButton.setSelectedBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
        BorderedRadioButton.setUnselectedBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
        for (int i = 0; i < botBtns.length; i++) {
            BorderedRadioButton rb = new BorderedRadioButton(
                    IconManager.getIcon(typeNames[i], IconManager.IconSize.Std16));
            botBtns[i] = rb;
            rb.makeSquare();
        }
    }

    for (int i = 0; i < botBtns.length; i++) {
        botBtns[i].setToolTipText(typeToolTips[i]);
        botBtnBar.add(botBtns[i], cc.xy((i * 2) + 2, 1));
        btnGroup.add(botBtns[i]);
        selectedTypeHash.put(botBtns[i], types[i]);

        botBtns[i].addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ce) {
                stateChanged(null);
                currentType = selectedTypeHash.get(ce.getSource());
                swapForm(formatSelector.getSelectedIndex(), currentType);
            }
        });
    }
    botBtns[0].setSelected(true);

    if (isViewMode) {
        typeLabel = createLabel(" ");
    }

    ActionListener infoAL = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            doPrefs();
        }
    };

    JButton infoBtn = UIHelper.createIconBtn("Preferences", IconManager.IconSize.Std16,
            getResourceString("PREFERENCES"), true, infoAL);
    infoBtn.setEnabled(true);

    PanelBuilder topPane = new PanelBuilder(
            new FormLayout("l:p, c:p:g" + (isViewMode ? "" : ",4px,p,8px"), "p"));
    topPane.add(formatSelector, cc.xy(1, 1));
    topPane.add(isViewMode ? typeLabel : botBtnBar.getPanel(), cc.xy(2, 1));
    if (!isViewMode)
        topPane.add(infoBtn, cc.xy(4, 1));

    builder.add(topPane.getPanel(), cc.xy(1, 1));
    builder.add(cardPanel, cc.xy(1, 3));

    prefsPanel = new PrefsPanel(false);
    prefsPanel.add(getResourceString("LatLonUI.LL_SEP"));
    prefsPanel.add(CompType.eCheckbox, getResourceString("LatLonUI.LATDEF_DIR"), LAT_PREF, Boolean.class, true);
    prefsPanel.add(CompType.eCheckbox, getResourceString("LatLonUI.LONDEF_DIR"), LON_PREF, Boolean.class, true);
    prefsPanel.add(CompType.eComboBox, getResourceString("LatLonUI.DEF_TYP"), TYP_PREF, Integer.class,
            typeNamesLabels, 0);
    prefsPanel.add(CompType.eComboBox, getResourceString("LatLonUI.DEF_FMT"), FMT_PREF, Integer.class,
            formatLabels, 0);
    prefsPanel.createForm(null, null);

    popResourceBundle();
}

From source file:edu.ku.brc.specify.plugins.TaxonLabelFormatting.java

@Override
public void initialize(Properties propertiesArg, boolean isViewModeArg) {
    super.initialize(propertiesArg, isViewModeArg);

    String plName = "TaxonLabelFormatter";
    PickListDBAdapterIFace adapter = PickListDBAdapterFactory.getInstance().create(plName, false);
    if (adapter == null || adapter.getPickList() == null) {
        throw new RuntimeException("PickList Adapter [" + plName + "] cannot be null!");
    }//  www  . jav a 2 s.com
    formatCBX = new ValComboBox(adapter);
    formatCBX.getComboBox().addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doFormatting();
        }
    });
    formatCBX.getComboBox().addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            doFormatting();
        }
    });

    newAgentBtn = createButton(""); // Label set when new Resource Bundle is installed (below)
    searchPanel = new DBObjSearchPanel("Search", "AgentNameSearch", "AgentNameSearch",
            "edu.ku.brc.specify.datamodel.Agent", "agentId", SwingConstants.BOTTOM);
    searchPanel.getScrollPane().setMinimumSize(new Dimension(100, 200));
    searchPanel.getScrollPane().setPreferredSize(new Dimension(100, 150));
    ((FormViewObj) searchPanel.getForm()).getPanel().setBorder(null);

    try {
        UIRegistry.loadAndPushResourceBundle("specify_plugins");

        newAgentBtn.setText(getResourceString("NewAgent"));

        authorsList = new JList(new DefaultListModel());
        authorsList.setVisibleRowCount(10);
        authorsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    Object selObj = authorsList.getSelectedValue();
                    if (selObj != null) {

                    }
                    updateEnabledState();
                }
            }
        });
        JScrollPane scrollPane = new JScrollPane(authorsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

        mapToBtn = createIconBtn("Map", "ADD_AUTHOR_NAME_TT", new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                Object agent = searchPanel.getSelectedObject();
                ((DefaultListModel) authorsList.getModel()).addElement(agent);
                doFormatting();
            }
        });
        unmapBtn = createIconBtn("Unmap", "REMOVE_AUTHOR_NAME_TT", new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                int index = authorsList.getSelectedIndex();
                if (index > -1) {
                    DefaultListModel model = (DefaultListModel) authorsList.getModel();
                    model.remove(index);
                    updateEnabledState();
                    doFormatting();
                }
            }
        });

        upBtn = createIconBtn("ReorderUp", "MOVE_AUTHOR_NAME_UP", new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                DefaultListModel model = (DefaultListModel) authorsList.getModel();
                int index = authorsList.getSelectedIndex();
                Object item = authorsList.getSelectedValue();
                model.remove(index);
                model.insertElementAt(item, index - 1);
                authorsList.setSelectedIndex(index - 1);
                updateEnabledState();
            }
        });
        downBtn = createIconBtn("ReorderDown", "MOVE_AUTHOR_NAME_DOWN", new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                DefaultListModel model = (DefaultListModel) authorsList.getModel();
                int index = authorsList.getSelectedIndex();
                Object item = authorsList.getSelectedValue();
                model.remove(index);
                model.insertElementAt(item, index + 1);
                authorsList.setSelectedIndex(index + 1);
                updateEnabledState();
            }
        });

        PanelBuilder bldr = new PanelBuilder(new FormLayout("p, 5px, p, 5px, f:p:g, 2px, p",
                "p, 4px, p, 2px, f:p:g, 4px, p, 4px, p, 2px, p, 2px, p, 2px, p"), this);
        CellConstraints cc = new CellConstraints();

        PanelBuilder upDownPanel = new PanelBuilder(new FormLayout("p", "p, 2px, p, f:p:g"));
        upDownPanel.add(upBtn, cc.xy(1, 1));
        upDownPanel.add(downBtn, cc.xy(1, 3));

        PanelBuilder middlePanel = new PanelBuilder(new FormLayout("c:p:g", "f:p:g, p, 2px, p, f:p:g"));
        middlePanel.add(mapToBtn, cc.xy(1, 2));
        middlePanel.add(unmapBtn, cc.xy(1, 4));

        PanelBuilder rwPanel = new PanelBuilder(new FormLayout("p, 2px, f:p:g", "p"));
        refWorkLabel = createLabel(getResourceString("NONE"));
        rwPanel.add(createI18NFormLabel("REFERENCEWORK"), cc.xy(1, 1));
        rwPanel.add(refWorkLabel, cc.xy(3, 1));

        int y = 1;

        bldr.add(rwPanel.getPanel(), cc.xywh(1, y, 7, 1));
        y += 2;

        bldr.add(searchPanel, cc.xywh(1, y, 1, 3));
        bldr.addSeparator(getResourceString("Authors"), cc.xy(5, y));
        y += 2;

        bldr.add(middlePanel.getPanel(), cc.xy(3, y));
        bldr.add(scrollPane, cc.xywh(5, y, 1, 3));
        bldr.add(upDownPanel.getPanel(), cc.xy(7, y));
        y += 2;

        PanelBuilder newAgentPanel = new PanelBuilder(new FormLayout("f:p:g,p", "p"));
        newAgentPanel.add(newAgentBtn, cc.xy(2, 1));

        bldr.add(newAgentPanel.getPanel(), cc.xy(1, y));
        y += 2;

        JLabel fmtLabel = createLabel(getResourceString("LABELFORMAT"));
        bldr.add(fmtLabel, cc.xy(1, y));
        y += 2;
        bldr.add(formatCBX, cc.xywh(1, y, 7, 1));
        y += 2;

        Font plain = fmtLabel.getFont();
        specialLabel = new SpecialLabel(plain, new Font(plain.getName(), Font.ITALIC, plain.getSize()));
        specialLabel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
        bldr.add(createLabel(getResourceString("SAMPLEOUTPUT") + ":"), cc.xywh(1, y, 7, 1));
        y += 2;
        bldr.add(specialLabel, cc.xywh(1, y, 7, 1));

        searchPanel.setOKBtn(mapToBtn);
    } catch (Exception ex) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(TaxonLabelFormatting.class, ex);
        log.error(ex);
        ex.printStackTrace();
    }
    UIRegistry.popResourceBundle();
}

From source file:com.github.cric.app.ui.SettingPanel.java

private void addBorder(JTextField f, Color c) {

    f.setBorder(BorderFactory.createLineBorder(c));
}