Java Code Examples for javax.swing.JTextPane#setBackground()

The following examples show how to use javax.swing.JTextPane#setBackground() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShowNotifications.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static JTextPane createInfoPanel(String notification) {
    JTextPane balloon = new JTextPane();
    balloon.setContentType("text/html");
    String text = getDetails(notification).replaceAll("(\r\n|\n|\r)", "<br>");
    balloon.setText(text);
    balloon.setOpaque(false);
    balloon.setEditable(false);
    balloon.setBorder(new EmptyBorder(0, 0, 0, 0));


    if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
        //#134837
        //http://forums.java.net/jive/thread.jspa?messageID=283882
        balloon.setBackground(new Color(0, 0, 0, 0));
    }

    balloon.addHyperlinkListener(new HyperlinkListener() {

        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
                URLDisplayer.getDefault().showURL(e.getURL());
            }
        }
    });
    return balloon;
}
 
Example 2
Source File: HistoryCellRenderer.java    From EchoSim with Apache License 2.0 6 votes vote down vote up
@Override
public Component getListCellRendererComponent(
        JList<? extends TransactionBean> list,
        TransactionBean value, int index, boolean isSelected,
        boolean cellHasFocus)
{
    JTextPane client = new JTextPane();
    client.setEditable(false);
    client.setContentType("text/html");
    TransactionRenderOpsBean ops = mRuntime.getRenderOps();
    String html = TransactionLogic.renderAsHTML(value, ops);
    int w = list.getFixedCellWidth();
    if (w < 0)
        w = 750;
    else
        w = w*3/4;
    html = "<html><body><table width=\""+w+"px\">"+html+"</table></body></html>";
    client.setText(html);
    if (cellHasFocus)
        client.setBorder(new MatteBorder(1, 5, 1, 1, Color.DARK_GRAY));
    client.setBackground(isSelected ? SELECTED : DESELECTED);
    return client;
}
 
Example 3
Source File: InformationPanel.java    From stendhal with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new InformationPanel.
 */
InformationPanel() {
	setLayout(new OverlayLayout(this));
	JComponent container = SBoxLayout.createContainer(SBoxLayout.VERTICAL);
	glassPane = new JComponent(){};
	add(glassPane);
	add(container);

	// ** Zone name **
	nameField = new JTextPane();
	StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
	nameField.setAlignmentX(CENTER_ALIGNMENT);
	nameField.setOpaque(true);
	nameField.setBackground(getBackground());
	nameField.setForeground(Color.WHITE);
	nameField.setFocusable(false);
	nameField.setEditable(false);
	container.add(nameField, SLayout.EXPAND_X);

	// ** Danger display **
	dangerIndicator = new DangerIndicator(MAX_SKULLS);
	dangerIndicator.setAlignmentX(CENTER_ALIGNMENT);
	container.add(dangerIndicator);
	// Default to safe, so that we always have a tooltip
	describeDanger(0);
}
 
Example 4
Source File: LatencyFrame.java    From JRakNet with MIT License 6 votes vote down vote up
/**
 * Creates a latency test frame.
 */
protected LatencyFrame() {
	// Frame and content settings
	this.setResizable(false);
	this.setSize(FRAME_WIDTH, FRAME_HEIGHT);
	this.setTitle("JRakNet Latency Test");
	this.getContentPane().setLayout(null);

	// Client latencies
	JTextPane txtpnClientLatencies = new JTextPane();
	txtpnClientLatencies.setEditable(false);
	txtpnClientLatencies.setText("Client latencies");
	txtpnClientLatencies.setBackground(UIManager.getColor("Button.background"));
	txtpnClientLatencies.setBounds(10, 10, 350, 20);
	this.getContentPane().add(txtpnClientLatencies);

	// The list of the connected clients
	txtPnClientLatencies = new JTextPane();
	txtPnClientLatencies.setToolTipText("This is the list of the connected clients and their latencies");
	txtPnClientLatencies.setEditable(false);
	txtPnClientLatencies.setBackground(UIManager.getColor("Button.background"));
	txtPnClientLatencies.setBounds(10, 30, 350, 165);
	this.getContentPane().add(txtPnClientLatencies);
}
 
Example 5
Source File: HistoryCellRenderer.java    From EchoSim with Apache License 2.0 6 votes vote down vote up
@Override
public Component getListCellRendererComponent(
        JList<? extends TransactionBean> list,
        TransactionBean value, int index, boolean isSelected,
        boolean cellHasFocus)
{
    JTextPane client = new JTextPane();
    client.setEditable(false);
    client.setContentType("text/html");
    TransactionRenderOpsBean ops = mRuntime.getRenderOps();
    String html = TransactionLogic.renderAsHTML(value, ops);
    int w = list.getFixedCellWidth();
    if (w < 0)
        w = 750;
    else
        w = w*3/4;
    html = "<html><body><table width=\""+w+"px\">"+html+"</table></body></html>";
    client.setText(html);
    if (cellHasFocus)
        client.setBorder(new MatteBorder(1, 5, 1, 1, Color.DARK_GRAY));
    client.setBackground(isSelected ? SELECTED : DESELECTED);
    return client;
}
 
Example 6
Source File: VCSNotificationDisplayer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JTextPane getPane(File[] files, File projectDir, String url, String revision) {
    JTextPane bubble = new JTextPane();
    bubble.setOpaque(false);
    bubble.setEditable(false);

    if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {                   //NOI18N
        //#134837
        //http://forums.java.net/jive/thread.jspa?messageID=283882
        bubble.setBackground(new Color(0, 0, 0, 0));
    }

    bubble.setContentType("text/html");                                          //NOI18N
    setupPane(bubble, files, projectDir, url, revision);
    return bubble;
}
 
Example 7
Source File: RevisionItemCell.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initTextPane (JTextPane pane) {
    pane.setBorder(null);
    pane.setLayout(null);
    //fix for nimbus laf
    pane.setOpaque(false);
    pane.setBackground(new Color(0, 0, 0, 0));
}
 
Example 8
Source File: CommentsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void setupTextPane(final JTextPane textPane, String comment) {
    if( UIUtils.isNimbus() ) {
        textPane.setUI( new BasicTextPaneUI() );
    }
    textPane.setText(comment);
    
    Caret caret = textPane.getCaret();
    if (caret instanceof DefaultCaret) {
        ((DefaultCaret)caret).setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
    }

    // attachments
    if (!attachmentIds.isEmpty()) {
        AttachmentHyperlinkSupport.Attachement a = AttachmentHyperlinkSupport.findAttachment(comment, attachmentIds);
        if (a != null) {
            String attachmentId = a.id;
            if (attachmentId != null) {
                int index = attachmentIds.indexOf(attachmentId);
                if (index != -1) {
                    BugzillaIssue.Attachment attachment = attachments.get(index);
                    AttachmentLink attachmentLink = new AttachmentLink(attachment);
                    HyperlinkSupport.getInstance().registerLink(textPane, new int[] {a.idx1, a.idx2}, attachmentLink);
                } else {
                    Bugzilla.LOG.log(Level.WARNING, "couldn''t find attachment id in: {0}", comment); // NOI18N
                }
            }
        }
    }

    // pop-ups
    textPane.setComponentPopupMenu(commentsPopup);

    textPane.setBackground(blueBackground);

    textPane.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
    textPane.setEditable(false);
    textPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(CommentsPanel.class, "CommentsPanel.textPane.AccessibleContext.accessibleName")); // NOI18N
    textPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CommentsPanel.class, "CommentsPanel.textPane.AccessibleContext.accessibleDescription")); // NOI18N
}
 
Example 9
Source File: LogPanel.java    From Robot-Overlord-App with GNU General Public License v2.0 5 votes vote down vote up
public LogPanel(Translator translator, RobotEntity robot) {
	this.translator = translator;
	this.robot = robot;
	
	// log panel
	Log.addListener(this);

	// the log panel
	log = new JTextPane();
	log.setEditable(false);
	log.setBackground(Color.BLACK);
	kit = new HTMLEditorKit();
	doc = new HTMLDocument();
	log.setEditorKit(kit);
	log.setDocument(doc);
	DefaultCaret caret = (DefaultCaret) log.getCaret();
	caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

	JScrollPane logPane = new JScrollPane(log);

	// Now put all the parts together
	panel.setLayout(new GridBagLayout());
	GridBagConstraints con1 = new GridBagConstraints();
	con1.gridx = 0;
	con1.gridy = 0;
	con1.weightx=1;
	con1.weighty=1;
	con1.fill=GridBagConstraints.HORIZONTAL;
	con1.anchor=GridBagConstraints.NORTHWEST;
	panel.add(logPane,con1);
	con1.gridy++;


	con1.weightx=1;
	con1.weighty=0;
	panel.add(getTextInputField(),con1);
	
	// lastly, clear the log
	clearLog();
}
 
Example 10
Source File: JAboutFrame.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
public JAboutFrame(JByteMod jbm) {
  this.setTitle(JByteMod.res.getResource("about") + " " + jbm.getTitle());
  this.setModal(true);
  setBounds(100, 100, 400, 300);
  JPanel cp = new JPanel();
  cp.setLayout(new BorderLayout());
  cp.setBorder(new EmptyBorder(10, 10, 10, 10));
  setResizable(false);
  JButton close = new JButton(JByteMod.res.getResource("close"));
  close.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      JAboutFrame.this.dispose();
    }
  });
  JPanel jp = new JPanel(new GridLayout(1, 4));
  for (int i = 0; i < 3; i++)
    jp.add(new JPanel());

  jp.add(close);
  cp.add(jp, BorderLayout.PAGE_END);

  JTextPane title = new JTextPane();
  title.setContentType("text/html");
  title.setText(TextUtils.toHtml(jbm.getTitle()
      + "<br/>Copyright \u00A9 2016-2018 noverify<br/><font color=\"#0000EE\"><u>https://github.com/GraxCode/JByteMod-Beta</u></font><br/>Donate LTC: <font color=\"#333333\">LhwXLVASzb6t4vHSssA9FQwq2X5gAg8EKX</font>"));
  UIDefaults defaults = new UIDefaults();
  defaults.put("TextPane[Enabled].backgroundPainter", this.getBackground());
  title.putClientProperty("Nimbus.Overrides", defaults);
  title.putClientProperty("Nimbus.Overrides.InheritDefaults", true);
  title.setBackground(null);
  title.setEditable(false);
  title.setBorder(null);
  cp.add(title, BorderLayout.CENTER);

  getContentPane().add(cp);
}
 
Example 11
Source File: JTextPaneTest.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
private Component createTextPane() {
  textNewSection = new JTextPane();
  textNewSection.setBackground(Color.WHITE);
  textNewSection.setEditable(true);
  JScrollPane scrollContents = new JScrollPane(textNewSection);
  scrollContents.setMinimumSize(new Dimension(100, 100));
  scrollContents.setPreferredSize(new Dimension(1000, 500));
  scrollContents.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
  return scrollContents;
}
 
Example 12
Source File: TextPaneAppender.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public
void setTextPane(JTextPane textpane) {
  this.textpane=textpane;
  textpane.setEditable(false);
  textpane.setBackground(Color.lightGray);
  this.doc=textpane.getStyledDocument();
}
 
Example 13
Source File: ResourcePanel.java    From AML-Project with Apache License 2.0 5 votes vote down vote up
public ResourcePanel(Dimension max, Dimension min)
{
	super("Resource Panel",false,false,false,false);
	this.setMaximumSize(max);
	this.setPreferredSize(min);
	
	desc = new JTextPane();
	desc.setEditable(false);
	
	UIDefaults defaults = new UIDefaults();
	defaults.put("TextPane[Enabled].backgroundPainter", AMLColor.WHITE);
	desc.putClientProperty("Nimbus.Overrides", defaults);
	desc.putClientProperty("Nimbus.Overrides.InheritDefaults", true);
	desc.setBackground(AMLColor.WHITE);
	
	doc = desc.getStyledDocument();
	def = StyleContext.getDefaultStyleContext(). getStyle(StyleContext.DEFAULT_STYLE);
	bold = doc.addStyle("bold", def);
	StyleConstants.setBold(bold, true);
	s = doc.addStyle("source", def);
	StyleConstants.setBold(s, true);
	StyleConstants.setForeground(s, AMLColor.BLUE);
	t = doc.addStyle("target", def);
	StyleConstants.setBold(t, true);
	StyleConstants.setForeground(t, AMLColor.BROWN);
	u = doc.addStyle("uri", def);
	StyleConstants.setUnderline(u, true);
	
	setContentPane(desc);
	pack();
	setVisible(true);

	refresh();
}
 
Example 14
Source File: ReadLogsWindow.java    From Hotel-Properties-Management-System with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create the frame.
 */
public ReadLogsWindow() {
	
	setTitle("Coder HPMSA - [Read Logs]");
	setBounds(100, 100, 660, 550);
	setBackground(Color.decode("#066d95"));
	setLocationRelativeTo(null);
	setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	
	this.setIconImage(Toolkit.getDefaultToolkit().
			getImage(getClass().getResource(LOGOPATH)));
	
	final JScrollPane scrollPane = new JScrollPane();
	scrollPane.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
	getContentPane().add(scrollPane, BorderLayout.CENTER);
	
	editorPane = new JTextPane();
	editorPane.setBackground(new Color(255, 255, 240));
	editorPane.setFont(new Font("Verdana", Font.PLAIN, 13));
	editorPane.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
	editorPane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
	editorPane.setEditable(false);
	scrollPane.setViewportView(editorPane);
	
	final JPanel filesPanel = new JPanel();
	filesPanel.setPreferredSize(new Dimension(200, 10));
	getContentPane().add(filesPanel, BorderLayout.EAST);
	filesPanel.setLayout(new BorderLayout(0, 0));
	
	final JScrollPane listScrollPane = new JScrollPane();
	listScrollPane.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
	listScrollPane.setViewportView(logFilesList());
	filesPanel.add(listScrollPane, BorderLayout.CENTER);
	
	final JPanel titlePanel = new JPanel();
	titlePanel.setPreferredSize(new Dimension(10, 40));
	titlePanel.setBackground(Color.decode("#066d95"));
	titlePanel.setAutoscrolls(true);
	getContentPane().add(titlePanel, BorderLayout.NORTH);
	titlePanel.setLayout(new BorderLayout(0, 0));
	
	final JLabel lblTitle = new JLabel("SYSTEM LOG RECORDS");
	lblTitle.setHorizontalTextPosition(SwingConstants.CENTER);
	lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
	lblTitle.setAutoscrolls(true);
	lblTitle.setFont(new Font("Verdana", Font.BOLD, 25));
	lblTitle.setForeground(UIManager.getColor("Button.highlight"));
	titlePanel.add(lblTitle, BorderLayout.CENTER);
	
	final StyledDocument doc = editorPane.getStyledDocument();
	final SimpleAttributeSet center = new SimpleAttributeSet();
	StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
	doc.setParagraphAttributes(0, doc.getLength(), center, false);
	
	setVisible(true);
}
 
Example 15
Source File: SimpleGUI.java    From org.alloytools.alloy with Apache License 2.0 4 votes vote down vote up
/**
 * This method displays the about box.
 */
public Runner doAbout() {
    if (wrap)
        return wrapMe();

    // Old about message
    // OurDialog.showmsg("About Alloy Analyzer " + Version.version(), OurUtil.loadIcon("images/logo.gif"), "Alloy Analyzer " + Version.version(), "Build date: " + " git: " + Version.commit, " ", "Lead developer: Felix Chang", "Engine developer: Emina Torlak", "Graphic design: Julie Pelaez", "Project lead: Daniel Jackson", " ", "Please post comments and questions to the Alloy Community Forum at http://alloy.mit.edu/", " ", "Thanks to: Ilya Shlyakhter, Manu Sridharan, Derek Rayside, Jonathan Edwards, Gregory Dennis,", "Robert Seater, Edmond Lau, Vincent Yeung, Sam Daitch, Andrew Yip, Jongmin Baek, Ning Song,", "Arturo Arizpe, Li-kuo (Brian) Lin, Joseph Cohen, Jesse Pavel, Ian Schechter, and Uriel Schafer.");

    HTMLEditorKit kit = new HTMLEditorKit();
    StyleSheet styleSheet = kit.getStyleSheet();
    styleSheet.addRule("body {color:#000; font-family:Verdana, Trebuchet MS,Geneva, sans-serif; font-size: 10px; margin: 4px; }");
    styleSheet.addRule("h1 {color: blue;}");
    styleSheet.addRule("h2 {color: #ff0000;}");
    styleSheet.addRule("pre {font : 10px monaco; color : black; background-color: #C0C0C0; padding: 4px; margin: 4px; }");
    styleSheet.addRule("th {text-align:left;}");

    JTextPane ta = new JTextPane();
    ta.setEditorKit(kit);
    ta.setContentType("text/html");
    ta.setBackground(null);
    ta.setBorder(null);
    ta.setFont(new JLabel().getFont());
    // @formatter:off
    ta.setText("<html><h1>Alloy Analyzer " + Version.getShortversion() + "</h1>"
    + "<br/>"
    + "<html>"
    + "<tr><th>Project Lead</th><td>Daniel Jackson</td></tr>"
    + "<tr><th>Chief Developer</th><td>Aleksandar Milicevic</td></tr>"
    + "<tr><th>Kodkod Engine</th><td>Emina Torlak</td></tr>"
    + "<tr><th>Open Source</th><td>Peter Kriens</td></tr>"
    + "</table><br/>"
    + "<p>For more information about Alloy, <a href='http://alloytools.org'>http://alloytools.org</a></p>"
    + "<p>Questions and comments about Alloy are welcome at the community forum:</p>"
    + "<p>Alloy Community Forum: <a href='https://groups.google.com/forum/#!forum/alloytools'>https://groups.google.com/forum/#!forum/alloytools</a></p>"
    + "<p>Alloy experts also respond to <a href='https://stackoverflow.com/questions/tagged/alloy'>https://stackoverflow.com</a> questions tagged <code>alloy</code>.</p>"
    + "<p>Major contributions to earlier versions of Alloy were made by: Felix Chang (v4);<br/>"
    + "Jonathan Edwards, Eunsuk Kang, Joe Near, Robert Seater, Derek Rayside, Greg Dennis,<br/>"
    + "Ilya Shlyakhter, Mana Taghdiri, Mandana Vaziri, Sarfraz Khurshid (v3); Manu Sridharan<br/>"
    + "(v2); Edmond Lau, Vincent Yeung, Sam Daitch, Andrew Yip, Jongmin Baek, Ning Song,<br/>"
    + "Arturo Arizpe, Li-kuo (Brian) Lin, Joseph Cohen, Jesse Pavel, Ian Schechter, Uriel<br/>"
    + "Schafer (v1).</p>"
    + "<p>The development of Alloy was funded by part by the National Science Foundation under<br/>"
    + "Grant Nos. 0325283, 0541183, 0438897 and 0707612; by the Air Force Research Laboratory<br/>"
    + "(AFRL/IF) and the Disruptive Technology Office (DTO) in the National Intelligence<br/>"
    + "Community Information Assurance Research (NICIAR) Program; and by the Nokia<br/>"
    + "Corporation as part of a collaboration between Nokia Research and MIT CSAIL.</p>"
    + "<br/><pre>"
    + "Build Date: " + Version.buildDate() + "<br/>"
    + "Git Commit: " + Version.commit
    + "</pre>");
    // @formatter:on
    ta.setEditable(false);
    ta.addHyperlinkListener((e) -> {
        if (e.getEventType() == EventType.ACTIVATED) {
            if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
                try {
                    Desktop.getDesktop().browse(e.getURL().toURI());
                } catch (IOException | URISyntaxException e1) {
                    // ignore
                }
            }
        }
    });
    OurDialog.showmsg("About Alloy Analyzer " + Version.version(), ta);

    return null;
}
 
Example 16
Source File: MainFrame.java    From procamtracker with GNU General Public License v2.0 4 votes vote down vote up
private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed
    String version = MainFrame.class.getPackage().getImplementationVersion();
    if (version == null) {
        version = "unknown";
    }
    JTextPane textPane = new JTextPane();
    textPane.setEditable(false);
    textPane.setContentType("text/html");
    textPane.setText(
            "<font face=sans-serif><strong><font size=+2>ProCamTracker</font></strong> version " + version + "<br>" +
            "Copyright (C) 2009-2014 Samuel Audet &lt;<a href=\"mailto:[email protected]%28Samuel%20Audet%29\">[email protected]</a>&gt;<br>" +
            "Web site: <a href=\"http://www.ok.ctrl.titech.ac.jp/~saudet/procamtracker/\">http://www.ok.ctrl.titech.ac.jp/~saudet/procamtracker/</a><br>" +
            "<br>" +
            "Licensed under the GNU General Public License version 2 (GPLv2).<br>" +
            "Please refer to LICENSE.txt or <a href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a> for details."
            );
    textPane.setCaretPosition(0);
    Dimension dim = textPane.getPreferredSize();
    dim.height = dim.width*3/4;
    textPane.setPreferredSize(dim);

    textPane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if(e.getEventType() == EventType.ACTIVATED) {
                try {
                    Desktop.getDesktop().browse(e.getURL().toURI());
                } catch(Exception ex) {
                    Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE,
                            "Could not launch browser to \"" + e.getURL()+ "\"", ex);
                }
            }
        }
    });

    // pass the scrollpane to the joptionpane.
    JDialog dialog = new JOptionPane(textPane, JOptionPane.PLAIN_MESSAGE).
            createDialog(this, "About");

    if ("com.sun.java.swing.plaf.gtk.GTKLookAndFeel".equals(UIManager.getLookAndFeel().getClass().getName())) {
        // under GTK, frameBackground is white, but rootPane color is OK...
        // but under Windows, the rootPane's color is funny...
        Color c = dialog.getRootPane().getBackground();
        textPane.setBackground(new Color(c.getRGB()));
    } else {
        Color frameBackground = this.getBackground();
        textPane.setBackground(frameBackground);
    }
    dialog.setVisible(true);
}
 
Example 17
Source File: ProjectFolder.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** This method is called from within the constructor to
 * initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    projectFolderCheckBox = new JCheckBox();
    projectFolderLabel = new JLabel();
    projectFolderTextField = new JTextField();
    projectFolderBrowseButton = new JButton();
    projectFolderScrollPane = new JScrollPane();
    projectFolderTextPane = new JTextPane();

    Mnemonics.setLocalizedText(projectFolderCheckBox, NbBundle.getMessage(ProjectFolder.class, "LBL_SeparateProjectFolder")); // NOI18N

    projectFolderLabel.setLabelFor(projectFolderTextField);
    Mnemonics.setLocalizedText(projectFolderLabel, NbBundle.getMessage(ProjectFolder.class, "LBL_MetadataFolder")); // NOI18N
    projectFolderLabel.setEnabled(false);

    projectFolderTextField.setColumns(20);
    projectFolderTextField.setEnabled(false);

    Mnemonics.setLocalizedText(projectFolderBrowseButton, NbBundle.getMessage(ProjectFolder.class, "LBL_BrowseProject")); // NOI18N
    projectFolderBrowseButton.setEnabled(false);
    projectFolderBrowseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            projectFolderBrowseButtonActionPerformed(evt);
        }
    });

    projectFolderScrollPane.setBorder(null);

    projectFolderTextPane.setBackground(UIManager.getDefaults().getColor("Label.background"));
    projectFolderTextPane.setBorder(null);
    projectFolderTextPane.setFont(new Font("Dialog", 1, 12)); // NOI18N
    projectFolderTextPane.setText(NbBundle.getMessage(ProjectFolder.class, "TXT_MetadataInfo")); // NOI18N
    projectFolderScrollPane.setViewportView(projectFolderTextPane);
    projectFolderTextPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderTextPane.AccessibleContext.accessibleName")); // NOI18N
    projectFolderTextPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderTextPane.AccessibleContext.accessibleDescription")); // NOI18N

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(Alignment.LEADING)
        .addGroup(Alignment.TRAILING, layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                .addComponent(projectFolderCheckBox)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(projectFolderLabel)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(projectFolderTextField, GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addComponent(projectFolderBrowseButton))
        .addComponent(projectFolderScrollPane, GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addComponent(projectFolderCheckBox)
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                .addComponent(projectFolderTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(projectFolderLabel)
                .addComponent(projectFolderBrowseButton))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addComponent(projectFolderScrollPane))
    );

    projectFolderCheckBox.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderCheckBox.AccessibleContext.accessibleName")); // NOI18N
    projectFolderCheckBox.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderCheckBox.AccessibleContext.accessibleDescription")); // NOI18N
    projectFolderLabel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderLabel.AccessibleContext.accessibleName")); // NOI18N
    projectFolderLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderLabel.AccessibleContext.accessibleDescription")); // NOI18N
    projectFolderTextField.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderTextField.AccessibleContext.accessibleName")); // NOI18N
    projectFolderTextField.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderTextField.AccessibleContext.accessibleDescription")); // NOI18N
    projectFolderBrowseButton.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderBrowseButton.AccessibleContext.accessibleName")); // NOI18N
    projectFolderBrowseButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderBrowseButton.AccessibleContext.accessibleDescription")); // NOI18N
    projectFolderScrollPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderScrollPane1.AccessibleContext.accessibleName")); // NOI18N
    projectFolderScrollPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.projectFolderScrollPane1.AccessibleContext.accessibleDescription")); // NOI18N

    getAccessibleContext().setAccessibleName(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.AccessibleContext.accessibleName")); // NOI18N
    getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ProjectFolder.class, "ProjectFolder.AccessibleContext.accessibleDescription")); // NOI18N
}
 
Example 18
Source File: BroadcastFrame.java    From JRakNet with MIT License 4 votes vote down vote up
/**
 * Creates a broadcast test frame.
 */
protected BroadcastFrame() {
	// Frame and content settings
	this.setResizable(false);
	this.setSize(FRAME_WIDTH, FRAME_HEIGHT);
	this.setTitle("JRakNet Broadcast Test");
	this.getContentPane().setLayout(null);

	// Discovered MCPE Servers
	JTextPane txtpnDiscoveredMcpeServers = new JTextPane();
	txtpnDiscoveredMcpeServers.setEditable(false);
	txtpnDiscoveredMcpeServers.setBackground(UIManager.getColor("Button.background"));
	txtpnDiscoveredMcpeServers.setText("Discovered servers");
	txtpnDiscoveredMcpeServers.setBounds(10, 10, 350, 20);
	this.getContentPane().add(txtpnDiscoveredMcpeServers);

	// How the client will discover servers on the local network
	JComboBox<String> comboBoxDiscoveryType = new JComboBox<String>();
	comboBoxDiscoveryType.setToolTipText(
			"Changing this will update how the client will discover servers, by default it will look for any possible connection on the network");
	comboBoxDiscoveryType.setModel(new DefaultComboBoxModel<String>(DISCOVERY_MODE_OPTIONS));
	comboBoxDiscoveryType.setBounds(370, 10, 115, 20);
	comboBoxDiscoveryType.addActionListener(new RakNetBroadcastDiscoveryTypeListener());
	this.getContentPane().add(comboBoxDiscoveryType);

	// Used to update the discovery port
	JTextField textFieldDiscoveryPort = new JTextField();
	textFieldDiscoveryPort.setBounds(370, 45, 115, 20);
	textFieldDiscoveryPort.setText(Integer.toString(Discovery.getPorts()[0]));
	this.getContentPane().add(textFieldDiscoveryPort);
	textFieldDiscoveryPort.setColumns(10);
	JButton btnUpdatePort = new JButton("Update Port");
	btnUpdatePort.setBounds(370, 76, 114, 23);
	btnUpdatePort.addActionListener(new RakNetBroadcastUpdatePortListener(textFieldDiscoveryPort));
	this.getContentPane().add(btnUpdatePort);

	// The text containing the discovered MCPE servers
	txtPnDiscoveredMcpeServerList = new JTextPane();
	txtPnDiscoveredMcpeServerList.setToolTipText("This is the list of the discovered servers on the local network");
	txtPnDiscoveredMcpeServerList.setEditable(false);
	txtPnDiscoveredMcpeServerList.setBackground(UIManager.getColor("Button.background"));
	txtPnDiscoveredMcpeServerList.setBounds(10, 30, 350, 165);
	this.getContentPane().add(txtPnDiscoveredMcpeServerList);
}
 
Example 19
Source File: MainFrame.java    From procamcalib with GNU General Public License v2.0 4 votes vote down vote up
private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed
    String version = MainFrame.class.getPackage().getImplementationVersion();
    if (version == null) {
        version = "unknown";
    }
    JTextPane textPane = new JTextPane();
    textPane.setEditable(false);
    textPane.setContentType("text/html");
    textPane.setText(
            "<font face=sans-serif><strong><font size=+2>ProCamCalib</font></strong> version " + version + "<br>" +
            "Copyright (C) 2009-2014 Samuel Audet &lt;<a href=\"mailto:[email protected]%28Samuel%20Audet%29\">[email protected]</a>&gt;<br>" +
            "Web site: <a href=\"http://www.ok.ctrl.titech.ac.jp/~saudet/procamcalib/\">http://www.ok.ctrl.titech.ac.jp/~saudet/procamcalib/</a><br>" +
            "<br>" +
            "Licensed under the GNU General Public License version 2 (GPLv2).<br>" +
            "Please refer to LICENSE.txt or <a href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a> for details."
            );
    textPane.setCaretPosition(0);
    Dimension dim = textPane.getPreferredSize();
    dim.height = dim.width*3/4;
    textPane.setPreferredSize(dim);

    textPane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if(e.getEventType() == EventType.ACTIVATED) {
                try {
                    Desktop.getDesktop().browse(e.getURL().toURI());
                } catch(Exception ex) {
                    Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE,
                            "Could not launch browser to \"" + e.getURL()+ "\"", ex);
                }
            }
        }
    });

    // pass the scrollpane to the joptionpane.
    JDialog dialog = new JOptionPane(textPane, JOptionPane.PLAIN_MESSAGE).
            createDialog(this, "About");

    if ("com.sun.java.swing.plaf.gtk.GTKLookAndFeel".equals(UIManager.getLookAndFeel().getClass().getName())) {
        // under GTK, frameBackground is white, but rootPane color is OK...
        // but under Windows, the rootPane's color is funny...
        Color c = dialog.getRootPane().getBackground();
        textPane.setBackground(new Color(c.getRGB()));
    } else {
        Color frameBackground = this.getBackground();
        textPane.setBackground(frameBackground);
    }
    dialog.setVisible(true);
}
 
Example 20
Source File: NotifyExcPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Constructor.
*/
private NotifyExcPanel () {
    java.util.ResourceBundle bundle = org.openide.util.NbBundle.getBundle(NotifyExcPanel.class);
    next = new JButton ();
    Mnemonics.setLocalizedText(next, bundle.getString("CTL_NextException"));
    // bugfix 25684, don't set Previous/Next as default capable
    next.setDefaultCapable (false);
    previous = new JButton ();
    Mnemonics.setLocalizedText(previous, bundle.getString("CTL_PreviousException"));
    previous.setDefaultCapable (false);
    details = new JButton ();
    details.setDefaultCapable (false);

    output = new JTextPane() {
        public @Override boolean getScrollableTracksViewportWidth() {
            return false;
        }
    };
    output.setEditable(false);
    Font f = output.getFont();
    output.setFont(new Font("Monospaced", Font.PLAIN, null == f ? 12 : f.getSize() + 1)); // NOI18N
    output.setForeground(UIManager.getColor("Label.foreground")); // NOI18N
    output.setBackground(UIManager.getColor("Label.background")); // NOI18N

    setLayout( new BorderLayout() );
    add(new JScrollPane(output));
    setBorder( new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.LOWERED));
        
    next.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_NextException"));
    previous.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_PreviousException"));
    output.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_ExceptionStackTrace"));
    output.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_ExceptionStackTrace"));
    getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_NotifyExceptionPanel"));

    descriptor = new DialogDescriptor ("", ""); // NOI18N

    descriptor.setMessageType (DialogDescriptor.ERROR_MESSAGE);
    descriptor.setOptions (computeOptions(previous, next));
    descriptor.setAdditionalOptions (new Object[] {
                                         details
                                     });
    descriptor.setClosingOptions (new Object[0]);
    descriptor.setButtonListener (this);

    // bugfix #27176, create dialog in modal state if some other modal
    // dialog is opened at the time
    // #53328 do not let the error dialog to be created modal unless the main
    // window is visible. otherwise the error message may be hidden behind
    // the main window thus making the main window unusable
    descriptor.setModal( isModalDialogPresent() 
            && WindowManager.getDefault().getMainWindow().isVisible() );
    
    setPreferredSize(new Dimension(SIZE_PREFERRED_WIDTH + extraW, SIZE_PREFERRED_HEIGHT + extraH));

    dialog = DialogDisplayer.getDefault().createDialog(descriptor);
    if( null != lastBounds ) {
        lastBounds.width = Math.max( lastBounds.width, SIZE_PREFERRED_WIDTH+extraW );
        dialog.setBounds( lastBounds );
    }
    
    dialog.getAccessibleContext().setAccessibleName(bundle.getString("ACN_NotifyExcPanel_Dialog")); // NOI18N
    dialog.getAccessibleContext().setAccessibleDescription(bundle.getString("ACD_NotifyExcPanel_Dialog")); // NOI18N
}