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


Java JTextPane.setBorder方法代码示例

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


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

示例3: 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

示例4: 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

示例5: ReadLogsWindow

import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:59,代码来源:ReadLogsWindow.java

示例6: main

import javax.swing.JTextPane; //导入方法依赖的package包/类
public static void main(String[] args) {
			
	//Creates the JFrame and configures it.
	JFrame window = new JFrame("Hash Generator 1.0");
	window.setSize(670, 110);
	window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	window.setLayout(new FlowLayout(FlowLayout.LEFT));
	window.setResizable(false);
	
	//Creates the JPanels.
	JPanel panel = new JPanel();
	window.add(panel);

	//Creates the "Choose a file button."
	JButton chooseFile = new JButton("Choose a file");
	panel.add(chooseFile);
	
	//Creates the file chooser with custom options.
	String userDir = System.getProperty("user.home");
	JFileChooser input = new JFileChooser(userDir +"/");
	Action details = input.getActionMap().get("viewTypeDetails");
	details.actionPerformed(null);
	
	// Creates the output text field.
	JTextPane finalText = new JTextPane();
	finalText.setBorder(BorderFactory.createEmptyBorder());
	finalText.setOpaque(false);
	finalText.setEditable(false);
	finalText.setPreferredSize( new Dimension( 520, 60 ) );
	finalText.setText("MD5: \nSHA1: \nSHA-256: ");
	panel.add(finalText);
	
	//This will make the window appear.
	window.setVisible(true);
	
	//Adds a listener for when the button is clicked, it opens the file chooser.
	chooseFile.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent onClick) {
			
			//Opens the file chooser.
			int result = input.showOpenDialog(chooseFile);
			
			//When the file chooser opens, this will save the file and get the checksum.
			if (result == JFileChooser.FILES_ONLY) {
				
					try 
					{
						//Gets the file from the file chooser.
						File finalFile = new File(input.getSelectedFile().getAbsolutePath());
						InputStream is = new FileInputStream(finalFile);
						InputStream is2 = new FileInputStream(finalFile);
						InputStream is3 = new FileInputStream(finalFile);

						//Generate the checksum with the given file.
						md5Final = DigestUtils.md5Hex(is);
						sha1Final = DigestUtils.shaHex(is2);
						sha256Final = DigestUtils.sha256Hex(is3);
						
						//Puts the final output into the text box.
						finalText.setText("MD5: " + md5Final + "\nSHA1: " + sha1Final + "\nSHA-256: " + sha256Final);

					}
					catch(IOException e) 
					{
						e.printStackTrace();
					}
				}
		}
	});
}
 
开发者ID:hyperdefined,项目名称:hash-generator,代码行数:71,代码来源:HashGenerator.java


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