Example usage for java.awt BorderLayout EAST

List of usage examples for java.awt BorderLayout EAST

Introduction

In this page you can find the example usage for java.awt BorderLayout EAST.

Prototype

String EAST

To view the source code for java.awt BorderLayout EAST.

Click Source Link

Document

The east layout constraint (right side of container).

Usage

From source file:info.puzz.trackprofiler.gui.TrackProfilerFrame.java

private void initGUI() {
    try {//from  w w w  . j a va  2  s.c  o  m
        BorderLayout thisLayout = new BorderLayout();
        this.getContentPane().setLayout(thisLayout);
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        this.setTitle("Track Profiler " + TrackProfilerAppContext.PROGRAM_VERSION); //$NON-NLS-1$//$NON-NLS-2$
        this.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent evt) {
                rootWindowClosing(evt);
            }
        });
        this.getContentPane().add(getJPanel1(), BorderLayout.CENTER);
        this.getContentPane().add(getTopToolBar(), BorderLayout.NORTH);
        this.getContentPane().add(getJPanel2(), BorderLayout.EAST);
        this.setLocation(new java.awt.Point(100, 100));
        pack();
        this.setSize(794, 537);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.eumetsat.metop.visat.SounderInfoView.java

@Override
protected JComponent createControl() {
    overlayListener = new SounderOverlayListener() {
        @Override/*from www .  ja  v  a  2  s . c  om*/
        public void selectionChanged(SounderOverlay overlay) {
            updateUI(overlay);
        }

        @Override
        public void dataChanged(SounderOverlay overlay) {
            updateUI(overlay);
        }
    };
    internalFrameListener = new InternalFrameAdapter() {
        @Override
        public void internalFrameActivated(final InternalFrameEvent e) {
            final Container contentPane = e.getInternalFrame().getContentPane();
            if (contentPane instanceof ProductSceneView) {
                final ProductSceneView view = (ProductSceneView) contentPane;
                final SounderLayer layer = getSounderLayer(view);

                if (layer != null) {
                    layerChanged(layer);
                } else {
                    final LayerListener layerListener = new AbstractLayerListener() {
                        @Override
                        public void handleLayersAdded(Layer parentLayer, Layer[] childLayers) {
                            final SounderLayer layer = getSounderLayer(view);
                            if (layer != null) {
                                layerChanged(layer);
                                view.getRootLayer().removeListener(this);
                            }
                        }
                    };
                    view.getRootLayer().addListener(layerListener);
                }
            }
        }

        @Override
        public void internalFrameDeactivated(final InternalFrameEvent e) {
            final Container contentPane = e.getInternalFrame().getContentPane();
            if (contentPane instanceof ProductSceneView) {
                final ProductSceneView view = (ProductSceneView) contentPane;
                final SounderLayer layer = getSounderLayer(view);
                if (layer != null) {
                    layer.getOverlay().removeListener(overlayListener);
                }
            }
        }

        @Override
        public void internalFrameClosed(InternalFrameEvent e) {
            if (getSounderLayer() == null) {
                clearUI();
                editor.setModel(null);
            }
        }
    };
    VisatApp.getApp().addInternalFrameListener(internalFrameListener);

    final JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add("Sounder Info", createInfoComponent());
    tabbedPane.add("Sounder Spectrum", createSpectrumChartComponent());
    tabbedPane.add("Sounder Layer", createSounderLayerComponent());

    final SounderLayer layer = getSounderLayer();
    if (layer != null) {
        layerChanged(layer);
    }

    final AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help24.gif"),
            false);
    helpButton.setToolTipText("Help."); /*I18N*/
    helpButton.setName("helpButton");

    if (getDescriptor().getHelpId() != null) {
        HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId());
        HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId());
    }

    final JPanel containerPanel = new JPanel(new BorderLayout());
    containerPanel.add(tabbedPane, BorderLayout.CENTER);
    final JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.add(helpButton, BorderLayout.EAST);
    containerPanel.add(buttonPanel, BorderLayout.SOUTH);

    return containerPanel;
}

From source file:com.intel.stl.ui.monitor.view.PSPortsDetailsPanel.java

protected JPanel createTitlePanel() {
    JPanel panel = new JPanel(new BorderLayout(5, 1));
    panel.setOpaque(false);//  w  w w.  j av  a 2s  .  c o  m
    numberLabel = ComponentFactory.getH1Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.PLAIN);
    numberLabel.setHorizontalAlignment(JLabel.RIGHT);
    panel.add(numberLabel, BorderLayout.CENTER);
    nameLabel = ComponentFactory.getH3Label("", Font.PLAIN);
    nameLabel.setHorizontalAlignment(JLabel.LEFT);
    nameLabel.setVerticalAlignment(JLabel.BOTTOM);
    panel.add(nameLabel, BorderLayout.EAST);

    return panel;
}

From source file:StandardDialog.java

/**
 * Standard constructor - creates a three button panel with the specified button labels.
 *
 * @param label1  the label for button 1.
 * @param label2  the label for button 2.
 * @param label3  the label for button 3.
 *//*  w ww  .  j  av  a 2s .c  om*/
public L1R2ButtonPanel(final String label1, final String label2, final String label3) {

    setLayout(new BorderLayout());

    // create the pieces...
    this.left = new JButton(label1);

    final JPanel rightButtonPanel = new JPanel(new GridLayout(1, 2));
    this.right1 = new JButton(label2);
    this.right2 = new JButton(label3);
    rightButtonPanel.add(this.right1);
    rightButtonPanel.add(this.right2);

    // ...and put them together
    add(this.left, BorderLayout.WEST);
    add(rightButtonPanel, BorderLayout.EAST);

}

From source file:com.jamfsoftware.jss.healthcheck.ui.HealthReport.java

/**
 * Creates a new Health Report JPanel window from the Health Check JSON string.
 * Will throw errors if the JSON is not formatted correctly.
 *///  www .  j  ava 2s. c o  m
public HealthReport(final String JSON) throws Exception {
    LOGGER.debug("[DEBUG] - JSON String (Copy entire below line)");
    LOGGER.debug(JSON.replace("\n", ""));
    LOGGER.debug("Attempting to parse Health Report JSON");

    JsonElement report = new JsonParser().parse(JSON);
    JsonObject healthcheck = ((JsonObject) report).get("healthcheck").getAsJsonObject();
    Boolean show_system_info = true;
    JsonObject system = null;
    //Check if the check JSON contains system information and show/hide panels accordingly later.
    system = ((JsonObject) report).get("system").getAsJsonObject();

    final JsonObject data = ((JsonObject) report).get("checkdata").getAsJsonObject();

    this.JSSURL = extractData(healthcheck, "jss_url");

    if (extractData(system, "iscloudjss").contains("true")) {
        show_system_info = false;
        isCloudJSS = true;
    }

    PanelIconGenerator iconGen = new PanelIconGenerator();
    PanelGenerator panelGen = new PanelGenerator();

    //Top Level Frame
    final JFrame frame = new JFrame("JSS Health Check Report");

    //Top Level Content
    JPanel outer = new JPanel(new BorderLayout());

    //Two Blank Panels for the Sides
    JPanel blankLeft = new JPanel();
    blankLeft.add(new JLabel("        "));
    JPanel blankRight = new JPanel();
    blankRight.add(new JLabel("        "));
    blankLeft.setMinimumSize(new Dimension(100, 100));
    blankRight.setMinimumSize(new Dimension(100, 100));
    //Header
    JPanel header = new JPanel();
    header.add(new JLabel("Total Computers: " + extractData(healthcheck, "totalcomputers")));
    header.add(new JLabel("Total Mobile Devices: " + extractData(healthcheck, "totalmobile")));
    header.add(new JLabel("Total Users: " + extractData(healthcheck, "totalusers")));
    int total_devices = Integer.parseInt(extractData(healthcheck, "totalcomputers"))
            + Integer.parseInt(extractData(healthcheck, "totalmobile"));
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yy HH:mm:ss");
    Date dateobj = new Date();
    header.add(new JLabel("JSS Health Check Report Performed On " + df.format(dateobj)));
    //Foooter
    JPanel footer = new JPanel();
    JButton view_report_json = new JButton("View Report JSON");
    footer.add(view_report_json);
    JButton view_activation_code = new JButton("View Activation Code");
    footer.add(view_activation_code);
    JButton test_again = new JButton("Run Test Again");
    footer.add(test_again);
    JButton view_text_report = new JButton("View Text Report");
    footer.add(view_text_report);
    JButton about_and_terms = new JButton("About and Terms");
    footer.add(about_and_terms);
    //Middle Content, set the background white and give it a border
    JPanel content = new JPanel(new GridLayout(2, 3));
    content.setBackground(Color.WHITE);
    content.setBorder(BorderFactory.createLineBorder(Color.BLACK));

    //Setup Outer Placement
    outer.add(header, BorderLayout.NORTH);
    outer.add(footer, BorderLayout.SOUTH);
    outer.add(blankLeft, BorderLayout.WEST);
    outer.add(blankRight, BorderLayout.EAST);
    outer.add(content, BorderLayout.CENTER);

    //Don't show system info if it is hosted.
    JPanel system_info = null;
    JPanel database_health = null;
    if (show_system_info) {
        //Read all of the System information variables from the JSON and perform number conversions.
        String[][] sys_info = { { "Operating System", extractData(system, "os") },
                { "Java Version", extractData(system, "javaversion") },
                { "Java Vendor", extractData(system, "javavendor") },
                { "Processor Cores", extractData(system, "proc_cores") },
                { "Is Clustered?", extractData(system, "clustering") },
                { "Web App Directory", extractData(system, "webapp_dir") },
                { "Free Memory",
                        Double.toString(
                                round((Double.parseDouble(extractData(system, "free_memory")) / 1000000000), 2))
                                + " GB" },
                { "Max Memory",
                        Double.toString(
                                round((Double.parseDouble(extractData(system, "max_memory")) / 1000000000), 2))
                                + " GB" },
                { "Memory currently in use", Double.toString(round(
                        (Double.parseDouble(extractData(system, "memory_currently_in_use")) / 1000000000), 2))
                        + " GB" },
                { "Total space",
                        Double.toString(
                                round((Double.parseDouble(extractData(system, "total_space")) / 1000000000), 2))
                                + " GB" },
                { "Free Space",
                        Double.toString(round(
                                (Double.parseDouble(extractData(system, "usable_space")) / 1000000000), 2))
                                + " GB" } };
        //Generate the system info panel.
        String systemInfoIcon = iconGen.getSystemInfoIconType(
                Integer.parseInt(extractData(healthcheck, "totalcomputers"))
                        + Integer.parseInt(extractData(healthcheck, "totalmobile")),
                extractData(system, "javaversion"), Double.parseDouble(extractData(system, "max_memory")));
        system_info = panelGen.generateContentPanelSystem("System Info", sys_info, "JSS Minimum Requirements",
                "http://www.jamfsoftware.com/resources/casper-suite-system-requirements/", systemInfoIcon);

        //Get all of the DB information.
        String[][] db_health = { { "Database Size", extractData(system, "database_size") + " MB" } };
        if (extractData(system, "database_size").equals("0")) {
            db_health[0][0] = "Unable to connect to database.";
        }

        String[][] large_sql_tables = extractArrayData(system, "largeSQLtables", "table_name", "table_size");
        String[][] db_health_for_display = ArrayUtils.addAll(db_health, large_sql_tables);
        //Generate the DB Health panel.
        String databaseIconType = iconGen.getDatabaseInfoIconType(total_devices,
                Double.parseDouble(extractData(system, "database_size")),
                extractArrayData(system, "largeSQLtables", "table_name", "table_size").length);
        database_health = panelGen.generateContentPanelSystem("Database Health", db_health_for_display,
                "Too Large SQL Tables", "https://google.com", databaseIconType);
        if (!databaseIconType.equals("green")) {
            this.showLargeDatabase = true;
        }
    }

    int password_strenth = 0;
    if (extractData(data, "password_strength", "uppercase?").contains("true")) {
        password_strenth++;
    }
    if (extractData(data, "password_strength", "lowercase?").contains("true")) {
        password_strenth++;
    }
    if (extractData(data, "password_strength", "number?").contains("true")) {
        password_strenth++;
    }
    if (extractData(data, "password_strength", "spec_chars?").contains("true")) {
        password_strenth++;
    }
    String password_strength_desc = "";
    if (password_strenth == 4) {
        password_strength_desc = "Excellent";
    } else if (password_strenth == 3 || password_strenth == 2) {
        password_strength_desc = "Good";
    } else if (password_strenth == 1) {
        this.strongerPassword = true;
        password_strength_desc = "Poor";
    } else {
        this.strongerPassword = true;
        password_strength_desc = "Needs Updating";
    }

    if (extractData(data, "loginlogouthooks", "is_configured").contains("false")) {
        this.loginInOutHooks = true;
    }

    try {
        if (Integer.parseInt(extractData(data, "device_row_counts", "computers").trim()) != Integer
                .parseInt(extractData(data, "device_row_counts", "computers_denormalized").trim())) {
            this.computerDeviceTableCountMismatch = true;
        }

        if (Integer.parseInt(extractData(data, "device_row_counts", "mobile_devices").trim()) != Integer
                .parseInt(extractData(data, "device_row_counts", "mobile_devices_denormalized").trim())) {
            this.mobileDeviceTableCountMismatch = true;
        }
    } catch (Exception e) {
        System.out.println("Unable to parse device row counts.");
    }

    if ((extractData(system, "mysql_version").contains("5.6.16")
            || extractData(system, "mysql_version").contains("5.6.20"))
            && (extractData(system, "os").contains("OS X") || extractData(system, "os").contains("Mac")
                    || extractData(system, "os").contains("OSX"))) {
        this.mysql_osx_version_bug = true;
    }

    //Get all of the information for the JSS ENV and generate the panel.
    String[][] env_info = {
            { "Checkin Frequency", extractData(data, "computercheckin", "frequency") + " Minutes" },
            { "Log Flushing", extractData(data, "logflushing", "log_flush_time") },
            { "Log In/Out Hooks", extractData(data, "loginlogouthooks", "is_configured") },
            { "Computer EA", extractData(data, "computerextensionattributes", "count") },
            { "Mobile Deivce EA", extractData(data, "mobiledeviceextensionattributes", "count") },
            { "Password Strength", password_strength_desc },
            { "SMTP Server", extractData(data, "smtpserver", "server") },
            { "Sender Email", extractData(data, "smtpserver", "sender_email") },
            { "GSX Connection", extractData(data, "gsxconnection", "status") } };
    String[][] vpp_accounts = extractArrayData(data, "vppaccounts", "name", "days_until_expire");
    String[][] ldap_servers = extractArrayData(data, "ldapservers", "name", "type", "address", "id");
    String envIconType = iconGen.getJSSEnvIconType(Integer.parseInt(extractData(healthcheck, "totalcomputers")),
            Integer.parseInt(extractData(data, "computercheckin", "frequency")),
            Integer.parseInt(extractData(data, "computerextensionattributes", "count")),
            Integer.parseInt(extractData(data, "mobiledeviceextensionattributes", "count")));
    JPanel env = panelGen.generateContentPanelEnv("JSS Environment", env_info, vpp_accounts, ldap_servers, "",
            "", envIconType);

    //Get all of the group information from the JSON, merge the arrays, and then generate the groups JPanel.
    String[][] groups_1 = ArrayUtils.addAll(
            extractArrayData(data, "computergroups", "name", "nested_groups_count", "criteria_count", "id"),
            extractArrayData(data, "mobiledevicegroups", "name", "nested_groups_count", "criteria_count",
                    "id"));
    String[][] groups_2 = ArrayUtils.addAll(groups_1,
            extractArrayData(data, "usergroups", "name", "nested_groups_count", "criteria_count", "id"));
    String groupIconType = iconGen.getGroupIconType("groups", countJSONObjectSize(data, "computergroups")
            + countJSONObjectSize(data, "mobiledevicegroups") + countJSONObjectSize(data, "usergroups"));
    JPanel groups = panelGen.generateContentPanelGroups("Groups", groups_2, "", "", groupIconType);
    if (groupIconType.equals("yellow") || groupIconType.equals("red")) {
        this.showGroupsHelp = true;
    }

    //Get all of the information for the printers, policies and scripts, then generate the panel.
    String[][] printers = extractArrayData(data, "printer_warnings", "model");
    String[][] policies = extractArrayData(data, "policies_with_issues", "name", "ongoing", "checkin_trigger");
    String[][] scripts = extractArrayData(data, "scripts_needing_update", "name");
    String[][] certs = { { "SSL Cert Issuer", extractData(data, "tomcat", "ssl_cert_issuer") },
            { "SLL Cert Expires", extractData(data, "tomcat", "cert_expires") },
            { "MDM Push Cert Expires", extractData(data, "push_cert_expirations", "mdm_push_cert") },
            { "Push Proxy Expires", extractData(data, "push_cert_expirations", "push_proxy") },
            { "Change Management Enabled?", extractData(data, "changemanagment", "isusinglogfile") },
            { "Log File Path:", extractData(data, "changemanagment", "logpath") } };
    String policiesScriptsIconType = iconGen.getPoliciesAndScriptsIconType(
            extractArrayData(data, "policies_with_issues", "name", "ongoing", "checkin_trigger").length,
            extractArrayData(data, "scripts_needing_update", "name").length);
    JPanel policies_scripts = panelGen.generateContentPanelPoliciesScripts(
            "Policies, Scripts, Certs and Change", policies, scripts, printers, certs, "", "",
            policiesScriptsIconType);
    if (extractArrayData(data, "policies_with_issues", "name", "ongoing", "checkin_trigger").length > 0) {
        this.showPolicies = true;
    }
    if (extractArrayData(data, "scripts_needing_update", "name").length > 0) {
        this.showScripts = true;
    }
    if (extractData(data, "changemanagment", "isusinglogfile").contains("false")) {
        this.showChange = true;
    }
    this.showCheckinFreq = iconGen.showCheckinFreq;
    this.showExtensionAttributes = iconGen.showCheckinFreq;
    this.showSystemRequirements = iconGen.showSystemRequirements;
    this.showScalability = iconGen.showScalability;
    //Update Panel Gen Variables
    updatePanelGenVariables(panelGen);

    //Generate the Help Section.
    content.add(panelGen.generateContentPanelHelp("Modifications to Consider", "", "", "blank"));
    //If contains system information, add those panels, otherwise just continue adding the rest of the panels.
    if (show_system_info) {
        content.add(system_info);
        content.add(database_health);
    }
    content.add(env);
    content.add(groups);
    content.add(policies_scripts);

    //View report action listner.
    //Opens a window with the health report JSON listed
    view_report_json.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JPanel middlePanel = new JPanel();
            middlePanel.setBorder(new TitledBorder(new EtchedBorder(), "Health Report JSON"));
            // create the middle panel components
            JTextArea display = new JTextArea(16, 58);
            display.setEditable(false);
            //Make a new GSON object so the text can be Pretty Printed.
            Gson gson = new GsonBuilder().setPrettyPrinting().create();
            String pp_json = gson.toJson(JSON.trim());
            display.append(JSON);
            JScrollPane scroll = new JScrollPane(display);
            scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            //Add Textarea in to middle panel
            middlePanel.add(scroll);

            JFrame frame = new JFrame();
            frame.add(middlePanel);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    //Action listener for the Terms, About and Licence button.
    //Opens a new window with the AS IS License, 3rd Party Libs used and a small about section
    about_and_terms.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JPanel middlePanel = new JPanel();
            middlePanel.setBorder(new TitledBorder(new EtchedBorder(), "About, Licence and Terms"));
            // create the middle panel components
            JTextArea display = new JTextArea(16, 58);
            display.setEditable(false);
            display.append(StringConstants.ABOUT);
            display.append("\n\nThird Party Libraries Used:");
            display.append(
                    " Apache Commons Codec, Google JSON (gson), Java X JSON, JDOM, JSON-Simple, MySQL-connector");
            display.append(StringConstants.LICENSE);
            JScrollPane scroll = new JScrollPane(display);
            scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            //Add Textarea in to middle panel
            middlePanel.add(scroll);

            JFrame frame = new JFrame();
            frame.add(middlePanel);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });

    //Listener for a button click to open a window containing the activation code.
    view_activation_code.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(frame, extractData(data, "activationcode", "code") + "\nExpires: "
                    + extractData(data, "activationcode", "expires"));
        }
    });

    view_text_report.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JPanel middlePanel = new JPanel();
            middlePanel.setBorder(new TitledBorder(new EtchedBorder(), "Text Health Report"));
            // create the middle panel components
            JTextArea display = new JTextArea(16, 58);
            display.setEditable(false);
            //Make a new GSON object so the text can be Pretty Printed.
            display.append(new HealthReportHeadless(JSON).getReportString());
            JScrollPane scroll = new JScrollPane(display);
            scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            //Add Textarea in to middle panel
            middlePanel.add(scroll);

            JFrame frame = new JFrame();
            frame.add(middlePanel);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });

    //Listener for the Test Again button. Opens a new UserPrompt object and keeps the Health Report open in the background.
    test_again.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                new UserPrompt();
            } catch (Exception ex) {
                ex.printStackTrace();
            }

        }
    });

    frame.add(outer);
    frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.setVisible(true);

    DetectVM vm_checker = new DetectVM();
    if (EnvironmentUtil.isMac()) {
        if (vm_checker.getIsVM()) {
            JOptionPane.showMessageDialog(new JFrame(),
                    "The tool has detected that it is running in a OSX Virtual Machine.\nThe opening of links is not supported on OSX VMs.\nPlease open the tool on a non-VM computer and run it again OR\nyou can also copy the JSON from the report to a non-VM OR view the text report.\nIf you are not running a VM, ignore this message.",
                    "VM Detected", JOptionPane.ERROR_MESSAGE);
        }
    }

}

From source file:org.nbheaven.sqe.codedefects.history.controlcenter.panels.SQEHistoryPanel.java

/** Creates new form SQEHistoryPanel */
public SQEHistoryPanel() {
    historyChart = org.jfree.chart.ChartFactory.createStackedXYAreaChart(null, "Snapshot", "CodeDefects",
            perProjectDataSet, PlotOrientation.VERTICAL, false, true, false);
    historyChart.setBackgroundPaint(Color.WHITE);
    historyChart.getXYPlot().setRangeGridlinePaint(Color.BLACK);
    historyChart.getXYPlot().setDomainGridlinePaint(Color.BLACK);
    historyChart.getXYPlot().setBackgroundPaint(Color.WHITE);

    XYPlot plot = historyChart.getXYPlot();
    plot.setForegroundAlpha(0.7f);/*from   w ww  .  j  ava 2s. co  m*/
    //        plot.getRenderer();

    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    LogarithmicAxis rangeAxis = new LogarithmicAxis("CodeDefects");
    rangeAxis.setStrictValuesFlag(false);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.setRangeAxis(rangeAxis);

    StackedXYAreaRenderer2 categoryItemRenderer = new StackedXYAreaRenderer2(); //3D();
    categoryItemRenderer.setSeriesPaint(0, Color.RED);
    categoryItemRenderer.setSeriesPaint(1, Color.ORANGE);
    categoryItemRenderer.setSeriesPaint(2, Color.YELLOW);

    plot.setRenderer(categoryItemRenderer);

    ChartPanel historyChartPanel = new ChartPanel(historyChart);
    historyChartPanel.setBorder(null);
    historyChartPanel.setPreferredSize(new Dimension(150, 200));
    historyChartPanel.setBackground(Color.WHITE);
    initComponents();

    historyView.setLayout(new BorderLayout());
    historyView.add(historyChartPanel, BorderLayout.CENTER);

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

    GroupLayout layout = new GroupLayout(selectorPanel);
    selectorPanel.setLayout(layout);

    // Turn on automatically adding gaps between components
    layout.setAutocreateGaps(true);

    // Turn on automatically creating gaps between components that touch
    // the edge of the container and the container.
    layout.setAutocreateContainerGaps(true);

    ParallelGroup horizontalParallelGroup = layout.createParallelGroup(GroupLayout.LEADING);
    SequentialGroup verticalSequentialGroup = layout.createSequentialGroup();

    layout.setHorizontalGroup(layout.createSequentialGroup().add(horizontalParallelGroup));

    layout.setVerticalGroup(verticalSequentialGroup);

    clearHistoryButton = new JButton();
    clearHistoryButton.setEnabled(false);
    clearHistoryButton.setIcon(ImageUtilities
            .image2Icon(ImageUtilities.loadImage("org/nbheaven/sqe/codedefects/history/resources/trash.png")));
    clearHistoryButton.setOpaque(false);
    clearHistoryButton.setFocusPainted(false);
    clearHistoryButton.setToolTipText(
            NbBundle.getBundle("org/nbheaven/sqe/codedefects/history/controlcenter/panels/Bundle")
                    .getString("HINT_clear_button"));
    horizontalParallelGroup.add(clearHistoryButton);
    verticalSequentialGroup.add(clearHistoryButton);
    clearHistoryButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (null != activeHistory) {
                activeHistory.clear();
            }
        }

    });

    Component createVerticalStrut = Box.createVerticalStrut(10);

    horizontalParallelGroup.add(createVerticalStrut);
    verticalSequentialGroup.add(createVerticalStrut);

    for (final QualityProvider provider : SQEUtilities.getProviders()) {
        final JToggleButton providerButton = new JToggleButton();
        providerButton.setIcon(provider.getIcon());
        providerButton.setOpaque(false);
        providerButton.setFocusPainted(false);
        horizontalParallelGroup.add(providerButton);
        verticalSequentialGroup.add(providerButton);
        ActionListener listener = new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (providerButton.isSelected()) {
                    addSelectedProvider(provider);
                } else {
                    removeSelectedProvider(provider);
                }
                updateView();
            }
        };
        providerButton.addActionListener(listener);
        addSelectedProvider(provider);
        providerButton.setSelected(true);
    }

    historyView.add(selectorPanel, BorderLayout.EAST);
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.TerminologyConstraintPanel.java

/**
 * Inits the components.//from w ww  . j  a va2s. c o  m
 */
public synchronized void initComponents() {

    setName(getClass().getCanonicalName());

    simpleCloseToUserExpressionPanel = new SimpleCloseToUserExpressionPanel(propertyChangeTrackerService,
            terminologySearchService, applicationService, selectionService, terminologyConceptDAO,
            humanReadableRender, normalFormGenerator);
    simpleCloseToUserExpressionPanel.initComponents();
    propertyChangeTrackerService.registerListener(simpleCloseToUserExpressionPanel);

    // add check box that allows user to toggle subsume all types
    subsumeAllTypesCheckBox = new JCheckBox(new AbstractAction("Include all types of") {
        public void actionPerformed(ActionEvent e) {
            if (subsumeAllTypesCheckBox.isSelected()) {
                setAndNotify(SubsumptionVocabulary.SELF_OR_ANY_TYPE_OF);
            } else {
                setAndNotify(SubsumptionVocabulary.SELF_ONLY);
            }
        }
    });

    // add a combo box that allows user to specify subsumption
    SubsumptionVocabulary[] vocabularies = SubsumptionVocabulary.values();
    subsumptionBox = new JComboBox(vocabularies);
    // add listener to subsumptionBox
    subsumptionBox.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent e) {

            Object selectedItem = subsumptionBox.getSelectedItem();
            if (selectedItem instanceof SubsumptionVocabulary) {
                setAndNotify((SubsumptionVocabulary) selectedItem);
            }
        }
    });

    final JXCollapsiblePane collapsiblePane = new JXCollapsiblePane(new BorderLayout());
    collapsiblePane.add(new JLabel("Choose subsumption"), BorderLayout.WEST);
    collapsiblePane.add(subsumptionBox, BorderLayout.CENTER);
    collapsiblePane.setCollapsed(true);

    // set advanced button that displays the collapsible panel with more options
    JideButton advancedButton = new JideButton(new AbstractAction("V") {
        public void actionPerformed(ActionEvent e) {
            if (collapsiblePane.isCollapsed()) {
                collapsiblePane.setCollapsed(false);
            } else {
                collapsiblePane.setCollapsed(true);
            }
        }
    });

    // add panel for subsumption options
    JPanel subsumptionPanel = new JPanel(new BorderLayout());
    subsumptionPanel.add(subsumeAllTypesCheckBox, BorderLayout.CENTER);
    subsumptionPanel.add(advancedButton, BorderLayout.EAST);
    subsumptionPanel.add(collapsiblePane, BorderLayout.SOUTH);
    // set layout and add closeToUserExpressionPanel and subsumptionBox with a label on top
    setLayout(new BorderLayout());
    add(simpleCloseToUserExpressionPanel, BorderLayout.CENTER);
    add(subsumptionPanel, BorderLayout.SOUTH);
}

From source file:org.eumetsat.metop.visat.IasiInfoView.java

@Override
protected JComponent createControl() {
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add("Sounder Info", createInfoComponent());
    tabbedPane.add("Sounder Spectrum", createSpectrumChartComponent());
    tabbedPane.add("Radiance Analysis", createRadianceAnalysisComponent());
    tabbedPane.add("Sounder Layer", createSounderLayerComponent());

    if (getDescriptor().getHelpId() != null) {
        HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId());
    }// w w  w. j  ava 2 s.c  om

    InternalFrameListener internalFrameListener = new InternalFrameAdapter() {

        @Override
        public void internalFrameActivated(InternalFrameEvent e) {
            final Container contentPane = e.getInternalFrame().getContentPane();
            if (contentPane instanceof ProductSceneView) {
                final ProductSceneView view = (ProductSceneView) contentPane;
                final IasiLayer layer = getIasiLayer();
                if (layer != null) {
                    modelChanged(layer);
                } else {
                    final LayerListener layerListener = new AbstractLayerListener() {
                        @Override
                        public void handleLayersAdded(Layer parentLayer, Layer[] childLayers) {
                            final IasiLayer layer = getIasiLayer();
                            if (layer != null) {
                                modelChanged(layer);
                                view.getRootLayer().removeListener(this);
                            }
                        }
                    };
                    view.getRootLayer().addListener(layerListener);
                }
            }
        }

        @Override
        public void internalFrameDeactivated(InternalFrameEvent e) {
            if (currentOverlay != null) {
                currentOverlay.removeListener(overlayListener);
            }
            updateUI(null);
            editor.setModel(null);
        }
    };

    VisatApp.getApp().addInternalFrameListener(internalFrameListener);
    if (MetopSounderVPI.isValidAvhrrProductSceneViewSelected()) {
        final IasiLayer layer = getIasiLayer();
        if (layer != null) {
            modelChanged(layer);
        }
    }

    final AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help24.gif"),
            false);
    helpButton.setToolTipText("Help."); /*I18N*/
    helpButton.setName("helpButton");

    if (getDescriptor().getHelpId() != null) {
        HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId());
        HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId());
    }

    final JPanel containerPanel = new JPanel(new BorderLayout());
    containerPanel.add(tabbedPane, BorderLayout.CENTER);
    final JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.add(helpButton, BorderLayout.EAST);
    containerPanel.add(buttonPanel, BorderLayout.SOUTH);

    return containerPanel;
}

From source file:aurelienribon.gdxsetupui.ui.MainPanel.java

private void initUI() {
    startSetupBtn.addActionListener(new ActionListener() {
        @Override/*w w  w .  j  a v a2  s  .  c o  m*/
        public void actionPerformed(ActionEvent e) {
            showSetupView();
        }
    });

    startUpdateBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            showUpdateView();
        }
    });

    changeModeBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            showInitView();
        }
    });

    JLabel aboutLabel = new JLabel("About this app >");
    Style.registerCssClasses(aboutLabel, ".linkLabel");
    aboutLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    versionLabel.setLayout(new BorderLayout());
    versionLabel.add(aboutLabel, BorderLayout.EAST);

    aboutLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            showAboutPanel();
        }
    });
}

From source file:org.rdv.viz.spectrum.SpectrumViz.java

/**
 * Initializes the properties panel.//www. ja v  a  2  s. c  om
 */
private void initPropertiesPanel() {
    propertiesPanel = new JPanel();
    propertiesPanel.setLayout(new SpringLayout());
    propertiesPanel.setBorder(BorderFactory.createTitledBorder("Properties"));

    ActionListener actionListener = new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            handlePropertiesUpdate((Component) ae.getSource());
        }
    };

    FocusAdapter focusListener = new FocusAdapter() {
        public void focusLost(FocusEvent fe) {
            handlePropertiesUpdate(fe.getComponent());
        }
    };

    propertiesPanel.add(new JLabel("Sample rate: "));
    sampleRateTextField = new JTextField(Double.toString(spectrumAnalyzerPanel.getSampleRate()));
    sampleRateTextField.addActionListener(actionListener);
    sampleRateTextField.addFocusListener(focusListener);
    propertiesPanel.add(sampleRateTextField);

    propertiesPanel.add(new JLabel("Number of points: "));
    numberOfSamplesTextField = new JTextField(Integer.toString(spectrumAnalyzerPanel.getNumberOfSamples()));
    numberOfSamplesTextField.addActionListener(actionListener);
    numberOfSamplesTextField.addFocusListener(focusListener);
    propertiesPanel.add(numberOfSamplesTextField);

    propertiesPanel.add(new JLabel("Window: "));
    Object[] windowTypes = EnumSet.allOf(WindowFunction.class).toArray();
    windowFunctionComboBox = new JComboBox(windowTypes);
    windowFunctionComboBox.setSelectedItem(spectrumAnalyzerPanel.getWindowFunction());
    windowFunctionComboBox.addActionListener(actionListener);
    propertiesPanel.add(windowFunctionComboBox);

    propertiesPanel.add(new JLabel("Size: "));
    segmentSizeTextField = new JTextField(Integer.toString(spectrumAnalyzerPanel.getSegmentSize()));
    segmentSizeTextField.addActionListener(actionListener);
    segmentSizeTextField.addFocusListener(focusListener);
    propertiesPanel.add(segmentSizeTextField);

    propertiesPanel.add(new JLabel("Overlap: "));
    overlapTextField = new JTextField(Integer.toString(spectrumAnalyzerPanel.getOverlap()));
    overlapTextField.addActionListener(actionListener);
    overlapTextField.addFocusListener(focusListener);
    propertiesPanel.add(overlapTextField);

    SpringUtilities.makeCompactGrid(propertiesPanel, 5, 2, 5, 5, 5, 5);

    panel.add(propertiesPanel, BorderLayout.EAST);
}