Example usage for javax.swing JLabel setFont

List of usage examples for javax.swing JLabel setFont

Introduction

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

Prototype

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

Source Link

Document

Sets the font for this component.

Usage

From source file:pcgui.SetupParametersPanel.java

/**
 * Create the frame.//from   w w w . j a  v a2s.c o  m
 * 
 * @param switcher
 * 
 * @param rootFrame
 */

public SetupParametersPanel(final PanelSwitcher switcher, JFrame rootFrame) {
    this.rootFrame = rootFrame;
    setLayout(new BorderLayout());

    JLabel headingLabel = new JLabel("Setup Parameters");
    headingLabel.setFont(new Font("Tahoma", Font.BOLD, 16));
    add(headingLabel, BorderLayout.NORTH);
    JButton saveBtn = new JButton("Save");
    final JButton runModifiedBtn = new JButton("Run");

    runModifiedBtn.setEnabled(false);

    runModifiedBtn.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            runModel();

        }
    });

    saveBtn.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            //creating separate copy of model so that changes in one doesn't effect other
            ArrayList<ArrayList<Object>> mod = new ArrayList<ArrayList<Object>>(model.getData());
            //call save model of modelsaver
            //TODO add visualization list and save to excel using similar method as below
            //TODO add modelname, should contain .xls/.xlsx extension
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_hhmmss");
            outputFile = importedFile.toString().replace(".mos", "") + "_" + sdf.format(new Date())
                    + "_FEORA_solution.xlsx";
            ModelSaver.saveInputModel(mod, outputFile);

            runModifiedBtn.setEnabled(true);

        }
    });

    JLabel label = new JLabel("Enter count of random value runs");
    repeatCount = new JTextField();
    repeatCount.setToolTipText("Enter count for which each combination of step variables is run ");
    repeatCount.setText("1");
    repeatCount.setPreferredSize(new Dimension(100, 20));

    JPanel runConfig = new JPanel();
    runConfig.setLayout(new GridLayout(2, 2));

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = GridBagConstraints.CENTER;

    JPanel configCount = new JPanel(new FlowLayout());
    JPanel configButtons = new JPanel(new FlowLayout());
    configCount.add(label);
    configCount.add(repeatCount);

    JButton btnLoadSavedConfiguration = new JButton("Load Saved Configuration");
    btnLoadSavedConfiguration.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser jFileChooser = new JFileChooser();

            File workingDirectory = new File(System.getProperty("user.dir"));

            jFileChooser.setCurrentDirectory(workingDirectory);

            jFileChooser.setFileFilter(new FileFilter() {

                @Override
                public String getDescription() {
                    // TODO Auto-generated method stub
                    return "Excel solution files";
                }

                @Override
                public boolean accept(File f) {
                    // TODO Auto-generated method stub
                    return f.isDirectory() || f.getName().endsWith(".xls") || f.getName().endsWith(".xlsx");

                }
            });
            int returnVal = jFileChooser.showOpenDialog(null);

            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = jFileChooser.getSelectedFile();

                // This is where a real application would open the file.

                if (file.getName().endsWith(".xls") || file.getName().endsWith(".xlsx")) {
                    String fileName = file.getAbsolutePath();
                    List<List<String>> savedConfig = ModelSaver.loadInputConfigFromExcel(fileName);
                    ArrayList<Symbol> symList = new ArrayList<Symbol>();

                    int i = 0;
                    for (List<String> list : savedConfig) {
                        //ignore the header row
                        if (i > 0) {
                            System.out.println("VariableName=" + list.get(0));
                            System.out.println("Datatype=" + list.get(1));
                            System.out.println("Type=" + list.get(2));
                            System.out.println("Value=" + list.get(3));
                            System.out.println("ExternalFile=" + list.get(4));
                            System.out.println("ExcelRange=" + list.get(5));
                            System.out.println("DistributionFunction=" + list.get(6));
                            System.out.println("OutputTracket=" + list.get(7));
                            Symbol sym = new Symbol<>();
                            sym.name = list.get(0);
                            sym.typeString = list.get(1);
                            sym.mode = list.get(2);
                            sym.set(list.get(3));
                            sym.externalFile = list.get(4);
                            sym.excelFileRange = list.get(5);
                            sym.distFunction = list.get(6);
                            sym.trackingEnabled = Boolean.parseBoolean(list.get(7));
                            symList.add(sym);
                        }
                        i++;

                    }
                    initParamList(symList, parser);
                }

            } else {
                //               System.out.println("Open command cancelled by user.");
            }

        }
    });
    configButtons.add(btnLoadSavedConfiguration);

    configButtons.add(saveBtn);
    configButtons.add(runModifiedBtn);
    runConfig.add(configCount);
    runConfig.add(configButtons);
    add(runConfig, BorderLayout.SOUTH);

    setVisible(true);
}

From source file:pcgui.SetupVisualizationPanel.java

/**
 * Create the frame./*from w  w  w.  ja  v a 2  s .  c o m*/
 * 
 * @param switcher
 * 
 * @param rootFrame
 */

public SetupVisualizationPanel(final PanelSwitcher switcher, JFrame rootFrame) {
    this.rootFrame = rootFrame;
    setLayout(new BorderLayout());

    if (trackedVariables == null) {
        trackedVariables = new ArrayList<String>();
        trackedVariables.add("");
    }

    JLabel headingLabel = new JLabel("Setup Visualization");
    headingLabel.setFont(new Font("Tahoma", Font.BOLD, 16));
    add(headingLabel, BorderLayout.NORTH);

    JLabel chartTypeLabel = new JLabel("Chart Type");
    chartTypeLabel.setPreferredSize(new Dimension(140, 30));
    chartTypeCB = new JComboBox<String>(chartTypes);
    chartTypeCB.setPreferredSize(new Dimension(140, 30));

    JLabel xAxisLabel = new JLabel("X Axis");
    xAxisLabel.setPreferredSize(new Dimension(140, 30));
    //      xAxisTF = new JTextField();
    //      xAxisTF.setPreferredSize(new Dimension(100, 20));
    xAxisCB = new JComboBox<String>(new DefaultComboBoxModel(trackedVariables.toArray()));
    xAxisCB.setPreferredSize(new Dimension(140, 30));

    JLabel yAxisLabel = new JLabel("Y Axis");
    yAxisLabel.setPreferredSize(new Dimension(140, 30));
    //      yAxisTF = new JTextField();
    //      yAxisTF.setPreferredSize(new Dimension(100, 20));
    yAxisCB = new JComboBox<String>(new DefaultComboBoxModel(trackedVariables.toArray()));
    yAxisCB.setPreferredSize(new Dimension(140, 30));

    JLabel iterationAsXLabel = new JLabel("Use Iteration Number as X Axis");
    iterationAsXLabel.setPreferredSize(new Dimension(250, 30));
    useIterationNumAsXChkBox = new JCheckBox("Use Iteration Count as X Axis");
    useIterationNumAsXChkBox.setPreferredSize(new Dimension(250, 30));

    addVisualizationBtn = new JButton("Add");
    addVisualizationBtn.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            ArrayList<Object> visRow = new ArrayList<Object>(4);
            visRow.add(chartTypeCB.getSelectedItem());
            visRow.add(xAxisCB.getSelectedItem());
            visRow.add(yAxisCB.getSelectedItem());
            visRow.add(useIterationNumAsXChkBox.isSelected());
            visRow.add("");//for Delete
            model.addRow(visRow);

        }
    });

    drawVisualizationBtn = new JButton("Draw Visualizations");
    drawVisualizationBtn.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            ArrayList<ArrayList<Object>> visList = getVisualizationConfig();
            boolean successOnCharts = true;

            for (ArrayList<Object> row : visList) {
                Visualization vis = new Visualization();
                vis.setChartType((String) row.get(0));
                vis.setXAxis((String) row.get(1));
                vis.setYAxis((String) row.get(2));
                vis.setUsingIterationNumAsX((boolean) row.get(3));
                switch (vis.getChartType()) {
                case "LineChart":
                    try {
                        if (vis.isUsingIterationNumAsX()) {
                            ModelSaver.drawLineChart(null, vis.getYAxis());
                        } else {
                            ModelSaver.drawLineChart(vis.getXAxis(), vis.getYAxis());
                        }
                    } catch (Exception exc) {
                        successOnCharts = false;
                        CustomErrorDialog.showDialog("Exception while drawing LineChart to Excel",
                                exc.toString());
                        exc.printStackTrace();
                    }
                    break;
                case "ScatterPlot":
                    try {
                        if (vis.isUsingIterationNumAsX()) {
                            ModelSaver.drawScatterPlot(null, vis.getYAxis());
                        } else {
                            ModelSaver.drawScatterPlot(vis.getXAxis(), vis.getYAxis());
                        }
                    } catch (Exception exc) {
                        successOnCharts = false;
                        CustomErrorDialog.showDialog("Exception while drawing ScatterPlot to Excel",
                                exc.toString());
                        exc.printStackTrace();
                    }
                    break;
                case "BarChart":
                    try {
                        if (vis.isUsingIterationNumAsX()) {
                            ModelSaver.drawBarChart(null, vis.getYAxis());
                        } else {
                            ModelSaver.drawBarChart(vis.getXAxis(), vis.getYAxis());
                        }
                    } catch (Exception exc) {
                        successOnCharts = false;
                        CustomErrorDialog.showDialog("Exception while drawing BarChart to Excel",
                                exc.toString());
                        exc.printStackTrace();
                    }
                    break;
                case "PieChart":
                    try {
                        if (vis.isUsingIterationNumAsX()) {
                            ModelSaver.drawPieChart(null, vis.getYAxis());
                        } else {
                            ModelSaver.drawPieChart(vis.getXAxis(), vis.getYAxis());
                        }
                    } catch (Exception exc) {
                        successOnCharts = false;
                        CustomErrorDialog.showDialog("Exception while drawing PieChart to Excel",
                                exc.toString());
                        exc.printStackTrace();
                    }
                    break;

                }

            }

            if (successOnCharts)
                JOptionPane.showMessageDialog(new JFrame("Success"),
                        "Visualization completed.\nOutput charts added to excel file : "
                                + ModelSaver.excelFileName);

        }
    });
    JPanel runConfig = new JPanel();
    runConfig.setLayout(new GridLayout(3, 2));

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = GridBagConstraints.CENTER;

    JPanel configLabel = new JPanel(new FlowLayout());
    JPanel configCount = new JPanel(new FlowLayout());
    JPanel configButtons = new JPanel(new FlowLayout());
    configLabel.setAlignmentX(LEFT_ALIGNMENT);
    configLabel.add(chartTypeLabel);
    configLabel.add(xAxisLabel);
    configLabel.add(yAxisLabel);
    configLabel.add(iterationAsXLabel);

    configCount.setAlignmentX(LEFT_ALIGNMENT);
    configCount.add(chartTypeCB);
    configCount.add(xAxisCB);
    configCount.add(yAxisCB);
    configCount.add(useIterationNumAsXChkBox);

    configButtons.add(addVisualizationBtn);
    configButtons.add(drawVisualizationBtn);

    runConfig.add(configLabel);
    runConfig.add(configCount);
    runConfig.add(configButtons);
    add(runConfig, BorderLayout.SOUTH);

    setVisible(true);
}

From source file:phex.gui.dialogs.UpdateNotificationDialog.java

private JPanel buildNotificationPanel() {
    JPanel panel = new JPanel();
    //JPanel panel = new FormDebugPanel();

    CellConstraints cc = new CellConstraints();
    FormLayout layout = new FormLayout("16dlu, d, 8dlu, right:d, 16dlu", // columns
            "p, 8dlu, p"); // rows
    layout.setRowGroups(new int[][] { { 1, 3 } });
    PanelBuilder builder = new PanelBuilder(layout, panel);

    builder.addLabel(Localizer.getString("UpdateNotification_YourVersion"), cc.xy(2, 1));
    builder.addLabel(VersionUtils.getFullProgramVersion(), cc.xy(4, 1));

    String releaseVersion = updateChecker.getReleaseVersion();
    String betaVersion = updateChecker.getBetaVersion();
    if (releaseVersion != null) {
        builder.addLabel(Localizer.getString("UpdateNotification_AvailableStableVersion"), cc.xy(2, 3));
        JLabel label = builder.addLabel(releaseVersion, cc.xy(4, 3));
        label.setFont(label.getFont().deriveFont(Font.BOLD));
    } else if (betaVersion != null) {
        builder.addLabel(Localizer.getString("UpdateNotification_AvailableBetaVersion"), cc.xy(2, 3));
        JLabel label = builder.addLabel(betaVersion, cc.xy(4, 3));
        label.setFont(label.getFont().deriveFont(Font.BOLD));
    }//w  w w .  j av  a 2  s.co m

    return panel;
}

From source file:pl.edu.icm.visnow.system.main.VisNow.java

private void profile() {
    JLabel jl = new JLabel("VisNow");
    jl.setFont(new java.awt.Font("Tahoma", 1, 9));
    jl.getFontMetrics(jl.getFont()).charsWidth(jl.getText().toCharArray(), 0, jl.getText().length());
}

From source file:pl.otros.logview.exceptionshandler.ShowErrorDialogExceptionHandler.java

protected JComponent createDialogView() {
    JPanel jPanel = new JPanel(new MigLayout());
    JLabel label = new JLabel("Do you want to send error report?");
    label.setFont(label.getFont().deriveFont(Font.BOLD));
    jPanel.add(label, "span 4, wrap, center");
    jPanel.add(new JLabel("Comment:"));
    commentTextArea = new JTextArea(10, 30);
    commentTextArea.setWrapStyleWord(true);
    commentTextArea.setLineWrap(true);/* w  w  w  . j  a v  a 2 s .  c o m*/
    JScrollPane jScrollPane = new JScrollPane(commentTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jPanel.add(jScrollPane, "span 3, wrap");
    jPanel.add(new JLabel("Email (optional):"));
    emailTextField = new JTextField(30);
    jPanel.add(emailTextField, "span 3, wrap");

    jPanel.add(new JSeparator(), "span 4, wrap, grow");
    checkBoxUseProxy = new JCheckBox("Use HTTP proxy");
    proxyTf = new JTextField();
    proxyPortModel = new SpinnerNumberModel(80, 1, 256 * 256 - 1, 1);
    proxyUser = new JTextField();
    proxyPasswordField = new JPasswordField();
    proxySpinner = new JSpinner(proxyPortModel);

    jPanel.add(checkBoxUseProxy, "wrap");
    labelProxyHost = new JLabel("Proxy address");
    jPanel.add(labelProxyHost);
    jPanel.add(proxyTf, "wrap, span 3, grow");
    labelProxyPort = new JLabel("Proxy port");
    jPanel.add(labelProxyPort);
    jPanel.add(proxySpinner, "wrap");
    labelProxyUser = new JLabel("User");
    jPanel.add(labelProxyUser);
    jPanel.add(proxyUser, "grow");
    labelProxyPassword = new JLabel("Password");
    jPanel.add(labelProxyPassword);
    jPanel.add(proxyPasswordField, "grow");

    checkBoxUseProxy.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            setProxyEnabled(checkBoxUseProxy.isSelected());
        }
    });
    DataConfiguration c = otrosApplication.getConfiguration();
    proxyTf.setText(c.getString(ConfKeys.HTTP_PROXY_HOST, ""));
    proxyUser.setText(c.getString(ConfKeys.HTTP_PROXY_USER, ""));
    proxyPortModel.setValue(Integer.valueOf(c.getInt(ConfKeys.HTTP_PROXY_PORT, 80)));
    boolean useProxy = c.getBoolean(ConfKeys.HTTP_PROXY_USE, false);
    checkBoxUseProxy.setSelected(useProxy);
    setProxyEnabled(useProxy);

    return jPanel;
}

From source file:pl.otros.logview.gui.Log4jPatternParserEditor.java

private void createGui() {
    this.setLayout(new BorderLayout());
    heading1Font = new JLabel().getFont().deriveFont(20f).deriveFont(Font.BOLD);
    heading2Font = new JLabel().getFont().deriveFont(14f).deriveFont(Font.BOLD);

    loadLog = new JButton("Load log", Icons.FOLDER_OPEN);
    testParser = new JButton("Test parser", Icons.WRENCH_ARROW);
    saveParser = new JButton("Save", Icons.DISK);
    logFileContent = new JTextArea();
    DefaultSyntaxKit.initKit();/*from w ww.j  a  va 2 s  .  c o m*/
    propertyEditor = new JEditorPane();

    logFileContent = new JTextArea();
    logViewPanel = new LogViewPanel(new LogDataTableModel(), TableColumns.ALL_WITHOUT_LOG_SOURCE,
            otrosApplication);
    JPanel panelEditorActions = new JPanel(new BorderLayout(5, 5));
    JToolBar actionsToolBar = new JToolBar("Actions");
    actionsToolBar.setFloatable(false);
    actionsToolBar.add(testParser);
    actionsToolBar.add(saveParser);

    JToolBar propertyEditorToolbar = new JToolBar();
    JLabel labelEditProperties = new JLabel("Edit your properties: and test parser");
    labelEditProperties.setFont(heading2Font);
    propertyEditorToolbar.add(labelEditProperties);
    panelEditorActions.add(propertyEditorToolbar, BorderLayout.NORTH);
    panelEditorActions.add(actionsToolBar, BorderLayout.SOUTH);
    panelEditorActions.add(new JScrollPane(propertyEditor));

    logFileContentLabel = new JLabel(" Load your log file, paste from clipboard or drag and drop file. ");
    JToolBar loadToolbar = new JToolBar();
    loadToolbar.add(logFileContentLabel);
    loadToolbar.add(loadLog);
    logFileContentLabel.setFont(heading2Font);
    JPanel logContentPanel = new JPanel(new BorderLayout(5, 5));
    logContentPanel.add(new JScrollPane(logFileContent));
    logContentPanel.add(loadToolbar, BorderLayout.NORTH);

    JSplitPane northSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    northSplit.setOneTouchExpandable(true);
    northSplit.add(logContentPanel);
    northSplit.add(panelEditorActions);

    JPanel southPanel = new JPanel(new BorderLayout(5, 5));
    JLabel labelParsingResult = new JLabel(" Parsing result:");
    labelParsingResult.setFont(heading1Font);
    southPanel.add(labelParsingResult, BorderLayout.NORTH);
    southPanel.add(logViewPanel);

    JSplitPane mainSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    mainSplit.setOneTouchExpandable(true);
    mainSplit.add(northSplit);
    mainSplit.add(southPanel);
    mainSplit.setDividerLocation(0.5f);

    add(mainSplit);

    propertyEditor.setContentType("text/properties");

}

From source file:pl.otros.logview.gui.LogViewMainFrame.java

private void initMenu() {
    JMenuBar menuBar = getJMenuBar();
    if (menuBar == null) {
        menuBar = new JMenuBar();
        setJMenuBar(menuBar);// www.  ja va 2  s . c  o  m
    }
    menuBar.removeAll();
    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    JLabel labelOpenLog = new JLabel("Open log", Icons.FOLDER_OPEN, SwingConstants.LEFT);
    Font menuGroupFont = labelOpenLog.getFont().deriveFont(13f).deriveFont(Font.BOLD);
    labelOpenLog.setFont(menuGroupFont);
    fileMenu.add(labelOpenLog);
    JMenuItem openAutoDetectLog = new JMenuItem("Open log with autodetect type");
    openAutoDetectLog.addActionListener(new ImportLogWithAutoDetectedImporterActionListener(otrosApplication));
    openAutoDetectLog.setMnemonic(KeyEvent.VK_O);
    openAutoDetectLog.setIcon(Icons.WIZARD);
    fileMenu.add(openAutoDetectLog);
    JMenuItem tailAutoDetectLog = new JMenuItem("Tail log with autodetect type");
    tailAutoDetectLog.addActionListener(new TailLogWithAutoDetectActionListener(otrosApplication));
    tailAutoDetectLog.setMnemonic(KeyEvent.VK_T);
    tailAutoDetectLog.setIcon(Icons.ARROW_REPEAT);
    fileMenu.add(tailAutoDetectLog);
    fileMenu.add(new TailMultipleFilesIntoOneView(otrosApplication));
    fileMenu.add(new ConnectToSocketHubAppenderAction(otrosApplication));
    fileMenu.add(new JSeparator());
    JLabel labelLogInvestigation = new JLabel("Log investigation", SwingConstants.LEFT);
    labelLogInvestigation.setFont(menuGroupFont);
    fileMenu.add(labelLogInvestigation);
    fileMenu.add(new OpenLogInvestigationAction(otrosApplication));
    JMenuItem saveLogsInvest = new JMenuItem(new SaveLogInvestigationAction(otrosApplication));
    enableDisableComponetsForTabs.addComponet(saveLogsInvest);
    fileMenu.add(saveLogsInvest);
    fileMenu.add(new JSeparator());
    LogImporter[] importers = new LogImporter[0];
    importers = logImportersContainer.getElements().toArray(importers);
    for (LogImporter logImporter : importers) {
        JMenuItem openLog = new JMenuItem("Open " + logImporter.getName() + " log");
        openLog.addActionListener(new ImportLogWithGivenImporterActionListener(otrosApplication, logImporter));
        if (logImporter.getKeyStrokeAccelelator() != null) {
            openLog.setAccelerator(KeyStroke.getKeyStroke(logImporter.getKeyStrokeAccelelator()));
        }
        if (logImporter.getMnemonic() > 0) {
            openLog.setMnemonic(logImporter.getMnemonic());
        }
        Icon icon = logImporter.getIcon();
        if (icon != null) {
            openLog.setIcon(icon);
        }
        fileMenu.add(openLog);
    }
    fileMenu.add(new JSeparator());
    JLabel labelTailLog = new JLabel("Tail log [from begging of file]", Icons.ARROW_REPEAT,
            SwingConstants.LEFT);
    labelTailLog.setFont(menuGroupFont);
    fileMenu.add(labelTailLog);
    for (LogImporter logImporter : importers) {
        JMenuItem openLog = new JMenuItem("Tail " + logImporter.getName() + " log");
        openLog.addActionListener(new TailLogActionListener(otrosApplication, logImporter));
        if (logImporter.getKeyStrokeAccelelator() != null) {
            openLog.setAccelerator(KeyStroke.getKeyStroke(logImporter.getKeyStrokeAccelelator()));
        }
        if (logImporter.getMnemonic() > 0) {
            openLog.setMnemonic(logImporter.getMnemonic());
        }
        Icon icon = logImporter.getIcon();
        if (icon != null) {
            openLog.setIcon(icon);
        }
        fileMenu.add(openLog);
    }
    JMenuItem exitMenuItem = new JMenuItem("Exit", 'e');
    exitMenuItem.setIcon(Icons.TURN_OFF);
    exitMenuItem.setAccelerator(KeyStroke.getKeyStroke("control F4"));
    exitAction = new ExitAction(this);
    exitMenuItem.addActionListener(exitAction);
    fileMenu.add(new JSeparator());
    fileMenu.add(exitMenuItem);
    JMenu toolsMenu = new JMenu("Tools");
    toolsMenu.setMnemonic(KeyEvent.VK_T);
    JMenuItem closeAll = new JMenuItem(new CloseAllTabsAction(otrosApplication));
    enableDisableComponetsForTabs.addComponet(closeAll);
    ArrayList<SocketLogReader> logReaders = new ArrayList<SocketLogReader>();
    toolsMenu.add(new JMenuItem(new StartSocketListener(otrosApplication, logReaders)));
    toolsMenu.add(new JMenuItem(new StopAllSocketListeners(otrosApplication, logReaders)));
    toolsMenu.add(new ShowMarkersEditor(otrosApplication));
    toolsMenu.add(new ShowLog4jPatternParserEditor(otrosApplication));
    toolsMenu.add(new ShowMessageColorizerEditor(otrosApplication));
    toolsMenu.add(new ShowLoadedPlugins(otrosApplication));
    toolsMenu.add(new ShowOlvLogs(otrosApplication));
    toolsMenu.add(new OpenPreferencesAction(otrosApplication));
    toolsMenu.add(closeAll);
    JMenu pluginsMenu = new JMenu("Plugins");
    otrosApplication.setPluginsMenu(pluginsMenu);
    JMenu helpMenu = new JMenu("Help");
    JMenuItem about = new JMenuItem("About");
    AboutAction action = new AboutAction(otrosApplication);
    action.putValue(Action.NAME, "About");
    about.setAction(action);
    helpMenu.add(about);
    helpMenu.add(new GoToDonatePageAction(otrosApplication));
    JMenuItem checkForNewVersion = new JMenuItem(new CheckForNewVersionAction(otrosApplication));
    helpMenu.add(checkForNewVersion);
    helpMenu.add(new GettingStartedAction(otrosApplication));
    menuBar.add(fileMenu);
    menuBar.add(toolsMenu);
    menuBar.add(pluginsMenu);
    menuBar.add(helpMenu);
}

From source file:pl.otros.logview.gui.LogViewPanel.java

private void addFiltersGUIsToPanel(JPanel filtersPanel) {
    filtersPanel.setLayout(new MigLayout("", "[grow]", ""));

    Collection<LogFilter> loadedFilters = logFiltersContainer.getElements();

    // Reload filters, every instance of filter is connected to listeners, data table etc.
    filtersList = new ArrayList<LogFilter>();
    for (LogFilter logFilter : loadedFilters) {
        try {//ww w .  jav  a2 s.  co m
            LogFilter filter = logFilter.getClass().newInstance();
            filtersList.add(filter);
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, "Can't initialize filter: " + logFilter.getClass(), e);
        }

    }
    JLabel filtersLabel = new JLabel("Filters:");
    filtersLabel.setMinimumSize(new Dimension(200, 16));
    filtersLabel.setPreferredSize(new Dimension(200, 16));
    filtersLabel.setIcon(Icons.FILTER);
    Font f = filtersLabel.getFont().deriveFont(Font.BOLD);
    filtersLabel.setFont(f);
    filtersPanel.add(filtersLabel, "wrap, growx, span");
    LogFilterValueChangeListener listener = new LogFilterValueChangeListener(table, sorter, filtersList,
            statusObserver);
    for (LogFilter filter : filtersList) {
        filter.init(new Properties(), dataTableModel);
        FilterPanel filterPanel = new FilterPanel(filter, listener);
        filtersPanel.add(filterPanel, "wrap, growx");
        if (filter instanceof ThreadFilter) {
            ThreadFilter threadFilter = (ThreadFilter) filter;
            focusOnThisThreadAction = new FocusOnThisThreadAction(threadFilter, filterPanel.getEnableCheckBox(),
                    otrosApplication);
        } else if (filter instanceof TimeFilter) {
            focusOnEventsAfter = new FocusOnEventsAfter((TimeFilter) filter, filterPanel.getEnableCheckBox(),
                    otrosApplication);
            focusOnEventsBefore = new FocusOnEventsBefore((TimeFilter) filter, filterPanel.getEnableCheckBox(),
                    otrosApplication);
        } else if (filter instanceof ClassFilter) {
            focusOnSelectedClassesAction = new FocusOnSelectedClassesAction((ClassFilter) filter,
                    filterPanel.getEnableCheckBox(), otrosApplication);
            ignoreSelectedEventsClasses = new IgnoreSelectedEventsClasses((ClassFilter) filter,
                    filterPanel.getEnableCheckBox(), otrosApplication);
        } else if (filter instanceof LoggerNameFilter) {
            focusOnSelectedLoggerNameAction = new FocusOnSelectedLoggerNameAction((LoggerNameFilter) filter,
                    filterPanel.getEnableCheckBox(), otrosApplication);
        } else if (filter instanceof CallHierarchyLogFilter) {
            showCallHierarchyAction = new ShowCallHierarchyAction((CallHierarchyLogFilter) filter,
                    filterPanel.getEnableCheckBox(), otrosApplication);
        } else if (filter instanceof PropertyFilter) {
            propertyFilter = (PropertyFilter) filter;
            propertyFilterPanel = filterPanel;

        }
    }
    filtersLabel.add(logsMarkersPanel, "span, grow");
}

From source file:pl.otros.logview.gui.LogViewPanel.java

private JPopupMenu initTableContextMenu() {
    JPopupMenu menu = new JPopupMenu("Menu");
    JMenuItem mark = new JMenuItem("Mark selected rows");
    mark.addActionListener(new MarkRowAction(otrosApplication));
    JMenuItem unmark = new JMenuItem("Unmark selected rows");
    unmark.addActionListener(new UnMarkRowAction(otrosApplication));

    JMenuItem autoResizeMenu = new JMenu("Table auto resize mode");
    autoResizeMenu.setIcon(Icons.TABLE_RESIZE);
    JMenuItem autoResizeSubsequent = new JMenuItem("Subsequent columns");
    autoResizeSubsequent/*from w  ww  . j  av  a 2  s . c o  m*/
            .addActionListener(new TableResizeActionListener(table, JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS));
    JMenuItem autoResizeLast = new JMenuItem("Last column");
    autoResizeLast.addActionListener(new TableResizeActionListener(table, JTable.AUTO_RESIZE_LAST_COLUMN));
    JMenuItem autoResizeNext = new JMenuItem("Next column");
    autoResizeNext.addActionListener(new TableResizeActionListener(table, JTable.AUTO_RESIZE_NEXT_COLUMN));
    JMenuItem autoResizeAll = new JMenuItem("All columns");
    autoResizeAll.addActionListener(new TableResizeActionListener(table, JTable.AUTO_RESIZE_ALL_COLUMNS));
    JMenuItem autoResizeOff = new JMenuItem("Auto resize off");
    autoResizeOff.addActionListener(new TableResizeActionListener(table, JTable.AUTO_RESIZE_OFF));
    autoResizeMenu.add(autoResizeSubsequent);
    autoResizeMenu.add(autoResizeOff);
    autoResizeMenu.add(autoResizeNext);
    autoResizeMenu.add(autoResizeLast);
    autoResizeMenu.add(autoResizeAll);
    JMenu removeMenu = new JMenu("Remove log events");
    removeMenu.setFont(menuLabelFont);
    removeMenu.setIcon(Icons.BIN);
    JLabel removeLabel = new JLabel("Remove by:");
    removeLabel.setFont(menuLabelFont);
    removeMenu.add(removeLabel);

    Map<String, Set<String>> propKeyValue = getPropertiesOfSelectedLogEvents();
    for (AcceptCondition acceptCondition : acceptConditionList) {
        removeMenu.add(new JMenuItem(new RemoveByAcceptanceCriteria(acceptCondition, otrosApplication)));
    }
    for (String propertyKey : propKeyValue.keySet()) {
        for (String propertyValue : propKeyValue.get(propertyKey)) {
            PropertyAcceptCondition propAcceptCondition = new PropertyAcceptCondition(propertyKey,
                    propertyValue);
            removeMenu
                    .add(new JMenuItem(new RemoveByAcceptanceCriteria(propAcceptCondition, otrosApplication)));
        }
    }

    menu.add(new JSeparator());
    JLabel labelMarkingRows = new JLabel("Marking/unmarking rows");
    labelMarkingRows.setFont(menuLabelFont);
    menu.add(labelMarkingRows);
    menu.add(new JSeparator());
    menu.add(mark);
    menu.add(unmark);
    JMenu[] markersMenu = getAutomaticMarkersMenu();
    menu.add(markersMenu[0]);
    menu.add(markersMenu[1]);
    menu.add(new ClearMarkingsAction(otrosApplication));
    menu.add(new JSeparator());
    JLabel labelQuickFilters = new JLabel("Quick filters");
    labelQuickFilters.setFont(menuLabelFont);
    menu.add(labelQuickFilters);
    menu.add(new JSeparator());
    menu.add(focusOnThisThreadAction);
    menu.add(focusOnEventsAfter);
    menu.add(focusOnEventsBefore);
    menu.add(focusOnSelectedClassesAction);
    menu.add(ignoreSelectedEventsClasses);
    menu.add(focusOnSelectedLoggerNameAction);
    menu.add(showCallHierarchyAction);
    for (String propertyKey : propKeyValue.keySet()) {
        for (String propertyValue : propKeyValue.get(propertyKey)) {
            menu.add(new FocusOnSelectedPropertyAction(propertyFilter, propertyFilterPanel.getEnableCheckBox(),
                    otrosApplication, propertyKey, propertyValue));
        }
    }
    menu.add(new JSeparator());
    menu.add(removeMenu);
    menu.add(new JSeparator());
    JLabel labelTableOptions = new JLabel("Table options");
    labelTableOptions.setFont(menuLabelFont);
    menu.add(labelTableOptions);
    menu.add(new JSeparator());
    menu.add(autoResizeMenu);

    menu.add(new JSeparator());
    List<MenuActionProvider> menuActionProviders = otrosApplication.getLogViewPanelMenuActionProvider();
    for (MenuActionProvider menuActionProvider : menuActionProviders) {
        try {
            List<OtrosAction> actions = menuActionProvider.getActions(otrosApplication, this);
            if (actions == null) {
                continue;
            }
            for (OtrosAction action : actions) {
                menu.add(action);
            }
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, "Cant get action from from provider " + menuActionProvider, e);
        }
    }

    return menu;
}

From source file:pl.otros.vfs.browser.VfsBrowser.java

License:asdf

private JLabel getTitleListLabel(String text, Icon icon) {
    JLabel jLabel = new JLabel(text, icon, SwingConstants.CENTER);
    Font font = jLabel.getFont();
    jLabel.setFont(font.deriveFont(Font.ITALIC | Font.BOLD, font.getSize() * 1.1f));
    jLabel.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 3));

    return jLabel;
}