javax.swing.JTextPane#setOpaque ( )源码实例Demo

下面列出了javax.swing.JTextPane#setOpaque ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: ShowNotifications.java
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;
}
 
源代码2 项目: stendhal   文件: InformationPanel.java
/**
 * 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);
}
 
源代码3 项目: netbeans   文件: OperationPanel.java
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;
}
 
源代码4 项目: netbeans   文件: NetworkErrorPanel.java
/**
 * 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() {

    infoScrollPane = new JScrollPane();
    infoTextPane = new JTextPane();

    infoScrollPane.setBorder(null);

    infoTextPane.setEditable(false);
    infoTextPane.setBorder(null);
    infoTextPane.setContentType("text/html"); // NOI18N
    infoTextPane.setText(NbBundle.getMessage(NetworkErrorPanel.class, "NetworkErrorPanel.infoTextPane.text")); // NOI18N
    infoTextPane.setOpaque(false);
    infoScrollPane.setViewportView(infoTextPane);

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(infoScrollPane)
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(infoScrollPane)
            .addContainerGap())
    );
}
 
源代码5 项目: netbeans   文件: VCSNotificationDisplayer.java
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;
}
 
源代码6 项目: netbeans   文件: RevisionItemCell.java
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));
}
 
源代码7 项目: GIFKR   文件: UpdateFrame.java
private void initializeComponents() {
	infoPane		= new JTextPane();
	infoPane.setText("You are using version "+version+" but the current version is " +CalebKussmaul.getLatestVersion(p)+". It is strongly reccomended that you update to take advantage of the latest additions and fixes.");
	
	StyledDocument doc = infoPane.getStyledDocument();
	SimpleAttributeSet center = new SimpleAttributeSet();
	StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
	doc.setParagraphAttributes(0, doc.getLength(), center, false);
	
	infoPane.setEditable(false);
	infoPane.setOpaque(false);
	updateButton 	= new JButton("Download update...");
}
 
源代码8 项目: freecol   文件: Utility.java
/**
 * Get a {@code JTextPane} with default styles.
 *
 * @return The default {@code JTextPane} to use.
 */
public static JTextPane getDefaultTextPane() {
    DefaultStyledDocument document
        = new DefaultStyledDocument(STYLE_CONTEXT);

    JTextPane textPane = new JTextPane(document);
    textPane.setOpaque(false);
    textPane.setEditable(false);
    textPane.setLogicalStyle(STYLE_CONTEXT.getStyle("regular"));
    return textPane;
}
 
源代码9 项目: RemoteSupportTool   文件: AppUtils.java
public static Boolean askQuestion(Component parent, String message, String title) {
    JTextPane content = new JTextPane();
    content.setEditable(false);
    content.setOpaque(false);
    content.setText(message);

    int response = JOptionPane.showConfirmDialog(
            parent, content, title, JOptionPane.YES_NO_OPTION);

    if (response == JOptionPane.OK_OPTION)
        return true;
    if (response == JOptionPane.NO_OPTION)
        return false;
    return null;
}
 
源代码10 项目: RemoteSupportTool   文件: AppUtils.java
public static void showMessage(Component parent, String message, String title, int type) {
    JTextPane content = new JTextPane();
    content.setEditable(false);
    content.setOpaque(false);
    content.setText(message);
    JOptionPane.showMessageDialog(parent, content, title, type);
}
 
源代码11 项目: netbeans   文件: ModuleLifecycleManager.java
void disableOtherModules () {
    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            boolean notify = false;
            outter: for (int i = 0; i < otherGitModules.length; i++) {
                FileLock lock = null;
                OutputStream os = null;
                try {
                    String newModule = otherGitModules[i];
                    String newModuleXML = "Modules/" + newModule.replace('.', '-') + ".xml"; // NOI18N
                    FileObject fo = FileUtil.getConfigFile(newModuleXML);
                    if (fo == null) continue;
                    Document document = readModuleDocument(fo);

                    NodeList list = document.getDocumentElement().getElementsByTagName("param"); // NOI18N
                    int n = list.getLength();
                    for (int j = 0; j < n; j++) {
                        Element node = (Element) list.item(j);
                        if ("enabled".equals(node.getAttribute("name"))) { // NOI18N
                            Text text = (Text) node.getChildNodes().item(0);
                            String value = text.getNodeValue();
                            if ("true".equals(value)) { // NOI18N
                                text.setNodeValue("false"); // NOI18N
                                break;
                            } else {
                                continue outter;
                            }
                        }
                    }
                    notify = true;                            
                    lock = fo.lock();
                    os = fo.getOutputStream(lock);
                    
                    XMLUtil.write(document, os, "UTF-8"); // NOI18N
                } catch (Exception e) {
                    Git.LOG.log(Level.WARNING, null, e);
                } finally {
                    if (os != null) try { os.close(); } catch (IOException ex) {}
                    if (lock != null) lock.releaseLock();
                }
            }
            if(notify) {
                JTextPane ballonDetails = getPane(NbBundle.getBundle(ModuleLifecycleManager.class).getString("MSG_Install_Warning")); // using the same pane causes the balloon popup
                JTextPane popupDetails = getPane(NbBundle.getBundle(ModuleLifecycleManager.class).getString("MSG_Install_Warning"));  // to trim the text to the first line
                NotificationDisplayer.getDefault().notify(
                        NbBundle.getMessage(ModuleLifecycleManager.class, "MSG_Install_Warning_Title"), //NOI18N
                        ImageUtilities.loadImageIcon("org/netbeans/modules/git/resources/icons/info.png", false),
                        ballonDetails, popupDetails, NotificationDisplayer.Priority.NORMAL, NotificationDisplayer.Category.WARNING);
            }
        }
                    
        private JTextPane getPane(String txt) {
            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
            bubble.setText(txt);
            return bubble;
        }             
    };
    RequestProcessor.getDefault().post(runnable);
}
 
源代码12 项目: GIFKR   文件: CreditsFrame.java
public CreditsFrame() {
	super("Credits");
	setLayout(new GridBagLayout());
	GridBagConstraints gbc = ViewUtils.createGBC();
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.weighty=1;
	gbc.insets = new Insets(0, 10, 10, 10);
	
	JLabel logoLabel = new JLabel(new ImageIcon(ImageTools.scaleToHeight(ImageTools.getResourceImage("icon.png"), 100, false)));
	logoLabel.setText("<HTML>GIFKR &copy; 2017 Caleb Kussmaul");
	logoLabel.setHorizontalTextPosition(JLabel.CENTER);
	logoLabel.setVerticalTextPosition(JLabel.BOTTOM);
	
	add(logoLabel, gbc);
	
	gbc.gridy++;
	gbc.weighty=0;
	
	JTextPane dedicationPane = new JTextPane();
	
	dedicationPane.setText("Dedicated to my dad, Wes Kussmaul, for inspiring my passion for programming, creativity, and entrepreneurship.");
	dedicationPane.setOpaque(false);
	dedicationPane.setEditable(false);
	ViewUtils.centerText(dedicationPane);
	
	add(dedicationPane, gbc);
	gbc.gridy++;
	
	JTextPane copyrightPane = new JTextPane();
	copyrightPane.setText("Referenced libraries:\nOpen-Imaging under Apache 2.0\nJavaCV under Apache 2.0\nFFmpeg under LGPL 2.1");
	add(copyrightPane, gbc);
	gbc.gridy++;
	gbc.fill = GridBagConstraints.NONE;
	gbc.anchor = GridBagConstraints.CENTER;
	
	
	JCheckBox doNotShowBox = new JCheckBox("Do not show again", !GIFKRPrefs.showCreditsFrame());
	doNotShowBox.addChangeListener(ce -> {
		GIFKRPrefs.setShowCreditsFrame(!doNotShowBox.isSelected());
	});
	
	add(doNotShowBox, gbc);
	
	setSize(500, 350);
	setLocationRelativeTo(null);
	setAlwaysOnTop(true);
}
 
源代码13 项目: ChickenChunks   文件: PlayerChunkViewer.java
public TicketInfoDialog(LinkedList<TicketInfo> tickets)
{
    super(PlayerChunkViewer.this);
    setModalityType(ModalityType.DOCUMENT_MODAL);
    this.tickets = tickets;

    infoPane = new JTextPane();
    infoPane.setEditable(false);
    infoPane.setOpaque(false);
    infoPane.setContentType("text/html");
    
    infoScrollPane = new JScrollPane(infoPane);
    infoScrollPane.setOpaque(false);
    add(infoScrollPane);
    
    chunkPane = new JTextPane();
    chunkPane.setEditable(false);
    chunkPane.setOpaque(false);
    chunkPane.setContentType("text/html");
    
    chunkScrollPane = new JScrollPane(chunkPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    add(chunkScrollPane);

    ticketComboBox = new JComboBox<String>();
    for(TicketInfo ticket : tickets)
    {
        String ident = ticket.modId;
        if(ticket.player != null)
            ident += ", " + ticket.player;
        ident += " #" + ticket.ID;
        ticketComboBox.addItem(ident);
    }
    add(ticketComboBox);

    addWindowListener(new WindowAdapter()
    {
        @Override
        public void windowClosing(WindowEvent e)
        {
            dialog = null;
        }
    });

    setLayout(this);
    setSize(getPreferredSize());
    setLocationRelativeTo(null);
    pack();

    dialog = this;

    setVisible(true);
}
 
源代码14 项目: whyline   文件: BreakpointConsoleUI.java
public BreakpointConsoleUI(WhylineUI whylineUI) {
	
	this.whylineUI = whylineUI;

	setBorder(new WhylineControlBorder());

	console = new JTextPane() {
		public boolean getScrollableTracksViewportWidth() { return false; }
	};
	console.setBackground(UI.getConsoleBackColor());
	console.setForeground(UI.getConsoleTextColor());
	console.setFont(UI.getFixedFont());
	console.setEditable(false);
	
	console.setBackground(UI.getControlBackColor());
	console.setOpaque(true);

	debugAttributes = new SimpleAttributeSet();
	StyleConstants.setItalic(debugAttributes, false);
	StyleConstants.setForeground(debugAttributes, UI.getConsoleTextColor());

	regularAttributes = new SimpleAttributeSet();
	StyleConstants.setItalic(regularAttributes, false);
	StyleConstants.setForeground(regularAttributes, UI.getConsoleTextColor());

	setLayout(new BorderLayout(0, UI.getPanelPadding()));

	add(new WhylineScrollPane(console), BorderLayout.CENTER);

	setPreferredSize(new Dimension(0, UI.getDefaultInfoPaneHeight(whylineUI)));
	
	clear();
	
}