Example usage for javax.swing JLabel setFont

List of usage examples for javax.swing JLabel setFont

Introduction

In this page you can find the example usage for javax.swing JLabel setFont.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The font for the component.")
public void setFont(Font font) 

Source Link

Document

Sets the font for this component.

Usage

From source file:autoGui.RegisterPagePanel.java

RegisterPagePanel(JFrame parent, MouseAdapter backHandler) {
    parent.getContentPane().add(RegisterPage, "name_22846752421143");
    RegisterPage.setLayout(null);//from   w w w  .  j av a 2s.c om
    //System.out.println(parent.getContentPane());
    RegisterPage.setBounds(100, 100, 1036, 608);

    email = new JTextField();
    email.setBounds(642, 87, 116, 22);
    RegisterPage.add(email);
    email.setColumns(10);

    JLabel lblEmail = new JLabel("Email*");
    lblEmail.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblEmail.setBounds(506, 89, 56, 16);
    RegisterPage.add(lblEmail);

    JLabel lblNewLabel = new JLabel("Password*");
    lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNewLabel.setBounds(506, 132, 71, 16);
    RegisterPage.add(lblNewLabel);

    JLabel lblFirstName = new JLabel("First Name*");
    lblFirstName.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblFirstName.setBounds(141, 87, 88, 16);
    RegisterPage.add(lblFirstName);

    firstName = new JTextField();
    firstName.setBounds(241, 85, 142, 22);
    RegisterPage.add(firstName);
    firstName.setColumns(10);

    JLabel lblNewLabel_1 = new JLabel("Middle Name");
    lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNewLabel_1.setBounds(141, 132, 88, 16);
    RegisterPage.add(lblNewLabel_1);

    middleName = new JTextField();
    middleName.setBounds(241, 129, 142, 22);
    RegisterPage.add(middleName);
    middleName.setColumns(10);

    JLabel lblNewLabel_2 = new JLabel("Last Name*");
    lblNewLabel_2.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNewLabel_2.setBounds(141, 174, 88, 16);
    RegisterPage.add(lblNewLabel_2);

    lastName = new JTextField();
    lastName.setBounds(241, 172, 142, 22);
    RegisterPage.add(lastName);
    lastName.setColumns(10);

    JLabel lblPersonalInformation = new JLabel("Personal Information");
    lblPersonalInformation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    lblPersonalInformation.setBounds(86, 33, 159, 27);
    RegisterPage.add(lblPersonalInformation);

    JLabel lblContactInformation = new JLabel("Contact Information");
    lblContactInformation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    lblContactInformation.setBounds(459, 33, 175, 27);
    RegisterPage.add(lblContactInformation);

    JLabel lblPhoneNumber = new JLabel("Phone*");
    lblPhoneNumber.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblPhoneNumber.setBounds(506, 217, 71, 16);
    RegisterPage.add(lblPhoneNumber);

    phone = new JTextField();
    phone.setBounds(642, 215, 116, 22);
    RegisterPage.add(phone);
    phone.setColumns(10);

    password = new JPasswordField();
    password.setBounds(642, 130, 116, 22);
    RegisterPage.add(password);

    JButton btnBack_5 = new JButton("Back");
    btnBack_5.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });

    btnBack_5.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (lastPage == 6) {
                lastPage = 4;

            }
            RegisterPage.setVisible(false);
            parent.getContentPane().getComponent(lastPage).setVisible(true);
            backHandler.mouseClicked(e);
        }
    });
    btnBack_5.setBounds(12, 525, 97, 25);
    RegisterPage.add(btnBack_5);

    JButton btnExit_6 = new JButton("Exit");
    btnExit_6.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            parent.setVisible(false);
            parent.dispose();
        }
    });
    btnExit_6.setBounds(909, 525, 97, 25);
    RegisterPage.add(btnExit_6);

    JLabel lblAddress = new JLabel("Address*");
    lblAddress.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblAddress.setBounds(141, 217, 56, 16);
    RegisterPage.add(lblAddress);

    address = new JTextField();
    address.setBounds(241, 215, 142, 22);
    RegisterPage.add(address);
    address.setColumns(10);

    address2 = new JTextField();
    address2.setBounds(241, 260, 142, 22);
    RegisterPage.add(address2);
    address2.setColumns(10);

    JLabel lblCity = new JLabel("City*");
    lblCity.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblCity.setBounds(141, 308, 56, 16);
    RegisterPage.add(lblCity);

    city = new JTextField();
    city.setBounds(241, 306, 142, 22);
    RegisterPage.add(city);
    city.setColumns(10);

    JLabel lblAddress_1 = new JLabel("Address 2");
    lblAddress_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblAddress_1.setBounds(141, 263, 77, 16);
    RegisterPage.add(lblAddress_1);

    JLabel lblZip = new JLabel("Zip*");
    lblZip.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblZip.setBounds(141, 402, 56, 16);
    RegisterPage.add(lblZip);

    zip = new JTextField();
    zip.setBounds(241, 400, 142, 22);
    RegisterPage.add(zip);
    zip.setColumns(10);

    JLabel lblState = new JLabel("State*");
    lblState.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblState.setBounds(141, 355, 56, 16);
    RegisterPage.add(lblState);

    state = new JTextField();
    state.setBounds(241, 353, 142, 22);
    RegisterPage.add(state);
    state.setColumns(10);

    JLabel lblRequired = new JLabel("* = required");
    lblRequired.setBounds(301, 39, 88, 16);
    RegisterPage.add(lblRequired);

    JLabel lblLicenseInfo = new JLabel("License Information");
    lblLicenseInfo.setFont(new Font("Tahoma", Font.PLAIN, 16));
    lblLicenseInfo.setBounds(459, 257, 148, 27);
    RegisterPage.add(lblLicenseInfo);

    JLabel lblNumber = new JLabel("Number*");
    lblNumber.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNumber.setBounds(506, 310, 71, 16);
    RegisterPage.add(lblNumber);

    license = new JTextField();
    license.setBounds(642, 306, 116, 22);
    RegisterPage.add(license);
    license.setColumns(10);

    JLabel lblDateOfBirth = new JLabel("Date of Birth*");
    lblDateOfBirth.setBounds(506, 372, 88, 16);
    RegisterPage.add(lblDateOfBirth);

    birthMonth = new JComboBox();
    birthMonth.setModel(new DefaultComboBoxModel(new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
            "Aug", "Sep", "Oct", "Nov", "Dec" }));
    birthMonth.setBounds(642, 370, 71, 22);
    RegisterPage.add(birthMonth);

    birthDay = new JComboBox();
    birthDay.setModel(new DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
            "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26",
            "27", "28", "29", "30", "31" }));
    birthDay.setBounds(708, 370, 62, 22);
    RegisterPage.add(birthDay);

    List<Integer> years = new ArrayList<Integer>();
    for (int i = 1915; i <= 2015; ++i) {
        years.add(i);
    }

    birthYear = new JComboBox(years.toArray());
    birthYear.setBounds(769, 370, 97, 22);
    RegisterPage.add(birthYear);

    JButton btnContinue = new JButton("Continue ->");
    btnContinue.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            register(parent);

        }
    });
    btnContinue.setBounds(674, 428, 133, 34);
    RegisterPage.add(btnContinue);

    JLabel lblConfirmPassword = new JLabel("Confirm Password*");
    lblConfirmPassword.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblConfirmPassword.setBounds(506, 174, 121, 16);
    RegisterPage.add(lblConfirmPassword);

    repassword = new JPasswordField();
    repassword.setBounds(642, 172, 116, 22);
    RegisterPage.add(repassword);

    JLabel lblNewLabel_3 = new JLabel("Credit card #*");
    lblNewLabel_3.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNewLabel_3.setBounds(141, 448, 93, 16);
    RegisterPage.add(lblNewLabel_3);

    cardNumber = new JTextField();
    cardNumber.setBounds(241, 443, 142, 28);
    RegisterPage.add(cardNumber);
    cardNumber.setColumns(10);

    JLabel lblCardExp = new JLabel("Card exp*");
    lblCardExp.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblCardExp.setBounds(141, 496, 82, 16);
    RegisterPage.add(lblCardExp);

    cardExpMonth = new JComboBox();
    cardExpMonth.setModel(new DefaultComboBoxModel(new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }));
    cardExpMonth.setBounds(238, 493, 77, 27);
    RegisterPage.add(cardExpMonth);

    cardExpDay = new JComboBox();
    cardExpDay.setModel(new DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9",
            "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25",
            "26", "27", "28", "29", "30", "31" }));
    cardExpDay.setBounds(312, 493, 71, 27);
    RegisterPage.add(cardExpDay);

    JLabel lblLicenseState = new JLabel("License state*");
    lblLicenseState.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblLicenseState.setBounds(506, 338, 88, 16);
    RegisterPage.add(lblLicenseState);

    licenseState = new JTextField();
    licenseState.setBounds(642, 333, 116, 28);
    RegisterPage.add(licenseState);
    licenseState.setColumns(10);

    RegisterPage.setVisible(false);
}

From source file:es.emergya.ui.gis.popups.SDSDialog.java

public SDSDialog(Recurso r) {
    super();//w  w  w.j a va  2 s  .  c  o m
    setAlwaysOnTop(true);
    setResizable(false);
    iconTransparente = LogicConstants.getIcon("48x48_transparente");
    iconEnviando = LogicConstants.getIcon("anim_enviando");
    destino = r;
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            super.windowClosing(e);
            cancel.doClick();
        }
    });

    // setPreferredSize(new Dimension(400, 150));
    setTitle(i18n.getString("window.sds.titleBar") + " " + r.getIdentificador());
    try {
        setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getIconImage());
    } catch (Throwable e) {
        LOG.error("There is no icon image", e);
    }

    JPanel base = new JPanel();

    base.setBackground(Color.WHITE);
    base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

    // Icono del titulo
    JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING));
    final JLabel titleLabel = new JLabel(i18n.getString("window.sds.title"),
            LogicConstants.getIcon("tittleventana_icon_enviarsds"), JLabel.LEFT);

    titleLabel.setFont(LogicConstants.deriveBoldFont(12f));
    title.add(titleLabel);
    title.setOpaque(false);
    base.add(title);

    // Espacio para el mensaje
    sds = new JTextArea(7, 40);
    sds.setLineWrap(true);

    final JScrollPane sdsp = new JScrollPane(sds);

    sdsp.setOpaque(false);
    sdsp.setBorder(new TitledBorder(BorderFactory.createLineBorder(Color.BLACK),
            i18n.getString("Admin.message") + "\t (0/" + maxChars + ")"));
    sds.setDocument(new PlainDocument() {
        @Override
        public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
            if (this.getLength() + str.length() <= maxChars) {
                super.insertString(offs, str, a);
            }
        }
    });
    sds.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent e) {
            updateChars(e);
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            updateChars(e);
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            updateChars(e);
        }

        private void updateChars(DocumentEvent e) {
            ((TitledBorder) sdsp.getBorder()).setTitle(
                    i18n.getString("Admin.message") + "\t (" + sds.getText().length() + "/" + maxChars + ")");
            sdsp.repaint();
            send.setEnabled(!sds.getText().isEmpty());
            notification.setForeground(Color.WHITE);
            notification.setText("PLACEHOLDER");
        }
    });
    base.add(sdsp);

    // Area para mensajes
    JPanel notificationArea = new JPanel();

    notificationArea.setOpaque(false);
    notification = new JLabel("TEXT");
    notification.setForeground(Color.WHITE);
    notificationArea.add(notification);
    base.add(notificationArea);

    JPanel buttons = new JPanel();

    buttons.setOpaque(false);
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
    send = new JButton(i18n.getString("Buttons.send"),
            LogicConstants.getIcon("ventanacontextual_button_enviarsds"));
    send.addActionListener(this);
    send.setEnabled(false);
    buttons.add(send);
    buttons.add(Box.createHorizontalGlue());
    progressIcon = new JLabel(iconTransparente);
    buttons.add(progressIcon);
    buttons.add(Box.createHorizontalGlue());
    cancel = new JButton(i18n.getString("Buttons.cancel"), LogicConstants.getIcon("button_cancel"));
    cancel.addActionListener(this);
    buttons.add(cancel);
    base.add(buttons);
    getContentPane().add(base);
    pack();

    int x;
    int y;
    Container myParent;
    try {
        myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getContentPane();
        java.awt.Point topLeft = myParent.getLocationOnScreen();
        Dimension parentSize = myParent.getSize();

        Dimension mySize = getSize();

        if (parentSize.width > mySize.width)
            x = ((parentSize.width - mySize.width) / 2) + topLeft.x;
        else
            x = topLeft.x;

        if (parentSize.height > mySize.height)
            y = ((parentSize.height - mySize.height) / 2) + topLeft.y;
        else
            y = topLeft.y;

        setLocation(x, y);
    } catch (Throwable e1) {
        LOG.error("There is no basic window!", e1);
    }
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent arg0) {
            deleteErrorMessage();
        }

        @Override
        public void windowClosed(WindowEvent arg0) {
            deleteErrorMessage();
        }

        private void deleteErrorMessage() {
            SwingWorker<Object, Object> sw = new SwingWorker<Object, Object>() {
                @Override
                protected Object doInBackground() throws Exception {
                    if (bandejaSalida != null) {
                        MessageGenerator.remove(bandejaSalida.getId());
                    }

                    bandejaSalida = null;

                    return null;
                }

                @Override
                protected void done() {
                    super.done();
                    SDSDialog.this.sds.setText("");
                    SDSDialog.this.sds.setEnabled(true);
                    SDSDialog.this.sds.repaint();
                    SDSDialog.this.progressIcon.setIcon(iconTransparente);
                    SDSDialog.this.progressIcon.repaint();
                    SDSDialog.this.notification.setText("");
                    SDSDialog.this.notification.repaint();
                }
            };

            sw.execute();
        }
    });
}

From source file:com.sshtools.appframework.api.ui.SshToolsApplicationPanel.java

/**
 * Display something other that the normal blank screen so our component
 * looks pretty.//from   ww  w  . j  av  a2s .  c  o  m
 */
protected void showWelcomeScreen() {
    synchronized (getTreeLock()) {
        removeAll();
        setLayout(new BorderLayout());
        //         GradientPanel p = new GradientPanel(new BorderLayout());
        //         p.setBackground(Color.white);
        //         p.setBackground2(new Color(164, 228, 244));
        //         p.setForeground(Color.black);
        JPanel p = new JPanel(new BorderLayout());
        JLabel welcomeLabel = new JLabel("", JLabel.CENTER);
        welcomeLabel.setForeground(Color.white);
        welcomeLabel.setFont(welcomeLabel.getFont().deriveFont(72f).deriveFont(Font.BOLD + Font.ITALIC));
        welcomeLabel.setHorizontalAlignment(JLabel.RIGHT);
        p.add(welcomeLabel, BorderLayout.SOUTH);
        add(p, BorderLayout.CENTER);
        validate();
    }
}

From source file:es.emergya.ui.gis.popups.RouteDialog.java

private RouteDialog() {
    super();/* w w w  . j a va  2 s.c om*/
    setAlwaysOnTop(true);
    setResizable(false);
    iconTransparente = LogicConstants.getIcon("48x48_transparente");
    iconEnviando = LogicConstants.getIcon("anim_calculando");
    try {
        route = new OsmDataLayer(new DataSet(), "route", File.createTempFile("route", "route"));
    } catch (IOException e) {
        log.error(e.getMessage(), e);
    }
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            clear.doClick();
            setVisible(false);
        }
    });
    setTitle(i18n.getString("window.route.titleBar"));
    setMinimumSize(new Dimension(400, 200));
    try {
        setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getIconImage());
    } catch (Throwable e) {
        LOG.error("There is no icon image", e);
    }

    JPanel base = new JPanel();
    base.setBackground(Color.WHITE);
    base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

    // Icono del titulo
    JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING));
    title.setOpaque(false);
    final JLabel labelTitle = new JLabel(i18n.getString("window.route.title"),
            LogicConstants.getIcon("tittleventana_icon_calcularruta"), JLabel.LEFT);
    labelTitle.setFont(LogicConstants.deriveBoldFont(12.0f));
    title.add(labelTitle);
    base.add(title);

    JPanel content = new JPanel(new SpringLayout());
    content.setOpaque(false);

    // Coordenadas
    content.add(new JLabel(i18n.getString("window.route.origen"), JLabel.LEFT));
    JPanel coords = new JPanel(new GridLayout(1, 2));
    coords.setOpaque(false);
    fx = new JTextField(8);
    fx.setEditable(false);
    fy = new JTextField(8);
    fy.setEditable(false);
    coords.add(fy);
    coords.add(fx);
    content.add(coords);
    content.add(new JLabel(i18n.getString("window.route.destino"), JLabel.LEFT));
    JPanel coords2 = new JPanel(new GridLayout(1, 2));
    coords2.setOpaque(false);
    tx = new JTextField(8);
    tx.setEditable(false);
    ty = new JTextField(8);
    ty.setEditable(false);
    coords2.add(ty);
    coords2.add(tx);
    content.add(coords2);

    SpringUtilities.makeCompactGrid(content, 2, 2, 6, 6, 6, 6);
    base.add(content);

    // Area para mensajes
    JPanel notificationArea = new JPanel();
    notificationArea.setOpaque(false);
    notification = new JLabel("PLACEHOLDER");
    notification.setForeground(Color.WHITE);
    notificationArea.add(notification);
    base.add(notificationArea);

    JPanel buttons = new JPanel();
    buttons.setOpaque(false);
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
    search = new JButton(i18n.getString("window.route.calcular"),
            LogicConstants.getIcon("ventanacontextual_button_calcularruta"));
    search.addActionListener(this);
    buttons.add(search);
    clear = new JButton(i18n.getString("window.route.limpiar"), LogicConstants.getIcon("button_limpiar"));
    clear.addActionListener(this);
    buttons.add(clear);
    buttons.add(Box.createHorizontalGlue());
    progressIcon = new JLabel(iconTransparente);
    buttons.add(progressIcon);
    buttons.add(Box.createHorizontalGlue());
    JButton cancel = new JButton(i18n.getString("Buttons.cancel"), LogicConstants.getIcon("button_cancel"));
    cancel.addActionListener(this);
    buttons.add(cancel);
    base.add(buttons);
    getContentPane().add(base);
    pack();
    int x;
    int y;

    Container myParent;
    try {
        myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getContentPane();
        java.awt.Point topLeft = myParent.getLocationOnScreen();
        Dimension parentSize = myParent.getSize();

        Dimension mySize = getSize();

        if (parentSize.width > mySize.width)
            x = ((parentSize.width - mySize.width) / 2) + topLeft.x;
        else
            x = topLeft.x;

        if (parentSize.height > mySize.height)
            y = ((parentSize.height - mySize.height) / 2) + topLeft.y;
        else
            y = topLeft.y;

        setLocation(x, y);
    } catch (Throwable e1) {
        LOG.error("There is no basic window!", e1);
    }
}

From source file:burp.BurpExtender.java

private void createTitle(String text, Container cont) {
    JLabel title = new JLabel(text);
    title.setForeground(new Color(229, 137, 0));
    Font f = title.getFont();//from  w w w  .  j av a2 s.  c  o  m
    title.setFont(new Font(f.getName(), Font.BOLD, f.getSize() + 2));
    callbacks.customizeUiComponent(title);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = 0;
    gbc.gridx = 0;
    gbc.insets = new Insets(8, 10, 0, 0);
    gbc.anchor = GridBagConstraints.WEST;
    cont.add(title, gbc);
}

From source file:com.diversityarrays.kdxplore.field.FieldViewPanel.java

public FieldViewPanel(PlotVisitList plotVisitList, Map<Integer, Trait> traitMap,
        SeparatorVisibilityOption visible, SimplePlotCellRenderer plotRenderer, Component... extras) {
    super(new BorderLayout());

    this.plotVisitList = plotVisitList;
    this.traitMap = traitMap;

    trial = plotVisitList.getTrial();/*from  w  ww.  j ava  2  s. c  om*/

    fieldLayoutTableModel.setTrial(trial);

    int rowHeight = fieldLayoutTable.getRowHeight();
    fieldLayoutTable.setRowHeight(4 * rowHeight);

    fieldLayoutTable.setCellSelectionEnabled(true);

    fieldLayoutTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

    // IMPORTANT: DO NOT SORT THE FIELD LAYOUT TABLE
    fieldLayoutTable.setAutoCreateRowSorter(false);

    Map<Integer, Plot> plotById = new HashMap<>();
    FieldLayout<Integer> plotIdLayout = FieldLayoutUtil.createPlotIdLayout(trial.getTrialLayout(),
            trial.getPlotIdentSummary(), plotVisitList.getPlots(), plotById);

    KdxploreFieldLayout<Plot> kdxFieldLayout = new KdxploreFieldLayout<Plot>(Plot.class, plotIdLayout.imageId,
            plotIdLayout.xsize, plotIdLayout.ysize);
    kdxFieldLayout.warning = plotIdLayout.warning;

    String displayName = null;
    for (VisitOrder2D vo : VisitOrder2D.values()) {
        if (vo.imageId == plotIdLayout.imageId) {
            displayName = vo.displayName;
            break;
        }
    }
    //      VisitOrder2D vo = plotVisitList.getVisitOrder();
    KDClientUtils.initAction(plotIdLayout.imageId, changeCollectionOrder, displayName);

    hasUserPlotId = lookForUserPlotIdPresent(plotById, plotIdLayout, kdxFieldLayout);

    this.plotCellRenderer = plotRenderer;
    plotCellRenderer.setShowUserPlotId(hasUserPlotId);

    plotCellRenderer.setPlotXYprovider(getXYprovider());

    plotCellRenderer.setPlotVisitList(plotVisitList);

    fieldLayoutTable.setDefaultRenderer(Plot.class, plotCellRenderer);
    fieldLayoutTable.setCellSelectionEnabled(true);

    fieldLayoutTableModel.setFieldLayout(kdxFieldLayout);

    if (kdxFieldLayout.warning != null && !kdxFieldLayout.warning.isEmpty()) {
        warningMessage.setText(kdxFieldLayout.warning);
    } else {
        warningMessage.setText("");
    }

    fieldLayoutTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    fieldLayoutTable.getTableHeader().setReorderingAllowed(false);
    fieldLayoutTable.setCellSelectionEnabled(true);

    StringBuilder naming = new StringBuilder();
    String nameForRow = plotVisitList.getTrial().getNameForRow();
    if (!Check.isEmpty(nameForRow)) {
        naming.append(nameForRow);
    }
    String nameForCol = plotVisitList.getTrial().getNameForColumn();
    if (!Check.isEmpty(nameForCol)) {
        if (naming.length() > 0) {
            naming.append('/');
        }
        naming.append(nameForCol);
    }
    fieldTableScrollPane = new JScrollPane(fieldLayoutTable);
    if (naming.length() > 0) {
        JLabel cornerLabel = new JLabel(naming.toString());
        fieldTableScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, cornerLabel);
    }
    fieldTableScrollPane.setRowHeaderView(rowHeaderTable);

    //      fieldLayoutTable.setRowHeaderTable(rowHeaderTable);

    //      Box extra = Box.createHorizontalBox();
    //      extra.add(new JButton(changeCollectionOrder));
    //      if (extras != null && extras.length > 0) {
    //         extra.add(Box.createHorizontalStrut(8));
    //         for (Component c : extras) {
    //            extra.add(c);
    //         }
    //      }
    //      extra.add(Box.createHorizontalGlue());

    switch (visible) {
    case NOTVISIBLE:
        break;

    case VISIBLE:
    default:
        Box top = Box.createHorizontalBox();
        top.setOpaque(true);
        top.setBackground(Color.LIGHT_GRAY);
        top.setBorder(new MatteBorder(0, 0, 1, 0, Color.GRAY));
        JLabel label = new JLabel("Field");
        label.setForeground(Color.DARK_GRAY);
        label.setFont(label.getFont().deriveFont(Font.BOLD));
        top.add(label);
        top.add(new JButton(changeCollectionOrder));

        if (extras != null && extras.length > 0) {
            top.add(Box.createHorizontalStrut(8));
            for (Component c : extras) {
                top.add(c);
            }
        }
        add(top, BorderLayout.NORTH);
        break;
    }

    add(fieldTableScrollPane, BorderLayout.CENTER);
    add(warningMessage, BorderLayout.SOUTH);
}

From source file:com.db4o.sync4o.ui.Db4oSyncSourceConfigPanel.java

private void setupControls() {

    // Layout and setup UI components...

    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    add(_namePanel);/*from   ww w  .  ja  v a2s.c o  m*/
    _namePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(_fieldsPanel);
    _fieldsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(_classConfigsTree);
    _classConfigsTree.setAlignmentX(Component.LEFT_ALIGNMENT);
    _classConfigsTree.setPreferredSize(new Dimension(300, 300));
    add(_buttonsPanel);
    _buttonsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    JLabel l;

    // Admin UI Management Panels use a title
    // (in a particular "title font") to identify themselves
    l = new JLabel("Edit Db4oSyncSource Configuration", SwingConstants.CENTER);
    l.setBorder(new TitledBorder(""));
    l.setFont(titlePanelFont);
    _namePanel.add(l);

    GridBagConstraints labelConstraints = new GridBagConstraints();
    labelConstraints.gridwidth = 1;
    labelConstraints.fill = GridBagConstraints.NONE;
    labelConstraints.weightx = 0.0;
    labelConstraints.gridx = 0;
    labelConstraints.gridy = 0;
    labelConstraints.anchor = GridBagConstraints.EAST;

    GridBagConstraints fieldConstraints = new GridBagConstraints();
    fieldConstraints.gridwidth = 2;
    fieldConstraints.fill = GridBagConstraints.HORIZONTAL;
    fieldConstraints.weightx = 1.0;
    fieldConstraints.gridx = 1;
    fieldConstraints.gridy = 0;

    _fieldsPanel.add(new JLabel("Source URI: "), labelConstraints);
    _fieldsPanel.add(_sourceUriValue, fieldConstraints);

    labelConstraints.gridy = GridBagConstraints.RELATIVE;
    fieldConstraints.gridy = GridBagConstraints.RELATIVE;

    _fieldsPanel.add(new JLabel("Name: "), labelConstraints);
    _fieldsPanel.add(_nameValue, fieldConstraints);

    fieldConstraints.gridwidth = 1;

    _fieldsPanel.add(new JLabel("db4o File: "), labelConstraints);
    _fieldsPanel.add(_dbFileValue, fieldConstraints);

    _dbFileValue.setEditable(false);

    fieldConstraints.gridwidth = 2;

    GridBagConstraints buttonConstraints = new GridBagConstraints();
    buttonConstraints.gridwidth = 1;
    buttonConstraints.fill = GridBagConstraints.NONE;
    buttonConstraints.gridx = 2;
    buttonConstraints.gridy = 3;
    _dbFileLocateButton.setText("...");
    _fieldsPanel.add(_dbFileLocateButton, buttonConstraints);

    buttonConstraints.gridwidth = 3;
    buttonConstraints.fill = GridBagConstraints.NONE;
    buttonConstraints.gridx = 0;
    buttonConstraints.gridy = GridBagConstraints.RELATIVE;
    buttonConstraints.anchor = GridBagConstraints.CENTER;

    // Ensure all the controls use the Admin UI standard font
    Component[] components = _fieldsPanel.getComponents();
    for (int i = 0; i < components.length; i++) {

        Component c = components[i];
        c.setFont(defaultFont);

    }

    _confirmButton.setText("Add");
    _buttonsPanel.add(_confirmButton);

}

From source file:com.sshtools.common.ui.SshToolsApplication.java

/**
 * Show an 'About' dialog//  www . jav  a2s .c  o  m
 *
 *
 */
public void showAbout(final Component parent) {

    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    GridBagConstraints gBC = new GridBagConstraints();
    gBC.anchor = GridBagConstraints.CENTER;
    gBC.fill = GridBagConstraints.HORIZONTAL;
    gBC.insets = new Insets(1, 1, 1, 1);

    JLabel a = new JLabel(getApplicationName());
    a.setFont(a.getFont().deriveFont(24f));
    UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER);

    MultilineLabel v = new MultilineLabel(getApplicationName() + " " + getApplicationVersion());
    v.setFont(v.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, v, gBC, GridBagConstraints.REMAINDER);

    MultilineLabel x = new MultilineLabel(getAboutAuthors());
    x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0));
    x.setFont(x.getFont().deriveFont(12f));
    UIUtil.jGridBagAdd(p, x, gBC, GridBagConstraints.REMAINDER);

    MultilineLabel c = new MultilineLabel(getAboutLicenseDetails());
    c.setFont(c.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, c, gBC, GridBagConstraints.REMAINDER);

    final JLabel h = new JLabel(getAboutURL());
    h.setForeground(Color.blue);
    h.setFont(new Font(h.getFont().getName(), Font.BOLD, 10));
    h.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    h.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent evt) {
            try {
                BrowserLauncher.openURL(getAboutURL());
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
        }
    });
    UIUtil.jGridBagAdd(p, h, gBC, GridBagConstraints.REMAINDER);

    JOptionPane.showMessageDialog(parent, p, "About", JOptionPane.PLAIN_MESSAGE, getApplicationLargeIcon());
}

From source file:com.sshtools.common.ui.SshToolsApplication.java

public void openChangelog(Component parent) {

    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    GridBagConstraints gBC = new GridBagConstraints();
    gBC.anchor = GridBagConstraints.CENTER;
    gBC.fill = GridBagConstraints.HORIZONTAL;
    gBC.insets = new Insets(1, 1, 1, 1);

    JLabel a = new JLabel(getApplicationName());
    a.setFont(a.getFont().deriveFont(24f));
    UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER);

    String changelog = "";
    try {//w w w  .j av  a  2s  . co  m
        BufferedReader br = new BufferedReader(
                new InputStreamReader(getClass().getResourceAsStream("/changelog")));
        String line = br.readLine();
        while (line != null) {
            changelog += line + "\n";
            line = br.readLine();
        }
        br.close();
    } catch (Exception e) {
        changelog = "<Error opening changelog>\n";
    }

    javax.swing.JTextArea message = new javax.swing.JTextArea(changelog);
    message.setEditable(false);
    message.setBorder(javax.swing.BorderFactory.createEmptyBorder(4, 4, 4, 4));
    javax.swing.JLabel jl = new javax.swing.JLabel();
    message.setFont(jl.getFont());
    message.setBackground(jl.getBackground());

    //   MultilineLabel x = new MultilineLabel(changelog);
    //   x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0));
    //   x.setFont(x.getFont().deriveFont(12f));   
    javax.swing.JScrollPane scrollPane = new javax.swing.JScrollPane();
    scrollPane.getViewport().add(message);
    scrollPane.setSize(400, 200);
    scrollPane.setPreferredSize(new java.awt.Dimension(400, 200));
    UIUtil.jGridBagAdd(p, scrollPane, gBC, GridBagConstraints.REMAINDER);

    JOptionPane.showMessageDialog(parent, p, "Change log", JOptionPane.PLAIN_MESSAGE,
            getApplicationLargeIcon());
}

From source file:com.polivoto.vistas.Charts.java

public void getBotonesPreguntas(JPanel botones) {
    GridBagConstraints gridBagConstraints;
    boolean first = false;
    botones.removeAll();/*from w w  w  . j av a2  s .  co m*/
    JPanel panelRelleno = new JPanel(new BorderLayout(20, 20));
    panelRelleno.setBackground(Color.white);
    JPanel panelContainer = new JPanel(new GridLayout(0, 1, 30, 30));
    panelContainer.setBackground(Color.white);
    botones.setPreferredSize(new Dimension(250, 0));
    botones.setLayout(new GridBagLayout());
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 0.1;
    gridBagConstraints.weighty = 0.1;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    botones.add(panelContainer, gridBagConstraints);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 0.1;
    gridBagConstraints.weighty = 0.9;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    botones.add(panelRelleno, gridBagConstraints);
    JLabel labelPreguntas = new JLabel("PREGUNTAS");
    labelPreguntas.setFont(new Font("Roboto", 1, 24));
    labelPreguntas.setHorizontalAlignment(0);
    labelPreguntas.setForeground(new Color(137, 36, 31));
    panelContainer.add(labelPreguntas);

    for (Pregunta pregunta : votacion.getPreguntas()) {
        Boton boton = new Boton("<html><div align=center>" + pregunta.getTitulo() + "</html>") {

            @Override
            public void botonClicked(Boton e) {
                crearGrafica(pregunta);
                botonActual = e;
            }
        };
        boton.setPreferredSize(new Dimension(200, 0));

        panelContainer.add(boton);
        if (!first) {
            botonActual = boton;
            first = true;
        }
    }

    botones.repaint();
    botones.revalidate();

}