Example usage for javax.swing UIManager getColor

List of usage examples for javax.swing UIManager getColor

Introduction

In this page you can find the example usage for javax.swing UIManager getColor.

Prototype

public static Color getColor(Object key) 

Source Link

Document

Returns a color from the defaults.

Usage

From source file:com.archivas.clienttools.arcmover.gui.panels.ProfilePanel.java

private void initGuiComponents() {
    fileListModel = new FileListTableModel();
    fileList = new FileListTable(fileListModel);
    fileList.addKeyListener(new KeyAdapter() {
        @Override/*from w ww . jav a2  s  .c  om*/
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                openSelectedFile();
                e.consume();
            }
        }
    });
    fileList.setAutoCreateColumnsFromModel(true);
    fileList.setDropMode(DropMode.ON_OR_INSERT_ROWS);
    fileList.setFillsViewportHeight(true);
    fileList.setGridColor(new Color(-1));

    fileListScrollPane = new JScrollPane(fileList);
    fileListScrollPane.setAutoscrolls(false);
    fileListScrollPane.setBackground(UIManager.getColor("TableHeader.background"));
    fileListScrollPane.setPreferredSize(new Dimension(100, 128));
    fileListScrollPane.setEnabled(false);

    //
    // toolbar
    //

    final JToolBar toolBar1 = new JToolBar();
    toolBar1.setBorderPainted(false);
    toolBar1.setFloatable(false);
    toolBar1.setRollover(true);
    toolBar1.putClientProperty("JToolBar.isRollover", Boolean.TRUE);

    homeDirectoryButton = new JButton();
    homeDirectoryButton.setHorizontalAlignment(2);
    homeDirectoryButton.setIcon(GUIHelper.HOME_ICON);
    homeDirectoryButton.setMargin(new Insets(3, 3, 3, 3));
    homeDirectoryButton.setText("");
    homeDirectoryButton.setToolTipText("Go to home directory");
    homeDirectoryButton.setEnabled(false);
    toolBar1.add(homeDirectoryButton);

    refreshButton = new JButton();
    refreshButton.setHorizontalAlignment(2);
    refreshButton.setIcon(new ImageIcon(getClass().getResource("/images/refresh.gif")));
    refreshButton.setMargin(new Insets(3, 3, 3, 3));
    refreshButton.setText("");
    refreshButton.setToolTipText("Refresh current directory listing");
    refreshButton.setEnabled(false);
    toolBar1.add(refreshButton);

    upDirectoryButton = new JButton();
    upDirectoryButton.setHideActionText(false);
    upDirectoryButton.setHorizontalAlignment(2);
    upDirectoryButton.setIcon(GUIHelper.UP_DIR_ICON);
    upDirectoryButton.setMargin(new Insets(3, 3, 3, 3));
    upDirectoryButton.setToolTipText("Up");
    upDirectoryButton.setEnabled(false);
    toolBar1.add(upDirectoryButton);

    browseDirectoryButton = new JButton();
    browseDirectoryButton.setHideActionText(false);
    browseDirectoryButton.setHorizontalAlignment(2);
    browseDirectoryButton.setIcon(GUIHelper.DIRECTORY_ICON);
    browseDirectoryButton.setMargin(new Insets(3, 3, 3, 3));
    browseDirectoryButton.setToolTipText(BROWSE_LFS_TEXT);
    browseDirectoryButton.setEnabled(false);
    toolBar1.add(browseDirectoryButton);

    profileModel = new ProfileComboBoxModel();
    profileSelectionCombo = new JComboBox(profileModel);
    profileSelectionCombo.setEnabled(false);
    profileSelectionCombo.setToolTipText("Select a namespace profile");
    profileSelectionCombo.setPrototypeDisplayValue("#");

    pathCombo = new JComboBox();
    pathCombo.setEditable(false);
    pathCombo.setEnabled(false);
    pathCombo.setToolTipText("Current directory path");
    pathCombo.setPrototypeDisplayValue("#");

    sslButton = new JButton();
    sslButton.setAlignmentY(0.0f);
    sslButton.setBorderPainted(false);
    sslButton.setHorizontalAlignment(2);
    sslButton.setHorizontalTextPosition(11);
    sslButton.setIcon(new ImageIcon(getClass().getResource("/images/lockedstate.gif")));
    sslButton.setMargin(new Insets(0, 0, 0, 0));
    sslButton.setMaximumSize(new Dimension(20, 20));
    sslButton.setMinimumSize(new Dimension(20, 20));
    sslButton.setPreferredSize(new Dimension(20, 20));
    sslButton.setText("");
    sslButton.setToolTipText("View certificate");
    sslButton.setEnabled(false);

    //
    // profile and toolbar buttons
    //
    JPanel profileAndToolbarPanel = new FixedHeightPanel();
    profileAndToolbarPanel.setLayout(new BoxLayout(profileAndToolbarPanel, BoxLayout.X_AXIS));
    profileAndToolbarPanel.add(profileSelectionCombo);
    profileAndToolbarPanel.add(Box.createHorizontalStrut(25));
    profileAndToolbarPanel.add(toolBar1);

    //
    // Path & SSLCert button
    //
    JPanel pathPanel = new FixedHeightPanel();
    pathPanel.setLayout(new BoxLayout(pathPanel, BoxLayout.X_AXIS));
    pathCombo.setAlignmentY(CENTER_ALIGNMENT);
    pathPanel.add(pathCombo);
    pathPanel.add(Box.createHorizontalStrut(5));
    sslButton.setAlignmentY(CENTER_ALIGNMENT);
    pathPanel.add(sslButton);

    //
    // Put it all together
    //
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(profileAndToolbarPanel);
    add(Box.createVerticalStrut(5));
    add(pathPanel);
    add(Box.createVerticalStrut(5));
    add(fileListScrollPane);
    setBorder(new EmptyBorder(12, 12, 12, 12));
}

From source file:aplicarFiltros.PanelResultado.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Sebastian Colavita
    DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance();
    panel2 = new JPanel();
    panel1 = new JPanel();
    scrollPaneRasgos2 = new JScrollPane();
    tableRasgos2 = new JTable();
    button1 = new JButton();
    separator1 = compFactory.createSeparator("Clasificaci\u00f3n");
    label1 = new JLabel();
    resultado = new JLabel();
    label2 = new JLabel();
    Descuento = new JLabel();
    panel3 = new JPanel();
    panelGraficoPixel = new JPanel();

    //======== this ========

    // JFormDesigner evaluation mark
    setBorder(/*from   w  w w  .  j a va 2 s  .com*/
            new javax.swing.border.CompoundBorder(
                    new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                            "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                            javax.swing.border.TitledBorder.BOTTOM,
                            new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red),
                    getBorder()));
    addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent e) {
            if ("border".equals(e.getPropertyName()))
                throw new RuntimeException();
        }
    });

    setLayout(null);

    //======== panel2 ========
    {
        panel2.setBackground(Color.blue);
        panel2.setLayout(null);

        //======== panel1 ========
        {
            panel1.setBorder(new BevelBorder(BevelBorder.RAISED));
            panel1.setLayout(null);

            //======== scrollPaneRasgos2 ========
            {

                //---- tableRasgos2 ----
                tableRasgos2.setModel(new DefaultTableModel(new Object[][] {},
                        new String[] { "Clasificaciones", "Cantidad", "Porcentaje Area" }) {
                    Class<?>[] columnTypes = new Class<?>[] { String.class, String.class, Object.class };

                    @Override
                    public Class<?> getColumnClass(int columnIndex) {
                        return columnTypes[columnIndex];
                    }
                });
                tableRasgos2.setPreferredScrollableViewportSize(new Dimension(200, 100));
                tableRasgos2.setBackground(UIManager.getColor("RadioButton.light"));
                tableRasgos2.setCellSelectionEnabled(true);
                scrollPaneRasgos2.setViewportView(tableRasgos2);
            }
            panel1.add(scrollPaneRasgos2);
            scrollPaneRasgos2.setBounds(10, 60, 605, 155);

            //---- button1 ----
            button1.setIcon(new ImageIcon("\\\\img\\\\maiz_mon810_al.jpg"));
            panel1.add(button1);
            button1.setBounds(620, 60, 225, 155);
            panel1.add(separator1);
            separator1.setBounds(10, 5, 835, separator1.getPreferredSize().height);

            //---- label1 ----
            label1.setText("Resultado:");
            label1.setFont(new Font("Times New Roman", Font.BOLD, 13));
            panel1.add(label1);
            label1.setBounds(10, 35, 67, label1.getPreferredSize().height);

            //---- resultado ----
            resultado.setText("Grado A");
            resultado.setFont(new Font("Times New Roman", Font.BOLD, 13));
            resultado.setForeground(Color.blue);
            panel1.add(resultado);
            resultado.setBounds(79, 35, 171, 19);

            //---- label2 ----
            label2.setText(" Descuento:");
            label2.setFont(new Font("Times New Roman", Font.BOLD, 13));
            panel1.add(label2);
            label2.setBounds(250, 35, 72, 19);

            //---- Descuento ----
            Descuento.setText("10%");
            Descuento.setFont(new Font("Times New Roman", Font.BOLD, 13));
            Descuento.setForeground(Color.blue);
            panel1.add(Descuento);
            Descuento.setBounds(320, 35, 60, Descuento.getPreferredSize().height);

            { // compute preferred size
                Dimension preferredSize = new Dimension();
                for (int i = 0; i < panel1.getComponentCount(); i++) {
                    Rectangle bounds = panel1.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = panel1.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                panel1.setMinimumSize(preferredSize);
                panel1.setPreferredSize(preferredSize);
            }
        }
        panel2.add(panel1);
        panel1.setBounds(15, 10, 856, 225);

        //======== panel3 ========
        {
            panel3.setBorder(new TitledBorder("Gr\u00e1ficos"));
            panel3.setLayout(new BoxLayout(panel3, BoxLayout.Y_AXIS));

            //======== panelGraficoPixel ========
            {
                panelGraficoPixel.setLayout(null);

                { // compute preferred size
                    Dimension preferredSize = new Dimension();
                    for (int i = 0; i < panelGraficoPixel.getComponentCount(); i++) {
                        Rectangle bounds = panelGraficoPixel.getComponent(i).getBounds();
                        preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                        preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                    }
                    Insets insets = panelGraficoPixel.getInsets();
                    preferredSize.width += insets.right;
                    preferredSize.height += insets.bottom;
                    panelGraficoPixel.setMinimumSize(preferredSize);
                    panelGraficoPixel.setPreferredSize(preferredSize);
                }
            }
            panel3.add(panelGraficoPixel);
        }
        panel2.add(panel3);
        panel3.setBounds(13, 245, 857, 355);

        { // compute preferred size
            Dimension preferredSize = new Dimension();
            for (int i = 0; i < panel2.getComponentCount(); i++) {
                Rectangle bounds = panel2.getComponent(i).getBounds();
                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
            }
            Insets insets = panel2.getInsets();
            preferredSize.width += insets.right;
            preferredSize.height += insets.bottom;
            panel2.setMinimumSize(preferredSize);
            panel2.setPreferredSize(preferredSize);
        }
    }
    add(panel2);
    panel2.setBounds(10, 5, 883, 610);

    { // compute preferred size
        Dimension preferredSize = new Dimension();
        for (int i = 0; i < getComponentCount(); i++) {
            Rectangle bounds = getComponent(i).getBounds();
            preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
            preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
        }
        Insets insets = getInsets();
        preferredSize.width += insets.right;
        preferredSize.height += insets.bottom;
        setMinimumSize(preferredSize);
        setPreferredSize(preferredSize);
    }
    // JFormDesigner - End of component initialization  //GEN-END:initComponents

    button1.setIcon(new ImageIcon("img\\maiz_mon810_al.jpg"));
}

From source file:edu.ku.brc.specify.tasks.ExpressSearchTask.java

/**
 * Performs the express search and returns the results.
 *///from   w  w  w  .  j  av  a  2s. co  m
protected void doQuery() {
    sqlHasResults = false;

    if (true) {
        searchText.setBackground(textBGColor);
        searchText.setForeground(UIManager.getColor("TextField.foreground"));

        String searchTerm = searchText.getText();
        if (isNotEmpty(searchTerm)) {
            if (searchTerm.length() == 2 && (searchTerm.endsWith("*") || searchTerm.startsWith("*"))) {
                UIRegistry.showLocalizedError("ExpressSearchTask.NO_SINGLE_CHAR");

            } else if (QueryAdjusterForDomain.getInstance()
                    .isUserInputNotInjectable(searchTerm.toLowerCase())) {
                boolean isOK = true;
                if (searchTerm.startsWith("*") && searchTerm.endsWith("*") && searchTerm.length() > 3) {
                    int inx = searchTerm.length() - 2;
                    if (searchTerm.indexOf(' ', 2) > 1 && searchTerm.lastIndexOf(' ') < searchTerm.length() - 2
                            && searchTerm.charAt(1) != '"' && searchTerm.charAt(1) != '\''
                            && searchTerm.charAt(1) != '`' && searchTerm.charAt(inx) != '"'
                            && searchTerm.charAt(inx) != '\'' && searchTerm.charAt(inx) != '`') {
                        JLabel label = UIHelper.createI18NLabel("ExpressSearchTask.MISSING_QUOTES");
                        PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "f:p:g"));
                        pb.add(label, (new CellConstraints()).xy(1, 1));
                        pb.setDefaultDialogBorder();
                        CustomDialog dlg = new CustomDialog((Frame) UIRegistry.getMostRecentWindow(),
                                getResourceString("HINT"), true, pb.getPanel());
                        dlg.setOkLabel(getResourceString("ExpressSearchTask.SRCH_ANYWAY"));
                        dlg.setCancelLabel(getResourceString("ExpressSearchTask.DNT_SRCH"));
                        dlg.setVisible(true);
                        isOK = !dlg.isCancelled();
                    }
                }

                if (isOK) {
                    ESResultsSubPane expressSearchPane = new ESResultsSubPane(searchTerm, this, true);
                    if (!doQuery(searchText, null, expressSearchPane)) {
                        setUserInputToNotFound("BAD_SEARCH_TERMS", true);

                    } else {
                        AppPreferences.getLocalPrefs().put(getLastSearchKey(), searchTerm);
                    }
                }

            } else {
                setUserInputToNotFound("ES_SUSPICIOUS_SQL", true);
            }
        }
    } else {
        String searchTerm = searchText.getText();

        ExplorerESPanel explorerSearch = new ExplorerESPanel();

        doQuery(searchTerm, explorerSearch);

        explorerSearch.done();
    }
}

From source file:com.projity.contrib.calendar.JXXMonthView.java

/**
 * Resets the UI property to a value from the current look and feel.
 *///w  w  w. j av a2 s .  c  o  m
public void updateUI() {
    super.updateUI();

    String[] daysOfTheWeek = (String[]) UIManager.get("JXMonthView.daysOfTheWeek");
    // Use some meaningful default if the UIManager doesn't have anything
    // for us.
    //      PROJITY_MODIFICATION
    int w0 = 0;
    int w1 = 1;
    if (isChinese()) {
        w0 = 2;
        w1 = 3;
    }

    if (daysOfTheWeek == null) {
        daysOfTheWeek = new String[DAYS_IN_WEEK];
        Calendar weekCal = calendarInstance();
        SimpleDateFormat format = dateFormatInstance("E");
        for (int i = 0; i < DAYS_IN_WEEK; i++) {
            weekCal.set(Calendar.DAY_OF_WEEK, i + 1);
            daysOfTheWeek[i] = format.format(weekCal.getTime()).substring(w0, w1).toUpperCase();
        }

        //         daysOfTheWeek = new String[] { "S", "M", "T", "W", "T", "F", "S" };
    }
    setDaysOfTheWeek(daysOfTheWeek);

    Color color = UIManager.getColor("JXMonthView.monthStringBackground");
    // Use some meaningful default if the UIManager doesn't have anything
    // for us.
    if (color == null) {
        color = Color.WHITE;//PROJITY_MODIFICATION
    }
    setMonthStringBackground(color);

    color = UIManager.getColor("JXMonthView.selectedBackground");
    // Use some meaningful default if the UIManager doesn't have anything
    // for us.
    if (color == null) {
        color = Color.LIGHT_GRAY;
    }
    setSelectedBackground(color);
}

From source file:logdruid.ui.DateEditor.java

/**
 * Create the panel.//  ww  w.j ava 2s  .c  o  m
 */
public DateEditor(Repository rep) {
    repository = rep;
    model = new MyTableModel2(data, header);

    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 15, 550, 15 };
    gridBagLayout.rowHeights = new int[] { 152, 300 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0, 0.0 };
    gridBagLayout.rowWeights = new double[] { 0.0, 1.0 };
    setLayout(gridBagLayout);

    JPanel panel_1 = new JPanel();
    GridBagConstraints gbc_panel_1 = new GridBagConstraints();
    gbc_panel_1.fill = GridBagConstraints.BOTH;
    gbc_panel_1.insets = new Insets(5, 0, 5, 5);
    gbc_panel_1.gridx = 1;
    gbc_panel_1.gridy = 0;
    add(panel_1, gbc_panel_1);
    panel_1.setLayout(new BorderLayout(0, 0));

    table = new JTable(model);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setBorder(UIManager.getBorder("TextPane.border"));
    table.setPreferredScrollableViewportSize(new Dimension(0, 0));
    table.setFillsViewportHeight(true);

    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            // ((table.getSelectedRow()!=-1)?table.convertRowIndexToModel(table.getSelectedRow()):-1)
            // persist repository
            // display selected row

            if (((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1) >= 0) {
                /*
                 * recEditor = new RecordingEditor(repository
                 * .getRecordings().get(((table.getSelectedRow()!=-1)?table.
                 * convertRowIndexToModel(table.getSelectedRow()):-1)),
                 * repository); jPanelDetail.removeAll();
                 */
                // jPanelDetail.add(recEditor, gbc_jPanelDetail);
                DateFormat df = repository.getDateFormat(
                        ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                                : -1));
                if (df != null) {
                    textFieldName.setText((String) df.getName());
                    textFieldPattern.setText((String) df.getPattern());
                    textField.setText((String) df.getDateFormat());
                }
                // jPanelDetail.revalidate();
                // jPanelDetail.repaint();
                // jPanelDetail.setVisible(true);
                // reloadTable(); those 2 ********
                // jPanelDetail.revalidate();
            }
        }
    });

    JScrollPane scrollPane = new JScrollPane(table);
    panel_1.add(scrollPane, BorderLayout.CENTER);
    // Set up column sizes.
    initColumnSizes(table);

    JPanel panel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) panel.getLayout();
    flowLayout.setAlignment(FlowLayout.LEFT);
    flowLayout.setVgap(2);
    flowLayout.setHgap(2);
    panel_1.add(panel, BorderLayout.SOUTH);

    JButton btnNew = new JButton("New");
    panel.add(btnNew);
    btnNew.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            DateFormat df = new DateFormat("name", "\\w{3}\\s[0-9]{1}/[0-9]{2}/[0-9]{2}\\s\\d\\d:\\d\\d:\\d\\d",
                    "EEE. MM/dd/yy HH:mm:ss");
            repository.addDateFormat(df);
            data.add(new Object[] { df.getName(), df.getPattern(), df.getDateFormat() });
            table.repaint();
        }
    });

    JButton btnDuplicate = new JButton("Duplicate");
    btnDuplicate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1) >= 0) {
                DateFormat df = repository.getDateFormat(
                        ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                                : -1));
                repository.addDateFormat(df);
                reloadTable();
                // data.add(new Object[] { table.getRowCount()+1,
                // df.getName(),df.getDateFormat()});
                table.repaint();
            }
        }
    });
    panel.add(btnDuplicate);

    JButton btnDelete = new JButton("Delete");
    btnDelete.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int selectedRow = ((table.getSelectedRow() != -1)
                    ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1);
            if (selectedRow >= 0) {
                repository.deleteDateFormat(
                        ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                                : -1));
                data.remove(
                        ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                                : -1));
                reloadTable();
                table.setRowSelectionInterval(selectedRow, selectedRow);
                table.repaint();
            }
        }
    });
    panel.add(btnDelete);

    jPanelDetail = new JPanel();
    gbc_jPanelDetail = new GridBagConstraints();
    gbc_jPanelDetail.anchor = GridBagConstraints.NORTH;
    gbc_jPanelDetail.fill = GridBagConstraints.HORIZONTAL;
    gbc_jPanelDetail.gridx = 1;
    gbc_jPanelDetail.gridy = 1;
    add(jPanelDetail, gbc_jPanelDetail);
    GridBagLayout gbl_jPanelDetail = new GridBagLayout();
    gbl_jPanelDetail.columnWidths = new int[] { 169 };
    gbl_jPanelDetail.rowHeights = new int[] { 0, 0, 0, 0, 150, 0 };
    gbl_jPanelDetail.columnWeights = new double[] { 1.0, 0.0 };
    gbl_jPanelDetail.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 1.0, 0.0 };
    jPanelDetail.setLayout(gbl_jPanelDetail);

    JPanel panel_2 = new JPanel();
    panel_2.setBorder(null);
    GridBagConstraints gbc_panel_2 = new GridBagConstraints();
    gbc_panel_2.gridwidth = 2;
    gbc_panel_2.anchor = GridBagConstraints.NORTHWEST;
    gbc_panel_2.insets = new Insets(0, 0, 5, 0);
    gbc_panel_2.gridx = 0;
    gbc_panel_2.gridy = 0;
    jPanelDetail.add(panel_2, gbc_panel_2);
    panel_2.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));

    JLabel label = new JLabel("Name");
    panel_2.add(label);

    textFieldName = new JTextField();
    textFieldName.setColumns(20);
    panel_2.add(textFieldName);

    JPanel panel_3 = new JPanel();
    FlowLayout flowLayout_1 = (FlowLayout) panel_3.getLayout();
    flowLayout_1.setAlignment(FlowLayout.LEFT);
    panel_3.setBorder(null);
    GridBagConstraints gbc_panel_3 = new GridBagConstraints();
    gbc_panel_3.insets = new Insets(0, 0, 5, 0);
    gbc_panel_3.gridwidth = 2;
    gbc_panel_3.anchor = GridBagConstraints.NORTHWEST;
    gbc_panel_3.gridx = 0;
    gbc_panel_3.gridy = 1;
    jPanelDetail.add(panel_3, gbc_panel_3);

    labelPattern = new JLabel("Pattern");
    panel_3.add(labelPattern);

    textFieldPattern = new JTextField();
    textFieldPattern.setColumns(40);
    panel_3.add(textFieldPattern);

    JButton btnSave = new JButton("Save");
    btnSave.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            DateFormat df1 = repository.getDateFormat(
                    ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                            : -1));
            df1.update(textFieldName.getText(), textFieldPattern.getText(), textField.getText());
            reloadTable();
        }
    });

    JPanel panel_4 = new JPanel();
    FlowLayout flowLayout_2 = (FlowLayout) panel_4.getLayout();
    flowLayout_2.setAlignment(FlowLayout.LEFT);
    GridBagConstraints gbc_panel_4 = new GridBagConstraints();
    gbc_panel_4.anchor = GridBagConstraints.WEST;
    gbc_panel_4.insets = new Insets(0, 0, 5, 5);
    gbc_panel_4.gridx = 0;
    gbc_panel_4.gridy = 2;
    jPanelDetail.add(panel_4, gbc_panel_4);

    JLabel lblFastDateFormat = new JLabel("FastDateFormat");
    panel_4.add(lblFastDateFormat);

    textField = new JTextField();
    panel_4.add(textField);
    textField.setColumns(30);

    JPanel panel_5 = new JPanel();
    FlowLayout flowLayout_3 = (FlowLayout) panel_5.getLayout();
    flowLayout_3.setAlignment(FlowLayout.LEFT);
    GridBagConstraints gbc_panel_5 = new GridBagConstraints();
    gbc_panel_5.insets = new Insets(0, 0, 5, 5);
    gbc_panel_5.fill = GridBagConstraints.BOTH;
    gbc_panel_5.gridx = 0;
    gbc_panel_5.gridy = 3;
    jPanelDetail.add(panel_5, gbc_panel_5);

    JLabel lblSampleLabel = new JLabel("Sample");
    panel_5.add(lblSampleLabel);

    JPanel panel_6 = new JPanel();
    panel_6.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_panel_6 = new GridBagConstraints();
    gbc_panel_6.ipady = 1;
    gbc_panel_6.ipadx = 1;
    gbc_panel_6.insets = new Insets(0, 0, 5, 5);
    gbc_panel_6.fill = GridBagConstraints.BOTH;
    gbc_panel_6.gridx = 0;
    gbc_panel_6.gridy = 4;
    jPanelDetail.add(panel_6, gbc_panel_6);
    panel_6.setLayout(new BorderLayout(0, 0));

    JTextPane textPane = new JTextPane();
    textPane.setBackground(UIManager.getColor("windowBorder"));
    panel_6.add(textPane);
    GridBagConstraints gbc_btnSave = new GridBagConstraints();
    gbc_btnSave.anchor = GridBagConstraints.WEST;
    gbc_btnSave.insets = new Insets(0, 0, 0, 5);
    gbc_btnSave.gridx = 0;
    gbc_btnSave.gridy = 5;
    jPanelDetail.add(btnSave, gbc_btnSave);
    reloadTable();
}

From source file:net.pms.newgui.LanguageSelection.java

private JComponent buildComponent() {
    // UIManager manages to get the background color wrong for text
    // components on OS X, so we apply the color manually
    Color backgroundColor = UIManager.getColor("Panel.background");
    rootPanel.setLayout(new BoxLayout(rootPanel, BoxLayout.PAGE_AXIS));

    // It needs to be something in the title text, or the size calculation for the border will be wrong.
    selectionPanelBorder.setTitle(" ");
    selectionPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5),
            BorderFactory.createCompoundBorder(selectionPanelBorder,
                    BorderFactory.createEmptyBorder(10, 5, 10, 5))));
    selectionPanel.setLayout(new BoxLayout(selectionPanel, BoxLayout.PAGE_AXIS));
    descriptionText.setEditable(false);//from w w w . j a  va  2 s .co m
    descriptionText.setBackground(backgroundColor);
    descriptionText.setFocusable(false);
    descriptionText.setLineWrap(true);
    descriptionText.setWrapStyleWord(true);
    descriptionText.setBorder(BorderFactory.createEmptyBorder(5, 15, 10, 15));
    selectionPanel.add(descriptionText);

    jLanguage = new JComboBox<>(keyedModel);
    jLanguage.setEditable(false);
    jLanguage.setPreferredSize(new Dimension(50, jLanguage.getPreferredSize().height));
    jLanguage.addActionListener(new LanguageComboBoxActionListener());
    languagePanel.setLayout(new BoxLayout(languagePanel, BoxLayout.PAGE_AXIS));
    languagePanel.setBorder(BorderFactory.createEmptyBorder(5, 15, 5, 15));
    languagePanel.add(jLanguage);
    selectionPanel.add(languagePanel);

    warningText.setEditable(false);
    warningText.setFocusable(false);
    warningText.setBackground(backgroundColor);
    warningText.setFont(warningText.getFont().deriveFont(Font.BOLD));
    warningText.setLineWrap(true);
    warningText.setWrapStyleWord(true);
    warningText.setBorder(BorderFactory.createEmptyBorder(5, 15, 0, 15));
    selectionPanel.add(warningText);

    // It needs to be something in the title text, or the size calculation for the border will be wrong.
    infoTextBorder.setTitle(" ");
    infoText.setBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5), BorderFactory
                    .createCompoundBorder(infoTextBorder, BorderFactory.createEmptyBorder(15, 20, 20, 20))));
    infoText.setEditable(false);
    infoText.setFocusable(false);
    infoText.setBackground(backgroundColor);
    infoText.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

    // This exercise is to avoid using the default shared StyleSheet with padding
    CustomHTMLEditorKit editorKit = new CustomHTMLEditorKit();
    StyleSheet styleSheet = new StyleSheet();
    styleSheet.addRule("a { color: #0000EE; text-decoration:underline; }");
    editorKit.setStyleSheet(styleSheet);
    infoText.setEditorKit(editorKit);
    infoText.addHyperlinkListener(new HyperlinkListener() {

        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                boolean error = false;
                if (Desktop.isDesktopSupported()) {
                    try {
                        Desktop.getDesktop().browse(new URI(e.getDescription()));
                    } catch (IOException | URISyntaxException ex) {
                        LOGGER.error("Language selection failed to open translation page hyperlink: ",
                                ex.getMessage());
                        LOGGER.trace("", ex);
                        error = true;
                    }
                } else {
                    LOGGER.warn("Desktop is not supported, the clicked translation page link can't be opened");
                    error = true;
                }
                if (error) {
                    JOptionPane.showOptionDialog(dialog,
                            String.format(buildString("LanguageSelection.6", true), PMS.CROWDIN_LINK),
                            buildString("Dialog.Error"), JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,
                            null, null, null);
                }
            }
        }

    });

    rootPanel.add(selectionPanel);
    rootPanel.add(infoText);

    applyButton.addActionListener(new ApplyButtonActionListener());
    applyButton.setActionCommand("apply");

    selectButton.addActionListener(new SelectButtonActionListener());
    selectButton.setActionCommand("select");

    return rootPanel;

}

From source file:dk.dma.epd.common.prototype.gui.route.RoutePropertiesDialogCommon.java

/**
 * Initializes the user interface//from  ww  w. j a va2 s.c o m
 */
private void initGui() {
    Insets insets1 = new Insets(5, 5, 0, 5);
    Insets insets2 = new Insets(5, 25, 0, 5);
    Insets insets3 = new Insets(5, 5, 0, 0);
    Insets insets4 = new Insets(5, 0, 0, 5);
    Insets insets5 = new Insets(5, 5, 5, 5);
    Insets insets6 = new Insets(5, 25, 5, 5);
    Insets insets10 = new Insets(10, 10, 10, 10);

    JPanel content = new JPanel(new GridBagLayout());
    getContentPane().add(content);

    // ********************************
    // ** Route properties panel
    // ********************************

    JPanel routeProps = new JPanel(new GridBagLayout());
    routeProps.setBorder(new TitledBorder(new LineBorder(Color.black), "Route Properties"));
    content.add(routeProps, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets10, 0, 0));

    // Auto-completion
    List<String> strings = new ArrayList<>();
    strings.add("Copenhagen");
    strings.add("Oslo");
    AutoCompleteDecorator.decorate(originTxT, strings, false);
    AutoCompleteDecorator.decorate(destinationTxT, strings, false);

    // Column 1 widgets
    int gridY = 0;
    nameTxT.setEditable(!readOnlyRoute);
    nameTxT.getDocument().addDocumentListener(new TextFieldChangeListener(nameTxT));
    routeProps.add(new JLabel("Name:"),
            new GridBagConstraints(0, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));
    routeProps.add(fixSize(nameTxT, 120),
            new GridBagConstraints(1, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));

    originTxT.setEditable(!readOnlyRoute);
    originTxT.getDocument().addDocumentListener(new TextFieldChangeListener(originTxT));
    routeProps.add(new JLabel("Origin:"),
            new GridBagConstraints(0, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));
    routeProps.add(fixSize(originTxT, 120),
            new GridBagConstraints(1, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));

    destinationTxT.setEnabled(!readOnlyRoute);
    destinationTxT.getDocument().addDocumentListener(new TextFieldChangeListener(destinationTxT));
    routeProps.add(new JLabel("Destination:"),
            new GridBagConstraints(0, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));
    routeProps.add(fixSize(destinationTxT, 120),
            new GridBagConstraints(1, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));

    distanceTxT.setEditable(false);
    routeProps.add(new JLabel("Total Distance:"),
            new GridBagConstraints(0, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));
    routeProps.add(fixSize(distanceTxT, 120),
            new GridBagConstraints(1, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));

    // Column 2 widgets
    gridY = 0;
    int h = (int) departurePicker.getPreferredSize().getHeight();
    initDatePicker(departurePicker, departureSpinner);
    routeProps.add(new JLabel("Estimated Time of Departure:"),
            new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0));
    routeProps.add(fixSize(departurePicker, 120),
            new GridBagConstraints(3, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets3, 0, 0));
    routeProps.add(fixSize(departureSpinner, 60, h),
            new GridBagConstraints(4, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets4, 0, 0));

    initDatePicker(arrivalPicker, arrivalSpinner);
    routeProps.add(new JLabel("Estimated Time of Arrival:"),
            new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0));
    routeProps.add(fixSize(arrivalPicker, 120),
            new GridBagConstraints(3, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets3, 0, 0));
    routeProps.add(fixSize(arrivalSpinner, 60, h),
            new GridBagConstraints(4, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets4, 0, 0));

    inrouteTxT.setEditable(false);
    routeProps.add(new JLabel("Estimated Time in-route:"),
            new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0));
    routeProps.add(fixSize(inrouteTxT, 180),
            new GridBagConstraints(3, gridY++, 2, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));

    etaCalculationTime.setEnabled(!readOnlyRoute);
    etaCalculationTime.addActionListener(this);
    routeProps.add(new JLabel("Calculate TTG/ETA using:"),
            new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets6, 0, 0));
    routeProps.add(fixSize(etaCalculationTime, 180),
            new GridBagConstraints(3, gridY++, 2, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));

    allSpeeds.setEnabled(!readOnlyRoute);
    allSpeedsBtn.setEnabled(!readOnlyRoute);
    routeProps.add(new JLabel("Speed all legs: "),
            new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0));
    routeProps.add(fixSize(allSpeeds, 60),
            new GridBagConstraints(3, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets3, 0, 0));
    routeProps.add(fixSize(allSpeedsBtn, 60, h),
            new GridBagConstraints(4, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets4, 0, 0));

    routeProps.add(new JLabel(""),
            new GridBagConstraints(5, 0, 1, 1, 1.0, 0.0, WEST, HORIZONTAL, insets2, 0, 0));

    // ********************************
    // ** Route detail panel
    // ********************************

    routeTableModel = createRouteTableModel();
    routeDetailTable = new DeltaTable(routeTableModel, DELTA_START_COL_INDEX);
    routeDetailTable.setTableFont(routeDetailTable.getTableFont().deriveFont(10.0f));
    routeDetailTable.setNonEditableBgColor(UIManager.getColor("Table.background").darker().darker());
    routeDetailTable.addListSelectionListener(this);

    // Set the minimum column widths
    for (int x = 0; x < COL_MIN_WIDTHS.length; x++) {
        routeDetailTable.getColumn(x).setMinWidth(COL_MIN_WIDTHS[x]);
    }

    // Configure lock column
    routeDetailTable.fixColumnWidth(0, COL_MIN_WIDTHS[0]);
    routeDetailTable.getColumn(0).setCellRenderer(new LockTableCell.CustomBooleanCellRenderer());
    routeDetailTable.getColumn(0).setCellEditor(new LockTableCell.CustomBooleanCellEditor());

    // Configure ETA column
    routeDetailTable.getColumn(7).setCellEditor(new EtaEditor());

    // Configure heading column
    JComboBox<Heading> headingCombo = new JComboBox<>(Heading.values());
    headingCombo.setFont(headingCombo.getFont().deriveFont(10.0f));
    routeDetailTable.getColumn(10).setCellEditor(new DefaultCellEditor(headingCombo));

    JPanel routeTablePanel = new JPanel(new BorderLayout());
    routeTablePanel.add(routeDetailTable, BorderLayout.CENTER);
    routeTablePanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Route Details"));
    content.add(routeTablePanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, NORTHWEST, BOTH, insets10, 0, 0));

    // ********************************
    // ** Button panel
    // ********************************

    JPanel btnPanel = new JPanel(new GridBagLayout());
    content.add(btnPanel, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0, NORTHWEST, HORIZONTAL, insets10, 0, 0));

    btnZoomToRoute.addActionListener(this);
    btnZoomToWp.addActionListener(this);
    btnDelete.addActionListener(this);
    btnActivate.addActionListener(this);
    btnClose.addActionListener(this);
    cbVisible.addActionListener(this);
    allSpeedsBtn.addActionListener(this);
    getRootPane().setDefaultButton(btnClose);
    btnPanel.add(btnZoomToRoute, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));
    btnPanel.add(btnZoomToWp, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));
    btnPanel.add(btnDelete, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));
    btnPanel.add(btnActivate, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));
    btnPanel.add(cbVisible, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));
    btnPanel.add(btnClose, new GridBagConstraints(5, 0, 1, 1, 1.0, 0.0, EAST, NONE, insets5, 0, 0));
}

From source file:net.sf.vfsjfilechooser.filepane.VFSFilePane.java

protected void installDefaults() {

    listViewBorder = UIManager.getBorder("FileChooser.listViewBorder");
    listViewBackground = UIManager.getColor("FileChooser.listViewBackground");
    listViewWindowsStyle = UIManager.getBoolean("FileChooser.listViewWindowsStyle");
    readOnly = UIManager.getBoolean("FileChooser.readOnly");

    // TODO: On windows, get the following localized strings from the OS
    viewMenuLabelText = VFSResources.getMessage("VFSJFileChooser.viewMenuLabelText");
    refreshActionLabelText = VFSResources.getMessage("VFSJFileChooser.refreshActionLabelText");
    newFolderActionLabelText = VFSResources.getMessage("VFSJFileChooser.newFolderActionLabelText");

    viewTypeActionNames = new String[VIEWTYPE_COUNT];
    viewTypeActionNames[VIEWTYPE_LIST] = VFSResources.getMessage("VFSJFileChooser.listViewActionLabelText");
    viewTypeActionNames[VIEWTYPE_DETAILS] = VFSResources
            .getMessage("VFSJFileChooser.detailsViewActionLabelText");

    renameErrorTitleText = VFSResources.getMessage("VFSJFileChooser.renameErrorTitleText");
    renameErrorText = VFSResources.getMessage("VFSJFileChooser.renameErrorText");
    renameErrorFileExistsText = VFSResources.getMessage("VFSJFileChooser.renameErrorFileExistsText");

    fileNameHeaderText = VFSResources.getMessage("VFSJFileChooser.fileNameHeaderText");
    fileSizeHeaderText = VFSResources.getMessage("VFSJFileChooser.fileSizeHeaderText");
    fileDateHeaderText = VFSResources.getMessage("VFSJFileChooser.fileDateHeaderText");
}

From source file:com.googlecode.vfsjfilechooser2.filepane.VFSFilePane.java

protected void installDefaults() {

    listViewBorder = UIManager.getBorder("FileChooser.listViewBorder");
    listViewBackground = UIManager.getColor("FileChooser.listViewBackground");
    listViewWindowsStyle = UIManager.getBoolean("FileChooser.listViewWindowsStyle");
    readOnly = UIManager.getBoolean("FileChooser.readOnly");

    // TODO: On windows, get the following localized strings from the OS
    viewMenuLabelText = VFSResources.getMessage("VFSJFileChooser.viewMenuLabelText");
    refreshActionLabelText = VFSResources.getMessage("VFSJFileChooser.refreshActionLabelText");
    showHiddenFilesLabelText = VFSResources.getMessage("VFSJFileChooser.showHiddenFilesLabelText");
    newFolderActionLabelText = VFSResources.getMessage("VFSJFileChooser.newFolderActionLabelText");

    viewTypeActionNames = new String[VIEWTYPE_COUNT];
    viewTypeActionNames[VIEWTYPE_LIST] = VFSResources.getMessage("VFSJFileChooser.listViewActionLabelText");
    viewTypeActionNames[VIEWTYPE_DETAILS] = VFSResources
            .getMessage("VFSJFileChooser.detailsViewActionLabelText");

    renameErrorTitleText = VFSResources.getMessage("VFSJFileChooser.renameErrorTitleText");
    renameErrorText = VFSResources.getMessage("VFSJFileChooser.renameErrorText");
    renameErrorFileExistsText = VFSResources.getMessage("VFSJFileChooser.renameErrorFileExistsText");

    fileNameHeaderText = VFSResources.getMessage("VFSJFileChooser.fileNameHeaderText");
    fileSizeHeaderText = VFSResources.getMessage("VFSJFileChooser.fileSizeHeaderText");
    fileDateHeaderText = VFSResources.getMessage("VFSJFileChooser.fileDateHeaderText");
}

From source file:com.mirth.connect.client.ui.components.rsta.MirthRSyntaxTextArea.java

@Override
public void setEnabled(boolean enabled) {
    super.setEnabled(enabled);
    setForeground(UIManager.getColor(enabled ? "Label.foreground" : "Label.disabledForeground"));
    setHighlightCurrentLine(enabled);/*from   w  ww.  j  a  v a 2s . com*/
    setBracketMatchingEnabled(enabled);

    if (enabled) {
        if (cachedStyleKey != null) {
            super.setSyntaxEditingStyle(cachedStyleKey);
        }
    } else {
        super.setSyntaxEditingStyle(SYNTAX_STYLE_NONE);
    }
}