List of usage examples for javax.swing JTextArea setEditable
@BeanProperty(description = "specifies if the text can be edited") public void setEditable(boolean b)
TextComponent
should be editable. From source file:edu.ku.brc.specify.tasks.subpane.LabelsPane.java
private void showErrorMsgs() { CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "f:p:g")); JTextArea ta = createTextArea(40, 80); pb.add(createScrollPane(ta, true), cc.xy(1, 1)); pb.setDefaultDialogBorder();/*from w ww.j a va 2 s . c o m*/ ta.setText(errThrowable != null ? getStackTrace(errThrowable) : ""); ta.setEditable(false); CustomDialog dlg = new CustomDialog((Frame) getMostRecentWindow(), getResourceString("Error"), true, CustomDialog.OK_BTN, pb.getPanel()); dlg.setOkLabel(getResourceString("CLOSE")); centerAndShow(dlg); }
From source file:net.aepik.alasca.gui.ldap.SchemaObjectEditorFrame.java
/** * Build frame.//from w w w .ja v a 2 s . c om */ private void build() { setTitle("Proprits de l'objet " + objetSchema.getId()); setSize(700, 400); setResizable(false); setLocationRelativeTo(mainFrame); if (mainFrame != null) setIconImage(mainFrame.getIconImage()); // - Panel bouton du bas - JPanel boutonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); boutonsPanel.add(boutonOk); boutonsPanel.add(boutonAnnuler); // - Description - JTextArea textAreaValues = new JTextArea("Vous pouvez apporter des modifications sur les paramtres" + " de cet objet d'identifiant " + objetSchema.getId() + ". Les" + " modifications apportes des paramtres non-cochs ne" + " seront pas prises en compte."); textAreaValues.setEditable(false); textAreaValues.setLineWrap(true); textAreaValues.setWrapStyleWord(true); textAreaValues.setFont((new JLabel()).getFont()); textAreaValues.setBorder(BorderFactory.createEmptyBorder(7, 8, 7, 8)); textAreaValues.setBackground((new JLabel()).getBackground()); // - La table des valeurs - // Correction : Tri alphabtique des valeurs Enumeration<String> k = values.keys(); String[] keys = new String[values.size()]; for (int i = 0; i < keys.length; i++) keys[i] = k.nextElement(); Arrays.sort(keys); JPanel colonne1 = new JPanel(new GridLayout(keys.length, 1)); JPanel colonne2 = new JPanel(new GridLayout(keys.length, 1)); // Enumeration<JComponent> l = labels.elements(); // Enumeration<JComponent> v = values.elements(); // Enumeration<String> k = values.keys(); // JPanel colonne1 = new JPanel( new GridLayout( values.size(), 1 ) ); // JPanel colonne2 = new JPanel( new GridLayout( values.size(), 1 ) ); for (int i = 0; keys != null && i < keys.length; i++) { // while( l.hasMoreElements() && v.hasMoreElements() && k.hasMoreElements() ) { String key = keys[i]; JComponent label = labels.get(key); JComponent value = values.get(key); JCheckBox checkbox = valuesPresent.get(key); // String key = k.nextElement(); // JComponent label = l.nextElement(); // JComponent value = v.nextElement(); // JCheckBox checkbox = valuesPresent.get( key ); if (!value.isEnabled() && value instanceof JTextField) { //value.setEnabled( true ); JButton b = new JButton("..."); b.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder(0, 5, 0, 0, Color.white), b.getBorder())); b.addActionListener(new SchemaValueEditorLauncher(b, (JTextField) value, objetSchema, key)); JPanel tmp = new JPanel(new BorderLayout()); tmp.add(value, BorderLayout.CENTER); tmp.add(b, BorderLayout.EAST); tmp.setOpaque(false); value = tmp; } JPanel panelTmp1 = new JPanel(new BorderLayout()); panelTmp1.add(checkbox, BorderLayout.WEST); panelTmp1.add(label, BorderLayout.CENTER); panelTmp1.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 3)); colonne1.add(panelTmp1); JPanel panelTmp2 = new JPanel(new BorderLayout()); panelTmp2.add(value, BorderLayout.CENTER); panelTmp2.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3)); colonne2.add(panelTmp2); checkbox.setOpaque(false); label.setOpaque(false); value.setOpaque(false); panelTmp1.setOpaque(false); panelTmp2.setOpaque(false); } JPanel tablePanel = new JPanel(new BorderLayout()); tablePanel.add(colonne1, BorderLayout.WEST); tablePanel.add(colonne2, BorderLayout.EAST); tablePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); colonne1.setOpaque(false); colonne2.setOpaque(false); tablePanel.setOpaque(false); JPanel tablePanelContainer = new JPanel(new BorderLayout()); tablePanelContainer.add(tablePanel, BorderLayout.NORTH); tablePanelContainer.setBackground(Color.white); JList tmpForBorderList = new JList(); JScrollPane tmpForBorderScroller = new JScrollPane(tmpForBorderList); JScrollPane tableScroller = new JScrollPane(tablePanelContainer); //tableScroller.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); tableScroller.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 6, 1, 6), BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Listes des paramtres "), BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5), tmpForBorderScroller.getBorder())))); // - Organisation gnrale - JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(textAreaValues, BorderLayout.NORTH); mainPanel.add(tableScroller, BorderLayout.CENTER); JPanel mainPanelContainer = new JPanel(new BorderLayout()); mainPanelContainer.add(mainPanel, BorderLayout.CENTER); mainPanelContainer.add(boutonsPanel, BorderLayout.SOUTH); mainPanelContainer.setBorder(BorderFactory.createEmptyBorder(2, 1, 1, 1)); getContentPane().add(mainPanelContainer); // - Listeners - addWindowListener(this); boutonOk.addActionListener(this); boutonAnnuler.addActionListener(this); }
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. *//*from w ww . j a va2s . 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:com.polivoto.vistas.Charts.java
private JPanel hacerTabla(Pregunta pregunta, List<Opcion> opciones, String perfil) { Tabla panel = new Tabla(); //Panel completo //scrollPanel.setBackground(Color.blue); //Ttulo pregunta JLabel tituloPregunta = new JLabel("\t" + pregunta.getTitulo() + " (" + perfil + ")"); tituloPregunta.setFont(new Font("Roboto", 1, 24)); tituloPregunta.setForeground(Color.black); tituloPregunta.setVerticalAlignment(JLabel.CENTER); JPanel panelHeader = panel.getjPanelHead(); panelHeader.add(tituloPregunta);/*from w w w .j a va2 s . c o m*/ panelHeader.setOpaque(false); panelHeader.setPreferredSize(panelGrafica.getSize()); //Panel de la tabla JPanel tabla = new JPanel(new GridLayout(pregunta.obtenerCantidadDeOpciones() + 2, 3, 5, 5)); tabla.setBackground(Color.white); //Poner el titulo de cada columna for (int i = 0; i < 3; i++) { JPanel tilt = new JPanel(); tilt.setBackground(new Color(137, 36, 31)); JLabel label = new JLabel(i == 0 ? "Opcion" : i == 2 ? "Porcentaje" : "Cantidad"); label.setFont(new Font("Roboto", 1, 18)); label.setForeground(Color.white); tilt.add(label); tilt.setSize(new Dimension(0, 35)); tilt.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); tabla.add(tilt); } int sum = 0; for (Opcion opcion : opciones) { sum += opcion.getCantidad(); } for (Opcion opc : opciones) { JPanel p1 = new JPanel(new GridLayout(0, 1)); p1.setBackground(Color.white); p1.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JTextArea l1 = new JTextArea(opc.getNombre()); l1.setWrapStyleWord(true); l1.setLineWrap(true); l1.setFont(new Font("Roboto", 0, 18)); l1.setEditable(false); l1.setBorder(null); p1.setPreferredSize(l1.getSize()); p1.add(l1); tabla.add(p1); JPanel p2 = new JPanel(); p2.setBackground(Color.white); p2.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JLabel l2 = new JLabel("" + opc.getCantidad()); l2.setFont(new Font("Roboto", 0, 18)); p2.add(l2); tabla.add(p2); JPanel p3 = new JPanel(); p3.setBackground(Color.white); p3.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); double porcentaje = (opc.getCantidad() * 100.0) / sum; JLabel l3 = new JLabel(String.format("%.2f", porcentaje) + "%"); l3.setFont(new Font("Roboto", 0, 18)); p3.add(l3); tabla.add(p3); } JPanel p1 = new JPanel(); p1.setBackground(Color.white); p1.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JLabel l1 = new JLabel("Total"); l1.setHorizontalTextPosition(JLabel.LEFT); l1.setFont(new Font("Roboto", 1, 18)); p1.add(l1); tabla.add(p1); JPanel p2 = new JPanel(); p2.setBackground(Color.white); p2.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JLabel l2 = new JLabel("" + sum); l2.setFont(new Font("Roboto", 1, 18)); p2.add(l2); tabla.add(p2); JPanel p3 = new JPanel(); p3.setBackground(Color.white); p3.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JLabel l3 = new JLabel("100.00%"); l3.setFont(new Font("Roboto", 1, 18)); p3.add(l3); tabla.add(p3); panel.getjPanelContent().add(tabla, BorderLayout.CENTER); //Relleno JPanel x = new JPanel(new GridLayout()); x.setPreferredSize(new Dimension(100, 0)); x.setBackground(Color.white); panel.getjPanelContent().add(x, BorderLayout.LINE_START); JPanel y = new JPanel(new GridLayout()); y.setPreferredSize(new Dimension(100, 0)); y.setBackground(Color.white); panel.getjPanelContent().add(y, BorderLayout.LINE_END); JPanel z = new JPanel(new GridLayout()); z.setBackground(Color.white); z.setPreferredSize(new Dimension(0, 40)); panel.getjPanelContent().add(z, BorderLayout.PAGE_END); return panel; }
From source file:ConfigFiles.java
public ConfigFiles(Dimension screensize) { // initializeFileBrowser(); paths = new JPanel(); paths.setBackground(Color.WHITE); //paths.setBorder(BorderFactory.createTitledBorder("Paths")); paths.setLayout(null);/*from ww w . ja v a 2s .c o m*/ paths.setPreferredSize(new Dimension(930, 1144)); paths.setSize(new Dimension(930, 1144)); paths.setMinimumSize(new Dimension(930, 1144)); paths.setMaximumSize(new Dimension(930, 1144)); //paths.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); setLayout(null); ttcpath = new JTextField(); addPanel("TestCase Source Path", "Master directory with the test cases that can" + " be run by the framework", ttcpath, RunnerRepository.TESTSUITEPATH, 10, true, null); tMasterXML = new JTextField(); tUsers = new JTextField(); addPanel("Projects Path", "Location of projects XML files", tUsers, RunnerRepository.REMOTEUSERSDIRECTORY, 83, true, null); tSuites = new JTextField(); addPanel("Predefined Suites Path", "Location of predefined suites", tSuites, RunnerRepository.PREDEFINEDSUITES, 156, true, null); testconfigpath = new JTextField(); addPanel("Test Configuration Path", "Test Configuration path", testconfigpath, RunnerRepository.TESTCONFIGPATH, 303, true, null); tepid = new JTextField(); addPanel("EP name File", "Location of the file that contains" + " the Ep name list", tepid, RunnerRepository.REMOTEEPIDDIR, 595, true, null); tlog = new JTextField(); addPanel("Logs Path", "Location of the directory that stores the most recent log files." + " The files are re-used each Run.", tlog, RunnerRepository.LOGSPATH, 667, true, null); tsecondarylog = new JTextField(); JPanel p = addPanel("Secondary Logs Path", "Location of the directory that archives copies of the most recent log files, with" + " original file names appended with <.epoch time>", tsecondarylog, RunnerRepository.SECONDARYLOGSPATH, 930, true, null); logsenabled.setSelected(Boolean.parseBoolean(RunnerRepository.PATHENABLED)); logsenabled.setBackground(Color.WHITE); p.add(logsenabled); JPanel p7 = new JPanel(); p7.setBackground(Color.WHITE); TitledBorder border7 = BorderFactory.createTitledBorder("Log Files"); border7.setTitleFont(new Font("Arial", Font.PLAIN, 14)); border7.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1)); p7.setBorder(border7); p7.setLayout(new BoxLayout(p7, BoxLayout.Y_AXIS)); p7.setBounds(80, 740, 800, 190); paths.add(p7); JTextArea log2 = new JTextArea("All the log files that will be monitored"); log2.setWrapStyleWord(true); log2.setLineWrap(true); log2.setEditable(false); log2.setCursor(null); log2.setOpaque(false); log2.setFocusable(false); log2.setBorder(null); log2.setFont(new Font("Arial", Font.PLAIN, 12)); log2.setBackground(getBackground()); log2.setMaximumSize(new Dimension(170, 25)); log2.setPreferredSize(new Dimension(170, 25)); JPanel p71 = new JPanel(); p71.setBackground(Color.WHITE); p71.setLayout(new GridLayout()); p71.setMaximumSize(new Dimension(700, 13)); p71.setPreferredSize(new Dimension(700, 13)); p71.add(log2); JPanel p72 = new JPanel(); p72.setBackground(Color.WHITE); p72.setLayout(new BoxLayout(p72, BoxLayout.Y_AXIS)); trunning = new JTextField(); p72.add(addField(trunning, "Running: ", 0)); tdebug = new JTextField(); p72.add(addField(tdebug, "Debug: ", 1)); tsummary = new JTextField(); p72.add(addField(tsummary, "Summary: ", 2)); tinfo = new JTextField(); p72.add(addField(tinfo, "Info: ", 3)); tcli = new JTextField(); p72.add(addField(tcli, "Cli: ", 4)); p7.add(p71); p7.add(p72); libpath = new JTextField(); addPanel("Library path", "Secondary user library path", libpath, RunnerRepository.REMOTELIBRARY, 229, true, null); JPanel p8 = new JPanel(); p8.setBackground(Color.WHITE); TitledBorder border8 = BorderFactory.createTitledBorder("File"); border8.setTitleFont(new Font("Arial", Font.PLAIN, 14)); border8.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1)); p8.setBorder(border8); p8.setLayout(null); p8.setBounds(80, 1076, 800, 50); if (PermissionValidator.canChangeFWM()) { paths.add(p8); } JButton save = new JButton("Save"); save.setToolTipText("Save and automatically load config"); save.setBounds(490, 20, 70, 20); save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { saveXML(false, "fwmconfig"); loadConfig("fwmconfig.xml"); } }); p8.add(save); // if(!PermissionValidator.canChangeFWM()){ // save.setEnabled(false); // } JButton saveas = new JButton("Save as"); saveas.setBounds(570, 20, 90, 20); saveas.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { String filename = CustomDialog.showInputDialog(JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, ConfigFiles.this, "File Name", "Please enter file name"); if (!filename.equals("NULL")) { saveXML(false, filename); } } }); p8.add(saveas); final JButton loadXML = new JButton("Load Config"); loadXML.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { String[] configs = RunnerRepository .getRemoteFolderContent(RunnerRepository.USERHOME + "/twister/config/"); JComboBox combo = new JComboBox(configs); int resp = (Integer) CustomDialog.showDialog(combo, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, ConfigFiles.this, "Config", null); final String config; if (resp == JOptionPane.OK_OPTION) config = combo.getSelectedItem().toString(); else config = null; if (config != null) { new Thread() { public void run() { setEnabledTabs(false); JFrame progress = new JFrame(); progress.setAlwaysOnTop(true); progress.setLocation((int) loadXML.getLocationOnScreen().getX(), (int) loadXML.getLocationOnScreen().getY()); progress.setUndecorated(true); JProgressBar bar = new JProgressBar(); bar.setIndeterminate(true); progress.add(bar); progress.pack(); progress.setVisible(true); loadConfig(config); progress.dispose(); setEnabledTabs(true); } }.start(); } } catch (Exception e) { e.printStackTrace(); } } }); loadXML.setBounds(670, 20, 120, 20); p8.add(loadXML); // if(!PermissionValidator.canChangeFWM()){ // loadXML.setEnabled(false); // } tdbfile = new JTextField(); addPanel("Database XML path", "File location for database configuration", tdbfile, RunnerRepository.REMOTEDATABASECONFIGPATH + RunnerRepository.REMOTEDATABASECONFIGFILE, 375, true, null); temailfile = new JTextField(); // emailpanel = (JPanel) addPanel("Email XML path", "File location for email configuration", temailfile, RunnerRepository.REMOTEEMAILCONFIGPATH + RunnerRepository.REMOTEEMAILCONFIGFILE, 448, true, null) .getParent(); //paths.remove(emailpanel); // emailpanel.setBounds(360,440,350,100); // RunnerRepository.window.mainpanel.p4.getEmails().add(emailpanel); tglobalsfile = new JTextField(); addPanel("Globals XML file", "File location for globals parameters", tglobalsfile, RunnerRepository.GLOBALSREMOTEFILE, 521, true, null); tceport = new JTextField(); addPanel("Central Engine Port", "Central Engine port", tceport, RunnerRepository.getCentralEnginePort(), 1003, false, null); // traPort = new JTextField(); // addPanel("Resource Allocator Port","Resource Allocator Port", // traPort,RunnerRepository.getResourceAllocatorPort(),808,false,null); // thttpPort = new JTextField(); // addPanel("HTTP Server Port","HTTP Server Port",thttpPort, // RunnerRepository.getHTTPServerPort(),740,false,null); //paths.add(loadXML); if (!PermissionValidator.canChangeFWM()) { ttcpath.setEnabled(false); tMasterXML.setEnabled(false); tUsers.setEnabled(false); tepid.setEnabled(false); tSuites.setEnabled(false); tlog.setEnabled(false); trunning.setEnabled(false); tdebug.setEnabled(false); tsummary.setEnabled(false); tinfo.setEnabled(false); tcli.setEnabled(false); tdbfile.setEnabled(false); temailfile.setEnabled(false); tceport.setEnabled(false); libpath.setEnabled(false); tsecondarylog.setEnabled(false); testconfigpath.setEnabled(false); tglobalsfile.setEnabled(false); logsenabled.setEnabled(false); } }
From source file:org.gumtree.vis.plot1d.Plot1DChartEditor.java
private JPanel createHelpPanel(JFreeChart chart) { JPanel wrap = new JPanel(new GridLayout(1, 1)); JPanel helpPanel = new JPanel(new GridLayout(1, 1)); helpPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); // helpPanel.setBorder(BorderFactory.createTitledBorder( // BorderFactory.createEtchedBorder(), "Help Topics")); SpringLayout spring = new SpringLayout(); JPanel inner = new JPanel(spring); inner.setBorder(BorderFactory.createEmptyBorder()); final IHelpProvider provider = new Plot1DHelpProvider(); final JList list = new JList(provider.getHelpMap().keySet().toArray()); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // list.setBorder(BorderFactory.createEtchedBorder()); JScrollPane listPane1 = new JScrollPane(list); inner.add(listPane1);/*w w w .j a va 2s . com*/ listPane1.setMaximumSize(new Dimension(140, 0)); listPane1.setMinimumSize(new Dimension(70, 0)); // JPanel contentPanel = new JPanel(new GridLayout(2, 1)); // inner.add(list); final JTextField keyField = new JTextField(); keyField.setMaximumSize(new Dimension(400, 20)); keyField.setEditable(false); // keyField.setMaximumSize(); // keyArea.setLineWrap(true); // keyArea.setWrapStyleWord(true); // keyArea.setBorder(BorderFactory.createEtchedBorder()); inner.add(keyField); // contentPanel.add(new JLabel()); // contentPanel.add(new JLabel()); final JTextArea helpArea = new JTextArea(); JScrollPane areaPane = new JScrollPane(helpArea); helpArea.setEditable(false); helpArea.setLineWrap(true); helpArea.setWrapStyleWord(true); // helpArea.setBorder(BorderFactory.createEtchedBorder()); inner.add(areaPane); // contentPanel.add(new JLabel()); // contentPanel.add(new JLabel()); // inner.add(contentPanel); spring.putConstraint(SpringLayout.WEST, listPane1, 2, SpringLayout.WEST, inner); spring.putConstraint(SpringLayout.NORTH, listPane1, 2, SpringLayout.NORTH, inner); spring.putConstraint(SpringLayout.WEST, keyField, 4, SpringLayout.EAST, listPane1); spring.putConstraint(SpringLayout.NORTH, keyField, 2, SpringLayout.NORTH, inner); spring.putConstraint(SpringLayout.EAST, inner, 2, SpringLayout.EAST, keyField); spring.putConstraint(SpringLayout.WEST, areaPane, 4, SpringLayout.EAST, listPane1); spring.putConstraint(SpringLayout.NORTH, areaPane, 4, SpringLayout.SOUTH, keyField); spring.putConstraint(SpringLayout.EAST, areaPane, -2, SpringLayout.EAST, inner); spring.putConstraint(SpringLayout.SOUTH, inner, 2, SpringLayout.SOUTH, areaPane); spring.putConstraint(SpringLayout.SOUTH, listPane1, -2, SpringLayout.SOUTH, inner); list.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { Object[] selected = list.getSelectedValues(); if (selected.length >= 0) { HelpObject help = provider.getHelpMap().get(selected[0]); if (help != null) { keyField.setText(help.getKey()); helpArea.setText(help.getDiscription()); } } } }); helpPanel.add(inner, BorderLayout.NORTH); wrap.setName("Help"); wrap.add(helpPanel, BorderLayout.NORTH); return wrap; }
From source file:com.github.lindenb.jvarkit.tools.bamviewgui.BamFileRef.java
BamInternalFrame(BamFileRef ref) { super(ref.bamFile.getName(), true, false, true, true); this.ref = ref; JPanel mainPane = new JPanel(new BorderLayout(5, 5)); setContentPane(mainPane);// ww w. j a v a 2 s .co m JTabbedPane tabbedPane = new JTabbedPane(); mainPane.add(tabbedPane, BorderLayout.CENTER); JPanel pane = new JPanel(new BorderLayout(5, 5)); tabbedPane.addTab("BAM", pane); this.tableModel = new BamTableModel(); this.jTable = createTable(tableModel); this.jTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); this.jTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scroll1 = new JScrollPane(this.jTable); this.infoTableModel = new FlagTableModel(); JTable tInfo = createTable(this.infoTableModel); this.genotypeTableModel = new SAMTagAndValueModel(); JTable tGen = createTable(this.genotypeTableModel); this.groupTableModel = new ReadGroupTableModel(); JTable tGrp = createTable(this.groupTableModel); JPanel splitH = new JPanel(new GridLayout(1, 0, 5, 5)); splitH.add(new JScrollPane(tInfo)); splitH.add(new JScrollPane(tGen)); splitH.add(new JScrollPane(tGrp)); JSplitPane splitVert = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scroll1, splitH); this.jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; int row = jTable.getSelectedRow(); SAMRecord ctx; if (row == -1 || (ctx = tableModel.getElementAt(row)) == null) { infoTableModel.setContext(null); genotypeTableModel.setContext(null); groupTableModel.setContext(null); } else { infoTableModel.setContext(ctx); genotypeTableModel.setContext(ctx); groupTableModel.setContext(ctx); } } }); pane.add(splitVert); //header as text pane = new JPanel(new BorderLayout(5, 5)); tabbedPane.addTab("Header", pane); JTextArea area = new JTextArea(String.valueOf(ref.header.getTextHeader())); area.setCaretPosition(0); area.setEditable(false); pane.add(new JScrollPane(area), BorderLayout.CENTER); //dict pane = new JPanel(new BorderLayout(5, 5)); tabbedPane.addTab("Reference", pane); JTable dictTable = createTable(new SAMSequenceDictionaryTableModel(ref.header.getSequenceDictionary())); dictTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); pane.add(new JScrollPane(dictTable), BorderLayout.CENTER); this.selList = new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; listSelectionChanged(); } }; this.addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameActivated(InternalFrameEvent e) { jTable.getSelectionModel().addListSelectionListener(selList); } @Override public void internalFrameDeactivated(InternalFrameEvent e) { jTable.getSelectionModel().removeListSelectionListener(selList); } }); }
From source file:hermes.renderers.DefaultMessageRenderer.java
/** * Depending on configuration, show the object via toString() or a list of * properties.//from ww w. j a v a2 s.c o m * * @param objectMessage * @return * @throws JMSException * @throws IllegalAccessException * @throws InvocationTargetException * @throws NoSuchMethodException */ protected JComponent handleObjectMessage(final ObjectMessage objectMessage) throws JMSException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { // // Unserialize the object and display all its properties Serializable obj = objectMessage.getObject(); if (obj instanceof JComponent) { return (JComponent) obj; } else { JTextArea textPane = new JTextArea(); StringBuffer buffer = new StringBuffer(); MyConfig currentConfig = (MyConfig) getConfig(); if (obj == null) { buffer.append("Payload is null"); } else if (currentConfig.isToStringOnObjectMessage()) { buffer.append(obj.toString()); } else { buffer.append(obj.toString()).append("\n\nProperty list\n"); for (Iterator iter = PropertyUtils.describe(obj).entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); buffer.append(entry.getKey().toString()).append("=").append(entry.getValue()).append("\n"); } } textPane.setEditable(false); textPane.setText(buffer.toString()); return textPane; } }
From source file:UI.SecurityDashboard.java
private void performMetric4(MainViewPanel mvp) { Metric4 metric4 = new Metric4(); JPanel graphPanel4 = new JPanel(); graphPanel4.setLayout(new BorderLayout()); metric4.run();/*from w ww . ja v a 2 s. com*/ graphPanel4.add(mvp.getPanel4(metric4), BorderLayout.CENTER); MalwarePanel.setLayout(new BorderLayout()); JTextArea header = new JTextArea( "\nThe Malware detection will scan for viruses, trojans, and worms that may have affected a device.\n"); header.setLineWrap(true); header.setWrapStyleWord(true); header.setEditable(false); MalwarePanel.add(header, BorderLayout.NORTH); if (metric4.getTotalCount() == 0) { Font noMalwareFont = new Font("Calibri", Font.BOLD, 40); JLabel noMalwareLabel = new JLabel( " No Malware Detected"); noMalwareLabel.setFont(noMalwareFont); noMalwareLabel.setPreferredSize(new Dimension(WIDTH, 100)); graphPanel4.add(noMalwareLabel, BorderLayout.NORTH); JPanel emptyPanel = new JPanel(); emptyPanel.setPreferredSize(new Dimension(50, 200)); emptyPanel.setOpaque(true); graphPanel4.add(emptyPanel, BorderLayout.SOUTH); } MalwarePanel.add(graphPanel4, BorderLayout.CENTER); ChartPanel fourthPanel = mvp.getPanel4(metric4); fourthPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent cme) { dashboardTabs.setSelectedIndex(4); } @Override public void chartMouseMoved(ChartMouseEvent cme) { } }); Metric4Panel.setLayout(new BorderLayout()); Font titleFont = new Font("Calibri", Font.BOLD, 27); JLabel malwareTitleLabel = new JLabel(" Malware Detection"); malwareTitleLabel.setFont(titleFont); Metric4Panel.add(malwareTitleLabel, BorderLayout.PAGE_START); Metric4Panel.add(fourthPanel, BorderLayout.CENTER); if (metric4.getTotalCount() == 0) { Font noMalwareFont = new Font("Calibri", Font.BOLD, 20); JLabel noMalwareLabel = new JLabel(" No Malware Detected"); noMalwareLabel.setFont(noMalwareFont); Metric4Panel.add(noMalwareLabel, BorderLayout.SOUTH); } Metric4Panel.setBackground(Color.white); }
From source file:UI.SecurityDashboard.java
private void performMetric5(MainViewPanel mvp) { Metric5 metric5 = new Metric5(); JPanel graphPanel5 = new JPanel(); graphPanel5.setLayout(new BorderLayout()); graphPanel5.add(metric5.run(), BorderLayout.NORTH); NetworkPanel.setLayout(new BorderLayout()); JTextArea header = new JTextArea( "\nThe web application page will scan all remote servers running a web program in search of any " + "vulnerabilities present.\n"); //header.setLineWrap(true); //header.setWrapStyleWord(true); header.setEditable(false); NetworkPanel.add(header, BorderLayout.NORTH); NetworkPanel.add(graphPanel5, BorderLayout.CENTER); ChartPanel fifthPanel = mvp.getPanel5(metric5); fifthPanel.addChartMouseListener(new ChartMouseListener() { @Override/* w ww . j ava 2 s. co m*/ public void chartMouseClicked(ChartMouseEvent cme) { dashboardTabs.setSelectedIndex(5); } @Override public void chartMouseMoved(ChartMouseEvent cme) { } }); Metric5Panel.setLayout(new BorderLayout()); Font titleFont = new Font("Calibri", Font.BOLD, 27); JLabel netAppTitleLabel = new JLabel(" Web Applications"); netAppTitleLabel.setFont(titleFont); Metric5Panel.add(netAppTitleLabel, BorderLayout.NORTH); Metric5Panel.add(fifthPanel, BorderLayout.CENTER); Metric5Panel.setBackground(Color.white); }