当前位置: 首页>>代码示例>>Java>>正文


Java JTextPane.setBackground方法代码示例

本文整理汇总了Java中javax.swing.JTextPane.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java JTextPane.setBackground方法的具体用法?Java JTextPane.setBackground怎么用?Java JTextPane.setBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JTextPane的用法示例。


在下文中一共展示了JTextPane.setBackground方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createInfoPanel

import javax.swing.JTextPane; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ShowNotifications.java

示例2: getTreeCellRendererComponent

import javax.swing.JTextPane; //导入方法依赖的package包/类
@Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    JTextPane pane = new JTextPane();
    if (sel) {
        pane.setBackground(bgSel);
        pane.setForeground(fgSel);
    } else {
        pane.setBackground(bgNonSel);
        pane.setForeground(fgNonSel);
    }
    AssertionTreeNode node = (AssertionTreeNode) value;
    pane.setText("");
    try {
        pane.getDocument().insertString(pane.getDocument().getLength(), node.getProperty() + " {", propertyStyle);
        pane.getDocument().insertString(pane.getDocument().getLength(),
                node.getDisplayNode().replace("\\", "\\\\").replace("\n", "\\n").replace("\r", "\\r"), valueStyle);
        pane.getDocument().insertString(pane.getDocument().getLength(), "}", propertyStyle);
    } catch (BadLocationException e) {
        e.printStackTrace();
    }
    return pane;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:DefaultContextMenu.java

示例3: About

import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
 * Create the frame.
 */
public About() {
	ImageIcon img = new ImageIcon("icon.PNG");
	this.setIconImage(img.getImage());
	this.setTitle("About");
	setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	setBounds(100, 100, 705, 335);
	contentPane = new JPanel();
	contentPane.setBackground(SystemColor.activeCaptionBorder);
	contentPane.setToolTipText("erh");
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	JTextPane txtpnByIkerGarca = new JTextPane();
	txtpnByIkerGarca.setBackground(SystemColor.menu);
	txtpnByIkerGarca.setEditable(false);
	txtpnByIkerGarca.setText("By: Iker Garc\u00EDa Ferrero\r\nDate: 03/01/2017\r\n\r\n--Contact--\r\nMail: [email protected] \r\n\r\nThe source code can be found here:\r\nhttps://github.com/ikergarcia1996/Simple-AI_Ikerg-app_INTELLIGENT_POINTS\r\n\r\nA demostration and explanation can be found here (Spanish):\r\nhttps://www.youtube.com/hardware360grados\r\n\r\nThis program uses Processing 3.2.3\r\n\r\nCopyright 2017 Iker Garc\u00EDa \"Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)\" ");
	txtpnByIkerGarca.setToolTipText("");
	txtpnByIkerGarca.setBounds(12, 13, 664, 262);
	contentPane.add(txtpnByIkerGarca);
}
 
开发者ID:ikergarcia1996,项目名称:Genetic-Algorithm-Path-Finder,代码行数:25,代码来源:About.java

示例4: initConsole

import javax.swing.JTextPane; //导入方法依赖的package包/类
private static Component initConsole() {
  Logger root = Logger.getLogger("");
  JTextPane consoleTextArea = new JTextPane();
  JScrollPane consoleScrollPane = new JScrollPane();
  consoleScrollPane.setViewportBorder(null);
  consoleScrollPane.setViewportView(consoleTextArea);

  consoleTextArea.setEditable(false);
  consoleTextArea.setBackground(Color.DARK_GRAY);
  consoleTextArea.setAutoscrolls(true);
  root.addHandler(new ConsoleLogHandler(consoleTextArea));
  return consoleScrollPane;
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:14,代码来源:Program.java

示例5: init

import javax.swing.JTextPane; //导入方法依赖的package包/类
private void init() {
    txpText = new JTextPane();
    txpLines = new JTextPane();

    // needed for correct layouting
    Insets ins = txpLines.getInsets();
    txpLines.setMargin(new Insets(ins.top + 1, ins.left, ins.bottom, ins.right));

    textHighlighter = new BookmarkHighlighter();
    lineHighlighter = new BookmarkHighlighter();

    txpText.setHighlighter(textHighlighter);
    //txpText.setMinimumSize(new Dimension(100, 100));
    txpText.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    txpText.setEditable(false);

    txpLines.setHighlighter(lineHighlighter);
    txpLines.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    txpLines.setBackground(Color.LIGHT_GRAY);
    txpLines.setEnabled(false);
    txpLines.setForeground(Color.BLACK);
    txpLines.addMouseListener(mouseInputListener);

    fm = txpText.getFontMetrics(txpText.getFont());

    JPanel pnlBookmarks = new JPanel();
    pnlBookmarks.setLayout(new BorderLayout());
    pnlBookmarks.add(txpText, BorderLayout.CENTER);

    JScrollPane jspBookmarks = new JScrollPane(pnlBookmarks);
    jspBookmarks.setRowHeaderView(txpLines);
    jspBookmarks.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    jspBookmarks.getVerticalScrollBar().setUnitIncrement(15);

    this.setLayout(new BorderLayout());
    this.add(jspBookmarks, BorderLayout.CENTER);
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:38,代码来源:BookmarkableLogViewer.java

示例6: initTextPane

import javax.swing.JTextPane; //导入方法依赖的package包/类
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));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:RevisionItemCell.java

示例7: getElementsComponent

import javax.swing.JTextPane; //导入方法依赖的package包/类
private JComponent getElementsComponent (String msg) {
    JTextPane area = new JTextPane ();
    area.setEditable (false);
    area.setContentType ("text/html"); // NOI18N
    area.setText (msg);
    area.setOpaque (false);
    area.setBackground(new Color(0, 0, 0, 0));
    area.putClientProperty( JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE );
    return area;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:OperationPanel.java

示例8: setupTextPane

import javax.swing.JTextPane; //导入方法依赖的package包/类
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
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:CommentsPanel.java

示例9: ROCViewer

import javax.swing.JTextPane; //导入方法依赖的package包/类
public ROCViewer(AreaUnderCurve auc) {
	setLayout(new BorderLayout());

	String message = auc.toString();

	criterionName = auc.getName();

	// info string
	JPanel infoPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
	infoPanel.setOpaque(true);
	infoPanel.setBackground(Colors.WHITE);
	JTextPane infoText = new JTextPane();
	infoText.setEditable(false);
	infoText.setBackground(infoPanel.getBackground());
	infoText.setFont(infoText.getFont().deriveFont(Font.BOLD));
	infoText.setText(message);
	infoPanel.add(infoText);
	add(infoPanel, BorderLayout.NORTH);

	// plot panel
	plotter = new ROCChartPlotter();
	plotter.addROCData("ROC", auc.getRocData());
	JPanel innerPanel = new JPanel(new BorderLayout());
	innerPanel.add(plotter, BorderLayout.CENTER);
	innerPanel.setBorder(BorderFactory.createMatteBorder(5, 0, 10, 10, Colors.WHITE));
	add(innerPanel, BorderLayout.CENTER);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:28,代码来源:ROCViewer.java

示例10: CurveViewer

import javax.swing.JTextPane; //导入方法依赖的package包/类
public CurveViewer(CurveCollection curves) {
   setLayout(new BorderLayout());

    String message = curves.toString();

    criterionName = curves.getName();

    // info string
    JPanel infoPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    infoPanel.setOpaque(true);
    infoPanel.setBackground(Colors.WHITE);
    JTextPane infoText = new JTextPane();
    infoText.setEditable(false);
    infoText.setBackground(infoPanel.getBackground());
    infoText.setFont(infoText.getFont().deriveFont(Font.BOLD));
    infoText.setText(message);
    infoPanel.add(infoText);
    add(infoPanel, BorderLayout.NORTH);

    // plot panel
    plotter = new CurveChartPlotter();
    plotter.setCurve(curves);

    JPanel innerPanel = new JPanel(new BorderLayout());
    innerPanel.add(plotter, BorderLayout.CENTER);
    innerPanel.setBorder(BorderFactory.createMatteBorder(5, 0, 10, 10, Colors.WHITE));
    add(innerPanel, BorderLayout.CENTER);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:CurveViewer.java

示例11: LicenseWindow

import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
 * Create the frame.
 */
public LicenseWindow(final String path) {
	
	setTitle("Coder HPMSA - [License]");
	setBounds(100, 100, 550, 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 StyledDocument doc = editorPane.getStyledDocument();
	final SimpleAttributeSet center = new SimpleAttributeSet();
	StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
	doc.setParagraphAttributes(0, doc.getLength()-1, center, false);
	
	fillEditorPane(path);
	setVisible(true);
}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:35,代码来源:LicenseWindow.java

示例12: setConsoleColor

import javax.swing.JTextPane; //导入方法依赖的package包/类
public static void setConsoleColor(Console con, Color foreground, Color background)
{
	JTextPane pane = con.getComponent();
	pane.setBackground(background);
	pane.setForeground(foreground);
	pane.setCaretColor(foreground);
}
 
开发者ID:andykuo1,项目名称:candlelight,代码行数:8,代码来源:ConsoleStyle.java

示例13: SignUpPanel

import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
 * Create the panel.
 */
public SignUpPanel() {
	setLayout(null);
	
	JLabel lblNewLabel = new JLabel("Hearthstone");
	lblNewLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 35));
	lblNewLabel.setBounds(150, 35, 211, 61);
	add(lblNewLabel);
	
	JPanel panel = new JPanel();
	panel.setBorder(new LineBorder(new Color(0, 0, 0)));
	panel.setBounds(434, 20, 245, 260);
	add(panel);
	panel.setLayout(null);
	
	JLabel lblUpdateNotes = new JLabel("Update Notes:");
	lblUpdateNotes.setBounds(6, 6, 89, 16);
	panel.add(lblUpdateNotes);
	
	JTextPane txtpn_UpdateNotes = new JTextPane();
	txtpn_UpdateNotes.setEditable(false);
	txtpn_UpdateNotes.setBackground(this.getBackground());
	txtpn_UpdateNotes.setText("* Added Support for Multiplayer\n\n\n* Support for login\n\n\n* Server can hold multiple games at once");
	txtpn_UpdateNotes.setBounds(16, 34, 211, 207);
	panel.add(txtpn_UpdateNotes);
	
	JLabel label = new JLabel("Username:");
	label.setBounds(58, 103, 70, 16);
	add(label);
	
	txt_Username = new JTextField();
	txt_Username.setColumns(20);
	txt_Username.setBounds(134, 97, 254, 28);
	add(txt_Username);
	
	JLabel label_1 = new JLabel("Password:");
	label_1.setBounds(65, 151, 63, 16);
	add(label_1);
	
	psf_Password = new JPasswordField();
	psf_Password.setColumns(20);
	psf_Password.setBounds(134, 145, 254, 28);
	add(psf_Password);
	
	pwf_Retype = new JPasswordField();
	pwf_Retype.setColumns(20);
	pwf_Retype.setBounds(134, 191, 254, 28);
	add(pwf_Retype);
	
	JLabel lblRetypePassword = new JLabel("Retype Password:");
	lblRetypePassword.setBounds(19, 197, 109, 16);
	add(lblRetypePassword);
	
	btn_Login = new JButton("Login");
	btn_Login.setBounds(134, 240, 117, 29);
	add(btn_Login);
	
	btn_SignUp = new JButton("Sign Up");
	btn_SignUp.setBounds(271, 240, 117, 29);
	add(btn_SignUp);

}
 
开发者ID:ikhaliq15,项目名称:JHearthstone,代码行数:65,代码来源:SignUpPanel.java

示例14: LoginPanel

import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
 * Create the panel.
 */
public LoginPanel() {
	setLayout(null);
	
	jpf_Password = new JPasswordField();
	jpf_Password.setBounds(123, 188, 254, 28);
	jpf_Password.setColumns(20);
	add(jpf_Password);
	
	btn_Submit = new JButton("Login");
	btn_Submit.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
		}
	});
	btn_Submit.setBounds(123, 228, 117, 29);
	add(btn_Submit);
	
	JLabel lblPassword = new JLabel("Password:");
	lblPassword.setBounds(54, 194, 63, 16);
	add(lblPassword);
	
	JLabel lblUsername = new JLabel("Username:");
	lblUsername.setBounds(47, 127, 70, 16);
	add(lblUsername);
	
	jtf_Username = new JTextField();
	jtf_Username.setBounds(123, 121, 254, 28);
	add(jtf_Username);
	jtf_Username.setColumns(20);
	
	JPanel panel = new JPanel();
	panel.setBorder(new LineBorder(new Color(0, 0, 0)));
	panel.setBounds(434, 20, 245, 260);
	add(panel);
	panel.setLayout(null);
	
	JLabel lblUpdateNotes = new JLabel("Update Notes:");
	lblUpdateNotes.setBounds(6, 6, 89, 16);
	panel.add(lblUpdateNotes);
	
	JTextPane txtpn_UpdateNotes = new JTextPane();
	txtpn_UpdateNotes.setEditable(false);
	txtpn_UpdateNotes.setBackground(this.getBackground());
	txtpn_UpdateNotes.setText("* Added Support for Multiplayer\n\n\n* Support for login\n\n\n* Server can hold multiple games at once");
	txtpn_UpdateNotes.setBounds(16, 34, 211, 207);
	panel.add(txtpn_UpdateNotes);
	
	JLabel lblNewLabel = new JLabel("Hearthstone");
	lblNewLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 35));
	lblNewLabel.setBounds(150, 35, 211, 61);
	add(lblNewLabel);
			
	btn_SignUp = new JButton("Sign Up");
	btn_SignUp.setBounds(260, 228, 117, 29);
	add(btn_SignUp);

}
 
开发者ID:ikhaliq15,项目名称:JHearthstone,代码行数:60,代码来源:LoginPanel.java

示例15: AcercaDe

import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
 * Create the frame.
 */
public AcercaDe(JFrame principal) {
	setIconImage(Toolkit.getDefaultToolkit().getImage(AcercaDe.class.getResource("/biblioteca/images/book.png")));
	this.principal=principal;
	principal.setEnabled(false);
	
	setTitle("Acerca de Biblioteca 2017");
	setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	setBounds(100, 100, 332, 330);
	setLocationRelativeTo(null);
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	JTextPane txtpnHola = new JTextPane();
	txtpnHola.setForeground(Color.WHITE);
	txtpnHola.setEditable(false);
	txtpnHola.setBackground(Color.BLACK);
	txtpnHola.setText("Biblioteca 2017 \u00A9 Juan Delgado Salmer\u00F3n");
	txtpnHola.setBounds(10, 11, 311, 20);
	contentPane.add(txtpnHola);
	
	JTextPane txtpnVersinBuild = new JTextPane();
	txtpnVersinBuild.setForeground(Color.WHITE);
	txtpnVersinBuild.setEditable(false);
	txtpnVersinBuild.setText("Versi\u00F3n 1.1.0\r\nBuild 20170516-5000");
	txtpnVersinBuild.setBackground(Color.BLACK);
	txtpnVersinBuild.setBounds(10, 42, 311, 34);
	contentPane.add(txtpnVersinBuild);
	
	JTextPane txtpnCopyrightBiblioteca = new JTextPane();
	txtpnCopyrightBiblioteca.setForeground(Color.WHITE);
	txtpnCopyrightBiblioteca.setEditable(false);
	txtpnCopyrightBiblioteca.setText("Copyright 2017 Biblioteca 2017 creado por Juan Delgado Salmer\u00F3n. Todos los derechos reservados por JunDev.\r\nEsta aplicaci\u00F3n tiene open-source los primeros 24 d\u00EDas de su distribuci\u00F3n, despu\u00E9s de dicha fecha se cobrar\u00E1n 200\u20AC por ella.");
	txtpnCopyrightBiblioteca.setBackground(Color.BLACK);
	txtpnCopyrightBiblioteca.setBounds(10, 98, 311, 109);
	contentPane.add(txtpnCopyrightBiblioteca);
	
	JLabel lblImage = new JLabel("");
	lblImage.setIcon(new ImageIcon(AcercaDe.class.getResource("/biblioteca/images/jundev.png")));
	lblImage.setBounds(10, 214, 311, 79);
	contentPane.add(lblImage);
	
	JPanel panel = new JPanel();
	panel.setBackground(Color.BLACK);
	panel.setBounds(0, 0, 331, 304);
	contentPane.add(panel);
	
	setVisible(true);
	addWindowListener(this);
	setResizable(false);
}
 
开发者ID:JuandeLS3,项目名称:Library-app,代码行数:56,代码来源:AcercaDe.java


注:本文中的javax.swing.JTextPane.setBackground方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。