Example usage for javax.swing JLabel getFont

List of usage examples for javax.swing JLabel getFont

Introduction

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

Prototype

@Transient
public Font getFont() 

Source Link

Document

Gets the font of this component.

Usage

From source file:rita.ui.component.DialogSelectEnemies.java

/**
 * Initialize the contents of the frame.
 * /* ww  w  .j  a  va2s.  c om*/
 * @throws NoEnemiesException
 */
private void initialize() throws NoEnemiesException {
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    this.getContentPane().setLayout(new BorderLayout(6, 6));
    this.setTitle(Language.get("selectEnemies"));
    randomMode = new JCheckBox(Language.get("robotsBattleMode.random"));
    randomMode.setSelected(true);
    randomMode.addActionListener(new SelectUnselectPositionAction());

    icon = new ImageIcon(DialogSelectEnemies.class.getResource("/images/icons/target.jpg"));

    JPanel panelRobots = new JPanel();
    panelRobots.setBorder(new EmptyBorder(0, 12, 12, 0));
    panelRobots.setLayout(new BorderLayout(0, 0));

    JPanel panelSelectAllNone = new JPanel();
    panelSelectAllNone.setBorder(new EmptyBorder(0, 12, 0, 12));
    panelRobots.add(panelSelectAllNone, BorderLayout.EAST);
    this.getContentPane().add(panelRobots, BorderLayout.CENTER);

    GridBagLayout gbl_panelSelectAllNone = new GridBagLayout();
    gbl_panelSelectAllNone.columnWidths = new int[] { 0, 0 };
    gbl_panelSelectAllNone.rowHeights = new int[] { 0, 0, 8 };
    gbl_panelSelectAllNone.columnWeights = new double[] { 0.0, Double.MIN_VALUE };
    gbl_panelSelectAllNone.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    panelSelectAllNone.setLayout(gbl_panelSelectAllNone);

    JButton btnSelectAll = new JButton(Language.get("selectAllEnemies"));
    GridBagConstraints gbc_btnSelectAll = new GridBagConstraints();
    gbc_btnSelectAll.fill = GridBagConstraints.HORIZONTAL;
    gbc_btnSelectAll.insets = new Insets(0, 0, 5, 0);
    gbc_btnSelectAll.gridx = 0;
    gbc_btnSelectAll.gridy = 0;
    panelSelectAllNone.add(btnSelectAll, gbc_btnSelectAll);

    JButton btnSelectNone = new JButton(Language.get("selectNoEnemies"));
    GridBagConstraints gbc_btnSelectNone = new GridBagConstraints();
    gbc_btnSelectNone.fill = GridBagConstraints.HORIZONTAL;
    gbc_btnSelectNone.gridx = 0;
    gbc_btnSelectNone.gridy = 1;
    panelSelectAllNone.add(btnSelectNone, gbc_btnSelectNone);

    /*
     * btnInitialPositionsConfig = new
     * JButton(Language.get("selectRobotsInitialPositions"));
     * GridBagConstraints gbc_btnInitialPositionsConfig = new
     * GridBagConstraints(); gbc_btnSelectNone.fill =
     * GridBagConstraints.HORIZONTAL; gbc_btnSelectNone.gridx = 0;
     * gbc_btnSelectNone.gridy = 1;
     * panelSelectAllNone.add(btnInitialPositionsConfig,
     * gbc_btnInitialPositionsConfig);
     * btnInitialPositionsConfig.addActionListener(new ActionListener() {
     * public void actionPerformed(ActionEvent evt) {
     * selectRobotsInitialPositions(); } });
     */

    JLabel label = new JLabel(String.format(Language.get("youtRobotAgainst"), HelperEditor.currentRobotName));
    label.setBorder(new EmptyBorder(12, 12, 0, 12));
    label.setIcon(new ImageIcon(DialogSelectEnemies.class.getResource("/images/icons/compite2.png")));
    label.setVerticalAlignment(SwingConstants.TOP);
    label.setFont(label.getFont().deriveFont(Font.BOLD, 14));

    panelSelectRobots = new JPanel();
    panelSelectRobots.setLayout(new GridLayout(0, 2));
    panelSelectRobots.setAutoscrolls(true);

    panelRobots.add(label, BorderLayout.NORTH);
    panelRobots.add(panelSelectRobots, BorderLayout.CENTER);

    // posicion de mi robot
    JPanel panelSetMyRobotPosition = new JPanel();
    // panelRobots.add(panelSetMyRobotPosition, BorderLayout.PAGE_END);
    panelSetMyRobotPosition.setLayout(new FlowLayout());
    JLabel ownPosition = new JLabel(Language.get("myRobotPosition") + " " + HelperEditor.currentRobotName);
    ownPosition.setFont(new Font("sansserif", Font.BOLD, 12));
    panelSetMyRobotPosition.add(ownPosition);
    // Posicion de mi robot
    buttonPos = new JButton(icon);
    buttonPos.addActionListener(new PosicionRobotAction(HelperEditor.currentRobotName)); // el nombre aqui es solo a
    // modo informativo
    buttonPos.setPreferredSize(new Dimension(30, 30));
    panelSetMyRobotPosition.add(buttonPos);
    positionComponents.add(buttonPos);

    // Matas
    JPanel panelSelectRoundsNumber = new JPanel();
    // panelRobots.add(panelSelectRoundsNumber, BorderLayout.SOUTH);
    panelSelectRoundsNumber.setLayout(new FlowLayout());
    panelSelectRoundsNumber.add(new JLabel(Language.get("selectRoundsNumber")));
    //      this.roundsNumberTextField = new JTextField(
    //            Integer.toString(Batalla.NUMBER_OF_ROUNDS), 5);
    this.roundsNumberSpinner = new JSpinner(new SpinnerNumberModel(Batalla.NUMBER_OF_ROUNDS,
            Batalla.MIN_NUMBER_OF_ROUNDS, Batalla.MAX_NUMBER_OF_ROUNDS, 1));

    panelSelectRoundsNumber.add(this.roundsNumberSpinner);

    JPanel panelSouth = new JPanel();
    panelSouth.setLayout(new GridLayout(4, 1));

    panelSouth.add(panelSetMyRobotPosition);
    //this.getContentPane().add(randomMode, BorderLayout.SOUTH);
    panelSouth.add(randomMode);
    panelSouth.add(new JSeparator());
    panelSouth.add(panelSelectRoundsNumber);
    panelRobots.add(panelSouth, BorderLayout.SOUTH);

    JPanel panelOkCancel = new JPanel();
    this.getContentPane().add(panelOkCancel, BorderLayout.SOUTH);
    panelOkCancel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 12));

    btnOK = new JButton(Language.get("selectStartBattle"));
    btnOK.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            startBattle(panelSelectRobots);
        }
    });
    // comienza deshabilitado hasta que se seleccione 1 enemigo
    // btnOK.setEnabled(false);
    panelOkCancel.add(btnOK);

    JButton btnCancel = new JButton(Language.get("cancel"));
    btnCancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            closeDialog();
        }
    });
    panelOkCancel.add(btnCancel);

    btnSelectAll.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            selectChecks(panelSelectRobots, true);
            // btnOK.setEnabled(true);
        }
    });

    btnSelectNone.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            selectChecks(panelSelectRobots, false);
            // btnOK.setEnabled(false);
        }
    });

    // TODO Agregar funcionalidad de elegir las posiciones iniciales de los
    // robots.
    // TODO Averiguar como pasar las posiciones para que se elijan de manera
    // random, probar (0,0,0)

    try {
        robotNameClicked = new RobotNameClickedEvent(btnOK);
        addRobotsToPanel(panelSelectRobots);

        this.setResizable(false);
        this.pack();
        PositionCalc.centerDialog(this);
        enablePositionOptions(false);
        this.setVisible(true);
    } catch (FileNotFoundException e) {
        throw new NoEnemiesException(e.getMessage());
    }

}

From source file:TrabajoFinalJava.DescargaFichero.java

@Override
public void run() {

    //************************INICIO****INTERFAZ**************************************************************************

    JFrame principal = new JFrame("GESTOR DESCARGAS");
    //Colores//from  ww  w.  j a  v  a2 s.co  m

    Color nuevoColor = new Color(167, 220, 231);

    principal.getContentPane().setBackground(nuevoColor);

    JLabel tituloPrincipal = new JLabel("GESTOR DESCARGAS");
    JLabel tituloVentana = new JLabel("DESCARGA FICHERO FTP");
    //Recojo la fuente que se esta utilizando actualmente.
    Font auxFont = tituloPrincipal.getFont();

    //Aplico la fuente actual, y al final le doy el tamao del texto...
    tituloPrincipal.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30));
    tituloVentana.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30));
    //tituloVentana.setAlignmentY(0);

    JLabel nombreArchivo = new JLabel("INTRODUCE EL NOMBRE DEL FICHERO A DESCARGAR.");
    JTextField nombreArchivoIn = new JTextField();
    JButton descarga = new JButton("DESCARGA FICHERO.");
    JButton atras = new JButton("ATRAS");

    JButton salir = new JButton("Salir");

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();

    //Asignamos la constante EXIT_ON_CLOSE, cierra la ventana al pulsar la X.
    principal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Asignamos al JFrame el Layout que usaremos, GridBagLayout
    principal.setLayout(gridbag);
    //aadir botones al layout

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1; // La fila 0 debe estirarse, le ponemos un 1.0
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(tituloPrincipal, gbc);

    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1; // La fila 0 debe estirarse, le ponemos un 1.0
    gbc.fill = GridBagConstraints.NONE;
    principal.add(tituloVentana, gbc);

    gbc.gridx = 1;
    gbc.gridy = 2;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(nombreArchivo, gbc);

    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(nombreArchivoIn, gbc);

    gbc.gridx = 1;
    gbc.gridy = 4;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(descarga, gbc);

    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(atras, gbc);

    gbc.gridx = 1;
    gbc.gridy = 5;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1; // La fila 0 debe estirarse, le ponemos un 1.0
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(salir, gbc);

    //Hace visible el panel
    principal.setVisible(true);
    principal.setSize(650, 350);
    principal.setLocationRelativeTo(null);
    principal.setResizable(false);
    //principal.pack();

    descarga.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            if (descargasUsuarioLog <= 9) {
                try {
                    cFtp.connect(ftpSsrver);
                    boolean login = cFtp.login(ftpUser, ftpPass);
                    System.out.print("conexion establecida");

                    cFtp.enterLocalPassiveMode();

                    nombreFichero = nombreArchivoIn.getText();
                    nombrePc = nombreArchivoIn.getText();

                    CrearListaFicheros listarFicheros = new CrearListaFicheros();
                    listarFicheros.start();

                    for (int i = 0; i < CrearListaFicheros.arrayArchivos.size(); i++) {

                        System.out.println(CrearListaFicheros.arrayArchivos.get(i));

                    }

                    if (CrearListaFicheros.arrayArchivos.contains(nombreFichero)) {
                        FTPFile file = cFtp.mlistFile(nombreFichero);
                        long size = file.getSize();
                        System.out.println("Tamao del fichero= " + size);

                        if (size > 1000000) {
                            System.out.println("El fichero es muy grande......");
                        } else {

                            FileOutputStream fos = new FileOutputStream(nombreFichero);
                            cFtp.retrieveFile(nombreFichero, fos);

                            System.out.println("");
                            System.out.println("Archivo recibido");

                            nombreArchivoIn.setBackground(Color.green);
                            descargasUsuarioLog = descargasUsuarioLog + 1;
                            System.out.println(descargasUsuarioLog);

                            //modificamos las descargas totales del usuario en la BBDD
                            Connection conn;

                            try {
                                try {
                                    Class.forName("com.mysql.jdbc.Driver");
                                } catch (Exception y) {
                                    y.printStackTrace();
                                }

                                conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/midb", "root",
                                        "");
                                System.out.println("Conn OK!");

                                stmt = conn.createStatement();

                                stmt.executeUpdate("UPDATE usuarios SET bajadas = '" + descargasUsuarioLog
                                        + "' WHERE usuario = '" + usuarioLog + "';");

                                System.out.print("Descargas modificadas correctamente.");

                                conn.close();
                            } catch (Exception i) {
                                System.out.println(e);
                            }
                        }

                    } else {
                        System.out.println("El fichero no existe...");
                        nombreArchivoIn.setText("El fichero no existe");
                    }

                } catch (IOException r) {
                    r.printStackTrace();
                }

            } else {
                System.out.println(
                        "No te quedan descargas... por favor comuniquese con el administrador del servidor. Gracias.");
                nombreArchivoIn.setText(
                        "No te quedan descargas... por favor comuniquese con el administrador del servidor. Gracias.");

            }

        }

    });

    atras.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            FormularioAccesoFtp accesoFtp = new FormularioAccesoFtp();
            accesoFtp.inicioFtp();
            principal.setVisible(false);

        }

    });

    salir.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            System.exit(1000);

        }

    });

}

From source file:TrabajoFinalJava.FormularioVerFicheros.java

public void run() {

    //************************INICIO****INTERFAZ**************************************************************************

    JFrame principal = new JFrame("GESTOR DESCARGAS");
    //Colores//from w w w .ja  v  a2  s . c  o m

    Color nuevoColor = new Color(167, 220, 231);

    principal.getContentPane().setBackground(nuevoColor);

    JLabel tituloPrincipal = new JLabel("GESTOR DESCARGAS");
    JLabel tituloVentana = new JLabel("VER FICHEROS");
    JTextArea cajaFicheros = new JTextArea(12, 20);

    JButton mostrar = new JButton("MOSTRAR FICHEROS");
    JButton atras = new JButton("ATRAS");
    JButton salir = new JButton("SALIR");

    cajaFicheros.setEditable(false);

    //Recojo la fuente que se esta utilizando actualmente.
    Font auxFont = tituloPrincipal.getFont();

    //Aplico la fuente actual, y al final le doy el tamao del texto...
    tituloPrincipal.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30));
    tituloVentana.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30));

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();

    //Asignamos la constante EXIT_ON_CLOSE, cierra la ventana al pulsar la X.
    principal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Asignamos al JFrame el Layout que usaremos, GridBagLayout

    principal.setLayout(gridbag);

    //aadir botones al layout

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(tituloPrincipal, gbc);

    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(tituloVentana, gbc);

    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(new JScrollPane(cajaFicheros), gbc);

    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(mostrar, gbc);

    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(atras, gbc);

    gbc.gridx = 1;
    gbc.gridy = 4;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(salir, gbc);

    //cajaFicheros.setEditable(false);

    //Hace visible el panel
    principal.setVisible(true);
    principal.setSize(650, 350);
    principal.setLocationRelativeTo(null);
    principal.setResizable(false);
    //principal.pack();

    mostrar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String ftpSsrver = "127.0.0.1";
            String ftpUser = "solera";
            String ftpPass = "solera";

            FTPClient cFtp = new FTPClient();

            try {

                cFtp.connect(ftpSsrver);
                boolean login = cFtp.login(ftpUser, ftpPass);
                System.out.print("conexion ftp para ver ficheros establecida");

                cFtp.enterLocalPassiveMode();

                String[] archivos = cFtp.listNames();
                FTPFile[] detalles = cFtp.listFiles();

                archivos = cFtp.listNames();

                for (int i = 0; i < archivos.length; i++) {
                    /*
                    cajaFicheros.selectAll();
                    cajaFicheros.replaceSelection("");
                    */
                    arrayArchivos.add(archivos[i].toString());
                    System.out.println(arrayArchivos.get(i));
                    cajaFicheros.append(System.getProperty("line.separator"));
                    cajaFicheros.append(arrayArchivos.get(i));

                }

                cFtp.logout();
                cFtp.disconnect();
                System.out.println("Conexion Finalizada, buenas tardes.");
            } catch (IOException ioe) {
                System.out.println("error" + ioe.toString());
            }

        }

    });

    try {
        salir.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                System.exit(0);

            }

        });
    } catch (Exception e) {
    }

    try {
        atras.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                FormularioAccesoFtp accesoFtp = new FormularioAccesoFtp();
                accesoFtp.inicioFtp();
                principal.setVisible(false);

            }

        });
    } catch (Exception e) {
    }

}

From source file:tvbrowser.ui.filter.dlgs.EditFilterDlg.java

public EditFilterDlg(JFrame parent, FilterList filterList, UserFilter filter) {

    super(parent, true);

    UiUtilities.registerForClosing(this);

    mFilterList = filterList;// ww w . j a v a  2s.c o  m
    mParent = parent;
    mFilter = filter;

    JPanel contentPane = (JPanel) getContentPane();
    contentPane.setLayout(new BorderLayout(7, 7));
    contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    if (filter == null) {
        setTitle(mLocalizer.msg("titleNew", "Create filter"));
    } else {
        setTitle(mLocalizer.msg("titleEdit", "Edit filter {0}", filter.toString()));
        mFilterName = filter.toString();
    }

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

    mFilterNameTF = new JTextField(new PlainDocument() {

        public void insertString(int offset, String str, AttributeSet a) throws BadLocationException {
            str = str.replaceAll("[\\p{Punct}&&[^_]]", "_");
            super.insertString(offset, str, a);
        }
    }, "", 30);

    mFilterNameTF.getDocument().addDocumentListener(this);
    JPanel panel = new JPanel(new BorderLayout(7, 7));
    panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 7, 0));
    panel.add(new JLabel(mLocalizer.msg("filterName", "Filter name:")), BorderLayout.WEST);
    JPanel panel1 = new JPanel(new BorderLayout());
    panel1.add(mFilterNameTF, BorderLayout.WEST);
    panel.add(panel1, BorderLayout.CENTER);
    northPanel.add(panel);

    mFilterRuleTF = new JTextField();
    mFilterRuleTF.getDocument().addDocumentListener(this);
    mFilterRuleTF.addCaretListener(this);
    panel = new JPanel(new BorderLayout(7, 7));
    panel1 = new JPanel(new BorderLayout());
    panel.add(new JLabel(mLocalizer.msg("ruleString", "Filter rule:")), BorderLayout.WEST);
    JLabel exampleLb = new JLabel(
            mLocalizer.msg("ruleExample", "example: component1 or (component2 and not component3)"));
    Font f = exampleLb.getFont();
    exampleLb.setFont(new Font(f.getName(), Font.ITALIC | Font.PLAIN, f.getSize()));
    panel1.add(exampleLb, BorderLayout.WEST);
    panel.add(panel1, BorderLayout.CENTER);
    northPanel.add(panel);
    northPanel.add(mFilterRuleTF);
    mFilterRuleErrorLb = new JLabel();
    mFilterRuleErrorLb.setForeground(Color.red);
    panel = new JPanel(new BorderLayout(7, 7));
    panel.add(mFilterRuleErrorLb, BorderLayout.WEST);
    mColLb = new JLabel("0");
    panel.add(mColLb, BorderLayout.EAST);
    northPanel.add(panel);

    JPanel filterComponentsPanel = new JPanel(new BorderLayout(7, 7));
    filterComponentsPanel.add(DefaultComponentFactory.getInstance().createSeparator(
            mLocalizer.msg("componentsTitle", "Available filter components:")), BorderLayout.NORTH);
    JPanel btnPanel = new JPanel(new BorderLayout());
    panel1 = new JPanel(new GridLayout(0, 1, 0, 7));

    mNewBtn = new JButton(mLocalizer.msg("newButton", "new"));
    mEditBtn = new JButton(Localizer.getLocalization(Localizer.I18N_EDIT));
    mRemoveBtn = new JButton(Localizer.getLocalization(Localizer.I18N_DELETE));

    mNewBtn.addActionListener(this);
    mEditBtn.addActionListener(this);
    mRemoveBtn.addActionListener(this);

    panel1.add(mNewBtn);
    panel1.add(mEditBtn);
    panel1.add(mRemoveBtn);

    btnPanel.add(panel1, BorderLayout.NORTH);

    mComponentTableModel = new FilterTableModel();

    mRuleTableBox = new JTable(mComponentTableModel);
    mRuleTableBox.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            updateBtns();
        }
    });

    mRuleTableBox.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() >= 2) {
                int row = mRuleTableBox.rowAtPoint(e.getPoint());

                if (mRuleTableBox.getSelectedRow() == row && mEditBtn.isEnabled()) {
                    actionPerformed(new ActionEvent(mEditBtn, ActionEvent.ACTION_PERFORMED,
                            mEditBtn.getActionCommand()));
                }
            }
        }
    });

    mRuleTableBox.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    mRuleTableBox.setShowGrid(false);
    mRuleTableBox.setShowVerticalLines(true);
    mRuleTableBox.getColumnModel().getColumn(0).setPreferredWidth(125);
    mRuleTableBox.getColumnModel().getColumn(1).setPreferredWidth(320);
    //    mRuleTableBox.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    // Dispatchs the KeyEvent to the RootPane for Closing the Dialog.
    // Needed for Java 1.4.
    mRuleTableBox.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                mRuleTableBox.getRootPane().dispatchEvent(e);
            }
        }
    });

    JPanel ruleListBoxPanel = new JPanel(new BorderLayout());
    ruleListBoxPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 7, 0));
    ruleListBoxPanel.add(new JScrollPane(mRuleTableBox), BorderLayout.CENTER);

    filterComponentsPanel.add(btnPanel, BorderLayout.EAST);
    filterComponentsPanel.add(ruleListBoxPanel, BorderLayout.CENTER);

    ButtonBarBuilder2 bottomBar = Utilities.createFilterButtonBar();

    mOkBtn = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
    mOkBtn.addActionListener(this);
    getRootPane().setDefaultButton(mOkBtn);

    mCancelBtn = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
    mCancelBtn.addActionListener(this);

    bottomBar.addButton(new JButton[] { mOkBtn, mCancelBtn });

    contentPane.add(northPanel, BorderLayout.NORTH);
    contentPane.add(filterComponentsPanel, BorderLayout.CENTER);
    contentPane.add(bottomBar.getPanel(), BorderLayout.SOUTH);

    if (mFilter != null) {
        mFilterNameTF.setText(mFilter.toString());
        mFilterRuleTF.setText(mFilter.getRule());
    }

    FilterComponent[] fc = FilterComponentList.getInstance().getAvailableFilterComponents();

    Arrays.sort(fc, new FilterComponent.NameComparator());

    for (FilterComponent element : fc) {
        mComponentTableModel.addElement(element);
    }

    updateBtns();

    Settings.layoutWindow("editFilterDlg", this, new Dimension(600, 300));
    setVisible(true);
}

From source file:uk.ac.soton.mib104.t2.activities.json.ui.config.JSONPathConfigurationPanel.java

protected void initGui() {
    this.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    this.setLayout(new GridBagLayout());

    jsonPathAsTextField.setMinimumSize(new Dimension(240, jsonPathAsTextField.getMinimumSize().height));
    jsonPathAsTextField.setPreferredSize(jsonPathAsTextField.getMinimumSize());
    jsonPathAsTextField.setText("");

    jsonPathButton.addActionListener(new ActionListener() {

        @Override/*from  w  w  w .j a va  2  s. c om*/
        public void actionPerformed(final ActionEvent e) {
            final JSONPathInputDialog jsonPathInputDialog = new JSONPathInputDialog(
                    SwingUtilities.getWindowAncestor(JSONPathConfigurationPanel.this));

            final JSONPathInputPanel jsonPathInputPane = jsonPathInputDialog.getJSONPathInputPane();

            jsonPathInputPane.getJSONDocumentEditorPane().setText(jsonPathInputDialog_jsonPathEditorPane_text);

            jsonPathInputPane.getJsonPathEditorPane()
                    .setJSONValue(jsonPathInputDialog_jsonPathEditorPane_value);
            jsonPathInputPane.getJsonPathEditorPane()
                    .setTreeVisible(jsonPathInputDialog_jsonPathEditorPane_treeVisible);
            jsonPathInputPane.getJsonPathEditorPane().setText(jsonPathAsTextField.getText());

            jsonPathInputDialog.setVisible(true);

            switch (jsonPathInputDialog.getOption()) {
            case JOptionPane.OK_OPTION:
                break;
            default:
                return;
            }

            jsonPathInputDialog_jsonPathEditorPane_text = jsonPathInputPane.getJSONDocumentEditorPane()
                    .getText();
            jsonPathInputDialog_jsonPathEditorPane_treeVisible = jsonPathInputPane.getJsonPathEditorPane()
                    .isTreeVisible();
            jsonPathInputDialog_jsonPathEditorPane_value = jsonPathInputPane.getJsonPathEditorPane()
                    .getJSONValue();

            jsonPathAsTextField.setText(jsonPathInputPane.getJsonPathEditorPane().getText());
        }

    });
    jsonPathButton.setFont(jsonPathButton.getFont().deriveFont(11f));
    jsonPathButton.setIcon(JSONPathServiceIcon.getIcon());
    jsonPathButton.setText(jsonPathButtonText);
    jsonPathButton.setToolTipText(jsonPathButtonTip);

    final JLabel portDepthLabel = new JLabel();
    portDepthLabel.setFont(portDepthLabel.getFont().deriveFont(11f));
    portDepthLabel.setHorizontalAlignment(JLabel.LEFT);
    portDepthLabel.setIcon(Silk.getHelpIcon());
    portDepthLabel.setText(portDepthInputPaneText);
    portDepthLabel.setToolTipText(portDepthInputPaneTip);

    final GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 0;

    constraints.anchor = GridBagConstraints.WEST;
    this.add(JSONPathTextField.createLabelForDocument(jsonPathAsTextField.getDocument()), constraints);

    constraints.gridx++;

    constraints.anchor = GridBagConstraints.EAST;
    constraints.weightx = 1d;
    this.add(jsonPathAsTextField, constraints);
    constraints.weightx = 0;

    constraints.gridx++;

    constraints.fill = GridBagConstraints.NONE;
    this.add(jsonPathButton, constraints);

    constraints.gridx--;

    constraints.gridy++;

    constraints.anchor = GridBagConstraints.CENTER;
    this.add(JSONPathTextField.createLabelForDocumentationURI(), constraints);
    constraints.fill = GridBagConstraints.HORIZONTAL;

    constraints.gridx = 0;
    constraints.gridy++;

    constraints.gridwidth = 3;
    this.add(new JSeparator(JSeparator.HORIZONTAL), constraints);
    constraints.gridwidth = 1;

    constraints.gridx = 0;
    constraints.gridy++;

    constraints.anchor = GridBagConstraints.WEST;
    this.add(portDepthLabel, constraints);

    constraints.gridx++;

    constraints.anchor = GridBagConstraints.EAST;
    constraints.gridwidth = 2;
    this.add(portDepthInputPane, constraints);
    constraints.gridwidth = 1;
}

From source file:util.ui.UiUtilities.java

/**
 * Creates a Html EditorPane that holds a HTML-Help Text.
 *
 * Add a Listener if you want to have clickable Links
 *
 * @param html/*w w  w .j  a va2  s  .c om*/
 *          HTML-Text to display
 * @param listener
 *          Link-Listener for this HelpText
 * @param background The color for the background.
 * @return EditorPane that holds a Help Text
 * @since 2.7.2
 */
public static JEditorPane createHtmlHelpTextArea(String html, HyperlinkListener listener, Color background) {
    // Quick "hack". Remove HTML-Code and replace it with Code that includes the
    // correct Font
    if (html.indexOf("<html>") >= 0) {
        html = StringUtils.substringBetween(html, "<html>", "</html>");
    }
    JLabel label = new JLabel();
    Font font = label.getFont();
    html = "<html><div style=\"color:" + UiUtilities.getHTMLColorCode(label.getForeground()) + ";font-family:"
            + font.getName() + "; font-size:" + font.getSize() + ";background-color:rgb(" + background.getRed()
            + "," + background.getGreen() + "," + background.getBlue() + ");\">" + html + "</div></html>";

    final JEditorPane pane = new JEditorPane("text/html", html);
    pane.setBorder(BorderFactory.createEmptyBorder());
    pane.setEditable(false);
    pane.setFont(font);
    pane.setOpaque(false);
    pane.setFocusable(false);

    if (listener != null) {
        pane.addHyperlinkListener(listener);
    }
    return pane;
}

From source file:utybo.branchingstorytree.swing.visuals.AboutDialog.java

@SuppressWarnings("unchecked")
public AboutDialog(OpenBSTGUI parent) {
    super(parent);
    setTitle(Lang.get("about.title"));
    setModalityType(ModalityType.APPLICATION_MODAL);

    JPanel banner = new JPanel(new FlowLayout(FlowLayout.CENTER));
    banner.setBackground(OpenBSTGUI.OPENBST_BLUE);
    JLabel lblOpenbst = new JLabel(new ImageIcon(Icons.getImage("FullLogoWhite", 48)));
    lblOpenbst.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    banner.add(lblOpenbst, "flowx,cell 0 0,alignx center");
    getContentPane().add(banner, BorderLayout.NORTH);

    JPanel pan = new JPanel();
    pan.setLayout(new MigLayout("insets 10, gap 10px", "[grow]", "[][][grow]"));
    getContentPane().add(pan, BorderLayout.CENTER);

    JLabel lblWebsite = new JLabel("https://utybo.github.io/BST/");
    Font f = lblWebsite.getFont();
    @SuppressWarnings("rawtypes")
    Map attrs = f.getAttributes();
    attrs.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
    lblWebsite.setFont(f.deriveFont(attrs));
    lblWebsite.setForeground(OpenBSTGUI.OPENBST_BLUE);
    lblWebsite.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lblWebsite.addMouseListener(new MouseAdapter() {
        @Override//from ww w  .  j av  a2s. co  m
        public void mouseClicked(MouseEvent e) {
            if (Desktop.isDesktopSupported()) {
                try {
                    Desktop.getDesktop().browse(new URL("https://utybo.github.io/BST/").toURI());
                } catch (IOException | URISyntaxException e1) {
                    OpenBST.LOG.warn("Exception when trying to open website", e1);
                }
            }
        }
    });
    pan.add(lblWebsite, "cell 0 0,alignx center");

    JLabel lblVersion = new JLabel(Lang.get("about.version").replace("$v", OpenBST.VERSION));
    pan.add(lblVersion, "flowy,cell 0 1");

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBorder(new LineBorder(pan.getBackground().darker(), 1, false));
    pan.add(scrollPane, "cell 0 2,grow");

    JTextArea textArea = new JTextArea();
    textArea.setMargin(new Insets(5, 5, 5, 5));
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    textArea.setFont(new Font(textArea.getFont().getFontName(), Font.PLAIN, (int) (Icons.getScale() * 11)));

    try (InputStream in = getClass().getResourceAsStream("/utybo/branchingstorytree/swing/about.txt");) {
        textArea.setText(IOUtils.toString(in, StandardCharsets.UTF_8));
    } catch (IOException ex) {
        OpenBST.LOG.warn("Loading about information failed", ex);
    }
    textArea.setEditable(false);
    textArea.setCaretPosition(0);
    scrollPane.setViewportView(textArea);

    JLabel lblTranslatedBy = new JLabel(Lang.get("author"));
    pan.add(lblTranslatedBy, "cell 0 1");

    setSize((int) (Icons.getScale() * 450), (int) (Icons.getScale() * 400));
    setLocationRelativeTo(parent);
}

From source file:VASSAL.launch.ModuleManagerWindow.java

public ModuleManagerWindow() {
    setTitle("VASSAL");
    setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS));

    ApplicationIcons.setFor(this);

    final AbstractAction shutDownAction = new AbstractAction() {
        private static final long serialVersionUID = 1L;

        public void actionPerformed(ActionEvent e) {
            if (!AbstractLaunchAction.shutDown())
                return;

            final Prefs gl = Prefs.getGlobalPrefs();
            try {
                gl.write();//from   w  w w.j ava  2  s . co  m
                gl.close();
            } catch (IOException ex) {
                WriteErrorDialog.error(ex, gl.getFile());
            } finally {
                IOUtils.closeQuietly(gl);
            }

            logger.info("Exiting");
            System.exit(0);
        }
    };
    shutDownAction.putValue(Action.NAME, Resources.getString(Resources.QUIT));

    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            shutDownAction.actionPerformed(null);
        }
    });

    // setup menubar and actions
    final MenuManager mm = MenuManager.getInstance();
    final MenuBarProxy mb = mm.getMenuBarProxyFor(this);

    // file menu
    final MenuProxy fileMenu = new MenuProxy(Resources.getString("General.file"));
    fileMenu.setMnemonic(Resources.getString("General.file.shortcut").charAt(0));

    fileMenu.add(mm.addKey("Main.play_module"));
    fileMenu.add(mm.addKey("Main.edit_module"));
    fileMenu.add(mm.addKey("Main.new_module"));
    fileMenu.add(mm.addKey("Main.import_module"));
    fileMenu.addSeparator();

    if (!SystemUtils.IS_OS_MAC_OSX) {
        fileMenu.add(mm.addKey("Prefs.edit_preferences"));
        fileMenu.addSeparator();
        fileMenu.add(mm.addKey("General.quit"));
    }

    // tools menu
    final MenuProxy toolsMenu = new MenuProxy(Resources.getString("General.tools"));

    // Initialize Global Preferences
    Prefs.getGlobalPrefs().getEditor().initDialog(this);
    Prefs.initSharedGlobalPrefs();

    final BooleanConfigurer serverStatusConfig = new BooleanConfigurer(SHOW_STATUS_KEY, null, Boolean.FALSE);
    Prefs.getGlobalPrefs().addOption(null, serverStatusConfig);

    dividerLocationConfig = new IntConfigurer(DIVIDER_LOCATION_KEY, null, -10);
    Prefs.getGlobalPrefs().addOption(null, dividerLocationConfig);

    toolsMenu.add(new CheckBoxMenuItemProxy(new AbstractAction(Resources.getString("Chat.server_status")) {
        private static final long serialVersionUID = 1L;

        public void actionPerformed(ActionEvent e) {
            serverStatusView.toggleVisibility();
            serverStatusConfig.setValue(serverStatusConfig.booleanValue() ? Boolean.FALSE : Boolean.TRUE);
            if (serverStatusView.isVisible()) {
                setDividerLocation(getPreferredDividerLocation());
            }
        }
    }, serverStatusConfig.booleanValue()));

    // help menu
    final MenuProxy helpMenu = new MenuProxy(Resources.getString("General.help"));
    helpMenu.setMnemonic(Resources.getString("General.help.shortcut").charAt(0));

    helpMenu.add(mm.addKey("General.help"));
    helpMenu.add(mm.addKey("Main.tour"));
    helpMenu.addSeparator();
    helpMenu.add(mm.addKey("UpdateCheckAction.update_check"));
    helpMenu.add(mm.addKey("Help.error_log"));

    if (!SystemUtils.IS_OS_MAC_OSX) {
        helpMenu.addSeparator();
        helpMenu.add(mm.addKey("AboutScreen.about_vassal"));
    }

    mb.add(fileMenu);
    mb.add(toolsMenu);
    mb.add(helpMenu);

    // add actions
    mm.addAction("Main.play_module", new Player.PromptLaunchAction(this));
    mm.addAction("Main.edit_module", new Editor.PromptLaunchAction(this));
    mm.addAction("Main.new_module", new Editor.NewModuleLaunchAction(this));
    mm.addAction("Main.import_module", new Editor.PromptImportLaunchAction(this));
    mm.addAction("Prefs.edit_preferences", Prefs.getGlobalPrefs().getEditor().getEditAction());
    mm.addAction("General.quit", shutDownAction);

    URL url = null;
    try {
        url = new File(Documentation.getDocumentationBaseDir(), "README.html").toURI().toURL();
    } catch (MalformedURLException e) {
        ErrorDialog.bug(e);
    }
    mm.addAction("General.help", new ShowHelpAction(url, null));

    mm.addAction("Main.tour", new LaunchTourAction(this));
    mm.addAction("AboutScreen.about_vassal", new AboutVASSALAction(this));
    mm.addAction("UpdateCheckAction.update_check", new UpdateCheckAction(this));
    mm.addAction("Help.error_log", new ShowErrorLogAction(this));

    setJMenuBar(mm.getMenuBarFor(this));

    // Load Icons
    moduleIcon = new ImageIcon(getClass().getResource("/images/mm-module.png"));
    activeExtensionIcon = new ImageIcon(getClass().getResource("/images/mm-extension-active.png"));
    inactiveExtensionIcon = new ImageIcon(getClass().getResource("/images/mm-extension-inactive.png"));
    openGameFolderIcon = new ImageIcon(getClass().getResource("/images/mm-gamefolder-open.png"));
    closedGameFolderIcon = new ImageIcon(getClass().getResource("/images/mm-gamefolder-closed.png"));
    fileIcon = new ImageIcon(getClass().getResource("/images/mm-file.png"));

    // build module controls
    final JPanel moduleControls = new JPanel(new BorderLayout());
    modulePanelLayout = new CardLayout();
    moduleView = new JPanel(modulePanelLayout);
    buildTree();
    final JScrollPane scroll = new JScrollPane(tree);
    moduleView.add(scroll, "modules");

    final JEditorPane l = new JEditorPane("text/html", Resources.getString("ModuleManager.quickstart"));
    l.setEditable(false);

    // Try to get background color and font from LookAndFeel;
    // otherwise, use dummy JLabel to get color and font.
    Color bg = UIManager.getColor("control");
    Font font = UIManager.getFont("Label.font");

    if (bg == null || font == null) {
        final JLabel dummy = new JLabel();
        if (bg == null)
            bg = dummy.getBackground();
        if (font == null)
            font = dummy.getFont();
    }

    l.setBackground(bg);
    ((HTMLEditorKit) l.getEditorKit()).getStyleSheet()
            .addRule("body { font: " + font.getFamily() + " " + font.getSize() + "pt }");

    l.addHyperlinkListener(BrowserSupport.getListener());

    // FIXME: use MigLayout for this!
    // this is necessary to get proper vertical alignment
    final JPanel p = new JPanel(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.CENTER;
    p.add(l, c);

    moduleView.add(p, "quickStart");
    modulePanelLayout.show(moduleView, getModuleCount() == 0 ? "quickStart" : "modules");
    moduleControls.add(moduleView, BorderLayout.CENTER);
    moduleControls.setBorder(new TitledBorder(Resources.getString("ModuleManager.recent_modules")));

    add(moduleControls);

    // build server status controls
    final ServerStatusView serverStatusControls = new ServerStatusView(new CgiServerStatus());
    serverStatusControls.setBorder(new TitledBorder(Resources.getString("Chat.server_status")));

    serverStatusView = new ComponentSplitter().splitRight(moduleControls, serverStatusControls, false);
    serverStatusView.revalidate();

    // show the server status controls according to the prefs
    if (serverStatusConfig.booleanValue()) {
        serverStatusView.showComponent();
    }

    setDividerLocation(getPreferredDividerLocation());
    serverStatusView.addPropertyChangeListener("dividerLocation", new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            setPreferredDividerLocation((Integer) e.getNewValue());
        }
    });

    final Rectangle r = Info.getScreenBounds(this);
    serverStatusControls.setPreferredSize(new Dimension((int) (r.width / 3.5), 0));

    setSize(3 * r.width / 4, 3 * r.height / 4);

    // Save/load the window position and size in prefs
    final PositionOption option = new PositionOption(PositionOption.key + "ModuleManager", this);
    Prefs.getGlobalPrefs().addOption(option);
}

From source file:xtrememp.XtremeMP.java

protected void createPanels() {
    JPanel framePanel = new JPanel(new MigLayout("fill"));

    mainPanel = new JPanel(new CardLayout());
    playlistManager = new PlaylistManager(this);
    visualizationManager = new VisualizationManager(audioPlayer.getDSS());
    if (Settings.getLastView().equals(Utilities.VISUALIZATION_PANEL)) {
        visualizationManager.setDssEnabled(true);
        mainPanel.add(visualizationManager, Utilities.VISUALIZATION_PANEL);
        mainPanel.add(playlistManager, Utilities.PLAYLIST_MANAGER);
        visualizationMenuItem.setSelected(true);
    } else {//from  ww  w .  j  a  va2s  .  c om
        mainPanel.add(playlistManager, Utilities.PLAYLIST_MANAGER);
        mainPanel.add(visualizationManager, Utilities.VISUALIZATION_PANEL);
        playlistManagerMenuItem.setSelected(true);
    }
    framePanel.add(mainPanel, "grow");

    JPanel southPanel = new JPanel(new MigLayout("fill", "[center]"));
    SubstanceLookAndFeel.setDecorationType(southPanel, DecorationAreaType.TOOLBAR);
    seekSlider = new SeekSlider(this);
    seekSlider.setEnabled(false);
    southPanel.add(seekSlider, "north, gap 4 4 1 0");

    controlPanel = new JPanel(new MigLayout("gap 0, ins 0", "[center]"));
    controlPanel.setOpaque(false);
    stopButton = new StopButton();
    stopButton.setEnabled(false);
    stopButton.addActionListener(this);
    controlPanel.add(stopButton);
    previousButton = new PreviousButton();
    previousButton.setEnabled(false);
    previousButton.addActionListener(this);
    controlPanel.add(previousButton);
    playPauseButton = new PlayPauseButton();
    playPauseButton.addActionListener(this);
    controlPanel.add(playPauseButton, "height pref!");
    nextButton = new NextButton();
    nextButton.setEnabled(false);
    nextButton.addActionListener(this);
    controlPanel.add(nextButton);
    volumeButton = new VolumeButton(Utilities.MIN_GAIN, Utilities.MAX_GAIN, Settings.getGain(),
            Settings.isMuted());
    volumeButton.addMouseWheelListener((MouseWheelEvent e) -> {
        try {
            int volumeValue = volumeSlider.getValue() - 5 * e.getWheelRotation();
            int volumeMin = volumeSlider.getMinimum();
            int volumeMax = volumeSlider.getMaximum();
            if (volumeValue < volumeMin) {
                volumeValue = volumeMin;
            } else if (volumeValue > volumeMax) {
                volumeValue = volumeMax;
            }
            volumeButton.setVolumeIcon(volumeValue);
            volumeSlider.setValue(volumeValue);
            audioPlayer.setGain(volumeValue / 100.0F);
            Settings.setGain(volumeValue);
        } catch (PlayerException ex) {
            logger.debug(ex.getMessage(), ex);
        }
    });
    JPopupMenu volumePopupMenu = volumeButton.getPopupMenu();
    volumeSlider = new JSlider(JSlider.VERTICAL, Utilities.MIN_GAIN, Utilities.MAX_GAIN, Settings.getGain());
    volumeSlider.setMajorTickSpacing(25);
    volumeSlider.setMinorTickSpacing(5);
    volumeSlider.setPaintTicks(true);
    volumeSlider.setPaintLabels(true);
    volumeSlider.addChangeListener((ChangeEvent e) -> {
        if (volumeSlider.getValueIsAdjusting()) {
            try {
                int volumeValue = volumeSlider.getValue();
                volumeButton.setVolumeIcon(volumeValue);
                audioPlayer.setGain(volumeValue / 100.0F);
                Settings.setGain(volumeValue);
            } catch (PlayerException ex) {
                logger.debug(ex.getMessage(), ex);
            }
        }
    });
    volumeSlider.setEnabled(!Settings.isMuted());
    JPanel volumePanel = new JPanel(new MigLayout("fill"));
    JLabel volumeLabel = new JLabel(tr("MainFrame.Menu.Player.Volume"), JLabel.CENTER);
    volumeLabel.setFont(volumeLabel.getFont().deriveFont(Font.BOLD));
    volumePanel.add(volumeLabel, "north");
    volumePanel.add(volumeSlider);
    JCheckBox muteCheckBox = new JCheckBox(tr("MainFrame.Menu.Player.Mute"));
    muteCheckBox.setSelected(Settings.isMuted());
    muteCheckBox.addItemListener((ItemEvent e) -> {
        try {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                volumeSlider.setEnabled(false);
                volumeButton.setVolumeMutedIcon();
                audioPlayer.setMuted(true);
                Settings.setMuted(true);
            } else {
                volumeSlider.setEnabled(true);
                volumeButton.setVolumeIcon(Settings.getGain());
                audioPlayer.setMuted(false);
                Settings.setMuted(false);
            }
        } catch (PlayerException ex) {
            logger.debug(ex.getMessage(), ex);
        }
    });
    volumePanel.add(muteCheckBox, "south");
    volumePopupMenu.add(volumePanel);
    controlPanel.add(volumeButton);
    southPanel.add(controlPanel, "gap 0 0 2 5");

    JPanel statusBar = new JPanel(new MigLayout("ins 2 0 2 0"));
    SubstanceLookAndFeel.setDecorationType(statusBar, DecorationAreaType.FOOTER);
    timeLabel = new JLabel(Utilities.ZERO_TIMER);
    timeLabel.setFont(timeLabel.getFont().deriveFont(Font.BOLD));
    statusBar.add(timeLabel, "gap 6 6 0 0, west");
    statusBar.add(new JSeparator(SwingConstants.VERTICAL), "hmin 16");
    statusLabel = new JLabel();
    statusBar.add(statusLabel, "gap 0 2 0 0, wmin 0, push");
    statusBar.add(new JSeparator(SwingConstants.VERTICAL), "hmin 16");
    playModeLabel = new JLabel();
    playModeLabel.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            Playlist.PlayMode[] playModes = Playlist.PlayMode.values();
            Playlist.PlayMode playMode = playlist.getPlayMode();
            int ordinal = playMode.ordinal();
            playlist.setPlayMode(playModes[(ordinal == playModes.length - 1) ? 0 : ordinal + 1]);
        }
    });
    statusBar.add(playModeLabel, "east, gap 2 2 2 2, width 18!, height 18!");
    southPanel.add(statusBar, "south");
    framePanel.add(southPanel, "south");
    mainFrame.setContentPane(framePanel);
}