private void setSubscriberDetails( String subscriberName, String subscriberAddress, String message) { this.name = subscriberName; this.address = subscriberAddress; Color color = messagePane.getForeground(); messagePane.setText( "<FONT COLOR=\"#" + Integer.toHexString(color.getRGB()).substring(2) + "\">" + messageString1 + "<p>" + namePrefix + name + nameSuffix + "<br>" + addressPrefix + address + addressSuffix + "<p>" + ((message != null && message.trim().length() > 0) ? messagePrefix + message + messageSuffix + "<p>" : "") + messageString2 + "</FONT>"); }
/** standard constructor */ public AboutDialog(JFrame frame) { super(frame, true); getConfDbVersion(); // load info from confdb.version file getContactPerson(); // load info from confdb.version file setTitle("About ConfDbGUI"); setContentPane(initComponents()); String txt = "<p>Thank you for using <b>ConfDbGUI</b>," + "a CMS tool to create and manage " + "CMSSW job configurations based on a " + "relational database.</p>" + "This software was originally developed " + "by Philipp Schieferdecker and is currently " + "maintained by Raul Jimenez Estupinan " + "with contributions from Ulf Behrens, " + "Jonathan Hollar, Vasundhara Chetluru " + "and Martin Gruenewald. " + "<p>For feedback please contact me at " + "<b>" + contactEmail + "</b>.</p>" + "<p>Find documentation on the web under " + "<b>https://twiki.cern.ch/twiki/bin/view/CMS/EvfConfDBGUI</b>.</p>"; jTextFieldApplication.setText("ConfDbGUI"); // jTextFieldVersion.setText("V01-05-82"); // Change in confdb.version file! jEditorPaneAbout.setContentType("text/html"); jEditorPaneAbout.setText(txt); }
private void jbInit() throws Exception { border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20); contentPane.setBorder(border1); contentPane.setLayout(borderLayout1); controlsPane.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setHgap(10); gridLayout1.setRows(0); gridLayout1.setVgap(10); okButton.setVerifyInputWhenFocusTarget(true); okButton.setMnemonic('O'); okButton.setText("OK"); buttonsPane.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.CENTER); messagePane.setEditable(false); messagePane.setText(""); borderLayout1.setHgap(10); borderLayout1.setVgap(10); this.setTitle("Subscription Authorization"); this.getContentPane().add(contentPane, BorderLayout.CENTER); contentPane.add(controlsPane, BorderLayout.SOUTH); controlsPane.add(responsesComboBox, null); controlsPane.add(buttonsPane, null); buttonsPane.add(okButton, null); contentPane.add(messageScrollPane, BorderLayout.CENTER); messageScrollPane.getViewport().add(messagePane, null); }
/** * Called when the selection changed in the tree. Loads the selected certificate. * * @param e the event */ private void valueChangedPerformed(TreeSelectionEvent e) { Object o = e.getNewLeadSelectionPath().getLastPathComponent(); if (o instanceof DefaultMutableTreeNode) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; infoTextPane.setText(toString(node.getUserObject())); } }
TextPanel(String file) { super(new BorderLayout()); JEditorPane text = new JEditorPane(); try { text.setPage(TextPanel.this.getClass().getResource(file)); } catch (Exception e) { text.setText("Error loading '" + file + "'"); e.printStackTrace(); } text.setEditable(false); JScrollPane scrollPane = new JScrollPane(text); Dimension dim = new Dimension(); dim.width = 450; dim.height = 200; scrollPane.setPreferredSize(dim); TextPanel.this.add(BorderLayout.CENTER, scrollPane); }
/** Construct a new "about…" dialog */ public DialogAbout(MDIManager mdimgr) { buttonOk = new JButton(localize("button.OK")); buttonOk.addActionListener(this); JPanel buttonPanel = new JPanel(new FlowLayout(), false); buttonPanel.add(buttonOk); JPanel logoPanel = new JPanel(new FlowLayout(), false); logoPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); logoPanel.add(PEToolKit.createJLabel("Frankenstein")); JPanel infoPanel = new JPanel(new GridLayout(9, 1, 5, 5), true); infoPanel.setBorder(new EmptyBorder(10, 60, 10, 10)); infoPanel.add( new JLabel("jPicEdt " + Version.getVersion() + " Built " + Version.getBuildDate())); infoPanel.add(new JLabel(localize("about.APictureEditorFor"))); final String[] addressLines = { "(c) Sylvain Reynal", "É.N.S.É.A. - Dept. of Physics", "6, avenue du Ponceau", "F-95014 CERGY Cedex", "Fax: +33 (0) 130 736 667", "*****@*****.**", "http://www.jpicedt.org" }; for (String addressLine : addressLines) infoPanel.add(new JLabel(addressLine)); JTabbedPane caveatPanel = new JTabbedPane(); String[] tabKeys = {"license.lines", "license.thirdparty.lines"}; for (String tabKey : tabKeys) { JEditorPane caveatTA = new JEditorPane(); caveatTA.setContentType("text/html; charset=" + localize(tabKey + ".encoding")); caveatTA.setEditable(false); caveatTA.setPreferredSize(new Dimension(485, 300)); JScrollPane scrollCaveat = new JScrollPane(caveatTA); caveatTA.setText(localize(tabKey)); caveatPanel.addTab(localize(tabKey + ".tabname"), null, scrollCaveat, null); } caveatPanel.setBorder(BorderFactory.createEtchedBorder()); JPanel upperPanel = new JPanel(new BorderLayout(), false); upperPanel.add(logoPanel, BorderLayout.WEST); upperPanel.add(infoPanel, BorderLayout.CENTER); upperPanel.add(caveatPanel, BorderLayout.SOUTH); upperPanel.setBorder(BorderFactory.createEtchedBorder()); JPanel contentPane = new JPanel(new BorderLayout(5, 5)); contentPane.add(upperPanel, BorderLayout.NORTH); contentPane.add(buttonPanel, BorderLayout.SOUTH); String title = localize("about.AboutPicEdt") + " " + Version.getVersion(); boolean modal = true; frame = mdimgr.createDialog(title, modal, contentPane); frame.setResizable(true); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Dimension dlgSize = frame.getPreferredSize(); frame.setSize(dlgSize); // this.pack(); frame.setVisible(true); }
/** * Constructs a X509 certificate panel. * * @param certificates <tt>X509Certificate</tt> objects */ public X509CertificatePanel(Certificate[] certificates) { setLayout(new BorderLayout(5, 5)); // Certificate chain list TransparentPanel topPanel = new TransparentPanel(new BorderLayout()); topPanel.add( new JLabel( "<html><body><b>" + R.getI18NString("service.gui.CERT_INFO_CHAIN") + "</b></body></html>"), BorderLayout.NORTH); DefaultMutableTreeNode top = new DefaultMutableTreeNode(); DefaultMutableTreeNode previous = top; for (int i = certificates.length - 1; i >= 0; i--) { Certificate cert = certificates[i]; DefaultMutableTreeNode next = new DefaultMutableTreeNode(cert); previous.add(next); previous = next; } JTree tree = new JTree(top); tree.setBorder(new BevelBorder(BevelBorder.LOWERED)); tree.setRootVisible(false); tree.setExpandsSelectedPaths(true); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setCellRenderer( new DefaultTreeCellRenderer() { @Override public Component getTreeCellRendererComponent( JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { JLabel component = (JLabel) super.getTreeCellRendererComponent( tree, value, sel, expanded, leaf, row, hasFocus); if (value instanceof DefaultMutableTreeNode) { Object o = ((DefaultMutableTreeNode) value).getUserObject(); if (o instanceof X509Certificate) { component.setText(getSimplifiedName((X509Certificate) o)); } else { // We don't know how to represent this certificate type, // let's use the first 20 characters String text = o.toString(); if (text.length() > 20) { text = text.substring(0, 20); } component.setText(text); } } return component; } }); tree.getSelectionModel() .addTreeSelectionListener( new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { valueChangedPerformed(e); } }); tree.setSelectionPath( new TreePath((((DefaultTreeModel) tree.getModel()).getPathToRoot(previous)))); topPanel.add(tree, BorderLayout.CENTER); add(topPanel, BorderLayout.NORTH); // Certificate details pane Caret caret = infoTextPane.getCaret(); if (caret instanceof DefaultCaret) { ((DefaultCaret) caret).setUpdatePolicy(DefaultCaret.NEVER_UPDATE); } /* * Make JEditorPane respect our default font because we will be using it * to just display text. */ infoTextPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true); infoTextPane.setOpaque(false); infoTextPane.setEditable(false); infoTextPane.setContentType("text/html"); infoTextPane.setText(toString(certificates[0])); final JScrollPane certScroll = new JScrollPane(infoTextPane); certScroll.setPreferredSize(new Dimension(300, 500)); add(certScroll, BorderLayout.CENTER); }