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); }
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); }
/** initialize GUI components */ private JPanel initComponents() { JPanel panel = new JPanel(); JScrollPane jScrollPane1 = new JScrollPane(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); jScrollPane1.setViewportView(jEditorPaneAbout); jButtonOk.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { jButtonOkActionPerformed(e); } }); jButtonOk.setText("OK"); jLabel1.setText("Application:"); jLabel2.setText("Version:"); jTextFieldApplication.setBackground(new Color(255, 255, 255)); jTextFieldApplication.setEditable(false); jTextFieldApplication.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); jTextFieldVersion.setBackground(new Color(255, 255, 255)); jTextFieldVersion.setEditable(false); jTextFieldVersion.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); jEditorPaneAbout.setEditable(false); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(panel); panel.setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add( layout .createSequentialGroup() .add( layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add( layout .createSequentialGroup() .addContainerGap() .add( layout .createParallelGroup( org.jdesktop.layout.GroupLayout.LEADING) .add( jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 289, Short.MAX_VALUE) .add( layout .createSequentialGroup() .add( layout .createParallelGroup( org.jdesktop.layout.GroupLayout .LEADING) .add( jTextFieldApplication, org.jdesktop.layout.GroupLayout .PREFERRED_SIZE, 145, org.jdesktop.layout.GroupLayout .PREFERRED_SIZE) .add(jLabel1)) .add(4, 4, 4) .add( layout .createParallelGroup( org.jdesktop.layout.GroupLayout .LEADING) .add(jLabel2) .add( jTextFieldVersion, org.jdesktop.layout.GroupLayout .DEFAULT_SIZE, 140, Short.MAX_VALUE))))) .add( layout .createSequentialGroup() .add(106, 106, 106) .add( jButtonOk, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE) .add(94, 94, 94))) .addContainerGap())); layout.setVerticalGroup( layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add( layout .createSequentialGroup() .addContainerGap() .add( layout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel1) .add(jLabel2)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add( layout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add( jTextFieldApplication, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add( jTextFieldVersion, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add( jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jButtonOk) .addContainerGap())); return panel; }
/** 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); }
public AboutDialog(JConsole jConsole) { super(jConsole, Resources.getText("Help.AboutDialog.title"), false); setAccessibleDescription(this, getText("Help.AboutDialog.accessibleDescription")); setDefaultCloseOperation(HIDE_ON_CLOSE); setResizable(false); JComponent cp = (JComponent) getContentPane(); createActions(); JLabel mastheadLabel = new JLabel(mastheadIcon); setAccessibleName(mastheadLabel, getText("Help.AboutDialog.masthead.accessibleName")); JPanel mainPanel = new TPanel(0, 0); mainPanel.add(mastheadLabel, NORTH); String jConsoleVersion = Version.getVersion(); String vmName = System.getProperty("java.vm.name"); String vmVersion = System.getProperty("java.vm.version"); String urlStr = getText("Help.AboutDialog.userGuideLink.url"); if (isBrowseSupported()) { urlStr = "<a style='color:#35556b' href=\"" + urlStr + "\">" + urlStr + "</a>"; } JPanel infoAndLogoPanel = new JPanel(new BorderLayout(10, 10)); infoAndLogoPanel.setBackground(bgColor); String colorStr = String.format("%06x", textColor.getRGB() & 0xFFFFFF); JEditorPane helpLink = new JEditorPane( "text/html", "<html><font color=#" + colorStr + ">" + getText("Help.AboutDialog.jConsoleVersion", jConsoleVersion) + "<p>" + getText("Help.AboutDialog.javaVersion", (vmName + ", " + vmVersion)) + "<p>" + getText("Help.AboutDialog.userGuideLink", urlStr) + "</html>"); helpLink.setOpaque(false); helpLink.setEditable(false); helpLink.setForeground(textColor); mainPanel.setBorder(BorderFactory.createLineBorder(borderColor)); infoAndLogoPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); helpLink.addHyperlinkListener( new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { browse(e.getDescription()); } } }); infoAndLogoPanel.add(helpLink, NORTH); ImageIcon brandLogoIcon = new ImageIcon(getClass().getResource("resources/brandlogo.png")); JLabel brandLogo = new JLabel(brandLogoIcon, JLabel.LEADING); JButton closeButton = new JButton(closeAction); JPanel bottomPanel = new TPanel(0, 0); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING)); buttonPanel.setOpaque(false); mainPanel.add(infoAndLogoPanel, CENTER); cp.add(bottomPanel, SOUTH); infoAndLogoPanel.add(brandLogo, SOUTH); buttonPanel.setBorder(new EmptyBorder(2, 12, 2, 12)); buttonPanel.add(closeButton); bottomPanel.add(buttonPanel, NORTH); statusBar = new JLabel(" "); bottomPanel.add(statusBar, SOUTH); cp.add(mainPanel, NORTH); pack(); setLocationRelativeTo(jConsole); Utilities.updateTransparency(this); }
/** * 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); }